protocol-http1 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of protocol-http1 might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f944a898dfe09f16d8a2fc6ea2272ce989ea740a13b14d4ecd3b760435dd842c
4
- data.tar.gz: fae9e2c5a83cfb5c7ea24f6e29031a4876ca03f1e7153000649a2d10bbc4c804
3
+ metadata.gz: 661cff536d9832701aaf027d558729e8d0e060becd87e07f76d5903bd10813de
4
+ data.tar.gz: 3362cd5687c0bcbc5a8774479d8a15a5be0d02ae9acc4dd0651bb1fec4335f1e
5
5
  SHA512:
6
- metadata.gz: 8ee87a749c191cf0edb310b086d1ee8aa5edb84e2aa706dba825d87e3a53a03fe7b26ec28b7906c6fd4c1e8568b14e0a3b281ad8da679a750e1f2ae50940c016
7
- data.tar.gz: ce9765e03174a8b7d8fc136a4b9ff5523aca8780335ffedd227ef0d5f528d4cd62065f82a3340103239e741639360e2d2a6e08b133e5712eaa747bf2e195aab3
6
+ metadata.gz: 467de24fe8851f44b9ff67429fd47fc87b25f048e6914041f63f6332137b22702677627c0d46bd995304ae816a4f4b29f786f8499471ca5838fa942a10ea83e3
7
+ data.tar.gz: '068f57168286dfd5db966e59aa6aa35c9164fa3402bd95cb488bc5ba746e2f12c418b46fce3c5f605f7d7c1299a272f3077422daea0fb247f1f88168b4b612bb'
@@ -27,6 +27,8 @@ require_relative 'body/chunked'
27
27
  require_relative 'body/fixed'
28
28
  require_relative 'body/remainder'
29
29
 
30
+ require 'protocol/http/methods'
31
+
30
32
  module Protocol
31
33
  module HTTP1
32
34
  CONTENT_LENGTH = 'content-length'.freeze
@@ -146,6 +148,15 @@ module Protocol
146
148
  return unless line = read_line?
147
149
 
148
150
  method, path, version = line.split(/\s+/, 3)
151
+
152
+ unless HTTP::Methods.const_defined?(method)
153
+ raise InvalidMethod, method
154
+ end
155
+
156
+ unless method and path and version
157
+ raise InvalidRequest, line.inspect
158
+ end
159
+
149
160
  headers = read_headers
150
161
 
151
162
  @persistent = persistent?(version, headers)
@@ -25,6 +25,12 @@ module Protocol
25
25
  class Error < HTTP::Error
26
26
  end
27
27
 
28
+ class InvalidMethod < Error
29
+ end
30
+
31
+ class InvalidRequest < Error
32
+ end
33
+
28
34
  # The request was parsed correctly, but was invalid for some other reason.
29
35
  class BadRequest < Error
30
36
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Protocol
22
22
  module HTTP1
23
- VERSION = "0.8.0"
23
+ VERSION = "0.8.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protocol-http
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.0.2
126
+ rubygems_version: 3.0.3
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: A low level implementation of the HTTP/1 protocol.