Why Subrequests are get only?
Maciej.Grochowski at sony.com
Maciej.Grochowski at sony.com
Sun Mar 3 21:33:57 UTC 2019
I am trying to use mirror module for multiple requests, one usecase that I am interested in is sending PUT request to additional/mirror location.
During that process I realized that PUT request became GET.
When I took deeper look on subrequest function "ngx_http_subrequest(...)" I noticed that new request is always setup as GET.
I was expecting behavior to be something like:
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2297,8 +2297,11 @@ ngx_http_subrequest(ngx_http_request_t *r,
#if (NGX_HTTP_V2)
sr->stream = r->stream;
#endif
-
- sr->method = NGX_HTTP_GET;
+ if (r->method != 0) {
+ sr->method = r->method;
+ } else {
+ sr->method = NGX_HTTP_GET;
+ }
sr->http_version = r->http_version;
sr->request_line = r->request_line;
@@ -2314,9 +2317,14 @@ ngx_http_subrequest(ngx_http_request_t *r,
sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0;
sr->background = (flags & NGX_HTTP_SUBREQUEST_BACKGROUND) != 0;
sr->unparsed_uri = r->unparsed_uri;
- sr->method_name = ngx_http_core_get_method;
+
+ if (r->method_name.data != NULL) {
+ sr->method_name.len = ngx_strlen(r->method_name.data);
+ sr->method_name.data = r->method_name.data;
+ } else {
+ sr->method_name = ngx_http_core_get_method;
+ }
sr->http_protocol = r->http_protocol;
sr->schema = r->schema;
What is the reason that I am missing and make Subrequests suitable for GET only requests?
Thank you
Maciej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20190303/7224765c/attachment-0001.html>
More information about the nginx-devel
mailing list