summaryrefslogtreecommitdiffhomepage
path: root/src/nginext/nxt_go_port.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-07-05 13:31:45 +0300
committerMax Romanov <max.romanov@nginx.com>2017-07-05 13:31:45 +0300
commitf3107f3896c199a5bc166f57ccd9fef2823ccdaf (patch)
tree1bb2388940d3ad1be08ababfecd270c65289cf26 /src/nginext/nxt_go_port.c
parentf05d674126f3ec3f147f645231a1357e4a0784bf (diff)
downloadunit-f3107f3896c199a5bc166f57ccd9fef2823ccdaf.tar.gz
unit-f3107f3896c199a5bc166f57ccd9fef2823ccdaf.tar.bz2
Complex target parser copied from NGINX.
nxt_app_request_header_t fields renamed: - 'path' renamed to 'target'. - 'path_no_query' renamed to 'path' and contains parsed value.
Diffstat (limited to '')
-rw-r--r--src/nginext/nxt_go_port.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nginext/nxt_go_port.c b/src/nginext/nxt_go_port.c
index 00d13a38..47e46f02 100644
--- a/src/nginext/nxt_go_port.c
+++ b/src/nginext/nxt_go_port.c
@@ -41,22 +41,27 @@ nxt_go_data_handler(nxt_port_msg_t *port_msg, size_t size)
h = &ctx->r.header;
nxt_go_ctx_read_str(ctx, &h->method);
+ nxt_go_ctx_read_str(ctx, &h->target);
nxt_go_ctx_read_str(ctx, &h->path);
- h->path_no_query = h->path;
nxt_go_ctx_read_size(ctx, &s);
if (s > 0) {
s--;
- h->query.start = h->path.start + s;
- h->query.length = h->path.length - s;
+ h->query.start = h->target.start + s;
+ h->query.length = h->target.length - s;
- if (s > 0) {
- h->path_no_query.length = s - 1;
+ if (h->path.start == NULL) {
+ h->path.start = h->target.start;
+ h->path.length = s - 1;
}
}
+ if (h->path.start == NULL) {
+ h->path = h->target;
+ }
+
nxt_go_new_request(r, port_msg->stream, nxt_go_str(&h->method),
- nxt_go_str(&h->path));
+ nxt_go_str(&h->target));
nxt_go_ctx_read_str(ctx, &h->version);