aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-07-09 03:22:52 +0000
committerChristian Grothoff <christian@grothoff.org>2007-07-09 03:22:52 +0000
commit34a4897ae604cbe90963acea46553bb1401c10cd (patch)
treee045c67b8395f6f2522caf1b13188f3b640045f0
parent473f4541144b6ea71a9ab30e113abd7853bc4428 (diff)
downloadlibmicrohttpd-34a4897ae604cbe90963acea46553bb1401c10cd.tar.gz
libmicrohttpd-34a4897ae604cbe90963acea46553bb1401c10cd.zip
fix
-rw-r--r--src/daemon/connection.c1
-rw-r--r--src/daemon/daemon.c5
-rw-r--r--src/daemon/internal.h8
-rw-r--r--src/daemon/minimal_example.c10
4 files changed, 13 insertions, 11 deletions
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) {
531 connection, 531 connection,
532 connection->url, 532 connection->url,
533 connection->method, 533 connection->method,
534 connection->version,
534 connection->read_buffer, 535 connection->read_buffer,
535 &processed)) { 536 &processed)) {
536 /* serios internal error, close connection */ 537 /* 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,
461 MHD_AcceptPolicyCallback apc, 461 MHD_AcceptPolicyCallback apc,
462 void * apc_cls, 462 void * apc_cls,
463 MHD_AccessHandlerCallback dh, 463 MHD_AccessHandlerCallback dh,
464 void * dh_cls) { 464 void * dh_cls,
465 ...) {
465 struct MHD_Daemon * retVal; 466 struct MHD_Daemon * retVal;
466 int socket_fd; 467 int socket_fd;
467 struct sockaddr_in servaddr; 468 struct sockaddr_in servaddr;
@@ -470,8 +471,6 @@ MHD_start_daemon(unsigned int options,
470 return NULL; 471 return NULL;
471 if ((options & MHD_USE_IPv6) != 0) 472 if ((options & MHD_USE_IPv6) != 0)
472 return NULL; 473 return NULL;
473 if ((options & MHD_USE_IPv4) == 0)
474 return NULL;
475 if ( (port == 0) || 474 if ( (port == 0) ||
476 (dh == NULL) ) 475 (dh == NULL) )
477 return NULL; 476 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 {
156 156
157 157
158 158
159struct MHD_Session { 159struct MHD_Connection {
160 struct MHD_Session * next; 160 struct MHD_Connection * next;
161 161
162 struct MHD_Daemon * daemon; 162 struct MHD_Daemon * daemon;
163 163
@@ -196,7 +196,7 @@ struct MHD_Session {
196 struct sockaddr_in * addr; 196 struct sockaddr_in * addr;
197 197
198 /** 198 /**
199 * Thread for this session (if we are using 199 * Thread for this connection (if we are using
200 * one thread per connection). 200 * one thread per connection).
201 */ 201 */
202 pthread_t pid; 202 pthread_t pid;
@@ -279,7 +279,7 @@ struct MHD_Daemon {
279 279
280 struct MHD_Access_Handler default_handler; 280 struct MHD_Access_Handler default_handler;
281 281
282 struct MHD_Session * connections; 282 struct MHD_Connection * connections;
283 283
284 MHD_AcceptPolicyCallback apc; 284 MHD_AcceptPolicyCallback apc;
285 285
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,
42} 42}
43 43
44static int ahc_echo(void * cls, 44static int ahc_echo(void * cls,
45 struct MHD_Session * session, 45 struct MHD_Connection * connection,
46 const char * url, 46 const char * url,
47 const char * method, 47 const char * method,
48 const char * upload_data, 48 const char * upload_data,
49 const char * version,
49 unsigned int * upload_data_size) { 50 unsigned int * upload_data_size) {
50 const char * me = cls; 51 const char * me = cls;
51 struct MHD_Response * response; 52 struct MHD_Response * response;
@@ -57,7 +58,7 @@ static int ahc_echo(void * cls,
57 (void*) me, 58 (void*) me,
58 MHD_NO, 59 MHD_NO,
59 MHD_NO); 60 MHD_NO);
60 ret = MHD_queue_response(session, 61 ret = MHD_queue_response(connection,
61 MHD_HTTP_OK, 62 MHD_HTTP_OK,
62 response); 63 response);
63 MHD_destroy_response(response); 64 MHD_destroy_response(response);
@@ -73,12 +74,13 @@ int main(int argc,
73 argv[0]); 74 argv[0]);
74 return 1; 75 return 1;
75 } 76 }
76 d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_IPv4 | MHD_USE_DEBUG, 77 d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
77 atoi(argv[1]), 78 atoi(argv[1]),
78 &apc_all, 79 &apc_all,
79 NULL, 80 NULL,
80 &ahc_echo, 81 &ahc_echo,
81 PAGE); 82 PAGE,
83 MHD_OPTION_END);
82 if (d == NULL) 84 if (d == NULL)
83 return 1; 85 return 1;
84 sleep(atoi(argv[2])); 86 sleep(atoi(argv[2]));