migrate parsing logic to libtalermhd
This commit is contained in:
parent
8f006e779e
commit
c22efccce8
@ -47,7 +47,6 @@ taler_exchange_httpd_SOURCES = \
|
|||||||
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
|
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
|
||||||
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
|
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
|
||||||
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
|
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
|
||||||
taler-exchange-httpd_parsing.c taler-exchange-httpd_parsing.h \
|
|
||||||
taler-exchange-httpd_payback.c taler-exchange-httpd_payback.h \
|
taler-exchange-httpd_payback.c taler-exchange-httpd_payback.h \
|
||||||
taler-exchange-httpd_refresh_link.c taler-exchange-httpd_refresh_link.h \
|
taler-exchange-httpd_refresh_link.c taler-exchange-httpd_refresh_link.h \
|
||||||
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \
|
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_mhd.h"
|
#include "taler-exchange-httpd_mhd.h"
|
||||||
#include "taler-exchange-httpd_deposit.h"
|
#include "taler-exchange-httpd_deposit.h"
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler-exchange-httpd_refund.h"
|
||||||
@ -175,7 +174,7 @@ handle_mhd_completion_callback (void *cls,
|
|||||||
"Request completed\n");
|
"Request completed\n");
|
||||||
if (NULL == ecls)
|
if (NULL == ecls)
|
||||||
return;
|
return;
|
||||||
TEH_PARSE_post_cleanup_callback (ecls->opaque_post_parsing_context);
|
TALER_MHD_parse_post_cleanup_callback (ecls->opaque_post_parsing_context);
|
||||||
GNUNET_free (ecls);
|
GNUNET_free (ecls);
|
||||||
*con_cls = NULL;
|
*con_cls = NULL;
|
||||||
/* check that we didn't leave any transactions hanging */
|
/* check that we didn't leave any transactions hanging */
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_deposit.h"
|
#include "taler-exchange-httpd_deposit.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
@ -428,11 +427,11 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) ||
|
if ( (GNUNET_NO == res) ||
|
||||||
@ -441,9 +440,9 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
|
|||||||
memset (&deposit,
|
memset (&deposit,
|
||||||
0,
|
0,
|
||||||
sizeof (deposit));
|
sizeof (deposit));
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO; /* hard failure */
|
return MHD_NO; /* hard failure */
|
||||||
|
@ -1,286 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of TALER
|
|
||||||
Copyright (C) 2014, 2015, 2016 GNUnet e.V.
|
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU Affero General Public License as published by the Free Software
|
|
||||||
Foundation; either version 3, or (at your option) any later version.
|
|
||||||
|
|
||||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License along with
|
|
||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file taler-exchange-httpd_parsing.c
|
|
||||||
* @brief functions to parse incoming requests (MHD arguments and JSON snippets)
|
|
||||||
* @author Florian Dold
|
|
||||||
* @author Benedikt Mueller
|
|
||||||
* @author Christian Grothoff
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
|
||||||
#include <gnunet/gnunet_json_lib.h>
|
|
||||||
#include "taler_json_lib.h"
|
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_responses.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum POST request size.
|
|
||||||
*/
|
|
||||||
#define REQUEST_BUFFER_MAX (1024 * 1024)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a POST request containing a JSON object. This function
|
|
||||||
* realizes an MHD POST processor that will (incrementally) process
|
|
||||||
* JSON data uploaded to the HTTP server. It will store the required
|
|
||||||
* state in the @a con_cls, which must be cleaned up using
|
|
||||||
* #TEH_PARSE_post_cleanup_callback().
|
|
||||||
*
|
|
||||||
* @param connection the MHD connection
|
|
||||||
* @param con_cls the closure (points to a `struct Buffer *`)
|
|
||||||
* @param upload_data the POST data
|
|
||||||
* @param upload_data_size number of bytes in @a upload_data
|
|
||||||
* @param json the JSON object for a completed request
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if json object was parsed or at least
|
|
||||||
* may be parsed in the future (call again);
|
|
||||||
* `*json` will be NULL if we need to be called again,
|
|
||||||
* and non-NULL if we are done.
|
|
||||||
* #GNUNET_NO is request incomplete or invalid
|
|
||||||
* (error message was generated)
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
* (we could not even queue an error message,
|
|
||||||
* close HTTP session with MHD_NO)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_post_json (struct MHD_Connection *connection,
|
|
||||||
void **con_cls,
|
|
||||||
const char *upload_data,
|
|
||||||
size_t *upload_data_size,
|
|
||||||
json_t **json)
|
|
||||||
{
|
|
||||||
enum GNUNET_JSON_PostResult pr;
|
|
||||||
|
|
||||||
pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX,
|
|
||||||
connection,
|
|
||||||
con_cls,
|
|
||||||
upload_data,
|
|
||||||
upload_data_size,
|
|
||||||
json);
|
|
||||||
switch (pr)
|
|
||||||
{
|
|
||||||
|
|
||||||
case GNUNET_JSON_PR_OUT_OF_MEMORY:
|
|
||||||
return (MHD_NO == TEH_RESPONSE_reply_internal_error
|
|
||||||
(connection,
|
|
||||||
TALER_EC_PARSER_OUT_OF_MEMORY,
|
|
||||||
"out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
|
|
||||||
|
|
||||||
case GNUNET_JSON_PR_CONTINUE:
|
|
||||||
return GNUNET_YES;
|
|
||||||
|
|
||||||
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
|
|
||||||
return (MHD_NO == TEH_RESPONSE_reply_request_too_large
|
|
||||||
(connection)) ? GNUNET_SYSERR : GNUNET_NO;
|
|
||||||
|
|
||||||
case GNUNET_JSON_PR_JSON_INVALID:
|
|
||||||
return (MHD_YES ==
|
|
||||||
TEH_RESPONSE_reply_invalid_json (connection))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
|
||||||
case GNUNET_JSON_PR_SUCCESS:
|
|
||||||
GNUNET_break (NULL != *json);
|
|
||||||
return GNUNET_YES;
|
|
||||||
}
|
|
||||||
/* this should never happen */
|
|
||||||
GNUNET_break (0);
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function called whenever we are done with a request
|
|
||||||
* to clean up our state.
|
|
||||||
*
|
|
||||||
* @param con_cls value as it was left by
|
|
||||||
* #TEH_PARSE_post_json(), to be cleaned up
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
TEH_PARSE_post_cleanup_callback (void *con_cls)
|
|
||||||
{
|
|
||||||
GNUNET_JSON_post_parser_cleanup (con_cls);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract base32crockford encoded data from request.
|
|
||||||
*
|
|
||||||
* Queues an error response to the connection if the parameter is
|
|
||||||
* missing or invalid.
|
|
||||||
*
|
|
||||||
* @param connection the MHD connection
|
|
||||||
* @param param_name the name of the parameter with the key
|
|
||||||
* @param[out] out_data pointer to store the result
|
|
||||||
* @param out_size expected size of data
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if the the argument is present
|
|
||||||
* #GNUNET_NO if the argument is absent or malformed
|
|
||||||
* #GNUNET_SYSERR on internal error (error response could not be sent)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
|
|
||||||
const char *param_name,
|
|
||||||
void *out_data,
|
|
||||||
size_t out_size)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
str = MHD_lookup_connection_value (connection,
|
|
||||||
MHD_GET_ARGUMENT_KIND,
|
|
||||||
param_name);
|
|
||||||
if (NULL == str)
|
|
||||||
{
|
|
||||||
return (MHD_NO ==
|
|
||||||
TEH_RESPONSE_reply_arg_missing (connection,
|
|
||||||
TALER_EC_PARAMETER_MISSING,
|
|
||||||
param_name))
|
|
||||||
? GNUNET_SYSERR : GNUNET_NO;
|
|
||||||
}
|
|
||||||
if (GNUNET_OK !=
|
|
||||||
GNUNET_STRINGS_string_to_data (str,
|
|
||||||
strlen (str),
|
|
||||||
out_data,
|
|
||||||
out_size))
|
|
||||||
return (MHD_NO ==
|
|
||||||
TEH_RESPONSE_reply_arg_invalid (connection,
|
|
||||||
TALER_EC_PARAMETER_MALFORMED,
|
|
||||||
param_name))
|
|
||||||
? GNUNET_SYSERR : GNUNET_NO;
|
|
||||||
return GNUNET_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse JSON object into components based on the given field
|
|
||||||
* specification. Generates error response on parse errors.
|
|
||||||
*
|
|
||||||
* @param connection the connection to send an error response to
|
|
||||||
* @param root the JSON node to start the navigation at.
|
|
||||||
* @param[in,out] spec field specification for the parser
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if navigation was successful (caller is responsible
|
|
||||||
* for freeing allocated variable-size data using
|
|
||||||
* GNUNET_JSON_parse_free() when done)
|
|
||||||
* #GNUNET_NO if json is malformed, error response was generated
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_json_data (struct MHD_Connection *connection,
|
|
||||||
const json_t *root,
|
|
||||||
struct GNUNET_JSON_Specification *spec)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
const char *error_json_name;
|
|
||||||
unsigned int error_line;
|
|
||||||
|
|
||||||
ret = GNUNET_JSON_parse (root,
|
|
||||||
spec,
|
|
||||||
&error_json_name,
|
|
||||||
&error_line);
|
|
||||||
if (GNUNET_SYSERR == ret)
|
|
||||||
{
|
|
||||||
if (NULL == error_json_name)
|
|
||||||
error_json_name = "<no field>";
|
|
||||||
ret = (MHD_YES ==
|
|
||||||
TEH_RESPONSE_reply_json_pack (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
"{s:s, s:I, s:s, s:I}",
|
|
||||||
"error", "parse error",
|
|
||||||
"code",
|
|
||||||
(json_int_t)
|
|
||||||
TALER_EC_JSON_INVALID_WITH_DETAILS,
|
|
||||||
"field", error_json_name,
|
|
||||||
"line", (json_int_t) error_line))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return GNUNET_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse JSON array into components based on the given field
|
|
||||||
* specification. Generates error response on parse errors.
|
|
||||||
*
|
|
||||||
* @param connection the connection to send an error response to
|
|
||||||
* @param root the JSON node to start the navigation at.
|
|
||||||
* @param[in,out] spec field specification for the parser
|
|
||||||
* @param ... -1-terminated list of array offsets of type 'int'
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if navigation was successful (caller is responsible
|
|
||||||
* for freeing allocated variable-size data using
|
|
||||||
* GNUNET_JSON_parse_free() when done)
|
|
||||||
* #GNUNET_NO if json is malformed, error response was generated
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_json_array (struct MHD_Connection *connection,
|
|
||||||
const json_t *root,
|
|
||||||
struct GNUNET_JSON_Specification *spec,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
const char *error_json_name;
|
|
||||||
unsigned int error_line;
|
|
||||||
va_list ap;
|
|
||||||
json_int_t dim;
|
|
||||||
|
|
||||||
va_start (ap, spec);
|
|
||||||
dim = 0;
|
|
||||||
while ( (-1 != (ret = va_arg (ap, int))) &&
|
|
||||||
(NULL != root) )
|
|
||||||
{
|
|
||||||
dim++;
|
|
||||||
root = json_array_get (root, ret);
|
|
||||||
}
|
|
||||||
va_end (ap);
|
|
||||||
if (NULL == root)
|
|
||||||
{
|
|
||||||
ret = (MHD_YES ==
|
|
||||||
TEH_RESPONSE_reply_json_pack (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
"{s:s, s:I}",
|
|
||||||
"error", "parse error",
|
|
||||||
"dimension", dim))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
ret = GNUNET_JSON_parse (root,
|
|
||||||
spec,
|
|
||||||
&error_json_name,
|
|
||||||
&error_line);
|
|
||||||
if (GNUNET_SYSERR == ret)
|
|
||||||
{
|
|
||||||
if (NULL == error_json_name)
|
|
||||||
error_json_name = "<no field>";
|
|
||||||
ret = (MHD_YES ==
|
|
||||||
TEH_RESPONSE_reply_json_pack (connection,
|
|
||||||
MHD_HTTP_BAD_REQUEST,
|
|
||||||
"{s:s, s:s, s:I}",
|
|
||||||
"error", "parse error",
|
|
||||||
"field", error_json_name,
|
|
||||||
"line", (json_int_t) error_line))
|
|
||||||
? GNUNET_NO : GNUNET_SYSERR;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return GNUNET_YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* end of taler-exchange-httpd_parsing.c */
|
|
@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of TALER
|
|
||||||
Copyright (C) 2014, 2015, 2016 GNUnet e.V.
|
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU Affero General Public License as published by the Free Software
|
|
||||||
Foundation; either version 3, or (at your option) any later version.
|
|
||||||
|
|
||||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License along with
|
|
||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @file taler-exchange-httpd_parsing.h
|
|
||||||
* @brief functions to parse incoming requests
|
|
||||||
* @author Florian Dold
|
|
||||||
* @author Benedikt Mueller
|
|
||||||
* @author Christian Grothoff
|
|
||||||
*/
|
|
||||||
#ifndef TALER_EXCHANGE_HTTPD_PARSING_H
|
|
||||||
#define TALER_EXCHANGE_HTTPD_PARSING_H
|
|
||||||
|
|
||||||
#include <microhttpd.h>
|
|
||||||
#include <jansson.h>
|
|
||||||
#include "taler_util.h"
|
|
||||||
#include "taler_json_lib.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process a POST request containing a JSON object. This
|
|
||||||
* function realizes an MHD POST processor that will
|
|
||||||
* (incrementally) process JSON data uploaded to the HTTP
|
|
||||||
* server. It will store the required state in the
|
|
||||||
* "connection_cls", which must be cleaned up using
|
|
||||||
* #TEH_PARSE_post_cleanup_callback().
|
|
||||||
*
|
|
||||||
* @param connection the MHD connection
|
|
||||||
* @param con_cls the closure (points to a `struct Buffer *`)
|
|
||||||
* @param upload_data the POST data
|
|
||||||
* @param upload_data_size number of bytes in @a upload_data
|
|
||||||
* @param json the JSON object for a completed request
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if json object was parsed or at least
|
|
||||||
* may be parsed in the future (call again);
|
|
||||||
* `*json` will be NULL if we need to be called again,
|
|
||||||
* and non-NULL if we are done.
|
|
||||||
* #GNUNET_NO is request incomplete or invalid
|
|
||||||
* (error message was generated)
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
* (we could not even queue an error message,
|
|
||||||
* close HTTP session with MHD_NO)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_post_json (struct MHD_Connection *connection,
|
|
||||||
void **con_cls,
|
|
||||||
const char *upload_data,
|
|
||||||
size_t *upload_data_size,
|
|
||||||
json_t **json);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function called whenever we are done with a request
|
|
||||||
* to clean up our state.
|
|
||||||
*
|
|
||||||
* @param con_cls value as it was left by
|
|
||||||
* #TEH_PARSE_post_json(), to be cleaned up
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
TEH_PARSE_post_cleanup_callback (void *con_cls);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse JSON object into components based on the given field
|
|
||||||
* specification.
|
|
||||||
*
|
|
||||||
* @param connection the connection to send an error response to
|
|
||||||
* @param root the JSON node to start the navigation at.
|
|
||||||
* @param spec field specification for the parser
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if navigation was successful (caller is responsible
|
|
||||||
* for freeing allocated variable-size data using
|
|
||||||
* GNUNET_JSON_parse_free() when done)
|
|
||||||
* #GNUNET_NO if json is malformed, error response was generated
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_json_data (struct MHD_Connection *connection,
|
|
||||||
const json_t *root,
|
|
||||||
struct GNUNET_JSON_Specification *spec);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse JSON array into components based on the given field
|
|
||||||
* specification. Generates error response on parse errors.
|
|
||||||
*
|
|
||||||
* @param connection the connection to send an error response to
|
|
||||||
* @param root the JSON node to start the navigation at.
|
|
||||||
* @param[in,out] spec field specification for the parser
|
|
||||||
* @param ... -1-terminated list of array offsets of type 'int'
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if navigation was successful (caller is responsible
|
|
||||||
* for freeing allocated variable-size data using
|
|
||||||
* GNUNET_JSON_parse_free() when done)
|
|
||||||
* #GNUNET_NO if json is malformed, error response was generated
|
|
||||||
* #GNUNET_SYSERR on internal error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_json_array (struct MHD_Connection *connection,
|
|
||||||
const json_t *root,
|
|
||||||
struct GNUNET_JSON_Specification *spec,
|
|
||||||
...);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extraxt fixed-size base32crockford encoded data from request.
|
|
||||||
*
|
|
||||||
* Queues an error response to the connection if the parameter is missing or
|
|
||||||
* invalid.
|
|
||||||
*
|
|
||||||
* @param connection the MHD connection
|
|
||||||
* @param param_name the name of the parameter with the key
|
|
||||||
* @param[out] out_data pointer to store the result
|
|
||||||
* @param out_size expected size of @a out_data
|
|
||||||
* @return
|
|
||||||
* #GNUNET_YES if the the argument is present
|
|
||||||
* #GNUNET_NO if the argument is absent or malformed
|
|
||||||
* #GNUNET_SYSERR on internal error (error response could not be sent)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
TEH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
|
|
||||||
const char *param_name,
|
|
||||||
void *out_data,
|
|
||||||
size_t out_size);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* TALER_EXCHANGE_HTTPD_PARSING_H */
|
|
@ -28,7 +28,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_payback.h"
|
#include "taler-exchange-httpd_payback.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
@ -605,18 +604,18 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO; /* hard failure */
|
return MHD_NO; /* hard failure */
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_mhd.h"
|
#include "taler-exchange-httpd_mhd.h"
|
||||||
#include "taler-exchange-httpd_refresh_link.h"
|
#include "taler-exchange-httpd_refresh_link.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
@ -204,11 +203,11 @@ TEH_REFRESH_handler_refresh_link (struct TEH_RequestHandler *rh,
|
|||||||
memset (&ctx,
|
memset (&ctx,
|
||||||
0,
|
0,
|
||||||
sizeof (ctx));
|
sizeof (ctx));
|
||||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
res = TALER_MHD_parse_request_arg_data (connection,
|
||||||
"coin_pub",
|
"coin_pub",
|
||||||
&ctx.coin_pub,
|
&ctx.coin_pub,
|
||||||
sizeof (struct
|
sizeof (struct
|
||||||
TALER_CoinSpendPublicKeyP));
|
TALER_CoinSpendPublicKeyP));
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_mhd.h"
|
#include "taler-exchange-httpd_mhd.h"
|
||||||
#include "taler-exchange-httpd_refresh_melt.h"
|
#include "taler-exchange-httpd_refresh_melt.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
@ -482,11 +482,11 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&root);
|
&root);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) ||
|
if ( (GNUNET_NO == res) ||
|
||||||
@ -496,9 +496,9 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
|
|||||||
memset (&rmc,
|
memset (&rmc,
|
||||||
0,
|
0,
|
||||||
sizeof (rmc));
|
sizeof (rmc));
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
json_decref (root);
|
json_decref (root);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
|
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_mhd.h"
|
#include "taler-exchange-httpd_mhd.h"
|
||||||
#include "taler-exchange-httpd_refresh_reveal.h"
|
#include "taler-exchange-httpd_refresh_reveal.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
@ -586,11 +585,11 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
|||||||
};
|
};
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = TEH_PARSE_json_array (connection,
|
res = TALER_MHD_parse_json_array (connection,
|
||||||
tp_json,
|
tp_json,
|
||||||
trans_spec,
|
trans_spec,
|
||||||
i,
|
i,
|
||||||
-1);
|
-1);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
}
|
}
|
||||||
@ -627,11 +626,11 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
|||||||
unsigned int hc;
|
unsigned int hc;
|
||||||
enum TALER_ErrorCode ec;
|
enum TALER_ErrorCode ec;
|
||||||
|
|
||||||
res = TEH_PARSE_json_array (connection,
|
res = TALER_MHD_parse_json_array (connection,
|
||||||
new_denoms_h_json,
|
new_denoms_h_json,
|
||||||
spec,
|
spec,
|
||||||
i,
|
i,
|
||||||
-1);
|
-1);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
TEH_KS_release (key_state);
|
TEH_KS_release (key_state);
|
||||||
@ -664,11 +663,11 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
res = TEH_PARSE_json_array (connection,
|
res = TALER_MHD_parse_json_array (connection,
|
||||||
coin_evs,
|
coin_evs,
|
||||||
spec,
|
spec,
|
||||||
i,
|
i,
|
||||||
-1);
|
-1);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j<i; j++)
|
for (unsigned int j = 0; j<i; j++)
|
||||||
@ -724,11 +723,11 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
|||||||
};
|
};
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = TEH_PARSE_json_array (connection,
|
res = TALER_MHD_parse_json_array (connection,
|
||||||
link_sigs_json,
|
link_sigs_json,
|
||||||
link_spec,
|
link_spec,
|
||||||
i,
|
i,
|
||||||
-1);
|
-1);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
/* Check link_sigs[i] signature */
|
/* Check link_sigs[i] signature */
|
||||||
@ -902,11 +901,11 @@ TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&root);
|
&root);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) ||
|
if ( (GNUNET_NO == res) ||
|
||||||
@ -916,9 +915,9 @@ TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh,
|
|||||||
memset (&rctx,
|
memset (&rctx,
|
||||||
0,
|
0,
|
||||||
sizeof (rctx));
|
sizeof (rctx));
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
json_decref (root);
|
json_decref (root);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_refund.h"
|
#include "taler-exchange-httpd_refund.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
@ -526,18 +525,18 @@ TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO; /* hard failure */
|
return MHD_NO; /* hard failure */
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
|
#include "taler_json_lib.h"
|
||||||
#include "taler-exchange-httpd_reserve_status.h"
|
#include "taler-exchange-httpd_reserve_status.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
|
|
||||||
@ -137,11 +137,11 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh,
|
|||||||
int res;
|
int res;
|
||||||
int mhd_ret;
|
int mhd_ret;
|
||||||
|
|
||||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
res = TALER_MHD_parse_request_arg_data (connection,
|
||||||
"reserve_pub",
|
"reserve_pub",
|
||||||
&rsc.reserve_pub,
|
&rsc.reserve_pub,
|
||||||
sizeof (struct
|
sizeof (struct
|
||||||
TALER_ReservePublicKeyP));
|
TALER_ReservePublicKeyP));
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO; /* internal error */
|
return MHD_NO; /* internal error */
|
||||||
if (GNUNET_NO == res)
|
if (GNUNET_NO == res)
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler-exchange-httpd_reserve_withdraw.h"
|
#include "taler-exchange-httpd_reserve_withdraw.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
|
|
||||||
@ -394,18 +394,18 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&root);
|
&root);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == root) )
|
if ( (GNUNET_NO == res) || (NULL == root) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
root,
|
root,
|
||||||
spec);
|
spec);
|
||||||
json_decref (root);
|
json_decref (root);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
|
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_test.h"
|
#include "taler-exchange-httpd_test.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
|
|
||||||
|
|
||||||
@ -70,18 +69,18 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
GNUNET_CRYPTO_hash (in_ptr,
|
GNUNET_CRYPTO_hash (in_ptr,
|
||||||
@ -135,18 +134,18 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -215,18 +214,18 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -278,18 +277,18 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -347,18 +346,18 @@ TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
|
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -482,18 +481,18 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
|
|||||||
GNUNET_JSON_spec_end ()
|
GNUNET_JSON_spec_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -563,18 +562,18 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
struct TALER_TransferSecretP secret;
|
struct TALER_TransferSecretP secret;
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
if (GNUNET_YES != res)
|
if (GNUNET_YES != res)
|
||||||
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
|
||||||
@ -609,11 +608,11 @@ TEH_TEST_handler_test (struct TEH_RequestHandler *rh,
|
|||||||
json_t *json;
|
json_t *json;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
#include "taler-exchange-httpd_track_transaction.h"
|
#include "taler-exchange-httpd_track_transaction.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
@ -366,18 +366,18 @@ TEH_TRACKING_handler_track_transaction (struct TEH_RequestHandler *rh,
|
|||||||
};
|
};
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
res = TEH_PARSE_post_json (connection,
|
res = TALER_MHD_parse_post_json (connection,
|
||||||
connection_cls,
|
connection_cls,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size,
|
upload_data_size,
|
||||||
&json);
|
&json);
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
res = TEH_PARSE_json_data (connection,
|
res = TALER_MHD_parse_json_data (connection,
|
||||||
json,
|
json,
|
||||||
spec);
|
spec);
|
||||||
if (GNUNET_OK != res)
|
if (GNUNET_OK != res)
|
||||||
{
|
{
|
||||||
json_decref (json);
|
json_decref (json);
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler-exchange-httpd_parsing.h"
|
|
||||||
#include "taler-exchange-httpd_keystate.h"
|
#include "taler-exchange-httpd_keystate.h"
|
||||||
#include "taler-exchange-httpd_track_transfer.h"
|
#include "taler-exchange-httpd_track_transfer.h"
|
||||||
#include "taler-exchange-httpd_responses.h"
|
#include "taler-exchange-httpd_responses.h"
|
||||||
|
#include "taler_json_lib.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
#include "taler_wire_lib.h"
|
#include "taler_wire_lib.h"
|
||||||
|
|
||||||
@ -503,11 +503,11 @@ TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh,
|
|||||||
int mhd_ret;
|
int mhd_ret;
|
||||||
|
|
||||||
memset (&ctx, 0, sizeof (ctx));
|
memset (&ctx, 0, sizeof (ctx));
|
||||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
res = TALER_MHD_parse_request_arg_data (connection,
|
||||||
"wtid",
|
"wtid",
|
||||||
&ctx.wtid,
|
&ctx.wtid,
|
||||||
sizeof (struct
|
sizeof (struct
|
||||||
TALER_WireTransferIdentifierRawP));
|
TALER_WireTransferIdentifierRawP));
|
||||||
if (GNUNET_SYSERR == res)
|
if (GNUNET_SYSERR == res)
|
||||||
return MHD_NO; /* internal error */
|
return MHD_NO; /* internal error */
|
||||||
if (GNUNET_NO == res)
|
if (GNUNET_NO == res)
|
||||||
|
Loading…
Reference in New Issue
Block a user