247: def build_request(out, method, uri, req)
248: ops = @options.merge(req)
249: query = ops[:query]
250:
251:
252: head = req[:head] || {}
253: head = ops[:head].merge(head) if ops[:head]
254:
255:
256: head[REQ_HOST] = encode_host(@host,@port)
257: head[REQ_CONTENT_LENGTH] = ops[:body] ? ops[:body].length : 0
258:
259:
260: out.write(HTTP_REQUEST_HEADER % [method, encode_query(uri,query)])
261: out.write(encode_headers(head))
262: out.write(encode_cookies(@cookies.merge(req[:cookies] || {})))
263: out.write(CRLF)
264: ops[:body] || ""
265: end