libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 73f261c56f22f06705cbbeff5871ac4ce07afb57
parent e8343cd44d334e373b1d6602147f3c45bee23572
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  9 Jul 2007 03:27:23 +0000

compile

Diffstat:
Msrc/daemon/daemontest.c | 4++--
Msrc/daemon/daemontest_get.c | 20++++++++++++--------
Msrc/daemon/daemontest_post.c | 22+++++++++++++---------
Msrc/daemon/daemontest_put.c | 20++++++++++++--------
4 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/src/daemon/daemontest.c b/src/daemon/daemontest.c @@ -53,11 +53,11 @@ static int apc_all(void * cls, } static int ahc_nothing(void * cls, - struct MHD_Session * session, + struct MHD_Connection * connection, const char * url, const char * method, - const char * upload_data, const char * version, + const char * upload_data, unsigned int * upload_data_size) { return MHD_NO; } diff --git a/src/daemon/daemontest_get.c b/src/daemon/daemontest_get.c @@ -61,9 +61,10 @@ static size_t copyBuffer(void * ptr, } static int ahc_echo(void * cls, - struct MHD_Session * session, + struct MHD_Connection * connection, const char * url, const char * method, + const char * version, const char * upload_data, unsigned int * upload_data_size) { const char * me = cls; @@ -76,7 +77,7 @@ static int ahc_echo(void * cls, (void*) url, MHD_NO, MHD_YES); - ret = MHD_queue_response(session, + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -93,12 +94,13 @@ static int testInternalGet() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 1080, &apc_all, NULL, &ahc_echo, - "GET"); + "GET", + MHD_OPTION_END); if (d == NULL) return 1; c = curl_easy_init(); @@ -157,12 +159,13 @@ static int testMultithreadedGet() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 1081, &apc_all, NULL, &ahc_echo, - "GET"); + "GET", + MHD_OPTION_END); if (d == NULL) return 16; c = curl_easy_init(); @@ -231,12 +234,13 @@ static int testExternalGet() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_DEBUG, 1082, &apc_all, NULL, &ahc_echo, - "GET"); + "GET", + MHD_OPTION_END); if (d == NULL) return 256; c = curl_easy_init(); diff --git a/src/daemon/daemontest_post.c b/src/daemon/daemontest_post.c @@ -65,9 +65,10 @@ static size_t copyBuffer(void * ptr, } static int ahc_echo(void * cls, - struct MHD_Session * session, + struct MHD_Connection * connection, const char * url, const char * method, + const char * version, const char * upload_data, unsigned int * upload_data_size) { struct MHD_Response * response; @@ -77,12 +78,12 @@ static int ahc_echo(void * cls, printf("METHOD: %s\n", method); return MHD_NO; /* unexpected method */ } - /* FIXME: check session headers... */ + /* FIXME: check connection headers... */ response = MHD_create_response_from_data(strlen(url), (void*) url, MHD_NO, MHD_YES); - ret = MHD_queue_response(session, + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -99,12 +100,13 @@ static int testInternalPost() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 1080, &apc_all, NULL, &ahc_echo, - NULL); + NULL, + MHD_OPTION_END); if (d == NULL) return 1; c = curl_easy_init(); @@ -169,12 +171,13 @@ static int testMultithreadedPost() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION |MHD_USE_DEBUG, 1081, &apc_all, NULL, &ahc_echo, - NULL); + NULL, + MHD_OPTION_END); if (d == NULL) return 16; c = curl_easy_init(); @@ -250,12 +253,13 @@ static int testExternalPost() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_DEBUG, 1082, &apc_all, NULL, &ahc_echo, - NULL); + NULL, + MHD_OPTION_END); if (d == NULL) return 256; c = curl_easy_init(); diff --git a/src/daemon/daemontest_put.c b/src/daemon/daemontest_put.c @@ -77,9 +77,10 @@ static size_t copyBuffer(void * ptr, } static int ahc_echo(void * cls, - struct MHD_Session * session, + struct MHD_Connection * connection, const char * url, const char * method, + const char * version, const char * upload_data, unsigned int * upload_data_size) { int * done = cls; @@ -107,7 +108,7 @@ static int ahc_echo(void * cls, (void*) url, MHD_NO, MHD_YES); - ret = MHD_queue_response(session, + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -126,12 +127,13 @@ static int testInternalPut() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 1080, &apc_all, NULL, &ahc_echo, - &done_flag); + &done_flag, + MHD_OPTION_END); if (d == NULL) return 1; c = curl_easy_init(); @@ -204,12 +206,13 @@ static int testMultithreadedPut() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 1081, &apc_all, NULL, &ahc_echo, - &done_flag); + &done_flag, + MHD_OPTION_END); if (d == NULL) return 16; c = curl_easy_init(); @@ -293,12 +296,13 @@ static int testExternalPut() { cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon(MHD_USE_IPv4 | MHD_USE_DEBUG, + d = MHD_start_daemon(MHD_USE_DEBUG, 1082, &apc_all, NULL, &ahc_echo, - &done_flag); + &done_flag, + MHD_OPTION_END); if (d == NULL) return 256; c = curl_easy_init();