Changeset

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
parents 718:aa78dfb26593
children 720:8f22e9fb2291
files net/http.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
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