diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-17 00:20:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-17 00:20:57 +0100 |
commit | ac923e939b6acf141f7ca101b41a18bae9e54d83 (patch) | |
tree | bd5911d52fd54fc2656ac95f774f34b27b49f631 | |
parent | dbfc626851e75b10b916e9a6b265d28b13034649 (diff) | |
download | sync-ac923e939b6acf141f7ca101b41a18bae9e54d83.tar.gz sync-ac923e939b6acf141f7ca101b41a18bae9e54d83.tar.bz2 sync-ac923e939b6acf141f7ca101b41a18bae9e54d83.zip |
fix #6031
-rw-r--r-- | src/sync/sync-httpd.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c index 14b2470..7b9587b 100644 --- a/src/sync/sync-httpd.c +++ b/src/sync/sync-httpd.c @@ -241,6 +241,11 @@ url_handler (void *cls, upload_data_size); } if (0 == strcasecmp (method, + MHD_HTTP_METHOD_OPTIONS)) + { + return TALER_MHD_reply_cors_preflight (connection); + } + if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) { return SH_backup_get (connection, @@ -270,27 +275,34 @@ url_handler (void *cls, { struct SH_RequestHandler *rh = &handlers[i]; - if ( (0 == strcmp (url, - rh->url)) && - ( (NULL == rh->method) || - (0 == strcasecmp (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)) { - /* 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) + { + /* 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 SH_MHD_handler_static_response (&h404, |