aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-02-12 15:24:47 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-02-12 15:24:47 +0000
commitd3a56d950947a01e0a932cf103631033373c57f5 (patch)
tree5191ef741600774c8aa0ffe73837676741c15b0f
parentc6514d44c8818c03c2f4a3d0c1097730c4561e63 (diff)
downloadrspamd-d3a56d950947a01e0a932cf103631033373c57f5.tar.gz
rspamd-d3a56d950947a01e0a932cf103631033373c57f5.zip
[Fix] Try to fix url path issue
-rw-r--r--src/libserver/http/http_message.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/libserver/http/http_message.c b/src/libserver/http/http_message.c
index 670122d52..4b68d1ecb 100644
--- a/src/libserver/http/http_message.c
+++ b/src/libserver/http/http_message.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2019 Vsevolod Stakhov
+/*
+ * Copyright 2024 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -85,7 +85,21 @@ rspamd_http_message_from_url(const gchar *url)
}
else {
path = url + pu.field_data[UF_PATH].off;
- pathlen = urllen - pu.field_data[UF_PATH].off;
+ pathlen = pu.field_data[UF_PATH].len;
+
+ if (path > url && *(path - 1) == '/') {
+ path--;
+ pathlen++;
+ }
+
+
+ /* Include query if needed */
+ if ((pu.field_set & (1 << UF_QUERY)) != 0) {
+ /* Include both ? and query */
+ pathlen += pu.field_data[UF_QUERY].len + 1;
+ }
+
+ /* Do not include fragment here! */
}
msg = rspamd_http_new_message(HTTP_REQUEST);