From 0523715580422caee3adca498ea1f69d66e2cb48 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 Aug 2021 09:13:46 +0200 Subject: -fix indentation and #6982 --- src/twister/taler-twister-service.c | 28 ++++++++----- src/twister/twister_api.c | 80 ++++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 45 deletions(-) diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c index 2a41e27..19ec492 100644 --- a/src/twister/taler-twister-service.c +++ b/src/twister/taler-twister-service.c @@ -459,7 +459,16 @@ curl_check_hdr (void *buffer, GNUNET_free (ndup); return bytes; } - + /* Skip "Connection: Keep-Alive" header, it will be + done by MHD if possible */ + if ( (0 == strcasecmp (header, + MHD_HTTP_HEADER_CONNECTION)) && + (0 == strcasecmp (value, + "Keep-Alive")) ) + { + GNUNET_free (ndup); + return bytes; + } if (0 != strlen (hdr_val)) /* Rely in MHD to set those */ { header = GNUNET_new (struct HttpResponseHeader); @@ -565,8 +574,8 @@ curl_download_cb (void *ptr, hr->curl_paused = GNUNET_YES; return CURL_WRITEFUNC_PAUSE; } - GNUNET_assert - (REQUEST_STATE_PROXY_DOWNLOAD_STARTED == hr->state); + GNUNET_assert (REQUEST_STATE_PROXY_DOWNLOAD_STARTED == + hr->state); if (hr->io_size - hr->io_len < total) { GNUNET_assert (total + hr->io_size >= total); @@ -775,12 +784,13 @@ curl_download_prepare () GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); - curl_download_task = GNUNET_SCHEDULER_add_select - (GNUNET_SCHEDULER_PRIORITY_DEFAULT, - rtime, - grs, gws, - &curl_task_download, - curl_multi); + curl_download_task + = GNUNET_SCHEDULER_add_select ( + GNUNET_SCHEDULER_PRIORITY_DEFAULT, + rtime, + grs, gws, + &curl_task_download, + curl_multi); GNUNET_NETWORK_fdset_destroy (gws); GNUNET_NETWORK_fdset_destroy (grs); } diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c index fb4e075..bfe99b0 100644 --- a/src/twister/twister_api.c +++ b/src/twister/twister_api.c @@ -26,6 +26,7 @@ */ #include "platform.h" #include +#include #include "taler_twister_service.h" #include "twister.h" @@ -147,8 +148,7 @@ handle_acknowledgement (void *cls, * @return handle to use in #TALER_TWISTER_disconnect to disconnect */ struct TALER_TWISTER_Handle * -TALER_TWISTER_connect - (const struct GNUNET_CONFIGURATION_Handle *cfg) +TALER_TWISTER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) { struct TALER_TWISTER_Handle *h; @@ -235,10 +235,9 @@ TALER_TWISTER_cancel (struct TALER_TWISTER_Operation *op) * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_malform_upload - (struct TALER_TWISTER_Handle *h, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_malform_upload (struct TALER_TWISTER_Handle *h, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; @@ -272,10 +271,9 @@ TALER_TWISTER_malform_upload * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_malform - (struct TALER_TWISTER_Handle *h, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_malform (struct TALER_TWISTER_Handle *h, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; @@ -313,11 +311,10 @@ TALER_TWISTER_malform * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_flip_download - (struct TALER_TWISTER_Handle *h, - const char *path, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_flip_download (struct TALER_TWISTER_Handle *h, + const char *path, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; @@ -364,11 +361,10 @@ TALER_TWISTER_flip_download * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_flip_upload - (struct TALER_TWISTER_Handle *h, - const char *path, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_flip_upload (struct TALER_TWISTER_Handle *h, + const char *path, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; @@ -418,11 +414,10 @@ TALER_TWISTER_flip_upload * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_delete_path - (struct TALER_TWISTER_Handle *h, - const char *path, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_delete_path (struct TALER_TWISTER_Handle *h, + const char *path, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; @@ -496,8 +491,8 @@ TALER_TWISTER_modify_path_dl (struct TALER_TWISTER_Handle *h, stralloc, TWISTER_MESSAGE_TYPE_MODIFY_PATH_DL); - GNUNET_assert - (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1], + GNUNET_assert (stralloc == + GNUNET_STRINGS_buffer_fill ((char *) &src[1], stralloc, 2, path, @@ -547,8 +542,8 @@ TALER_TWISTER_modify_path_ul (struct TALER_TWISTER_Handle *h, env = GNUNET_MQ_msg_extra (src, stralloc, TWISTER_MESSAGE_TYPE_MODIFY_PATH_UL); - GNUNET_assert - (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1], + GNUNET_assert (stralloc == + GNUNET_STRINGS_buffer_fill ((char *) &src[1], stralloc, 2, path, @@ -581,6 +576,20 @@ TALER_TWISTER_modify_header_dl (struct TALER_TWISTER_Handle *h, struct TWISTER_ModifyPath *src; uint16_t stralloc; + if ( (0 == strcasecmp (header, + MHD_HTTP_HEADER_CONNECTION)) && + (0 == strcasecmp (value, + "Keep-Alive")) ) + { + GNUNET_break (0); + return NULL; + } + if (0 == strcasecmp (header, + MHD_HTTP_HEADER_CONTENT_LENGTH)) + { + GNUNET_break (0); + return NULL; + } stralloc = strlen (header) + strlen (value) + 2; if (sizeof (*src) + stralloc > UINT16_MAX) { @@ -598,8 +607,8 @@ TALER_TWISTER_modify_header_dl (struct TALER_TWISTER_Handle *h, stralloc, TWISTER_MESSAGE_TYPE_MODIFY_HEADER_DL); - GNUNET_assert - (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1], + GNUNET_assert (stralloc == + GNUNET_STRINGS_buffer_fill ((char *) &src[1], stralloc, 2, header, @@ -619,11 +628,10 @@ TALER_TWISTER_modify_header_dl (struct TALER_TWISTER_Handle *h, * @return operation handle (to possibly abort) */ struct TALER_TWISTER_Operation * -TALER_TWISTER_change_response_code - (struct TALER_TWISTER_Handle *h, - unsigned int new_rc, - GNUNET_SCHEDULER_TaskCallback cb, - void *cb_cls) +TALER_TWISTER_change_response_code (struct TALER_TWISTER_Handle *h, + unsigned int new_rc, + GNUNET_SCHEDULER_TaskCallback cb, + void *cb_cls) { struct TALER_TWISTER_Operation *op; struct GNUNET_MQ_Envelope *env; -- cgit v1.2.3