-address fIXMEs in kyc-tester
This commit is contained in:
parent
d58334cf89
commit
b061ea85c8
@ -60,6 +60,11 @@ struct TEKT_RequestContext
|
|||||||
*/
|
*/
|
||||||
struct MHD_Connection *connection;
|
struct MHD_Connection *connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP response to return (or NULL).
|
||||||
|
*/
|
||||||
|
struct MHD_Response *response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @e rh-specific cleanup routine. Function called
|
* @e rh-specific cleanup routine. Function called
|
||||||
* upon completion of the request that should
|
* upon completion of the request that should
|
||||||
@ -74,6 +79,13 @@ struct TEKT_RequestContext
|
|||||||
* Can be NULL.
|
* Can be NULL.
|
||||||
*/
|
*/
|
||||||
void *rh_ctx;
|
void *rh_ctx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP status to return upon resume if @e response
|
||||||
|
* is non-NULL.
|
||||||
|
*/
|
||||||
|
unsigned int http_status;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -649,9 +661,16 @@ proof_cb (
|
|||||||
{
|
{
|
||||||
struct ProofRequestState *rs = cls;
|
struct ProofRequestState *rs = cls;
|
||||||
|
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||||
|
"KYC legitimization %s completed with status %d (%u) for %s\n",
|
||||||
|
provider_legitimization_id,
|
||||||
|
status,
|
||||||
|
http_status,
|
||||||
|
provider_user_id);
|
||||||
MHD_resume_connection (rs->rc->connection);
|
MHD_resume_connection (rs->rc->connection);
|
||||||
// FIXME: kick MHD event loop!
|
TALER_MHD_daemon_trigger ();
|
||||||
// FIXME: actually queue response...
|
rs->rc->response = response;
|
||||||
|
rs->rc->http_status = http_status;
|
||||||
GNUNET_CONTAINER_DLL_remove (rs_head,
|
GNUNET_CONTAINER_DLL_remove (rs_head,
|
||||||
rs_tail,
|
rs_tail,
|
||||||
rs);
|
rs);
|
||||||
@ -921,6 +940,15 @@ proceed_with_handler (struct TEKT_RequestContext *rc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
rh_cleaner_cb (struct TEKT_RequestContext *rc)
|
||||||
|
{
|
||||||
|
if (NULL != rc->response)
|
||||||
|
MHD_destroy_response (rc->response);
|
||||||
|
GNUNET_free (rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle incoming HTTP request.
|
* Handle incoming HTTP request.
|
||||||
*
|
*
|
||||||
@ -984,6 +1012,13 @@ handle_mhd_request (void *cls,
|
|||||||
rc = *con_cls = GNUNET_new (struct TEKT_RequestContext);
|
rc = *con_cls = GNUNET_new (struct TEKT_RequestContext);
|
||||||
rc->url = url;
|
rc->url = url;
|
||||||
rc->connection = connection;
|
rc->connection = connection;
|
||||||
|
rc->rh_cleaner = &rh_cleaner_cb;
|
||||||
|
}
|
||||||
|
if (NULL != rc->response)
|
||||||
|
{
|
||||||
|
return MHD_queue_response (rc->connection,
|
||||||
|
rc->http_status,
|
||||||
|
rc->response);
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
@ -993,7 +1028,6 @@ handle_mhd_request (void *cls,
|
|||||||
/* on repeated requests, check our cache first */
|
/* on repeated requests, check our cache first */
|
||||||
if (NULL != rc->rh)
|
if (NULL != rc->rh)
|
||||||
{
|
{
|
||||||
MHD_RESULT ret;
|
|
||||||
const char *start;
|
const char *start;
|
||||||
|
|
||||||
if ('\0' == url[0])
|
if ('\0' == url[0])
|
||||||
@ -1002,11 +1036,10 @@ handle_mhd_request (void *cls,
|
|||||||
start = strchr (url + 1, '/');
|
start = strchr (url + 1, '/');
|
||||||
if (NULL == start)
|
if (NULL == start)
|
||||||
start = "";
|
start = "";
|
||||||
ret = proceed_with_handler (rc,
|
return proceed_with_handler (rc,
|
||||||
start,
|
start,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size);
|
upload_data_size);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
if (0 == strcasecmp (method,
|
if (0 == strcasecmp (method,
|
||||||
MHD_HTTP_METHOD_HEAD))
|
MHD_HTTP_METHOD_HEAD))
|
||||||
@ -1051,18 +1084,13 @@ handle_mhd_request (void *cls,
|
|||||||
GNUNET_assert (NULL != rh->method);
|
GNUNET_assert (NULL != rh->method);
|
||||||
if (0 == strcasecmp (method,
|
if (0 == strcasecmp (method,
|
||||||
rh->method))
|
rh->method))
|
||||||
{
|
|
||||||
MHD_RESULT ret;
|
|
||||||
|
|
||||||
/* cache to avoid the loop next time */
|
/* cache to avoid the loop next time */
|
||||||
rc->rh = rh;
|
rc->rh = rh;
|
||||||
/* run handler */
|
/* run handler */
|
||||||
ret = proceed_with_handler (rc,
|
return proceed_with_handler (rc,
|
||||||
url + tok_size + 1,
|
url + tok_size + 1,
|
||||||
upload_data,
|
upload_data,
|
||||||
upload_data_size);
|
upload_data_size);
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
@ -1126,15 +1154,10 @@ handle_mhd_request (void *cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* No handler matches, generate not found */
|
/* No handler matches, generate not found */
|
||||||
{
|
return TALER_MHD_reply_with_error (connection,
|
||||||
MHD_RESULT ret;
|
|
||||||
|
|
||||||
ret = TALER_MHD_reply_with_error (connection,
|
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
|
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
|
||||||
url);
|
url);
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user