[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Handling requests

Function: int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls)

Get all the headers matching kind from the request.

The iterator callback is invoked once for each header, with iterator_cls as first argument. Return the number of entries iterated over; this can be less than the number of headers if, while iterating, iterator returns MHD_NO.

iterator can be NULL: in this case this function just counts and returns the number of headers.

Function: 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.).

connection is the connection for which the entry for key of the given kind should be set to the given value.

The function returns MHD_NO if the operation could not be performed due to insufficient memory and MHD_YES on success.

Function: 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 kind, return one of them (the “first”, whatever that means). key must reference a zero-terminated ASCII-coded string representing the header to look for: it is compared against the headers using strcasecmp(), so case is ignored. Return NULL if no such item was found.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Christian Grothoff on January 8, 2010 using texi2html 1.82.