summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_http_parse.c')
-rw-r--r--src/nxt_http_parse.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 8b4bf47c..945f4e93 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -1046,12 +1046,25 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
if (ch >= '0' && ch <= '9') {
ch = (u_char) ((high << 4) + ch - '0');
- if (ch == '%' || ch == '#') {
+ if (ch == '%') {
state = sw_normal;
- *u++ = ch;
+ *u++ = '%';
+
+ if (rp->encoded_slashes) {
+ *u++ = '2';
+ *u++ = '5';
+ }
+
+ continue;
+ }
+
+ if (ch == '#') {
+ state = sw_normal;
+ *u++ = '#';
continue;
+ }
- } else if (ch == '\0') {
+ if (ch == '\0') {
return NXT_HTTP_PARSE_INVALID;
}
@@ -1067,8 +1080,17 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
state = sw_normal;
*u++ = ch;
continue;
+ }
+
+ if (ch == '/' && rp->encoded_slashes) {
+ state = sw_normal;
+ *u++ = '%';
+ *u++ = '2';
+ *u++ = p[-1]; /* 'f' or 'F' */
+ continue;
+ }
- } else if (ch == '+') {
+ if (ch == '+') {
rp->plus_in_target = 1;
}