From 661b30bfc70217b74f21182ac708befae93cfaf0 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 15 Jan 2009 04:08:06 +0000 Subject: net.http: Fix to send query part of URL to server --- net/http.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/http.lua b/net/http.lua index da5b3c84..0da28f2e 100644 --- a/net/http.lua +++ b/net/http.lua @@ -142,7 +142,14 @@ function request(u, ex, callback) return nil, err; end - req.write((req.method or "GET ")..req.path.." HTTP/1.0\r\n"); + local request_line = { req.method or "GET", " ", req.path, " HTTP/1.1\r\n" }; + + if req.query then + t_insert(request_line, 4, "?"); + t_insert(request_line, 5, req.query); + end + + req.write(t_concat(request_line)); local t = { [2] = ": ", [4] = "\r\n" }; if custom_headers then for k, v in pairs(custom_headers) do -- cgit v1.2.3