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