mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
fixing 1399
This commit is contained in:
@@ -695,6 +695,36 @@ and returns the number of headers.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char * key, const char * value)
|
||||
This function can be used to add an entry to
|
||||
the HTTP headers of a connection (so that the
|
||||
MHD_get_connection_values function will return
|
||||
them -- and the MHD PostProcessor will also
|
||||
see them). This maybe required in certain
|
||||
situations (see Mantis #1399) where (broken)
|
||||
HTTP implementations fail to supply values needed
|
||||
by the post processor (or other parts of the
|
||||
application).
|
||||
|
||||
This function MUST only be called from within
|
||||
the MHD_AccessHandlerCallback (otherwise, access
|
||||
maybe improperly synchronized). Furthermore,
|
||||
the client must guarantee that the key and
|
||||
value arguments are 0-terminated strings that
|
||||
are NOT freed until the connection is closed.
|
||||
(The easiest way to do this is by passing only
|
||||
arguments to permanently allocated strings.).
|
||||
|
||||
@var{connection} is the connection for which
|
||||
the entry for @var{key} of the given @var{kind}
|
||||
should be set to the given @var{value}.
|
||||
|
||||
The function returns @code{MHD_NO} if the operation
|
||||
could not be performed due to insufficient memory
|
||||
and @code{MHD_YES} on success.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@deftypefun {const char *} MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
|
||||
Get a particular header value. If multiple values match the @var{kind},
|
||||
return one of them (the ``first'', whatever that means). @var{key} must
|
||||
|
||||
@@ -147,6 +147,56 @@ MHD_get_connection_values (struct MHD_Connection *connection,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function can be used to add an entry to
|
||||
* the HTTP headers of a connection (so that the
|
||||
* MHD_get_connection_values function will return
|
||||
* them -- and the MHD PostProcessor will also
|
||||
* see them). This maybe required in certain
|
||||
* situations (see Mantis #1399) where (broken)
|
||||
* HTTP implementations fail to supply values needed
|
||||
* by the post processor (or other parts of the
|
||||
* application).
|
||||
* <p>
|
||||
* This function MUST only be called from within
|
||||
* the MHD_AccessHandlerCallback (otherwise, access
|
||||
* maybe improperly synchronized). Furthermore,
|
||||
* the client must guarantee that the key and
|
||||
* value arguments are 0-terminated strings that
|
||||
* are NOT freed until the connection is closed.
|
||||
* (The easiest way to do this is by passing only
|
||||
* arguments to permanently allocated strings.).
|
||||
*
|
||||
* @param connection the connection for which a
|
||||
* value should be set
|
||||
* @param kind kind of the value
|
||||
* @param key key for the value
|
||||
* @param value the value itself
|
||||
* @return MHD_NO if the operation could not be
|
||||
* performed due to insufficient memory;
|
||||
* MHD_YES on success
|
||||
*/
|
||||
int
|
||||
MHD_set_connection_value (struct MHD_Connection *connection,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key,
|
||||
const char *value)
|
||||
{
|
||||
struct MHD_HTTP_Header * pos;
|
||||
|
||||
pos = MHD_pool_allocate(connection->pool,
|
||||
sizeof(struct MHD_HTTP_Header),
|
||||
MHD_NO);
|
||||
if (pos == NULL)
|
||||
return MHD_NO;
|
||||
pos->header = (char*) key;
|
||||
pos->value = (char*) value;
|
||||
pos->kind = kind;
|
||||
pos->next = connection->headers_received;
|
||||
connection->headers_received = pos;
|
||||
return MHD_YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a particular header value. If multiple
|
||||
* values match the kind, return any one of them.
|
||||
|
||||
@@ -790,6 +790,41 @@ MHD_get_connection_values (struct MHD_Connection *connection,
|
||||
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
|
||||
* MHD_get_connection_values function will return
|
||||
* them -- and the MHD PostProcessor will also
|
||||
* see them). This maybe required in certain
|
||||
* situations (see Mantis #1399) where (broken)
|
||||
* HTTP implementations fail to supply values needed
|
||||
* by the post processor (or other parts of the
|
||||
* application).
|
||||
* <p>
|
||||
* This function MUST only be called from within
|
||||
* the MHD_AccessHandlerCallback (otherwise, access
|
||||
* maybe improperly synchronized). Furthermore,
|
||||
* the client must guarantee that the key and
|
||||
* value arguments are 0-terminated strings that
|
||||
* are NOT freed until the connection is closed.
|
||||
* (The easiest way to do this is by passing only
|
||||
* arguments to permanently allocated strings.).
|
||||
*
|
||||
* @param connection the connection for which a
|
||||
* value should be set
|
||||
* @param kind kind of the value
|
||||
* @param key key for the value
|
||||
* @param value the value itself
|
||||
* @return MHD_NO if the operation could not be
|
||||
* performed due to insufficient memory;
|
||||
* MHD_YES on success
|
||||
*/
|
||||
int
|
||||
MHD_set_connection_value (struct MHD_Connection *connection,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* Get a particular header value. If multiple
|
||||
* values match the kind, return any one of them.
|
||||
|
||||
Reference in New Issue
Block a user