[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 06/06: fix #6748
From: |
gnunet |
Subject: |
[taler-anastasis] 06/06: fix #6748 |
Date: |
Sat, 13 Mar 2021 19:23:28 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
commit e715a2dcdc41998ad6da459bdc24c96bb81a5074
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Mar 13 18:49:34 2021 +0100
fix #6748
---
src/backend/anastasis-httpd.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 6d3c60f..eca67a9 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -303,9 +303,14 @@ url_handler (void *cls,
"<html><title>404: not found</title></html>", 0,
&TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
};
-
+ static struct AH_RequestHandler h405 = {
+ "", NULL, "text/html",
+ "<html><title>405: method not allowed</title></html>", 0,
+ &TMH_MHD_handler_static_response, MHD_HTTP_METHOD_NOT_ALLOWED
+ };
struct TM_HandlerContext *hc = *con_cls;
const char *correlation_id = NULL;
+ bool path_matched;
if (NULL == hc)
{
@@ -327,6 +332,9 @@ url_handler (void *cls,
*con_cls = hc;
hc->async_scope_id = aid;
}
+ if (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_HEAD))
+ method = MHD_HTTP_METHOD_GET; /* MHD will throw away the body */
GNUNET_SCHEDULER_begin_async_scope (&hc->async_scope_id);
if (NULL != correlation_id)
@@ -368,13 +376,14 @@ url_handler (void *cls,
if (0 == strcmp (method,
MHD_HTTP_METHOD_POST))
{
- // FIXME: need to accumulate upload_data first!
return AH_handler_policy_post (connection,
hc,
&account_pub,
upload_data,
upload_data_size);
}
+ return TMH_MHD_handler_static_response (&h405,
+ connection);
}
if (0 == strncmp (url,
"/truth/",
@@ -413,7 +422,10 @@ url_handler (void *cls,
upload_data,
upload_data_size);
}
+ return TMH_MHD_handler_static_response (&h405,
+ connection);
}
+ path_matched = false;
for (unsigned int i = 0; NULL != handlers[i].url; i++)
{
struct AH_RequestHandler *rh = &handlers[i];
@@ -421,6 +433,7 @@ url_handler (void *cls,
if (0 == strcmp (url,
rh->url))
{
+ path_matched = true;
if (0 == strcasecmp (method,
MHD_HTTP_METHOD_OPTIONS))
{
@@ -435,7 +448,9 @@ url_handler (void *cls,
}
}
}
- // FIXME: HTTP 405? METHOD_NOT_ALLOWED
+ if (path_matched)
+ return TMH_MHD_handler_static_response (&h405,
+ connection);
return TMH_MHD_handler_static_response (&h404,
connection);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (04827aa -> e715a2d), gnunet, 2021/03/13
- [taler-anastasis] 04/06: remove bogus unique constraint, gnunet, 2021/03/13
- [taler-anastasis] 01/06: fix #6572, gnunet, 2021/03/13
- [taler-anastasis] 03/06: add long polling support for payment on challenge solving, gnunet, 2021/03/13
- [taler-anastasis] 05/06: fix index, gnunet, 2021/03/13
- [taler-anastasis] 02/06: fix #6752, gnunet, 2021/03/13
- [taler-anastasis] 06/06: fix #6748,
gnunet <=