net/http.lua

changeset 2809
1a7b5b775275
parent 2808
23bb7e29819e
child 2810
85e253d6c4cf
equal deleted inserted replaced
2808:23bb7e29819e 2809:1a7b5b775275
105 elseif request.state == "status" then 105 elseif request.state == "status" then
106 print("Reading status...") 106 print("Reading status...")
107 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos); 107 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos);
108 code = tonumber(code); 108 code = tonumber(code);
109 if not code then 109 if not code then
110 return request.callback("invalid-status-line", 0, request); 110 log("warn", "Invalid HTTP status line, telling callback then closing");
111 local ret = request.callback("invalid-status-line", 0, request);
112 destroy_request(request);
113 return ret;
111 end 114 end
112 115
113 request.code, request.responseversion = code, http; 116 request.code, request.responseversion = code, http;
114 117
115 if request.onlystatus then 118 if request.onlystatus then

mercurial