summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2024-04-10 13:45:34 +0800
committerZhidao HONG <z.hong@f5.com>2024-04-11 22:23:09 +0800
commit64934e59f9c06f62fe99466b320cd397c8609807 (patch)
tree3c6e46f4e01479ab5bee3af92f2c2720ed2f8562
parent626977730f0e9029ee15b6321d35cb5aa311379d (diff)
downloadunit-64934e59f9c06f62fe99466b320cd397c8609807.tar.gz
unit-64934e59f9c06f62fe99466b320cd397c8609807.tar.bz2
HTTP: Introduce quoted target marker in HTTP parsing
The quoted_target field is to indentify URLs containing percent-encoded characters. It can be used in places where you might need to generate new URL, such as in the proxy module. It will be used in the subsequent commit.
-rw-r--r--src/nxt_http_parse.c15
-rw-r--r--src/nxt_http_parse.h2
2 files changed, 5 insertions, 12 deletions
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 50cbda2b..48be5bdb 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -286,13 +286,11 @@ continue_target:
case NXT_HTTP_TARGET_SPACE:
rp->target_end = p;
goto space_after_target;
-#if 0
+
case NXT_HTTP_TARGET_QUOTE_MARK:
rp->quoted_target = 1;
goto rest_of_target;
-#else
- case NXT_HTTP_TARGET_QUOTE_MARK:
-#endif
+
case NXT_HTTP_TARGET_HASH:
rp->complex_target = 1;
goto rest_of_target;
@@ -434,12 +432,7 @@ space_after_target:
rp->request_line_end = p;
- if (rp->complex_target != 0
-#if 0
- || rp->quoted_target != 0
-#endif
- )
- {
+ if (rp->complex_target || rp->quoted_target) {
rc = nxt_http_parse_complex_target(rp);
if (nxt_slow_path(rc != NXT_OK)) {
@@ -1041,7 +1034,7 @@ nxt_http_parse_complex_target(nxt_http_request_parse_t *rp)
break;
case sw_quoted:
- //rp->quoted_target = 1;
+ rp->quoted_target = 1;
if (ch >= '0' && ch <= '9') {
high = (u_char) (ch - '0');
diff --git a/src/nxt_http_parse.h b/src/nxt_http_parse.h
index fa95e842..9e1265d1 100644
--- a/src/nxt_http_parse.h
+++ b/src/nxt_http_parse.h
@@ -61,9 +61,9 @@ struct nxt_http_request_parse_s {
/* target with "/." */
uint8_t complex_target; /* 1 bit */
-#if 0
/* target with "%" */
uint8_t quoted_target; /* 1 bit */
+#if 0
/* target with " " */
uint8_t space_in_target; /* 1 bit */
#endif