This commit is contained in:
Christian Grothoff
2007-07-09 03:22:52 +00:00
parent 473f454114
commit 34a4897ae6
4 changed files with 13 additions and 11 deletions
+1
View File
@@ -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 */
+2 -3
View File
@@ -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;
+4 -4
View File
@@ -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;
+6 -4
View File
@@ -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]));