summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-09-16 21:20:53 +0200
committerChristian Grothoff <christian@grothoff.org>2019-09-16 21:20:53 +0200
commit386a544d34347e18db4761b08c01733e56917c7c (patch)
tree21454a6f64ad5c2fc8a4500f53620dff07e4c887
parent5d426714ed8a559a7a3b5bda17cff30d98f4218e (diff)
downloadtwister-386a544d34347e18db4761b08c01733e56917c7c.tar.gz
twister-386a544d34347e18db4761b08c01733e56917c7c.tar.bz2
twister-386a544d34347e18db4761b08c01733e56917c7c.zip
reindentation
-rw-r--r--src/twister/taler-twister-service.c599
1 files changed, 301 insertions, 298 deletions
diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c
index 9733555..51173a3 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -53,7 +53,7 @@
#endif
-#define REQUEST_BUFFER_MAX (1024*1024)
+#define REQUEST_BUFFER_MAX (1024 * 1024)
#define UNIX_BACKLOG 500
/**
@@ -64,7 +64,8 @@
* @param rc return code from curl
*/
#define LOG_CURL_EASY(level,fun,rc) \
- GNUNET_log(level, _("%s failed at %s:%d: `%s'\n"), fun, __FILE__, __LINE__, curl_easy_strerror (rc))
+ GNUNET_log (level, _ ("%s failed at %s:%d: `%s'\n"), fun, __FILE__, __LINE__, \
+ curl_easy_strerror (rc))
/* ******** Datastructures for HTTP handling ********** */
@@ -394,9 +395,9 @@ run_mhd_now (void);
*/
static size_t
curl_check_hdr (void *buffer,
- size_t size,
- size_t nmemb,
- void *cls)
+ size_t size,
+ size_t nmemb,
+ void *cls)
{
struct HttpRequest *hr = cls;
struct HttpResponseHeader *header;
@@ -445,7 +446,7 @@ curl_check_hdr (void *buffer,
/* Skip "Content-length:" header as it will be wrong, given
that we are man-in-the-middling the connection */
if (0 == strcasecmp (hdr_type,
- MHD_HTTP_HEADER_CONTENT_LENGTH))
+ MHD_HTTP_HEADER_CONTENT_LENGTH))
{
GNUNET_free (ndup);
return bytes;
@@ -522,15 +523,15 @@ create_mhd_response_from_hr (struct HttpRequest *hr)
*/
static size_t
curl_download_cb (void *ptr,
- size_t size,
- size_t nmemb,
- void *ctx)
+ size_t size,
+ size_t nmemb,
+ void *ctx)
{
struct HttpRequest *hr = ctx;
size_t total = size * nmemb;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Curl download proceeding\n");
+ "Curl download proceeding\n");
if (REQUEST_STATE_PROXY_UPLOAD_STARTED == hr->state)
{
@@ -545,8 +546,8 @@ curl_download_cb (void *ptr,
hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
GNUNET_log
(GNUNET_ERROR_TYPE_INFO,
- "Stopping %u byte upload: we are already downloading...\n",
- (unsigned int) hr->io_len);
+ "Stopping %u byte upload: we are already downloading...\n",
+ (unsigned int) hr->io_len);
hr->io_len = 0;
}
@@ -564,9 +565,9 @@ curl_download_cb (void *ptr,
GNUNET_assert (total + hr->io_size >= total);
GNUNET_assert (hr->io_size * 2 + 1024 > hr->io_size);
GNUNET_array_grow (hr->io_buf,
- hr->io_size,
- GNUNET_MAX (total + hr->io_len,
- hr->io_size * 2 + 1024));
+ hr->io_size,
+ GNUNET_MAX (total + hr->io_len,
+ hr->io_size * 2 + 1024));
}
GNUNET_memcpy (&hr->io_buf[hr->io_len],
ptr,
@@ -595,9 +596,9 @@ curl_download_prepare (void);
*/
static size_t
curl_upload_cb (void *buf,
- size_t size,
- size_t nmemb,
- void *cls)
+ size_t size,
+ size_t nmemb,
+ void *cls)
{
struct HttpRequest *hr = cls;
size_t len = size * nmemb;
@@ -611,12 +612,12 @@ curl_upload_cb (void *buf,
{
GNUNET_log
(GNUNET_ERROR_TYPE_INFO,
- "Upload cb aborts: we are already downloading...\n");
+ "Upload cb aborts: we are already downloading...\n");
return CURL_READFUNC_ABORT;
}
if ( (0 == hr->io_len) &&
- (REQUEST_STATE_PROXY_UPLOAD_STARTED == hr->state) )
+ (REQUEST_STATE_PROXY_UPLOAD_STARTED == hr->state) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Pausing CURL UPLOAD, need more data\n");
@@ -635,7 +636,7 @@ curl_upload_cb (void *buf,
{
hr->curl_paused = GNUNET_NO;
curl_easy_pause (hr->curl,
- CURLPAUSE_CONT);
+ CURLPAUSE_CONT);
}
curl_download_prepare ();
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -645,8 +646,8 @@ curl_upload_cb (void *buf,
to_copy = GNUNET_MIN (hr->io_len,
len);
GNUNET_memcpy (buf,
- hr->io_buf,
- to_copy);
+ hr->io_buf,
+ to_copy);
/* shift remaining data back to the beginning of the buffer. */
memmove (hr->io_buf,
&hr->io_buf[to_copy],
@@ -683,7 +684,7 @@ build_host_header (const char *url)
char *dup = GNUNET_strdup (url);
hostname = strstr (dup, MARKER);
- hostname+=3;
+ hostname += 3;
end = strchrnul (hostname, '/');
*end = '\0';
@@ -735,53 +736,53 @@ curl_download_prepare ()
FD_ZERO (&ws);
FD_ZERO (&es);
if (CURLM_OK != (mret = curl_multi_fdset (curl_multi,
- &rs,
- &ws,
- &es,
- &max)))
+ &rs,
+ &ws,
+ &es,
+ &max)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s failed at %s:%d: `%s'\n",
"curl_multi_fdset",
- __FILE__,
- __LINE__,
+ __FILE__,
+ __LINE__,
curl_multi_strerror (mret));
return;
}
to = -1;
GNUNET_break (CURLM_OK ==
- curl_multi_timeout (curl_multi,
- &to));
+ curl_multi_timeout (curl_multi,
+ &to));
if (-1 == to)
rtime = GNUNET_TIME_UNIT_FOREVER_REL;
else
rtime = GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS, to);
+ (GNUNET_TIME_UNIT_MILLISECONDS, to);
if (-1 != max)
{
grs = GNUNET_NETWORK_fdset_create ();
gws = GNUNET_NETWORK_fdset_create ();
GNUNET_NETWORK_fdset_copy_native (grs,
- &rs,
- max + 1);
+ &rs,
+ max + 1);
GNUNET_NETWORK_fdset_copy_native (gws,
- &ws,
- max + 1);
+ &ws,
+ max + 1);
curl_download_task = GNUNET_SCHEDULER_add_select
- (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
- rtime,
- grs, gws,
- &curl_task_download,
- curl_multi);
+ (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+ rtime,
+ grs, gws,
+ &curl_task_download,
+ curl_multi);
GNUNET_NETWORK_fdset_destroy (gws);
GNUNET_NETWORK_fdset_destroy (grs);
}
else
{
curl_download_task = GNUNET_SCHEDULER_add_delayed
- (rtime,
- &curl_task_download,
- curl_multi);
+ (rtime,
+ &curl_task_download,
+ curl_multi);
}
}
@@ -807,17 +808,17 @@ curl_task_download (void *cls)
{
running = 0;
mret = curl_multi_perform (curl_multi,
- &running);
+ &running);
while (NULL != (msg = curl_multi_info_read (curl_multi,
- &msgnum)))
+ &msgnum)))
{
GNUNET_break
(CURLE_OK == curl_easy_getinfo
(msg->easy_handle,
- CURLINFO_PRIVATE,
- (char **) &hr ));
+ CURLINFO_PRIVATE,
+ (char **) &hr));
if (NULL == hr)
{
@@ -826,67 +827,68 @@ curl_task_download (void *cls)
}
switch (msg->msg)
{
- case CURLMSG_NONE:
- /* documentation says this is not used */
- GNUNET_break (0);
- break;
- case CURLMSG_DONE:
- switch (msg->data.result)
+ case CURLMSG_NONE:
+ /* documentation says this is not used */
+ GNUNET_break (0);
+ break;
+ case CURLMSG_DONE:
+ switch (msg->data.result)
+ {
+ case CURLE_OK:
+ case CURLE_GOT_NOTHING:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CURL download completed.\n");
+ if (NULL == hr->response)
+ GNUNET_assert (GNUNET_OK ==
+ create_mhd_response_from_hr (hr));
+ hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
+ if (GNUNET_YES == hr->suspended)
{
- case CURLE_OK:
- case CURLE_GOT_NOTHING:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "CURL download completed.\n");
- if (NULL == hr->response)
- GNUNET_assert (GNUNET_OK ==
- create_mhd_response_from_hr (hr));
- hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
- if (GNUNET_YES == hr->suspended)
- {
- MHD_resume_connection (hr->con);
- hr->suspended = GNUNET_NO;
- }
- run_mhd_now ();
- break;
- default:
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Download curl failed: %s\n",
- curl_easy_strerror (msg->data.result));
- /* FIXME: indicate error somehow?
- * close MHD connection badly as well? */
- hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
- if (GNUNET_YES == hr->suspended)
- {
- MHD_resume_connection (hr->con);
- hr->suspended = GNUNET_NO;
- }
- run_mhd_now ();
- break;
+ MHD_resume_connection (hr->con);
+ hr->suspended = GNUNET_NO;
}
- if (NULL == hr->response)
- hr->response = curl_failure_response;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Curl request for `%s' finished (got the response)\n",
- hr->url);
- run_mhd_now ();
- break;
- case CURLMSG_LAST:
- /* documentation says this is not used */
- GNUNET_break (0);
+ run_mhd_now ();
break;
default:
- /* unexpected status code */
- GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Download curl failed: %s\n",
+ curl_easy_strerror (msg->data.result));
+ /* FIXME: indicate error somehow?
+ * close MHD connection badly as well? */
+ hr->state = REQUEST_STATE_PROXY_DOWNLOAD_DONE;
+ if (GNUNET_YES == hr->suspended)
+ {
+ MHD_resume_connection (hr->con);
+ hr->suspended = GNUNET_NO;
+ }
+ run_mhd_now ();
break;
+ }
+ if (NULL == hr->response)
+ hr->response = curl_failure_response;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Curl request for `%s' finished (got the response)\n",
+ hr->url);
+ run_mhd_now ();
+ break;
+ case CURLMSG_LAST:
+ /* documentation says this is not used */
+ GNUNET_break (0);
+ break;
+ default:
+ /* unexpected status code */
+ GNUNET_break (0);
+ break;
}
- };
+ }
+ ;
} while (mret == CURLM_CALL_MULTI_PERFORM);
if (CURLM_OK != mret)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s failed at %s:%d: `%s'\n",
"curl_multi_perform",
- __FILE__,
- __LINE__,
+ __FILE__,
+ __LINE__,
curl_multi_strerror (mret));
if (0 == running)
{
@@ -934,8 +936,8 @@ con_val_iter (void *cls,
if ((0 == strcmp (MHD_HTTP_HEADER_ACCEPT_ENCODING,
key)) ||
- (0 == strcmp (MHD_HTTP_HEADER_CONTENT_ENCODING,
- key)))
+ (0 == strcmp (MHD_HTTP_HEADER_CONTENT_ENCODING,
+ key)))
{
TALER_LOG_INFO ("Do not re-compress request and/or do not"
" ask for compressed responses\n");
@@ -945,7 +947,8 @@ con_val_iter (void *cls,
if ((0 == strcmp (MHD_HTTP_HEADER_CONTENT_LENGTH,
key)))
{
- TALER_LOG_INFO ("Do not re-set Content-Length for request (CURLOPT_POSTFIELDSIZE did)\n");
+ TALER_LOG_INFO (
+ "Do not re-set Content-Length for request (CURLOPT_POSTFIELDSIZE did)\n");
return MHD_YES;
}
@@ -1047,7 +1050,7 @@ walk_object (const char *path,
* deleting/modifying the response will operate on that
* same random array element. */
(NULL == json_array_get (element, (unsigned int) strtoul
- (token, NULL, 10))) )
+ (token, NULL, 10))) )
{
TALER_LOG_WARNING ("(Last) path token '%s' not found\n",
last_token);
@@ -1125,27 +1128,27 @@ modify_object (struct MHD_Connection *con,
return GNUNET_SYSERR;
perform_modbody:
- ret_modify = -1;
- if (json_is_object (parent))
- ret_modify = json_object_set (parent,
- target,
- new_value);
- if (json_is_array (parent))
- ret_modify = json_array_set_new
- (parent,
- (unsigned int) strtoul (target, NULL, 10),
- new_value);
+ ret_modify = -1;
+ if (json_is_object (parent))
+ ret_modify = json_object_set (parent,
+ target,
+ new_value);
+ if (json_is_array (parent))
+ ret_modify = json_array_set_new
+ (parent,
+ (unsigned int) strtoul (target, NULL, 10),
+ new_value);
- GNUNET_free (target);
- json_decref (new_value);
+ GNUNET_free (target);
+ json_decref (new_value);
- if (-1 == ret_modify)
- {
- TALER_LOG_WARNING ("Could not replace '%s'\n", target);
- return GNUNET_SYSERR;
- }
+ if (-1 == ret_modify)
+ {
+ TALER_LOG_WARNING ("Could not replace '%s'\n", target);
+ return GNUNET_SYSERR;
+ }
- return GNUNET_OK;
+ return GNUNET_OK;
}
@@ -1198,9 +1201,9 @@ flip_object (struct MHD_Connection *con,
if (json_is_array (parent))
child = json_array_get
- (parent, (unsigned int) strtoul (target,
- NULL,
- 10));
+ (parent, (unsigned int) strtoul (target,
+ NULL,
+ 10));
/* json walker is such that at this point the
* child's parent is always a object or array. */
@@ -1211,19 +1214,19 @@ flip_object (struct MHD_Connection *con,
current_value_flip = GNUNET_strdup (current_value);
flip_index = GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK,
- strlen (current_value_flip));
- do{
+ (GNUNET_CRYPTO_QUALITY_WEAK,
+ strlen (current_value_flip));
+ do {
crockford_index = GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_STRONG,
- CROCKFORD_MAX_INDEX + 1);
+ (GNUNET_CRYPTO_QUALITY_STRONG,
+ CROCKFORD_MAX_INDEX + 1);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Try flipping with Crockford index: %u\n",
crockford_index);
}
while (current_value_flip[flip_index] ==
- crockford_chars[crockford_index]);
+ crockford_chars[crockford_index]);
current_value_flip[flip_index] =
crockford_chars[crockford_index];
@@ -1232,8 +1235,8 @@ flip_object (struct MHD_Connection *con,
current_value,
current_value_flip);
if (0 != json_string_set
- (child,
- (const char *) current_value_flip))
+ (child,
+ (const char *) current_value_flip))
{
TALER_LOG_WARNING ("Could not flip '%s'\n", target);
GNUNET_free (current_value_flip);
@@ -1285,9 +1288,9 @@ delete_object (struct MHD_Connection *con,
if (json_is_array (parent))
{
ret_deletion = json_array_remove
- (parent, (unsigned int) strtoul (target,
- NULL,
- 10));
+ (parent, (unsigned int) strtoul (target,
+ NULL,
+ 10));
}
GNUNET_free (target);
@@ -1428,9 +1431,9 @@ create_response_with_chaos_rate (struct HttpRequest *request)
resp_buf = request->io_buf;
}
request->response = MHD_create_response_from_buffer
- (resp_len,
- resp_buf,
- MHD_RESPMEM_MUST_COPY);
+ (resp_len,
+ resp_buf,
+ MHD_RESPMEM_MUST_COPY);
}
@@ -1495,7 +1498,7 @@ create_response (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing %u bytes UPLOAD\n",
- (unsigned int) *upload_data_size);
+ (unsigned int) *upload_data_size);
/* Grow the buffer if remaining space isn't enough. */
if (hr->io_size - hr->io_len < *upload_data_size)
@@ -1508,8 +1511,8 @@ create_response (void *cls,
GNUNET_array_grow (hr->io_buf,
hr->io_size,
GNUNET_MAX
- (hr->io_size * 2 + 1024,
- *upload_data_size + hr->io_len));
+ (hr->io_size * 2 + 1024,
+ *upload_data_size + hr->io_len));
}
/* Finally copy upload data. */
@@ -1537,17 +1540,17 @@ create_response (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Attempting to decompress\n");
ce = MHD_lookup_connection_value
- (con,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_CONTENT_ENCODING);
+ (con,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_CONTENT_ENCODING);
if ((NULL != ce) && (0 == strcmp ("deflate", ce)))
GNUNET_assert (Z_OK == inflate_data (hr));
ce = MHD_lookup_connection_value
- (con,
- MHD_HEADER_KIND,
- MHD_HTTP_HEADER_CONTENT_TYPE);
+ (con,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_CONTENT_TYPE);
if ((NULL != ce) && (0 == strcmp ("application/json", ce)))
{
@@ -1561,8 +1564,8 @@ create_response (void *cls,
{
TALER_LOG_ERROR
("Could not parse JSON from client: %s (%s)\n",
- error.text,
- error.source);
+ error.text,
+ error.source);
/* Quick and dirty. */
return MHD_NO;
}
@@ -1581,7 +1584,7 @@ create_response (void *cls,
TALER_LOG_DEBUG
("Will (badly) truncate the request.\n");
malformed_size = GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len);
+ (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len);
hr->io_len = malformed_size;
malform_upload = GNUNET_NO;
}
@@ -1646,34 +1649,34 @@ create_response (void *cls,
* ignored.*/
curl_easy_setopt (hr->curl,
CURLOPT_POSTFIELDSIZE,
- hr->io_len);
+ hr->io_len);
curl_easy_setopt (hr->curl,
CURLOPT_INFILESIZE,
- hr->io_len);
+ hr->io_len);
curl_easy_setopt (hr->curl,
CURLOPT_HEADERFUNCTION,
&curl_check_hdr);
curl_easy_setopt (hr->curl,
- CURLOPT_HEADERDATA,
- hr);
+ CURLOPT_HEADERDATA,
+ hr);
curl_easy_setopt (hr->curl,
- CURLOPT_FOLLOWLOCATION,
- 0);
+ CURLOPT_FOLLOWLOCATION,
+ 0);
curl_easy_setopt (hr->curl,
- CURLOPT_CONNECTTIMEOUT,
- 600L);
+ CURLOPT_CONNECTTIMEOUT,
+ 600L);
curl_easy_setopt (hr->curl,
- CURLOPT_TIMEOUT,
- 600L);
+ CURLOPT_TIMEOUT,
+ 600L);
curl_easy_setopt (hr->curl,
- CURLOPT_NOSIGNAL,
- 1L);
+ CURLOPT_NOSIGNAL,
+ 1L);
curl_easy_setopt (hr->curl,
- CURLOPT_PRIVATE,
- hr);
+ CURLOPT_PRIVATE,
+ hr);
curl_easy_setopt (hr->curl,
- CURLOPT_VERBOSE,
- 0);
+ CURLOPT_VERBOSE,
+ 0);
curl_easy_setopt (hr->curl,
CURLOPT_READFUNCTION,
@@ -1695,12 +1698,12 @@ create_response (void *cls,
char *host_hdr;
GNUNET_asprintf (&curlurl,
- "%s%s",
- target_server_base_url,
- hr->url);
+ "%s%s",
+ target_server_base_url,
+ hr->url);
curl_easy_setopt (hr->curl,
- CURLOPT_URL,
- curlurl);
+ CURLOPT_URL,
+ curlurl);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Forwarding request to: %s\n",
curlurl);
@@ -1715,28 +1718,28 @@ create_response (void *cls,
}
if (0 == strcasecmp (meth,
- MHD_HTTP_METHOD_PUT))
+ MHD_HTTP_METHOD_PUT))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Crafting a CURL PUT request\n");
curl_easy_setopt (hr->curl,
- CURLOPT_PUT,
- 1L);
+ CURLOPT_PUT,
+ 1L);
hr->state = REQUEST_STATE_PROXY_UPLOAD_STARTED;
}
else if (0 == strcasecmp (meth,
- MHD_HTTP_METHOD_POST))
+ MHD_HTTP_METHOD_POST))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Crafting a CURL POST request\n");
curl_easy_setopt (hr->curl,
- CURLOPT_POST,
- 1L);
+ CURLOPT_POST,
+ 1L);
curl_easy_setopt (hr->curl,
CURLOPT_VERBOSE,
1L);
@@ -1744,33 +1747,33 @@ create_response (void *cls,
}
else if (0 == strcasecmp (meth,
- MHD_HTTP_METHOD_HEAD))
+ MHD_HTTP_METHOD_HEAD))
{
hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
curl_easy_setopt (hr->curl,
- CURLOPT_NOBODY,
- 1L);
+ CURLOPT_NOBODY,
+ 1L);
}
else if (0 == strcasecmp (meth,
- MHD_HTTP_METHOD_OPTIONS))
+ MHD_HTTP_METHOD_OPTIONS))
{
hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
curl_easy_setopt (hr->curl,
- CURLOPT_CUSTOMREQUEST,
- "OPTIONS");
+ CURLOPT_CUSTOMREQUEST,
+ "OPTIONS");
}
else if (0 == strcasecmp (meth,
- MHD_HTTP_METHOD_GET))
+ MHD_HTTP_METHOD_GET))
{
hr->state = REQUEST_STATE_PROXY_DOWNLOAD_STARTED;
curl_easy_setopt (hr->curl,
- CURLOPT_HTTPGET,
- 1L);
+ CURLOPT_HTTPGET,
+ 1L);
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Unsupported HTTP method `%s'\n"),
+ _ ("Unsupported HTTP method `%s'\n"),
meth);
curl_easy_cleanup (hr->curl);
hr->curl = NULL;
@@ -1778,28 +1781,28 @@ create_response (void *cls,
}
if (0 == strcasecmp (ver,
- MHD_HTTP_VERSION_1_0))
+ MHD_HTTP_VERSION_1_0))
{
curl_easy_setopt (hr->curl,
- CURLOPT_HTTP_VERSION,
- CURL_HTTP_VERSION_1_0);
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_0);
}
else if (0 == strcasecmp (ver,
- MHD_HTTP_VERSION_1_1))
+ MHD_HTTP_VERSION_1_1))
{
curl_easy_setopt (hr->curl,
- CURLOPT_HTTP_VERSION,
- CURL_HTTP_VERSION_1_1);
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_1);
}
else
{
curl_easy_setopt (hr->curl,
- CURLOPT_HTTP_VERSION,
- CURL_HTTP_VERSION_NONE);
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_NONE);
}
if (CURLM_OK != curl_multi_add_handle (curl_multi,
- hr->curl))
+ hr->curl))
{
GNUNET_break (0);
curl_easy_cleanup (hr->curl);
@@ -1899,7 +1902,7 @@ create_response (void *cls,
TALER_LOG_DEBUG
("Will (badly) truncate the response.\n");
fake_len = GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len);
+ (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len);
hr->io_len = fake_len;
malform = GNUNET_NO;
}
@@ -1911,9 +1914,9 @@ create_response (void *cls,
header = header->next)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding MHD response header %s->%s\n",
- header->type,
- header->value);
+ "Adding MHD response header %s->%s\n",
+ header->type,
+ header->value);
GNUNET_break
(MHD_YES == MHD_add_response_header (hr->response,
header->type,
@@ -2350,10 +2353,10 @@ parse_serving_mean (const struct GNUNET_CONFIGURATION_Handle *cfg,
*path = NULL;
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
- (cfg,
- "twister",
- "HTTP_PORT",
- &port_ull))
+ (cfg,
+ "twister",
+ "HTTP_PORT",
+ &port_ull))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"twister",
@@ -2367,10 +2370,10 @@ parse_serving_mean (const struct GNUNET_CONFIGURATION_Handle *cfg,
/* serving via unix */
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename
- (cfg,
- "twister",
- "SERVE_UNIXPATH",
- path))
+ (cfg,
+ "twister",
+ "SERVE_UNIXPATH",
+ path))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"twister",
@@ -2379,10 +2382,10 @@ parse_serving_mean (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
- (cfg,
- "twister",
- "SERVE_UNIXMODE",
- &modestring))
+ (cfg,
+ "twister",
+ "SERVE_UNIXMODE",
+ &modestring))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"twister",
@@ -2470,9 +2473,9 @@ run (void *cls,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string
(c,
- "twister",
- "DESTINATION_BASE_URL",
- &target_server_base_url))
+ "twister",
+ "DESTINATION_BASE_URL",
+ &target_server_base_url))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"twister",
@@ -2502,15 +2505,15 @@ run (void *cls,
/* start MHD daemon for HTTP */
mhd_daemon = MHD_start_daemon
- (MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME | MHD_USE_DUAL_STACK,
- (-1 == fh) ? (uint16_t) port : 0,
- NULL, NULL,
- &create_response, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
- MHD_OPTION_NOTIFY_COMPLETED, &mhd_completed_cb, NULL,
- MHD_OPTION_URI_LOG_CALLBACK, &mhd_log_callback, NULL,
- MHD_OPTION_LISTEN_SOCKET, fh,
- MHD_OPTION_END);
+ (MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME | MHD_USE_DUAL_STACK,
+ (-1 == fh) ? (uint16_t) port : 0,
+ NULL, NULL,
+ &create_response, NULL,
+ MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
+ MHD_OPTION_NOTIFY_COMPLETED, &mhd_completed_cb, NULL,
+ MHD_OPTION_URI_LOG_CALLBACK, &mhd_log_callback, NULL,
+ MHD_OPTION_LISTEN_SOCKET, fh,
+ MHD_OPTION_END);
if (NULL == mhd_daemon)
{
@@ -2535,8 +2538,8 @@ run (void *cls,
*/
static void *
client_connect_cb (void *cls,
- struct GNUNET_SERVICE_Client *c,
- struct GNUNET_MQ_Handle *mq)
+ struct GNUNET_SERVICE_Client *c,
+ struct GNUNET_MQ_Handle *mq)
{
(void) cls;
(void) mq;
@@ -2553,8 +2556,8 @@ client_connect_cb (void *cls,
*/
static void
client_disconnect_cb (void *cls,
- struct GNUNET_SERVICE_Client *c,
- void *internal_cls)
+ struct GNUNET_SERVICE_Client *c,
+ void *internal_cls)
{
/* intentionally empty */
(void) cls;
@@ -2648,11 +2651,11 @@ handle_modify_path_dl (void *cls,
tailsize = ntohs (src->header.size) - sizeof (*src);
if (tailsize != GNUNET_STRINGS_buffer_tokenize
- ((const char *) &src[1],
- tailsize,
- 2,
- &payload_path,
- &payload_value))
+ ((const char *) &src[1],
+ tailsize,
+ 2,
+ &payload_path,
+ &payload_value))
{
GNUNET_break_op (0);
GNUNET_SERVICE_client_drop (c);
@@ -2697,11 +2700,11 @@ handle_modify_path_ul (void *cls,
tailsize = ntohs (src->header.size) - sizeof (*src);
if (tailsize != GNUNET_STRINGS_buffer_tokenize
- ((const char *) &src[1],
- tailsize,
- 2,
- &payload_path,
- &payload_value))
+ ((const char *) &src[1],
+ tailsize,
+ 2,
+ &payload_path,
+ &payload_value))
{
GNUNET_break_op (0);
GNUNET_SERVICE_client_drop (c);
@@ -2732,10 +2735,10 @@ handle_flip_path_dl (void *cls,
tailsize = ntohs (src->header.size) - sizeof (*src);
if (tailsize != GNUNET_STRINGS_buffer_tokenize
- ((const char *) &src[1],
- tailsize,
- 1,
- &payload))
+ ((const char *) &src[1],
+ tailsize,
+ 1,
+ &payload))
{
GNUNET_break_op (0);
GNUNET_SERVICE_client_drop (c);
@@ -2789,10 +2792,10 @@ handle_flip_path_ul (void *cls,
tailsize = ntohs (src->header.size) - sizeof (*src);
if (tailsize != GNUNET_STRINGS_buffer_tokenize
- ((const char *) &src[1],
- tailsize,
- 1,
- &payload))
+ ((const char *) &src[1],
+ tailsize,
+ 1,
+ &payload))
{
GNUNET_break_op (0);
GNUNET_SERVICE_client_drop (c);
@@ -2834,10 +2837,10 @@ handle_delete_path (void *cls,
tailsize = ntohs (src->header.size) - sizeof (*src);
if (tailsize != GNUNET_STRINGS_buffer_tokenize
- ((const char *) &src[1],
- tailsize,
- 1,
- &payload))
+ ((const char *) &src[1],
+ tailsize,
+ 1,
+ &payload))
{
GNUNET_break_op (0);
GNUNET_SERVICE_client_drop (c);
@@ -2859,7 +2862,7 @@ handle_delete_path (void *cls,
static void
handle_set_response_code
(void *cls,
- const struct TWISTER_SetResponseCode *src)
+ const struct TWISTER_SetResponseCode *src)
{
struct GNUNET_SERVICE_Client *c = cls;
@@ -2872,53 +2875,53 @@ handle_set_response_code
* Define "main" method using service macro.
*/
GNUNET_SERVICE_MAIN
-("twister",
- GNUNET_SERVICE_OPTION_NONE,
- &run,
- &client_connect_cb,
- &client_disconnect_cb,
- NULL,
- GNUNET_MQ_hd_fixed_size (set_response_code,
- TWISTER_MESSAGE_TYPE_SET_RESPONSE_CODE,
- struct TWISTER_SetResponseCode,
- NULL),
-
- GNUNET_MQ_hd_var_size (modify_path_ul,
- TWISTER_MESSAGE_TYPE_MODIFY_PATH_UL,
- struct TWISTER_ModifyPath,
- NULL),
-
- GNUNET_MQ_hd_var_size (modify_path_dl,
- TWISTER_MESSAGE_TYPE_MODIFY_PATH_DL,
- struct TWISTER_ModifyPath,
- NULL),
-
- GNUNET_MQ_hd_fixed_size (malform_upload,
- TWISTER_MESSAGE_TYPE_MALFORM_UPLOAD,
- struct TWISTER_Malform,
- NULL),
-
- GNUNET_MQ_hd_fixed_size (malform,
- TWISTER_MESSAGE_TYPE_MALFORM,
- struct TWISTER_Malform,
- NULL),
-
- GNUNET_MQ_hd_var_size (delete_path,
- TWISTER_MESSAGE_TYPE_DELETE_PATH,
- struct TWISTER_DeletePath,
- NULL),
-
- GNUNET_MQ_hd_var_size (flip_path_ul,
- TWISTER_MESSAGE_TYPE_FLIP_PATH_UL,
- struct TWISTER_FlipPath,
- NULL),
-
- GNUNET_MQ_hd_var_size (flip_path_dl,
- TWISTER_MESSAGE_TYPE_FLIP_PATH_DL,
- struct TWISTER_FlipPath,
- NULL),
-
- GNUNET_MQ_handler_end ());
+ ("twister",
+ GNUNET_SERVICE_OPTION_NONE,
+ &run,
+ &client_connect_cb,
+ &client_disconnect_cb,
+ NULL,
+ GNUNET_MQ_hd_fixed_size (set_response_code,
+ TWISTER_MESSAGE_TYPE_SET_RESPONSE_CODE,
+ struct TWISTER_SetResponseCode,
+ NULL),
+
+ GNUNET_MQ_hd_var_size (modify_path_ul,
+ TWISTER_MESSAGE_TYPE_MODIFY_PATH_UL,
+ struct TWISTER_ModifyPath,
+ NULL),
+
+ GNUNET_MQ_hd_var_size (modify_path_dl,
+ TWISTER_MESSAGE_TYPE_MODIFY_PATH_DL,
+ struct TWISTER_ModifyPath,
+ NULL),
+
+ GNUNET_MQ_hd_fixed_size (malform_upload,
+ TWISTER_MESSAGE_TYPE_MALFORM_UPLOAD,
+ struct TWISTER_Malform,
+ NULL),
+
+ GNUNET_MQ_hd_fixed_size (malform,
+ TWISTER_MESSAGE_TYPE_MALFORM,
+ struct TWISTER_Malform,
+ NULL),
+
+ GNUNET_MQ_hd_var_size (delete_path,
+ TWISTER_MESSAGE_TYPE_DELETE_PATH,
+ struct TWISTER_DeletePath,
+ NULL),
+
+ GNUNET_MQ_hd_var_size (flip_path_ul,
+ TWISTER_MESSAGE_TYPE_FLIP_PATH_UL,
+ struct TWISTER_FlipPath,
+ NULL),
+
+ GNUNET_MQ_hd_var_size (flip_path_dl,
+ TWISTER_MESSAGE_TYPE_FLIP_PATH_DL,
+ struct TWISTER_FlipPath,
+ NULL),
+
+ GNUNET_MQ_handler_end ());
/* end of taler-twister-service.c */