[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: indentations
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: indentations |
Date: |
Mon, 06 Apr 2020 00:01:53 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 99785cf indentations
99785cf is described below
commit 99785cfe4f37fa16ba9e91098b738f3b4ac38890
Author: Dennis Neufeld <address@hidden>
AuthorDate: Sun Apr 5 22:01:38 2020 +0000
indentations
---
src/backend/anastasis-httpd.c | 59 ++++++++++++++++++-----------
src/backend/anastasis-httpd_policy_upload.c | 4 +-
src/lib/anastasis_api_policy_store.c | 10 ++---
src/lib/testing_api_cmd_policy_store.c | 34 ++++++++---------
4 files changed, 59 insertions(+), 48 deletions(-)
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index c43db62..902d9b4 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -264,12 +264,14 @@ url_handler (void *cls,
strlen ("/policy/")))
{
// return handle_policy (...);
- if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
+ if (0 == strcmp (method,
+ MHD_HTTP_METHOD_GET))
{
return AH_handler_policy_get (connection,
url);
}
- if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
+ if (0 == strcmp (method,
+ MHD_HTTP_METHOD_POST))
{
int ret;
ret = AH_handler_policy_post (connection,
@@ -292,13 +294,15 @@ url_handler (void *cls,
strlen ("/truth/")))
{
// return handle_truth (...);
- if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
+ if (0 == strcmp (method,
+ MHD_HTTP_METHOD_GET))
{
return AH_handler_truth_get (connection,
url,
con_cls);
}
- if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
+ if (0 == strcmp (method,
+ MHD_HTTP_METHOD_POST))
{
return AH_handler_truth_post (connection,
con_cls,
@@ -311,28 +315,35 @@ url_handler (void *cls,
{
struct TMH_RequestHandler *rh = &handlers[i];
- if ( (0 == strcmp (url,
- rh->url)) &&
- ( (NULL == rh->method) ||
- (0 == strcmp (method,
- rh->method)) ) )
+ if (0 == strcmp (url,
+ rh->url))
{
- int ret;
-
- ret = rh->handler (rh,
- connection,
- con_cls,
- upload_data,
- upload_data_size);
- hc = *con_cls;
- if (NULL != hc)
+ if (0 == strcasecmp (method,
+ MHD_HTTP_METHOD_OPTIONS))
{
- hc->rh = rh;
- /* Store the async context ID, so we can restore it if
- * we get another callack for this request. */
- hc->async_scope_id = aid;
+ return TALER_MHD_reply_cors_preflight (connection);
+ }
+ if ( (NULL == rh->method) ||
+ (0 == strcasecmp (method,
+ rh->method)) )
+ {
+ int ret;
+
+ ret = rh->handler (rh,
+ connection,
+ con_cls,
+ upload_data,
+ upload_data_size);
+ hc = *con_cls;
+ if (NULL != hc)
+ {
+ hc->rh = rh;
+ /* Store the async context ID, so we can restore it if
+ * we get another callack for this request. */
+ hc->async_scope_id = aid;
+ }
+ return ret;
}
- return ret;
}
}
return TMH_MHD_handler_static_response (&h404,
@@ -403,6 +414,8 @@ handle_mhd_completion_callback (void *cls,
{
struct TM_HandlerContext *hc = *con_cls;
+ (void) cls;
+ (void) connection;
if (NULL == hc)
return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/backend/anastasis-httpd_policy_upload.c
b/src/backend/anastasis-httpd_policy_upload.c
index 92a1302..da1fd9a 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -702,7 +702,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
GNUNET_STRINGS_string_to_data (im,
strlen (im),
&puc->old_policy_upload_hash,
- sizeof
(&puc->old_policy_upload_hash))) )
+ sizeof
(puc->old_policy_upload_hash))) )
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
@@ -762,7 +762,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
etag = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
- MHD_HTTP_HEADER_ETAG);
+ MHD_HTTP_HEADER_IF_NONE_MATCH);
if ( (NULL == etag) ||
(GNUNET_OK !=
GNUNET_STRINGS_string_to_data (etag,
diff --git a/src/lib/anastasis_api_policy_store.c
b/src/lib/anastasis_api_policy_store.c
index 36834bd..14fee26 100644
--- a/src/lib/anastasis_api_policy_store.c
+++ b/src/lib/anastasis_api_policy_store.c
@@ -118,6 +118,7 @@ handle_policy_store_finished (void *cls,
pso->job = NULL;
udp = NULL;
memset (&ud, 0, sizeof (ud));
+
switch (response_code)
{
case 0:
@@ -335,7 +336,8 @@ ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
val = GNUNET_STRINGS_data_to_string_alloc (&usp.new_recovery_data_hash,
sizeof (struct
GNUNET_HashCode));
GNUNET_asprintf (&hdr,
- "Etag: %s",
+ "%s: %s",
+ MHD_HTTP_HEADER_IF_NONE_MATCH,
val);
GNUNET_free (val);
ext = curl_slist_append (job_headers,
@@ -356,7 +358,8 @@ ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
sizeof (struct
GNUNET_HashCode));
GNUNET_asprintf (&hdr,
- "If-Match: %s",
+ "%s: %s",
+ MHD_HTTP_HEADER_IF_MATCH,
val);
GNUNET_free (val);
ext = curl_slist_append (job_headers,
@@ -390,7 +393,6 @@ ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
}
}
/* Finished setting up headers */
-
pso = GNUNET_new (struct ANASTASIS_PolicyStoreOperation);
pso->new_upload_hash = usp.new_recovery_data_hash;
{
@@ -400,14 +402,12 @@ ANASTASIS_policy_store (struct GNUNET_CURL_Context *ctx,
GNUNET_CRYPTO_eddsa_key_get_public (&anastasis_priv->priv,
&pub.pub);
-
acc_pub_str = GNUNET_STRINGS_data_to_string_alloc (&pub,
sizeof (pub));
GNUNET_asprintf (&path,
"policy/%s",
acc_pub_str);
GNUNET_free (acc_pub_str);
-
pso->url = (GNUNET_YES == payment_requested)
? TALER_url_join (backend_url,
path,
diff --git a/src/lib/testing_api_cmd_policy_store.c
b/src/lib/testing_api_cmd_policy_store.c
index b6e7af0..9356468 100644
--- a/src/lib/testing_api_cmd_policy_store.c
+++ b/src/lib/testing_api_cmd_policy_store.c
@@ -79,7 +79,7 @@ struct PolicyStoreState
/**
* The nonce.
*/
- struct GNUNET_CRYPTO_EddsaPublicKey nonce;
+ struct ANASTASIS_CRYPTO_Nonce nonce;
/**
* URL of the anastasis backend.
@@ -317,25 +317,23 @@ policy_store_run (void *cls,
}
if (0 != (ANASTASIS_TESTING_PSO_REFERENCE_ORDER_ID & pss->psopt))
{
+ const char *order_id;
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_order_id (ref,
+ 0,
+ &order_id))
{
- const char *order_id;
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (pss->is);
+ return;
+ }
+ pss->payment_order_req = order_id;
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_order_id (ref,
- 0,
- &order_id))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pss->is);
- return;
- }
- pss->payment_order_req = order_id;
- if (NULL == pss->payment_order_req)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (pss->is);
- return;
- }
+ if (NULL == pss->payment_order_req)
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (pss->is);
+ return;
}
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: indentations,
gnunet <=