Commit a29507a1 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Nils Goroll

http: Record which peer wants to close the session

Spotted by Martin.
parent 4bf0b9df
......@@ -650,7 +650,7 @@ int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **);
#define HTTP_FOREACH_PACK(wrk, oc, ptr) \
for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));)
const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr);
enum sess_close http_DoConnection(struct http *hp);
enum sess_close http_DoConnection(struct http *hp, enum sess_close sc_close);
int http_IsFiltered(const struct http *hp, unsigned u, unsigned how);
#define HTTPH_R_PASS (1 << 0) /* Request (c->b) in pass mode */
......
......@@ -730,12 +730,15 @@ http_GetContentLength(const struct http *hp)
*/
enum sess_close
http_DoConnection(struct http *hp)
http_DoConnection(struct http *hp, enum sess_close sc_close)
{
const char *h, *b, *e;
enum sess_close retval;
unsigned u, v;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
assert(sc_close == SC_REQ_CLOSE || sc_close == SC_RESP_CLOSE);
if (hp->protover == 10)
retval = SC_REQ_HTTP10;
else
......@@ -748,7 +751,7 @@ http_DoConnection(struct http *hp)
while (http_split(&h, NULL, ",", &b, &e)) {
u = pdiff(b, e);
if (u == 5 && !strncasecmp(b, "close", u))
retval = SC_REQ_CLOSE;
retval = sc_close;
if (u == 10 && !strncasecmp(b, "keep-alive", u))
retval = SC_NULL;
......
......@@ -83,7 +83,7 @@ cnt_transport(struct worker *wrk, struct req *req)
AZ(req->err_code);
req->doclose = http_DoConnection(req->http);
req->doclose = http_DoConnection(req->http, SC_REQ_CLOSE);
if (req->doclose == SC_RX_BAD) {
(void)req->transport->minimal_response(req, 400);
return (REQ_FSM_DONE);
......
......@@ -234,7 +234,7 @@ V1F_FetchRespHdr(struct busyobj *bo)
return (-1);
}
htc->doclose = http_DoConnection(hp);
htc->doclose = http_DoConnection(hp, SC_RESP_CLOSE);
/*
* Figure out how the fetch is supposed to happen, before the
......
......@@ -298,7 +298,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
VSLb(req->vsl, SLT_RespProtocol, "HTTP/2.0");
(void)http_DoConnection(req->resp);
(void)http_DoConnection(req->resp, SC_RESP_CLOSE);
ss = WS_Snapshot(req->ws);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment