summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-09-20 20:08:34 +0200
committerChristian Grothoff <christian@grothoff.org>2018-09-20 20:08:34 +0200
commitc27ec06b744f57189e4247410da09257b403ebbc (patch)
treeadb999ca25491c68ec9b43daf52268219c469e87
parentb4bbe2c09fe266bd74f3b76f00a7b88c3701bac1 (diff)
downloadtwister-c27ec06b744f57189e4247410da09257b403ebbc.tar.gz
twister-c27ec06b744f57189e4247410da09257b403ebbc.tar.bz2
twister-c27ec06b744f57189e4247410da09257b403ebbc.zip
fix root cause of #5337: curl interprets early response from MHD as error response (even though it is a 200 OK) and then aborted the upload; so we should wait with the response until the upload is complete
-rw-r--r--src/test/test_twister_webserver.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/test/test_twister_webserver.c b/src/test/test_twister_webserver.c
index bf32fcf..bb434c0 100644
--- a/src/test/test_twister_webserver.c
+++ b/src/test/test_twister_webserver.c
@@ -43,26 +43,33 @@ answer_to_connection
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls)
{
- #if 0
+#if 0
const char *page = "<html><body>Hello, browser!</body></html>";
- #endif
-
+#endif
const char *page = "{\"hello\": [{\"this\": \"browser!\"}],"\
"\"when\": \"today\"}";
-
struct MHD_Response *response;
int ret;
+
(void)cls; /* Unused. Silent compiler warning. */
(void)url; /* Unused. Silent compiler warning. */
(void)method; /* Unused. Silent compiler warning. */
(void)version; /* Unused. Silent compiler warning. */
(void)upload_data; /* Unused. Silent compiler warning. */
- (void)upload_data_size; /* Unused. Silent compiler warning. */
- (void)con_cls; /* Unused. Silent compiler warning. */
+ if (NULL == (*con_cls))
+ {
+ *con_cls = "first";
+ return MHD_YES;
+ }
+ if (0 != *upload_data_size)
+ {
+ *upload_data_size = 0;
+ return MHD_YES;
+ }
response = MHD_create_response_from_buffer
(strlen (page),
- (void *) page,
+ (void *) page,
MHD_RESPMEM_PERSISTENT);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);