commit 5a683e3d59ca9c5ab43b298d46a4ebaa2fc11593
parent 3a8cf70ea24c59d9e0deb6e2ec492b04565c4a4b
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 29 Dec 2024 14:03:46 +0100
fix #9420 + #9428
Diffstat:
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/challenger/challenger-httpd_common.c b/src/challenger/challenger-httpd_common.c
@@ -32,18 +32,20 @@
int
CH_get_output_type (struct MHD_Connection *connection)
{
- int output_type;
+ const char *mime;
+ double q_html;
+ double q_json;
- output_type
- = TALER_MHD_check_accept (connection,
- MHD_HTTP_HEADER_ACCEPT,
- "text/html",
- "application/json",
- NULL);
- if (output_type < 0)
- output_type = 0; /* default to HTML */
- GNUNET_assert (output_type < 2);
- return output_type;
+ mime = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_ACCEPT);
+ if (NULL == mime)
+ return 0; /* default to HTML */
+ q_html = TALER_pattern_matches (mime,
+ "text/html");
+ q_json = TALER_pattern_matches (mime,
+ "application/json");
+ return (q_html > q_json) ? 0 : 1;
}