# File lib/mongrel.rb, line 142 142: def initialize(params, initial_body, socket) 143: @body = initial_body || "" 144: @params = params 145: @socket = socket 146: 147: # fix up the CGI requirements 148: params[Const::CONTENT_LENGTH] = params[Const::HTTP_CONTENT_LENGTH] || 0 149: params[Const::CONTENT_TYPE] ||= params[Const::HTTP_CONTENT_TYPE] 150: 151: # now, if the initial_body isn't long enough for the content length we have to fill it 152: # TODO: adapt for big ass stuff by writing to a temp file 153: clen = params[Const::HTTP_CONTENT_LENGTH].to_i 154: if @body.length < clen 155: @body << @socket.read(clen - @body.length) 156: end 157: end