diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-06-20 18:29:48 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-07-19 17:50:04 +0300 |
commit | 93a449edfbfe0f4e0f0608791a8b54882dab76bf (patch) | |
tree | 1dcc82d82c105d0f822fa58333183c0f1cd82469 /src/microhttpd/daemon.c | |
parent | 57f57e8bfebab50dfde510523f09885d43aae369 (diff) | |
download | libmicrohttpd-93a449edfbfe0f4e0f0608791a8b54882dab76bf.tar.gz libmicrohttpd-93a449edfbfe0f4e0f0608791a8b54882dab76bf.zip |
Use new functions for decode request URLs
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 8ba1baba..251e563e 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "mhd_compat.h" | 45 | #include "mhd_compat.h" |
46 | #include "mhd_send.h" | 46 | #include "mhd_send.h" |
47 | #include "mhd_align.h" | 47 | #include "mhd_align.h" |
48 | #include "mhd_str.h" | ||
48 | 49 | ||
49 | #ifdef HAVE_SEARCH_H | 50 | #ifdef HAVE_SEARCH_H |
50 | #include <search.h> | 51 | #include <search.h> |
@@ -5672,7 +5673,7 @@ MHD_polling_thread (void *cls) | |||
5672 | 5673 | ||
5673 | /** | 5674 | /** |
5674 | * Process escape sequences ('%HH') Updates val in place; the | 5675 | * Process escape sequences ('%HH') Updates val in place; the |
5675 | * result should be UTF-8 encoded and cannot be larger than the input. | 5676 | * result cannot be larger than the input. |
5676 | * The result must also still be 0-terminated. | 5677 | * The result must also still be 0-terminated. |
5677 | * | 5678 | * |
5678 | * @param cls closure (use NULL) | 5679 | * @param cls closure (use NULL) |
@@ -5686,10 +5687,23 @@ unescape_wrapper (void *cls, | |||
5686 | struct MHD_Connection *connection, | 5687 | struct MHD_Connection *connection, |
5687 | char *val) | 5688 | char *val) |
5688 | { | 5689 | { |
5690 | bool broken; | ||
5691 | size_t res; | ||
5689 | (void) cls; /* Mute compiler warning. */ | 5692 | (void) cls; /* Mute compiler warning. */ |
5690 | 5693 | ||
5691 | (void) connection; /* Mute compiler warning. */ | 5694 | /* TODO: add individual parameter */ |
5692 | return MHD_http_unescape (val); | 5695 | if (1 <= connection->daemon->strict_for_client) |
5696 | return MHD_str_pct_decode_in_place_strict_ (val); | ||
5697 | |||
5698 | res = MHD_str_pct_decode_in_place_lenient_ (val, &broken); | ||
5699 | #ifdef HAVE_MESSAGES | ||
5700 | if (broken) | ||
5701 | { | ||
5702 | MHD_DLOG (connection->daemon, | ||
5703 | _ ("The URL encoding is broken.\n")); | ||
5704 | } | ||
5705 | #endif /* HAVE_MESSAGES */ | ||
5706 | return res; | ||
5693 | } | 5707 | } |
5694 | 5708 | ||
5695 | 5709 | ||