end
end
-
- -- Print status and headers
- sinkout("HTTP/1.1 " .. response.status .. " " .. statusmsg[response.status] .. "\r\n")
- for k, v in pairs(response.headers) do
- sinkout(k .. ": " .. v .. "\r\n")
- end
-
- -- End of Headers
- sinkout("\r\n")
-
- -- Pump content
- if sourceout then
- ltn12.pump.all(sourceout, sinkout)
- end
+ luci.http.push_response(request, status, response, sourceout, sinkout, sinkerr)
end
-- Handler Response
Response = luci.util.class()
-function Response.__init__(self, status, headers)
+function Response.__init__(self, request, status, headers)
self.status = tonumber(status) or 200
self.headers = (type(headers) == "table") and headers or {}
end
local message, err = luci.http.protocol.parse_message_header( line_source )
if message then
+
+ -- If we have a HTTP/1.1 client and an Expect: 100-continue header then
+ -- respond with HTTP 100 Continue message
+ if message.http_version == 1.1 and message.headers['Expect'] and
+ message.headers['Expect'] == '100-continue'
+ then
+ client:send("HTTP/1.1 100 Continue\r\n\r\n")
+ end
+
+
local s, e = luci.http.protocol.parse_message_body( block_source, message )
-- XXX: debug