mirror of
https://github.com/faye/websocket-driver-ruby.git
synced 2025-11-01 13:59:38 +00:00
Tweak the regexes for parsing HTTP.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user