[dev] status line processing in filter module

Manlio Perillo manlio_perillo at libero.it
Fri Oct 19 22:42:55 MSD 2007


Igor Sysoev ha scritto:
> On Fri, Oct 19, 2007 at 02:55:59PM +0200, Manlio Perillo wrote:
> 
>> When trying to enable support for Last-Modified validation in mod_wsgi I 
>> have found this code in the filter module:
>>
>> /* status line */
>>
>>     if (r->headers_out.status_line.len) {
>>         len += r->headers_out.status_line.len;
>> #if (NGX_SUPPRESS_WARN)
>>         status = NGX_INVALID_ARRAY_INDEX;
>> #endif
>>
>>     } else {
>>
>>
>>
>> The problem here is that the WSGI application returns a full status line 
>> (including the Reason-Phrase).
>>
>> This means that the not_modified_filter has no effect, since nginx will 
>> not set the status_code to NGX_HTTP_NOT_MODIFIED and r->header_only = 1.
>>
>> Of course in mod_wsgi I can just ignore the Reason-Phrase.
> 
> nginx passes status line from proxied server, fastcgi server, etc. untouched.
> So mod_wsgi should if-modified-since by itself.
> 

Its a nuisance, since Nginx already do it.
The problem is that it does not set r->header_only = 1, and I can't do just:

rc = ngx_http_send_header(r);
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
    ngx_http_wsgi_finalize_request(r, rc);
    return;



Well, this means that the validation must be done by the WSGI application.



Thanks and regards  Manlio Perillo





More information about the nginx mailing list