Comparison

net/http.lua @ 633:fe1e01a06729

Fix nil status code for http request callbacks
author Matthew Wild <mwild1@gmail.com>
date Mon, 22 Dec 2008 22:01:49 +0000
parent 628:3712d36b6d25
child 646:90da4c9b34b5
comparison
equal deleted inserted replaced
632:8f3db0bd2bb4 633:fe1e01a06729
79 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos); 79 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos);
80 if not code then 80 if not code then
81 return request.callback(0, "invalid-status-line", request); 81 return request.callback(0, "invalid-status-line", request);
82 end 82 end
83 83
84 request.responsecode, request.responseversion = code, http; 84 request.code, request.responseversion = code, http;
85 85
86 if request.onlystatus or not expectbody(request, tonumber(code)) then 86 if request.onlystatus or not expectbody(request, tonumber(code)) then
87 if request.callback then 87 if request.callback then
88 request.callback(code, nil, request); 88 request.callback(code, nil, request);
89 end 89 end