Welcome! Log In Create A New Profile

Advanced

Why Subrequests are get only?

March 03, 2019 04:36PM
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


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Why Subrequests are get only?

matfriday 354 March 03, 2019 04:36PM

Re: Why Subrequests are get only?

Maxim Dounin 162 March 04, 2019 08:34AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 311
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready