Tweak the regexes for parsing HTTP.

This commit is contained in:
James Coglan
2014-04-17 02:19:14 +01:00
parent c57cc359b2
commit ddd90b5438
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ module WebSocket
CR = 0x0D
LF = 0x0A
HEADER_LINE = /^([!#\$%&'\*\+\-\.\^_`\|~0-9a-z]+):\s*((?:\t|[\x20-\x7e])*?)\s*$/i
HEADER_LINE = /^([!#\$%&'\*\+\-\.\\\^_`\|~0-9a-z]+):\s*([\x20-\x7e]*?)\s*$/i
attr_reader :headers
+1 -1
View File
@@ -4,7 +4,7 @@ module WebSocket
class Request
include Headers
REQUEST_LINE = /^([A-Z]+) +([\x21-\x7e]+) +(HTTP\/[0-9]\.[0-9])$/
REQUEST_LINE = /^(OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT) ([\x21-\x7e]+) (HTTP\/[0-9]+\.[0-9]+)$/
REQUEST_TARGET = /^(.*?)(\?(.*))?$/
RESERVED_HEADERS = %w[content-length content-type]
+1 -1
View File
@@ -4,7 +4,7 @@ module WebSocket
class Response
include Headers
STATUS_LINE = /^(HTTP\/[0-9]\.[0-9]) +([0-9]{3}) +(.*)$/
STATUS_LINE = /^(HTTP\/[0-9]+\.[0-9]+) ([0-9]{3}) ([\x20-\x7e]+)$/
attr_reader :code