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_keystate.c taler-exchange-httpd_keystate.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_refresh_link.c taler-exchange-httpd_refresh_link.h \
|
||||
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/resource.h>
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_mhd.h"
|
||||
#include "taler-exchange-httpd_deposit.h"
|
||||
#include "taler-exchange-httpd_refund.h"
|
||||
@ -175,7 +174,7 @@ handle_mhd_completion_callback (void *cls,
|
||||
"Request completed\n");
|
||||
if (NULL == ecls)
|
||||
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);
|
||||
*con_cls = NULL;
|
||||
/* check that we didn't leave any transactions hanging */
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <pthread.h>
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_deposit.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
@ -428,7 +427,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -441,7 +440,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
|
||||
memset (&deposit,
|
||||
0,
|
||||
sizeof (deposit));
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
|
@ -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 "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_payback.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
@ -605,7 +604,7 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -614,7 +613,7 @@ TEH_PAYBACK_handler_payback (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_mhd.h"
|
||||
#include "taler-exchange-httpd_refresh_link.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
@ -204,7 +203,7 @@ TEH_REFRESH_handler_refresh_link (struct TEH_RequestHandler *rh,
|
||||
memset (&ctx,
|
||||
0,
|
||||
sizeof (ctx));
|
||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
||||
res = TALER_MHD_parse_request_arg_data (connection,
|
||||
"coin_pub",
|
||||
&ctx.coin_pub,
|
||||
sizeof (struct
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_mhd.h"
|
||||
#include "taler-exchange-httpd_refresh_melt.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
@ -482,7 +482,7 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -496,7 +496,7 @@ TEH_REFRESH_handler_refresh_melt (struct TEH_RequestHandler *rh,
|
||||
memset (&rmc,
|
||||
0,
|
||||
sizeof (rmc));
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
root,
|
||||
spec);
|
||||
json_decref (root);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_mhd.h"
|
||||
#include "taler-exchange-httpd_refresh_reveal.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
@ -586,7 +585,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
||||
};
|
||||
int res;
|
||||
|
||||
res = TEH_PARSE_json_array (connection,
|
||||
res = TALER_MHD_parse_json_array (connection,
|
||||
tp_json,
|
||||
trans_spec,
|
||||
i,
|
||||
@ -627,7 +626,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
||||
unsigned int hc;
|
||||
enum TALER_ErrorCode ec;
|
||||
|
||||
res = TEH_PARSE_json_array (connection,
|
||||
res = TALER_MHD_parse_json_array (connection,
|
||||
new_denoms_h_json,
|
||||
spec,
|
||||
i,
|
||||
@ -664,7 +663,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
res = TEH_PARSE_json_array (connection,
|
||||
res = TALER_MHD_parse_json_array (connection,
|
||||
coin_evs,
|
||||
spec,
|
||||
i,
|
||||
@ -724,7 +723,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
|
||||
};
|
||||
int res;
|
||||
|
||||
res = TEH_PARSE_json_array (connection,
|
||||
res = TALER_MHD_parse_json_array (connection,
|
||||
link_sigs_json,
|
||||
link_spec,
|
||||
i,
|
||||
@ -902,7 +901,7 @@ TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -916,7 +915,7 @@ TEH_REFRESH_handler_refresh_reveal (struct TEH_RequestHandler *rh,
|
||||
memset (&rctx,
|
||||
0,
|
||||
sizeof (rctx));
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
root,
|
||||
spec);
|
||||
json_decref (root);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <pthread.h>
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_refund.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
@ -526,7 +525,7 @@ TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -535,7 +534,7 @@ TEH_REFUND_handler_refund (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <jansson.h>
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler-exchange-httpd_reserve_status.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
|
||||
@ -137,7 +137,7 @@ TEH_RESERVE_handler_reserve_status (struct TEH_RequestHandler *rh,
|
||||
int res;
|
||||
int mhd_ret;
|
||||
|
||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
||||
res = TALER_MHD_parse_request_arg_data (connection,
|
||||
"reserve_pub",
|
||||
&rsc.reserve_pub,
|
||||
sizeof (struct
|
||||
|
@ -26,9 +26,9 @@
|
||||
#include "platform.h"
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <jansson.h>
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler-exchange-httpd_reserve_withdraw.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
|
||||
@ -394,7 +394,7 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -403,7 +403,7 @@ TEH_RESERVE_handler_reserve_withdraw (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == root) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
root,
|
||||
spec);
|
||||
json_decref (root);
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler-exchange-httpd_test.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
|
||||
|
||||
@ -70,7 +69,7 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -79,7 +78,7 @@ TEH_TEST_handler_test_base32 (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
if (GNUNET_YES != res)
|
||||
@ -135,7 +134,7 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
char *out;
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -144,7 +143,7 @@ TEH_TEST_handler_test_encrypt (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -215,7 +214,7 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -224,7 +223,7 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -278,7 +277,7 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -287,7 +286,7 @@ TEH_TEST_handler_test_ecdhe (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -347,7 +346,7 @@ TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -356,7 +355,7 @@ TEH_TEST_handler_test_eddsa (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -482,7 +481,7 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
|
||||
GNUNET_JSON_spec_end ()
|
||||
};
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -491,7 +490,7 @@ TEH_TEST_handler_test_rsa_sign (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -563,7 +562,7 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
struct TALER_TransferSecretP secret;
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -572,7 +571,7 @@ TEH_TEST_handler_test_transfer (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
json_decref (json);
|
||||
@ -609,7 +608,7 @@ TEH_TEST_handler_test (struct TEH_RequestHandler *rh,
|
||||
json_t *json;
|
||||
int res;
|
||||
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
|
@ -23,9 +23,9 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h>
|
||||
#include <pthread.h>
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
#include "taler-exchange-httpd_track_transaction.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
@ -366,7 +366,7 @@ TEH_TRACKING_handler_track_transaction (struct TEH_RequestHandler *rh,
|
||||
};
|
||||
|
||||
(void) rh;
|
||||
res = TEH_PARSE_post_json (connection,
|
||||
res = TALER_MHD_parse_post_json (connection,
|
||||
connection_cls,
|
||||
upload_data,
|
||||
upload_data_size,
|
||||
@ -375,7 +375,7 @@ TEH_TRACKING_handler_track_transaction (struct TEH_RequestHandler *rh,
|
||||
return MHD_NO;
|
||||
if ( (GNUNET_NO == res) || (NULL == json) )
|
||||
return MHD_YES;
|
||||
res = TEH_PARSE_json_data (connection,
|
||||
res = TALER_MHD_parse_json_data (connection,
|
||||
json,
|
||||
spec);
|
||||
if (GNUNET_OK != res)
|
||||
|
@ -24,10 +24,10 @@
|
||||
#include <microhttpd.h>
|
||||
#include <pthread.h>
|
||||
#include "taler_signatures.h"
|
||||
#include "taler-exchange-httpd_parsing.h"
|
||||
#include "taler-exchange-httpd_keystate.h"
|
||||
#include "taler-exchange-httpd_track_transfer.h"
|
||||
#include "taler-exchange-httpd_responses.h"
|
||||
#include "taler_json_lib.h"
|
||||
#include "taler_mhd_lib.h"
|
||||
#include "taler_wire_lib.h"
|
||||
|
||||
@ -503,7 +503,7 @@ TEH_TRACKING_handler_track_transfer (struct TEH_RequestHandler *rh,
|
||||
int mhd_ret;
|
||||
|
||||
memset (&ctx, 0, sizeof (ctx));
|
||||
res = TEH_PARSE_mhd_request_arg_data (connection,
|
||||
res = TALER_MHD_parse_request_arg_data (connection,
|
||||
"wtid",
|
||||
&ctx.wtid,
|
||||
sizeof (struct
|
||||
|
Loading…
Reference in New Issue
Block a user