diff --git a/src/daemon/connection.c b/src/daemon/connection.c index 6b82f9e7..bc44e665 100644 --- 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 index 8b4d25dd..54c98f04 100644 --- 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 index bcbe2724..101acfdd 100644 --- 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 index b25ad106..5e67b981 100644 --- 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]));