Skip to content

Commit

Permalink
Merge pull request #26 from agathewiky/master
Browse files Browse the repository at this point in the history
support for non-upstream,like ngx_lua
  • Loading branch information
evanmiller committed Feb 20, 2014
2 parents 35ea7ff + 5547901 commit d3f6fb3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ngx_http_zip_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

4 comments on commit d3f6fb3

@omricohen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note. Try this:

8ffc053

@omricohen
Copy link

@omricohen omricohen commented on d3f6fb3 Feb 21, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizetao
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.