libmicrohttpd

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

commit 34a4897ae604cbe90963acea46553bb1401c10cd
parent 473f4541144b6ea71a9ab30e113abd7853bc4428
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  9 Jul 2007 03:22:52 +0000

fix

Diffstat:
Msrc/daemon/connection.c | 1+
Msrc/daemon/daemon.c | 5++---
Msrc/daemon/internal.h | 8++++----
Msrc/daemon/minimal_example.c | 10++++++----
4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/daemon/connection.c b/src/daemon/connection.c @@ -531,6 +531,7 @@ MHD_call_connection_handler(struct MHD_Connection * connection) { connection, connection->url, connection->method, + connection->version, connection->read_buffer, &processed)) { /* serios internal error, close connection */ diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -461,7 +461,8 @@ MHD_start_daemon(unsigned int options, MHD_AcceptPolicyCallback apc, void * apc_cls, MHD_AccessHandlerCallback dh, - void * dh_cls) { + void * dh_cls, + ...) { struct MHD_Daemon * retVal; int socket_fd; struct sockaddr_in servaddr; @@ -470,8 +471,6 @@ MHD_start_daemon(unsigned int options, return NULL; if ((options & MHD_USE_IPv6) != 0) return NULL; - if ((options & MHD_USE_IPv4) == 0) - return NULL; if ( (port == 0) || (dh == NULL) ) return NULL; diff --git a/src/daemon/internal.h b/src/daemon/internal.h @@ -156,8 +156,8 @@ struct MHD_Response { -struct MHD_Session { - struct MHD_Session * next; +struct MHD_Connection { + struct MHD_Connection * next; struct MHD_Daemon * daemon; @@ -196,7 +196,7 @@ struct MHD_Session { struct sockaddr_in * addr; /** - * Thread for this session (if we are using + * Thread for this connection (if we are using * one thread per connection). */ pthread_t pid; @@ -279,7 +279,7 @@ struct MHD_Daemon { struct MHD_Access_Handler default_handler; - struct MHD_Session * connections; + struct MHD_Connection * connections; MHD_AcceptPolicyCallback apc; diff --git a/src/daemon/minimal_example.c b/src/daemon/minimal_example.c @@ -42,10 +42,11 @@ static int apc_all(void * cls, } static int ahc_echo(void * cls, - struct MHD_Session * session, + struct MHD_Connection * connection, const char * url, const char * method, const char * upload_data, + const char * version, unsigned int * upload_data_size) { const char * me = cls; struct MHD_Response * response; @@ -57,7 +58,7 @@ static int ahc_echo(void * cls, (void*) me, MHD_NO, MHD_NO); - ret = MHD_queue_response(session, + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -73,12 +74,13 @@ int main(int argc, argv[0]); return 1; } - 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, atoi(argv[1]), &apc_all, NULL, &ahc_echo, - PAGE); + PAGE, + MHD_OPTION_END); if (d == NULL) return 1; sleep(atoi(argv[2]));