Comparison

net/http/server.lua @ 5754:dee0f05ccf70

net.http.server: Fix Keep-Alive requests with HTTP 1.0
author Kim Alvefur <zash@zash.se>
date Mon, 22 Jul 2013 17:28:37 +0200
parent 5505:0b6a99e6c1b1
child 5776:bd0ff8ae98a8
child 6360:ffcd3992a40c
comparison
equal deleted inserted replaced
5752:729c78581308 5754:dee0f05ccf70
166 166
167 local date_header = os_date('!%a, %d %b %Y %H:%M:%S GMT'); -- FIXME use 167 local date_header = os_date('!%a, %d %b %Y %H:%M:%S GMT'); -- FIXME use
168 local conn_header = request.headers.connection; 168 local conn_header = request.headers.connection;
169 conn_header = conn_header and ","..conn_header:gsub("[ \t]", ""):lower().."," or "" 169 conn_header = conn_header and ","..conn_header:gsub("[ \t]", ""):lower().."," or ""
170 local httpversion = request.httpversion 170 local httpversion = request.httpversion
171 local persistent = conn_header:find(",Keep-Alive,", 1, true) 171 local persistent = conn_header:find(",keep-alive,", 1, true)
172 or (httpversion == "1.1" and not conn_header:find(",close,", 1, true)); 172 or (httpversion == "1.1" and not conn_header:find(",close,", 1, true));
173 173
174 local response_conn_header; 174 local response_conn_header;
175 if persistent then 175 if persistent then
176 response_conn_header = "Keep-Alive"; 176 response_conn_header = "Keep-Alive";