[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16764 - in libmicrohttpd: . doc src/daemon src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16764 - in libmicrohttpd: . doc src/daemon src/include |
Date: |
Mon, 12 Sep 2011 10:15:12 +0200 |
Author: grothoff
Date: 2011-09-12 10:15:12 +0200 (Mon, 12 Sep 2011)
New Revision: 16764
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/doc/microhttpd.texi
libmicrohttpd/src/daemon/EXPORT.sym
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/daemon/daemon.c
libmicrohttpd/src/daemon/internal.h
libmicrohttpd/src/include/microhttpd.h
Log:
indenting header more nicely, adding MHD_set_connection_option
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2011-09-11 12:55:32 UTC (rev 16763)
+++ libmicrohttpd/ChangeLog 2011-09-12 08:15:12 UTC (rev 16764)
@@ -1,3 +1,8 @@
+Mon Sep 12 10:05:36 CEST 2011
+ Added new function to allow setting of a custom timeout value
+ for an individual connection (the MHD_set_connection_option is
+ more generic, but this is currently the only use). -CG
+
Sat Sep 10 07:30:12 CEST 2011
Documenting that MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT is not
implemented and will not be implemented, and what to use instead. -CG
Modified: libmicrohttpd/doc/microhttpd.texi
===================================================================
--- libmicrohttpd/doc/microhttpd.texi 2011-09-11 12:55:32 UTC (rev 16763)
+++ libmicrohttpd/doc/microhttpd.texi 2011-09-12 08:15:12 UTC (rev 16764)
@@ -113,7 +113,7 @@
* microhttpd-responses:: Building responses to requests.
* microhttpd-dauth:: Utilizing Authentication.
* microhttpd-post:: Adding a @code{POST} processor.
-* microhttpd-info:: Obtaining status information.
+* microhttpd-info:: Obtaining and modifying status information.
Appendices
@@ -706,75 +706,8 @@
@end deftp
address@hidden {Enumeration} MHD_ConnectionInfoType
-Values of this enum are used to specify what information about a
-connection is desired.
address@hidden @code
address@hidden MHD_CONNECTION_INFO_CIPHER_ALGO
-What cipher algorithm is being used (HTTPS connections only).
-Takes no extra arguments.
-NULL is returned for non-HTTPS connections.
-
address@hidden MHD_CONNECTION_INFO_PROTOCOL,
-Takes no extra arguments. Allows finding out the TLS/SSL protocol used
-(HTTPS connections only).
-NULL is returned for non-HTTPS connections.
-
address@hidden MHD_CONNECTION_INFO_CLIENT_ADDRESS
-Returns information about the address of the client. Returns
-essentially a @code{struct sockaddr **} (since the API returns
-a @code{union MHD_ConnectionInfo *} and that union contains
-a @code{struct sockaddr *}).
-
address@hidden MHD_CONNECTION_INFO_GNUTLS_SESSION,
-Takes no extra arguments. Allows access to the underlying GNUtls session,
-including access to the underlying GNUtls client certificate
-(HTTPS connections only). Takes no extra arguments.
-NULL is returned for non-HTTPS connections.
-
address@hidden MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,
-Dysfunctional (never implemented, deprecated). Use
-MHD_CONNECTION_INFO_GNUTLS_SESSION to get the @code{gnutls_session_t}
-and then call @code{gnutls_certificate_get_peers()}.
-
address@hidden MHD_CONNECTION_INFO_DAEMON
-Returns information about @code{struct MHD_Daemon} which manages
-this connection.
-
address@hidden table
address@hidden deftp
-
-
-
-
address@hidden {Enumeration} MHD_DaemonInfoType
-Values of this enum are used to specify what
-information about a daemon is desired.
address@hidden @code
address@hidden MHD_DAEMON_INFO_KEY_SIZE
-Request information about the key size for a particular cipher
-algorithm. The cipher algorithm should be passed as an extra argument
-(of type 'enum MHD_GNUTLS_CipherAlgorithm').
-
address@hidden MHD_DAEMON_INFO_MAC_KEY_SIZE
-Request information about the key size for a particular cipher
-algorithm. The cipher algorithm should be passed as an extra argument
-(of type 'enum MHD_GNUTLS_HashAlgorithm').
-
address@hidden MHD_DAEMON_INFO_LISTEN_FD
address@hidden listen
-Request the file-descriptor number that MHD is using to listen to the
-server socket. This can be useful if no port
-was specified and a client needs to learn what port
-is actually being used by MHD.
-No extra arguments should be passed.
-
address@hidden table
address@hidden deftp
-
-
@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@c ------------------------------------------------------------
@@ -1394,8 +1327,6 @@
@deftypefun {struct MHD_Response *} MHD_create_response_from_fd (uint64_t
size, int fd)
Create a response object. The response object can be extended with
header information and then it can be used any number of times.
-Function is deprecated, use @code{MHD_create_response_from_fd_at_offset}
-instead (with an offset of zero).
@table @var
@item size
@@ -1942,12 +1873,13 @@
@c ------------------------------------------------------------
@node microhttpd-info
address@hidden Obtaining status information.
address@hidden Obtaining and modifying status information.
@menu
* microhttpd-info daemon:: State information about an MHD daemon
* microhttpd-info conn:: State information about a connection
+* microhttpd-option conn:: Modify per-connection options
@end menu
@@ -1977,6 +1909,34 @@
applicable.
@end deftypefun
+
address@hidden {Enumeration} MHD_DaemonInfoType
+Values of this enum are used to specify what
+information about a daemon is desired.
address@hidden @code
address@hidden MHD_DAEMON_INFO_KEY_SIZE
+Request information about the key size for a particular cipher
+algorithm. The cipher algorithm should be passed as an extra argument
+(of type 'enum MHD_GNUTLS_CipherAlgorithm').
+
address@hidden MHD_DAEMON_INFO_MAC_KEY_SIZE
+Request information about the key size for a particular cipher
+algorithm. The cipher algorithm should be passed as an extra argument
+(of type 'enum MHD_GNUTLS_HashAlgorithm').
+
address@hidden MHD_DAEMON_INFO_LISTEN_FD
address@hidden listen
+Request the file-descriptor number that MHD is using to listen to the
+server socket. This can be useful if no port
+was specified and a client needs to learn what port
+is actually being used by MHD.
+No extra arguments should be passed.
+
address@hidden table
address@hidden deftp
+
+
+
@c ------------------------------------------------------------
@node microhttpd-info conn
@section Obtaining state information about a connection
@@ -2003,8 +1963,89 @@
applicable.
@end deftypefun
address@hidden {Enumeration} MHD_ConnectionInfoType
+Values of this enum are used to specify what information about a
+connection is desired.
address@hidden @code
address@hidden MHD_CONNECTION_INFO_CIPHER_ALGO
+What cipher algorithm is being used (HTTPS connections only).
+Takes no extra arguments.
+NULL is returned for non-HTTPS connections.
+
address@hidden MHD_CONNECTION_INFO_PROTOCOL,
+Takes no extra arguments. Allows finding out the TLS/SSL protocol used
+(HTTPS connections only).
+NULL is returned for non-HTTPS connections.
+
address@hidden MHD_CONNECTION_INFO_CLIENT_ADDRESS
+Returns information about the address of the client. Returns
+essentially a @code{struct sockaddr **} (since the API returns
+a @code{union MHD_ConnectionInfo *} and that union contains
+a @code{struct sockaddr *}).
+
address@hidden MHD_CONNECTION_INFO_GNUTLS_SESSION,
+Takes no extra arguments. Allows access to the underlying GNUtls session,
+including access to the underlying GNUtls client certificate
+(HTTPS connections only). Takes no extra arguments.
+NULL is returned for non-HTTPS connections.
+
address@hidden MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,
+Dysfunctional (never implemented, deprecated). Use
+MHD_CONNECTION_INFO_GNUTLS_SESSION to get the @code{gnutls_session_t}
+and then call @code{gnutls_certificate_get_peers()}.
+
address@hidden MHD_CONNECTION_INFO_DAEMON
+Returns information about @code{struct MHD_Daemon} which manages
+this connection.
+
address@hidden table
address@hidden deftp
+
+
+
address@hidden ------------------------------------------------------------
address@hidden microhttpd-option conn
address@hidden Setting custom options for an individual connection
address@hidden timeout
+
+
+
address@hidden {int} MHD_set_connection_option (struct MHD_Connection *daemon,
enum MHD_CONNECTION_OPTION option, ...)
+Set a custom option for the given connection.
+
address@hidden @var
address@hidden connection
+the connection for which an option should be set or modified;
+
address@hidden option
+option to set
+
address@hidden ...
+additional arguments for the option (depending on option)
address@hidden table
+
+Returns @code{MHD_YES} on success, @code{MHD_NO} for errors
+(i.e. option argument invalid or option unknown).
address@hidden deftypefun
+
+
address@hidden {Enumeration} MHD_CONNECTION_OPTION
+Values of this enum are used to specify which option for a
+connection should be changed.
+
address@hidden @code
+
address@hidden MHD_CONNECTION_OPTION_TIMEOUT
+Set a custom timeout for the given connection. Specified
+as the number of seconds, given as an @code{unsigned int}. Use
+zero for no timeout.
+
address@hidden table
address@hidden deftp
+
+
@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Modified: libmicrohttpd/src/daemon/EXPORT.sym
===================================================================
--- libmicrohttpd/src/daemon/EXPORT.sym 2011-09-11 12:55:32 UTC (rev 16763)
+++ libmicrohttpd/src/daemon/EXPORT.sym 2011-09-12 08:15:12 UTC (rev 16764)
@@ -32,3 +32,4 @@
MHD_basic_auth_get_username_password
MHD_queue_basic_auth_fail_response
MHD_add_connection
+MHD_set_connection_option
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2011-09-11 12:55:32 UTC (rev
16763)
+++ libmicrohttpd/src/daemon/connection.c 2011-09-12 08:15:12 UTC (rev
16764)
@@ -2293,7 +2293,7 @@
}
break;
}
- timeout = connection->daemon->connection_timeout;
+ timeout = connection->connection_timeout;
if ( (timeout != 0) &&
(timeout <= (time (NULL) - connection->last_activity)) )
{
@@ -2354,4 +2354,32 @@
}
+/**
+ * Set a custom option for the given connection, overriding defaults.
+ *
+ * @param connection connection to modify
+ * @param option option to set
+ * @param ... arguments to the option, depending on the option type
+ * @return MHD_YES on success, MHD_NO if setting the option failed
+ */
+int
+MHD_set_connection_option (struct MHD_Connection *connection,
+ enum MHD_CONNECTION_OPTION option,
+ ...)
+{
+ va_list ap;
+
+ switch (option)
+ {
+ case MHD_CONNECTION_OPTION_TIMEOUT:
+ va_start (ap, option);
+ connection->connection_timeout = va_arg (ap, unsigned int);
+ va_end (ap);
+ return MHD_YES;
+ default:
+ return MHD_NO;
+ }
+}
+
+
/* end of connection.c */
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2011-09-11 12:55:32 UTC (rev 16763)
+++ libmicrohttpd/src/daemon/daemon.c 2011-09-12 08:15:12 UTC (rev 16764)
@@ -953,6 +953,7 @@
return MHD_NO;
}
memset (connection, 0, sizeof (struct MHD_Connection));
+ connection->connection_timeout = daemon->connection_timeout;
connection->pool = NULL;
connection->addr = malloc (addrlen);
if (connection->addr == NULL)
@@ -1222,7 +1223,6 @@
time_t earliest_deadline;
time_t now;
struct MHD_Connection *pos;
- unsigned int dto;
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
@@ -1231,26 +1231,23 @@
#endif
return MHD_NO;
}
- dto = daemon->connection_timeout;
- if (0 == dto)
- return MHD_NO;
pos = daemon->connections_head;
if (pos == NULL)
return MHD_NO; /* no connections */
- now = time (NULL);
- /* start with conservative estimate */
- earliest_deadline = now + dto + 1;
+ earliest_deadline = pos->last_activity + pos->connection_timeout;
+ pos = pos->next;
while (pos != NULL)
{
- if (earliest_deadline > pos->last_activity + dto)
- earliest_deadline = pos->last_activity + dto;
+ if (earliest_deadline > pos->last_activity + pos->connection_timeout)
+ earliest_deadline = pos->last_activity + pos->connection_timeout;
#if HTTPS_SUPPORT
if ( (0 != (daemon->options & MHD_USE_SSL)) &&
(0 != gnutls_record_check_pending (pos->tls_session)) )
- earliest_deadline = now;
+ earliest_deadline = 0;
#endif
pos = pos->next;
}
+ now = time (NULL);
if (earliest_deadline < now)
*timeout = 0;
else
Modified: libmicrohttpd/src/daemon/internal.h
===================================================================
--- libmicrohttpd/src/daemon/internal.h 2011-09-11 12:55:32 UTC (rev 16763)
+++ libmicrohttpd/src/daemon/internal.h 2011-09-12 08:15:12 UTC (rev 16764)
@@ -608,6 +608,12 @@
time_t last_activity;
/**
+ * After how many seconds of inactivity should
+ * this connection time out? Zero for no timeout.
+ */
+ unsigned int connection_timeout;
+
+ /**
* Did we ever call the "default_handler" on this connection?
* (this flag will determine if we call the 'notify_completed'
* handler when the connection closes down).
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2011-09-11 12:55:32 UTC (rev
16763)
+++ libmicrohttpd/src/include/microhttpd.h 2011-09-12 08:15:12 UTC (rev
16764)
@@ -106,7 +106,7 @@
/**
* Current version of the library.
*/
-#define MHD_VERSION 0x00090D01
+#define MHD_VERSION 0x00090E00
/**
* MHD-internal return code for "YES".
@@ -368,9 +368,9 @@
MHD_USE_POLL = 64
};
+
/**
- * MHD options. Passed in the varargs portion
- * of MHD_start_daemon.
+ * MHD options. Passed in the varargs portion of MHD_start_daemon.
*/
enum MHD_OPTION
{
@@ -662,6 +662,7 @@
MHD_FOOTER_KIND = 16
};
+
/**
* The MHD_RequestTerminationCode specifies reasons
* why a request has been terminated (or completed).
@@ -743,6 +744,7 @@
};
+
/**
* Values of this enum are used to specify what
* information about a deamon is desired.
@@ -773,7 +775,6 @@
};
-
/**
* Handle for the daemon (listening on a socket for HTTP traffic).
*/
@@ -797,6 +798,7 @@
*/
struct MHD_PostProcessor;
+
/**
* Callback for serious error condition. The default action is to abort().
* @param cls user specified value
@@ -804,10 +806,11 @@
* @param line where the error occured
* @param reason error detail, may be NULL
*/
-typedef void (*MHD_PanicCallback) (void *cls,
- const char *file,
- unsigned int line,
- const char *reason);
+typedef
+ void (*MHD_PanicCallback) (void *cls,
+ const char *file,
+ unsigned int line,
+ const char *reason);
/**
* Allow or deny a client to connect.
@@ -821,6 +824,7 @@
const struct sockaddr * addr,
socklen_t addrlen);
+
/**
* A client has requested the given url using the given method ("GET",
* "PUT", "DELETE", "POST", etc). The callback must call MHS
@@ -866,6 +870,7 @@
size_t *upload_data_size,
void **con_cls);
+
/**
* Signature of the callback used by MHD to notify the
* application about completed requests.
@@ -883,6 +888,7 @@
void **con_cls,
enum MHD_RequestTerminationCode toe);
+
/**
* Iterator over key-value pairs. This iterator
* can be used to iterate over all of the cookies,
@@ -898,6 +904,7 @@
enum MHD_ValueKind kind,
const char *key, const char *value);
+
/**
* Callback used by libmicrohttpd in order to obtain content. The
* callback is to copy at most "max" bytes of content into "buf". The
@@ -951,14 +958,17 @@
char *buf,
size_t max);
+
/**
* This method is called by libmicrohttpd if we
* are done with a content reader. It should
* be used to free resources associated with the
* content reader.
*/
-typedef void (*MHD_ContentReaderFreeCallback) (void *cls);
+typedef void
+ (*MHD_ContentReaderFreeCallback) (void *cls);
+
/**
* Iterator over key-value pairs where the value
* maybe made available in increments and/or may
@@ -985,7 +995,9 @@
const char *filename,
const char *content_type,
const char *transfer_encoding,
- const char *data, uint64_t off, size_t size);
+ const char *data,
+ uint64_t off,
+ size_t size);
/* **************** Daemon handling functions ***************** */
@@ -1005,13 +1017,14 @@
* terminated with MHD_OPTION_END).
* @return NULL on error, handle to daemon on success
*/
-struct MHD_Daemon *MHD_start_daemon_va (unsigned int options,
- uint16_t port,
- MHD_AcceptPolicyCallback apc,
- void *apc_cls,
- MHD_AccessHandlerCallback dh,
- void *dh_cls, va_list ap);
+struct MHD_Daemon *
+MHD_start_daemon_va (unsigned int options,
+ uint16_t port,
+ MHD_AcceptPolicyCallback apc, void *apc_cls,
+ MHD_AccessHandlerCallback dh, void *dh_cls,
+ va_list ap);
+
/**
* Start a webserver on the given port. Variadic version of
* MHD_start_daemon_va.
@@ -1027,19 +1040,21 @@
* @param dh_cls extra argument to dh
* @return NULL on error, handle to daemon on success
*/
-struct MHD_Daemon *MHD_start_daemon (unsigned int flags,
- uint16_t port,
- MHD_AcceptPolicyCallback apc,
- void *apc_cls,
- MHD_AccessHandlerCallback dh,
- void *dh_cls, ...);
+struct MHD_Daemon *
+MHD_start_daemon (unsigned int flags,
+ uint16_t port,
+ MHD_AcceptPolicyCallback apc, void *apc_cls,
+ MHD_AccessHandlerCallback dh, void *dh_cls,
+ ...);
+
/**
* Shutdown an http daemon.
*
* @param daemon daemon to stop
*/
-void MHD_stop_daemon (struct MHD_Daemon *daemon);
+void
+MHD_stop_daemon (struct MHD_Daemon *daemon);
/**
@@ -1063,10 +1078,11 @@
* not handle the connection (i.e. malloc failed, etc).
* The socket will be closed in any case.
*/
-int MHD_add_connection (struct MHD_Daemon *daemon,
- int client_socket,
- const struct sockaddr *addr,
- socklen_t addrlen);
+int
+MHD_add_connection (struct MHD_Daemon *daemon,
+ int client_socket,
+ const struct sockaddr *addr,
+ socklen_t addrlen);
/**
@@ -1084,9 +1100,12 @@
*/
int
MHD_get_fdset (struct MHD_Daemon *daemon,
- fd_set * read_fd_set,
- fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd);
+ fd_set *read_fd_set,
+ fd_set *write_fd_set,
+ fd_set *except_fd_set,
+ int *max_fd);
+
/**
* Obtain timeout value for select for this daemon (only needed if
* connection timeout is used). The returned value is how long select
@@ -1115,7 +1134,8 @@
* daemon was not started with the right
* options for this call.
*/
-int MHD_run (struct MHD_Daemon *daemon);
+int
+MHD_run (struct MHD_Daemon *daemon);
/* **************** Connection handling functions ***************** */
@@ -1135,6 +1155,7 @@
enum MHD_ValueKind kind,
MHD_KeyValueIterator iterator, void *iterator_cls);
+
/**
* This function can be used to add an entry to
* the HTTP headers of a connection (so that the
@@ -1167,8 +1188,10 @@
int
MHD_set_connection_value (struct MHD_Connection *connection,
enum MHD_ValueKind kind,
- const char *key, const char *value);
+ const char *key,
+ const char *value);
+
/**
* Sets the global error handler to a different implementation. "cb"
* will only be called in the case of typically fatal, serious
@@ -1184,8 +1207,10 @@
* @param cb new error handler
* @param cls passed to error handler
*/
-void MHD_set_panic_func (MHD_PanicCallback cb, void *cls);
+void
+MHD_set_panic_func (MHD_PanicCallback cb, void *cls);
+
/**
* Get a particular header value. If multiple
* values match the kind, return any one of them.
@@ -1195,10 +1220,12 @@
* @param key the header to look for
* @return NULL if no such item was found
*/
-const char *MHD_lookup_connection_value (struct MHD_Connection *connection,
- enum MHD_ValueKind kind,
- const char *key);
+const char *
+MHD_lookup_connection_value (struct MHD_Connection *connection,
+ enum MHD_ValueKind kind,
+ const char *key);
+
/**
* Queue a response to be transmitted to the client (as soon as
* possible but after MHD_AccessHandlerCallback returns).
@@ -1211,7 +1238,8 @@
*/
int
MHD_queue_response (struct MHD_Connection *connection,
- unsigned int status_code, struct MHD_Response *response);
+ unsigned int status_code,
+ struct MHD_Response *response);
/* **************** Response manipulation functions ***************** */
@@ -1231,12 +1259,11 @@
* @param crfc callback to call to free crc_cls resources
* @return NULL on error (i.e. invalid arguments, out of memory)
*/
-struct MHD_Response *MHD_create_response_from_callback (uint64_t size,
- size_t block_size,
-
MHD_ContentReaderCallback
- crc, void *crc_cls,
-
MHD_ContentReaderFreeCallback
- crfc);
+struct MHD_Response *
+MHD_create_response_from_callback (uint64_t size,
+ size_t block_size,
+ MHD_ContentReaderCallback crc, void *crc_cls,
+ MHD_ContentReaderFreeCallback crfc);
/**
@@ -1252,10 +1279,11 @@
* @return NULL on error (i.e. invalid arguments, out of memory)
* @deprecated use MHD_create_response_from_buffer instead
*/
-struct MHD_Response *MHD_create_response_from_data (size_t size,
- void *data,
- int must_free,
- int must_copy);
+struct MHD_Response *
+MHD_create_response_from_data (size_t size,
+ void *data,
+ int must_free,
+ int must_copy);
/**
@@ -1313,10 +1341,10 @@
* data; will be closed when response is destroyed;
* fd should be in 'blocking' mode
* @return NULL on error (i.e. invalid arguments, out of memory)
- * @deprecated use MHD_create_response_from_fd_at_offset instead
*/
-struct MHD_Response *MHD_create_response_from_fd (size_t size,
- int fd);
+struct MHD_Response *
+MHD_create_response_from_fd (size_t size,
+ int fd);
/**
@@ -1327,12 +1355,17 @@
* @param fd file descriptor referring to a file on disk with the
* data; will be closed when response is destroyed;
* fd should be in 'blocking' mode
- * @param off offset to start reading from in the file
+ * @param off offset to start reading from in the file;
+ * Be careful! 'off_t' may have been compiled to be a
+ * 64-bit variable for MHD, in which case your application
+ * also has to be compiled using the same options! Read
+ * the MHD manual for more details.
* @return NULL on error (i.e. invalid arguments, out of memory)
*/
-struct MHD_Response *MHD_create_response_from_fd_at_offset (size_t size,
- int fd,
- off_t offset);
+struct MHD_Response *
+MHD_create_response_from_fd_at_offset (size_t size,
+ int fd,
+ off_t offset);
/**
@@ -1345,6 +1378,7 @@
*/
void MHD_destroy_response (struct MHD_Response *response);
+
/**
* Add a header line to the response.
*
@@ -1432,13 +1466,12 @@
* Must NOT be NULL.
* @param cls first argument to ikvi
* @return NULL on error (out of memory, unsupported encoding),
- otherwise a PP handle
+ * otherwise a PP handle
*/
-struct MHD_PostProcessor *MHD_create_post_processor (struct MHD_Connection
- *connection,
- size_t buffer_size,
- MHD_PostDataIterator
- iter, void *cls);
+struct MHD_PostProcessor *
+MHD_create_post_processor (struct MHD_Connection *connection,
+ size_t buffer_size,
+ MHD_PostDataIterator iter, void *cls);
/**
* Parse and process POST data.
@@ -1467,7 +1500,8 @@
* problems; it is common to ignore the return
* value of this function
*/
-int MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
+int
+MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
/* ********************* Digest Authentication functions *************** */
@@ -1541,8 +1575,8 @@
* to the username if found
*/
char *
-MHD_basic_auth_get_username_password(struct MHD_Connection *connection,
- char** password);
+MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
+ char** password);
/**
* Queues a response to request basic authentication from the client
@@ -1552,9 +1586,9 @@
* @return MHD_YES on success, MHD_NO otherwise
*/
int
-MHD_queue_basic_auth_fail_response(struct MHD_Connection *connection,
- const char *realm,
- struct MHD_Response *response);
+MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
+ const char *realm,
+ struct MHD_Response *response);
/* ********************** generic query functions ********************** */
@@ -1605,14 +1639,44 @@
* @return NULL if this information is not available
* (or if the infoType is unknown)
*/
-const union MHD_ConnectionInfo *MHD_get_connection_info (struct MHD_Connection
- *connection,
- enum
- MHD_ConnectionInfoType
- infoType, ...);
+const union MHD_ConnectionInfo *
+MHD_get_connection_info (struct MHD_Connection *connection,
+ enum MHD_ConnectionInfoType infoType,
+ ...);
/**
+ * MHD connection options. Given to 'MHD_set_connection_option' to
+ * set custom options for a particular connection.
+ */
+enum MHD_CONNECTION_OPTION
+{
+
+ /**
+ * Set a custom timeout for the given connection. Specified
+ * as the number of seconds, given as an 'unsigned int'. Use
+ * zero for no timeout.
+ */
+ MHD_CONNECTION_OPTION_TIMEOUT
+
+};
+
+
+/**
+ * Set a custom option for the given connection, overriding defaults.
+ *
+ * @param connection connection to modify
+ * @param option option to set
+ * @param ... arguments to the option, depending on the option type
+ * @return MHD_YES on success, MHD_NO if setting the option failed
+ */
+int
+MHD_set_connection_option (struct MHD_Connection *connection,
+ enum MHD_CONNECTION_OPTION option,
+ ...);
+
+
+/**
* Information about an MHD daemon.
*/
union MHD_DaemonInfo
@@ -1643,16 +1707,19 @@
* @return NULL if this information is not available
* (or if the infoType is unknown)
*/
-const union MHD_DaemonInfo *MHD_get_daemon_info (struct MHD_Daemon *daemon,
- enum MHD_DaemonInfoType
- infoType, ...);
+const union MHD_DaemonInfo *
+MHD_get_daemon_info (struct MHD_Daemon *daemon,
+ enum MHD_DaemonInfoType infoType,
+ ...);
+
/**
* Obtain the version of this library
*
* @return static version string, e.g. "0.9.9"
*/
-const char* MHD_get_version(void);
+const char*
+MHD_get_version (void);
#if 0 /* keep Emacsens' auto-indent happy */
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16764 - in libmicrohttpd: . doc src/daemon src/include,
gnunet <=