Skip to content

Commit 6da0bad

Browse files
committed
fix URL decoding of HTTP request query parameters
see OpenIDC/ngx_openidc_module#24; thanks @drzraf Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 92c7244 commit 6da0bad

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
07/31/2025
2+
- fix URL decoding of HTTP request query parameters; see OpenIDC/ngx_openidc_module#24; thanks @drzraf
3+
14
03/13/2025
25
- test: add a space after the status code in the HTTP responses; see curl/curl#16692 ; thanks @charles2910 and @bagder
36
- bump to 2.1.1dev

src/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static bool _oauth2_http_request_query_parse(oauth2_log_t *log,
12171217

12181218
rc = _oauth2_nv_list_parse(log, request->query, request->_parsed_query,
12191219
_OAUTH2_CHAR_AMP, _OAUTH2_CHAR_EQUAL, true,
1220-
false);
1220+
true);
12211221

12221222
end:
12231223

test/check_http.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,25 @@ START_TEST(test_url_base)
463463
}
464464
END_TEST
465465

466+
START_TEST(test_url_query)
467+
{
468+
char *query = NULL;
469+
const char *code = NULL;
470+
oauth2_http_request_t *r = NULL;
471+
472+
r = oauth2_http_request_init(_log);
473+
oauth2_http_request_hostname_set(_log, r, "internal");
474+
oauth2_http_request_port_set(_log, r, 8080);
475+
query = "code=4%2F0AVMBsJh7C-GVOaM16SYgRMfrD";
476+
oauth2_http_request_query_set(_log, r, query);
477+
code = oauth2_http_request_query_param_get(_log, r, "code");
478+
ck_assert_str_eq(code, "4/0AVMBsJh7C-GVOaM16SYgRMfrD");
479+
480+
oauth2_http_request_free(_log, r);
481+
}
482+
END_TEST
483+
484+
466485
START_TEST(test_url_get)
467486
{
468487
char *url = NULL;
@@ -774,6 +793,7 @@ Suite *oauth2_check_http_suite()
774793
tcase_add_test(c, test_request_hostname);
775794
tcase_add_test(c, test_request_port);
776795
tcase_add_test(c, test_url_base);
796+
tcase_add_test(c, test_url_query);
777797
tcase_add_test(c, test_url_get);
778798
tcase_add_test(c, test_request_header);
779799
tcase_add_test(c, test_query_encode);

0 commit comments

Comments
 (0)