[PATCH-REQUEST] : SPDY handling for 304 response

Shrirang Ballal sballal at instartlogic.com
Thu Dec 25 15:18:41 UTC 2014


Hello Valentin,

I understand that the "*complete*" handling of the 204 & 304 response is
not same, but it is same for below mentioned response headers received by
downstream client

Quote for handling of "Content-Type", "Content-Length", "Last-Modified"
header from ngx_http_header_filter_module.c::ngx_http_header_filter()
    /* clear out CL/CT header for header only 204/304 response
       earlier it was done only for 204/304 generated by nginx
       making it common for both paths - when nginx is serving the response
       and when the response is generated from the upstream */
    if (r->headers_out.status == NGX_HTTP_NO_CONTENT
        || r->headers_out.status == NGX_HTTP_NOT_MODIFIED) {
      r->header_only = 1;
      ngx_str_null(&r->headers_out.content_type);
      r->headers_out.last_modified_time = -1;
      r->headers_out.last_modified = NULL;
      r->headers_out.content_length = NULL;
      r->headers_out.content_length_n = -1;
    }

---

After this "*common*" handling for 204 & 304 responses, specific handling
of 204/304 come in effect.

I wanted to achieve this "*common*" handling through the patch I submitted.
I think the patch is correct and should be incorporated.

Without the patch, SPDY 304 responses will have "Content-Length",
"Content-Type" header (which is not present in non-SPDY 304 response).

Let me know if I am not being clear here.

On Thu, Dec 25, 2014 at 8:04 PM, Valentin V. Bartenev <vbart at nginx.com>
wrote:

> On Thursday 25 December 2014 09:34:16 Shrirang Ballal wrote:
> > 304 handling for non-spdy requests is exactly same as that of 204
> handling
> > (Reference : ngx_http_header_filter_module.c::ngx_http_header_filter()).
> > SPDY requests too should be handled same way.
> [..]
>
> Well, they are not handled the same way.
>
> A quote from the function you mentioned:
>
>         if (status >= NGX_HTTP_OK
>             && status < NGX_HTTP_LAST_2XX)
>         {
>             /* 2XX */
>
>             if (status == NGX_HTTP_NO_CONTENT) {
>                 r->header_only = 1;
>                 ngx_str_null(&r->headers_out.content_type);
>                 r->headers_out.last_modified_time = -1;
>                 r->headers_out.last_modified = NULL;
>                 r->headers_out.content_length = NULL;
>                 r->headers_out.content_length_n = -1;
>             }
>
>             status -= NGX_HTTP_OK;
>             status_line = &ngx_http_status_lines[status];
>             len += ngx_http_status_lines[status].len;
>
>         } else if (status >= NGX_HTTP_MOVED_PERMANENTLY
>                    && status < NGX_HTTP_LAST_3XX)
>         {
>             /* 3XX */
>
>             if (status == NGX_HTTP_NOT_MODIFIED) {
>                 r->header_only = 1;
>             }
>
>             status = status - NGX_HTTP_MOVED_PERMANENTLY +
> NGX_HTTP_OFF_3XX;
>             status_line = &ngx_http_status_lines[status];
>             len += ngx_http_status_lines[status].len;
>
>         }
>
>
>
>   wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20141225/443a3748/attachment.html>


More information about the nginx-devel mailing list