226: def build_request(out, method, uri, req)
227: ops = @options.merge(req)
228: query = ops[:query]
229:
230:
231: head = req[:head] || {}
232: head = ops[:head].merge(head) if ops[:head]
233:
234:
235: head[HOST] = encode_host(@host,@port)
236: head[CONTENT_LENGTH] = ops[:body] ? ops[:body].length : 0
237:
238:
239: out.write(HTTP_REQUEST_HEADER % [method, encode_query(uri,query)])
240: out.write(encode_headers(head))
241: out.write(encode_cookies(@cookies.merge(req[:cookies] || {})))
242: out.write("\r\n")
243: ops[:body] || ""
244: end