method
read_chunked
v1_8_7_72 -
Show latest stable
-
0 notes -
Class: WEBrick::HTTPRequest
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
read_chunked(socket, block)
private
Hide source
# File lib/webrick/httprequest.rb, line 307 def read_chunked(socket, block) chunk_size, = read_chunk_size(socket) while chunk_size > 0 data = "" while data.size < chunk_size tmp = read_data(socket, chunk_size-data.size) # read chunk-data break unless tmp data << tmp end if data.nil? || data.size != chunk_size raise BadRequest, "bad chunk data size." end read_line(socket) # skip CRLF block.call(data) chunk_size, = read_chunk_size(socket) end read_header(socket) # trailer + CRLF @header.delete("transfer-encoding") @remaining_size = 0 end