|
|
@@ -1,6 +1,6 @@
|
|
|
/*
|
|
|
This file is part of libmicrohttpd
|
|
|
- Copyright (C) 2007-2013 Daniel Pittman and Christian Grothoff
|
|
|
+ Copyright (C) 2007-2015 Daniel Pittman and Christian Grothoff
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
@@ -487,8 +487,10 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state);
|
|
|
* @param max_bytes maximum number of bytes to receive
|
|
|
* @return number of bytes written to write_to
|
|
|
*/
|
|
|
-typedef ssize_t (*ReceiveCallback) (struct MHD_Connection * conn,
|
|
|
- void *write_to, size_t max_bytes);
|
|
|
+typedef ssize_t
|
|
|
+(*ReceiveCallback) (struct MHD_Connection *conn,
|
|
|
+ void *write_to,
|
|
|
+ size_t max_bytes);
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -499,8 +501,10 @@ typedef ssize_t (*ReceiveCallback) (struct MHD_Connection * conn,
|
|
|
* @param max_bytes maximum number of bytes to transmit
|
|
|
* @return number of bytes transmitted
|
|
|
*/
|
|
|
-typedef ssize_t (*TransmitCallback) (struct MHD_Connection * conn,
|
|
|
- const void *write_to, size_t max_bytes);
|
|
|
+typedef ssize_t
|
|
|
+(*TransmitCallback) (struct MHD_Connection *conn,
|
|
|
+ const void *write_to,
|
|
|
+ size_t max_bytes);
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -578,13 +582,22 @@ struct MHD_Connection
|
|
|
struct MemoryPool *pool;
|
|
|
|
|
|
/**
|
|
|
- * We allow the main application to associate some
|
|
|
- * pointer with the connection. Here is where we
|
|
|
- * store it. (MHD does not know or care what it
|
|
|
- * is).
|
|
|
+ * We allow the main application to associate some pointer with the
|
|
|
+ * HTTP request, which is passed to each #MHD_AccessHandlerCallback
|
|
|
+ * and some other API calls. Here is where we store it. (MHD does
|
|
|
+ * not know or care what it is).
|
|
|
*/
|
|
|
void *client_context;
|
|
|
|
|
|
+ /**
|
|
|
+ * We allow the main application to associate some pointer with the
|
|
|
+ * TCP connection (which may span multiple HTTP requests). Here is
|
|
|
+ * where we store it. (MHD does not know or care what it is).
|
|
|
+ * The location is given to the #MHD_NotifyConnectionCallback and
|
|
|
+ * also accessible via #MHD_CONNECTION_INFO_SOCKET_CONTEXT.
|
|
|
+ */
|
|
|
+ void *socket_context;
|
|
|
+
|
|
|
/**
|
|
|
* Request method. Should be GET/POST/etc. Allocated
|
|
|
* in pool.
|
|
|
@@ -606,7 +619,7 @@ struct MHD_Connection
|
|
|
/**
|
|
|
* Buffer for reading requests. Allocated
|
|
|
* in pool. Actually one byte larger than
|
|
|
- * read_buffer_size (if non-NULL) to allow for
|
|
|
+ * @e read_buffer_size (if non-NULL) to allow for
|
|
|
* 0-termination.
|
|
|
*/
|
|
|
char *read_buffer;
|
|
|
@@ -620,7 +633,8 @@ struct MHD_Connection
|
|
|
/**
|
|
|
* Last incomplete header line during parsing of headers.
|
|
|
* Allocated in pool. Only valid if state is
|
|
|
- * either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED.
|
|
|
+ * either #MHD_CONNECTION_HEADER_PART_RECEIVED or
|
|
|
+ * #MHD_CONNECTION_FOOTER_PART_RECEIVED.
|
|
|
*/
|
|
|
char *last;
|
|
|
|
|
|
@@ -628,12 +642,13 @@ struct MHD_Connection
|
|
|
* Position after the colon on the last incomplete header
|
|
|
* line during parsing of headers.
|
|
|
* Allocated in pool. Only valid if state is
|
|
|
- * either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED.
|
|
|
+ * either #MHD_CONNECTION_HEADER_PART_RECEIVED or
|
|
|
+ * #MHD_CONNECTION_FOOTER_PART_RECEIVED.
|
|
|
*/
|
|
|
char *colon;
|
|
|
|
|
|
/**
|
|
|
- * Foreign address (of length addr_len). MALLOCED (not
|
|
|
+ * Foreign address (of length @e addr_len). MALLOCED (not
|
|
|
* in pool!).
|
|
|
*/
|
|
|
struct sockaddr *addr;
|
|
|
@@ -676,7 +691,7 @@ struct MHD_Connection
|
|
|
|
|
|
/**
|
|
|
* How many more bytes of the body do we expect
|
|
|
- * to read? MHD_SIZE_UNKNOWN for unknown.
|
|
|
+ * to read? #MHD_SIZE_UNKNOWN for unknown.
|
|
|
*/
|
|
|
uint64_t remaining_upload_size;
|
|
|
|
|
|
@@ -800,17 +815,17 @@ struct MHD_Connection
|
|
|
/**
|
|
|
* Handler used for processing read connection operations
|
|
|
*/
|
|
|
- int (*read_handler) (struct MHD_Connection * connection);
|
|
|
+ int (*read_handler) (struct MHD_Connection *connection);
|
|
|
|
|
|
/**
|
|
|
* Handler used for processing write connection operations
|
|
|
*/
|
|
|
- int (*write_handler) (struct MHD_Connection * connection);
|
|
|
+ int (*write_handler) (struct MHD_Connection *connection);
|
|
|
|
|
|
/**
|
|
|
* Handler used for processing idle connection operations
|
|
|
*/
|
|
|
- int (*idle_handler) (struct MHD_Connection * connection);
|
|
|
+ int (*idle_handler) (struct MHD_Connection *connection);
|
|
|
|
|
|
/**
|
|
|
* Function used for reading HTTP request stream.
|
|
|
@@ -864,9 +879,10 @@ struct MHD_Connection
|
|
|
* @param con connection handle
|
|
|
* @return new closure
|
|
|
*/
|
|
|
-typedef void * (*LogCallback)(void * cls,
|
|
|
- const char * uri,
|
|
|
- struct MHD_Connection *con);
|
|
|
+typedef void *
|
|
|
+(*LogCallback)(void * cls,
|
|
|
+ const char * uri,
|
|
|
+ struct MHD_Connection *con);
|
|
|
|
|
|
/**
|
|
|
* Signature of function called to unescape URIs. See also
|
|
|
@@ -877,9 +893,10 @@ typedef void * (*LogCallback)(void * cls,
|
|
|
* @param uri 0-terminated string to unescape (should be updated)
|
|
|
* @return length of the resulting string
|
|
|
*/
|
|
|
-typedef size_t (*UnescapeCallback)(void *cls,
|
|
|
- struct MHD_Connection *conn,
|
|
|
- char *uri);
|
|
|
+typedef size_t
|
|
|
+(*UnescapeCallback)(void *cls,
|
|
|
+ struct MHD_Connection *conn,
|
|
|
+ char *uri);
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -999,6 +1016,17 @@ struct MHD_Daemon
|
|
|
*/
|
|
|
void *notify_completed_cls;
|
|
|
|
|
|
+ /**
|
|
|
+ * Function to call when we are starting/stopping
|
|
|
+ * a connection. May be NULL.
|
|
|
+ */
|
|
|
+ MHD_NotifyConnectionCallback notify_connection;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Closure argument to notify_connection.
|
|
|
+ */
|
|
|
+ void *notify_connection_cls;
|
|
|
+
|
|
|
/**
|
|
|
* Function to call with the full URI at the
|
|
|
* beginning of request processing. May be NULL.
|