Browse files

Merge pull request #26 from agathewiky/master

support for non-upstream,like ngx_lua
  • Loading branch information...
2 parents 35ea7ff + 5547901 commit d3f6fb37b1ca2c7ba6fb32087388b4851cf761be @evanmiller committed Feb 20, 2014
Showing with 12 additions and 2 deletions.
  1. +12 −2 ngx_http_zip_module.c
View
14 ngx_http_zip_module.c
@@ -192,9 +192,19 @@ ngx_http_zip_main_request_header_filter(ngx_http_request_t *r)
return NGX_ERROR;
/* Look for X-Archive-Files */
- if (ngx_http_upstream_header_variable(r, vv, (uintptr_t)(&ngx_http_zip_header_variable_name)) != NGX_OK
- || vv->not_found || ngx_strncmp(vv->data, "zip", sizeof("zip") - 1) != 0)
+ if ( !r->upstream && ( ngx_http_variable_unknown_header(vv, &ngx_http_zip_header_variable_name,
+ &r->headers_out.headers.part,
+ sizeof("upstream_http_") - 1) != NGX_OK)
+ || vv->not_found || ngx_strncmp(vv->data, "zip", sizeof("zip") - 1) != 0){
+
return ngx_http_next_header_filter(r);
+
+ }else if (r->upstream && ngx_http_upstream_header_variable(r, vv,
+ (uintptr_t)(&ngx_http_zip_header_variable_name)) != NGX_OK
+ || vv->not_found || ngx_strncmp(vv->data, "zip", sizeof("zip") - 1) != 0){
+
+ return ngx_http_next_header_filter(r);
+ }
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "mod_zip: X-Archive-Files found");

4 comments on commit d3f6fb3

@omricohen

this commit seems to cause this error:
/usr/local/src/mod_zip-master/ngx_http_zip_module.c: In function ‘ngx_http_zip_main_request_header_filter’:
/usr/local/src/mod_zip-master/ngx_http_zip_module.c:198: error: suggest parentheses around ‘&&’ within ‘||’
/usr/local/src/mod_zip-master/ngx_http_zip_module.c:204: error: suggest parentheses around ‘&&’ within ‘||’

@evanmiller
Owner

Thanks for the note. Try this:

8ffc053

@omricohen
@weizetao

Sorry for that, it's my fault. Thanks!

Please sign in to comment.