Diff

net/http.lua @ 719:b1eb112478b8

net.http: Fix to send query part of URL to server
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Jan 2009 04:08:06 +0000
parent 714:ab3c47f4fe1d
child 720:8f22e9fb2291
line wrap: on
line diff
--- a/net/http.lua	Thu Jan 15 04:36:35 2009 +0500
+++ b/net/http.lua	Thu Jan 15 04:08:06 2009 +0000
@@ -142,7 +142,14 @@
 		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