protocol-http1 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/protocol/http1/connection.rb +7 -7
- data/lib/protocol/http1/error.rb +0 -3
- data/lib/protocol/http1/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d23c921f561f2f7a6fb58631aaf830f8e4af6f7256021daa5adc9882f1666431
|
|
4
|
+
data.tar.gz: 1852cbee0e400253d31954a50a756e130843e71fabf513f7f5c0027e2676d153
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7828fd257625dcf05e8336915425d0be741c773dec2f41966d9c4425431b1631d0f241526579d29c4d2bfa86467727d2aa4cba2b9a8ee3028a65288ed2fc9f2
|
|
7
|
+
data.tar.gz: 8576793707526a79260c8d24f9d18d283e3c90e8c17a8cf8f48ba7a14bf5fd014675e85db923d3bca44e79fc7b9fecc114dc98396ca84806b4e32391eda11355
|
|
@@ -43,6 +43,10 @@ module Protocol
|
|
|
43
43
|
HOST = 'host'.freeze
|
|
44
44
|
UPGRADE = 'upgrade'.freeze
|
|
45
45
|
|
|
46
|
+
# HTTP/1.x request line parser:
|
|
47
|
+
TOKEN = /[!#$%&'*+-\.^_`|~0-9a-zA-Z]+/.freeze
|
|
48
|
+
REQUEST_LINE = /^(#{TOKEN}) ([^\s]+) (HTTP\/\d.\d)$/.freeze
|
|
49
|
+
|
|
46
50
|
class Connection
|
|
47
51
|
CRLF = "\r\n".freeze
|
|
48
52
|
HTTP10 = "HTTP/1.0".freeze
|
|
@@ -147,13 +151,9 @@ module Protocol
|
|
|
147
151
|
def read_request
|
|
148
152
|
return unless line = read_line?
|
|
149
153
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
raise InvalidMethod, method
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
unless method and path and version
|
|
154
|
+
if match = line.match(REQUEST_LINE)
|
|
155
|
+
_, method, path, version = *match
|
|
156
|
+
else
|
|
157
157
|
raise InvalidRequest, line.inspect
|
|
158
158
|
end
|
|
159
159
|
|
data/lib/protocol/http1/error.rb
CHANGED