Skip to content

Commit 44cb9cb

Browse files
committed
Make \r optional in chunk size detection
As pointed out by Ken Ballus, WEBrick allows \n without preceding \r generally. It probably shouldn't, but since it does, do not require \r for chunk size detection.
1 parent 6018ab9 commit 44cb9cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/webrick/httprequest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def read_body(socket, block)
542542

543543
def read_chunk_size(socket)
544544
line = read_line(socket)
545-
if /\A([0-9a-fA-F]+)(?:;(\S+(?:=\S+)?))?\r\n\z/ =~ line
545+
if /\A([0-9a-fA-F]+)(?:;(\S+(?:=\S+)?))?\r?\n\z/ =~ line
546546
chunk_size = $1.hex
547547
chunk_ext = $2
548548
[ chunk_size, chunk_ext ]

0 commit comments

Comments
 (0)