private Method

HTTPRequest.read_chunked(socket, block)

There's no documentation for this item.

Source Code

# File 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
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.