Commit 3cea8945 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Reduce RFC2616_Do_Cond() arg from sp to req

parent 14b7e6e9
...@@ -1015,7 +1015,7 @@ char *WS_Snapshot(struct ws *ws); ...@@ -1015,7 +1015,7 @@ char *WS_Snapshot(struct ws *ws);
void RFC2616_Ttl(struct busyobj *, unsigned xid); void RFC2616_Ttl(struct busyobj *, unsigned xid);
enum body_status RFC2616_Body(struct busyobj *, struct dstat *); enum body_status RFC2616_Body(struct busyobj *, struct dstat *);
unsigned RFC2616_Req_Gzip(const struct http *); unsigned RFC2616_Req_Gzip(const struct http *);
int RFC2616_Do_Cond(const struct sess *sp); int RFC2616_Do_Cond(const struct req *sp);
/* stevedore.c */ /* stevedore.c */
struct object *STV_NewObject(struct busyobj *, struct objcore **, struct object *STV_NewObject(struct busyobj *, struct objcore **,
......
...@@ -880,7 +880,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req) ...@@ -880,7 +880,7 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
*/ */
if (req->obj->response == 200 && if (req->obj->response == 200 &&
req->http->conds && req->http->conds &&
RFC2616_Do_Cond(sp)) RFC2616_Do_Cond(req))
bo->do_stream = 0; bo->do_stream = 0;
/* /*
......
...@@ -128,7 +128,7 @@ RES_BuildHttp(const struct sess *sp) ...@@ -128,7 +128,7 @@ RES_BuildHttp(const struct sess *sp)
http_Unset(req->resp, H_Content_Encoding); http_Unset(req->resp, H_Content_Encoding);
if (req->obj->response == 200 if (req->obj->response == 200
&& req->http->conds && RFC2616_Do_Cond(sp)) { && req->http->conds && RFC2616_Do_Cond(req)) {
req->wantbody = 0; req->wantbody = 0;
http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified"); http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified");
http_Unset(req->resp, H_Content_Length); http_Unset(req->resp, H_Content_Length);
......
...@@ -310,7 +310,7 @@ RFC2616_Req_Gzip(const struct http *hp) ...@@ -310,7 +310,7 @@ RFC2616_Req_Gzip(const struct http *hp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
int int
RFC2616_Do_Cond(const struct sess *sp) RFC2616_Do_Cond(const struct req *req)
{ {
char *p, *e; char *p, *e;
double ims; double ims;
...@@ -319,19 +319,19 @@ RFC2616_Do_Cond(const struct sess *sp) ...@@ -319,19 +319,19 @@ RFC2616_Do_Cond(const struct sess *sp)
/* RFC 2616 13.3.4 states we need to match both ETag /* RFC 2616 13.3.4 states we need to match both ETag
and If-Modified-Since if present*/ and If-Modified-Since if present*/
if (http_GetHdr(sp->req->http, H_If_Modified_Since, &p) ) { if (http_GetHdr(req->http, H_If_Modified_Since, &p) ) {
if (!sp->req->obj->last_modified) if (!req->obj->last_modified)
return (0); return (0);
ims = VTIM_parse(p); ims = VTIM_parse(p);
if (ims > sp->req->t_req) /* [RFC2616 14.25] */ if (ims > req->t_req) /* [RFC2616 14.25] */
return (0); return (0);
if (sp->req->obj->last_modified > ims) if (req->obj->last_modified > ims)
return (0); return (0);
do_cond = 1; do_cond = 1;
} }
if (http_GetHdr(sp->req->http, H_If_None_Match, &p) && if (http_GetHdr(req->http, H_If_None_Match, &p) &&
http_GetHdr(sp->req->obj->http, H_ETag, &e)) { http_GetHdr(req->obj->http, H_ETag, &e)) {
if (strcmp(p,e) != 0) if (strcmp(p,e) != 0)
return (0); return (0);
do_cond = 1; do_cond = 1;
......
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