Info Node: (libmicrohttpd.info)microhttpd-requests

CFHT HOME libmicrohttpd.info: microhttpd-requests


up: Top next: microhttpd-responses prev: microhttpd-inspect Back to Software 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 KIND
     argument can be a bitmask, ORing the various header kinds that are
     requested.

     The ITERATOR callback is invoked once for each header, with
     ITERATOR_CLS as first argument.  After version 0.9.19, the headers
     are iterated in the same order as they were received from the
     network; previous versions iterated over the headers in reverse
     order.

     ‘MHD_get_connection_values’ returns 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.

     In the case of ‘MHD_GET_ARGUMENT_KIND’, the VALUE argument will be
     ‘NULL’ if the URL contained a key without an equals operator.  For
     example, for a HTTP request to the URL “http://foo/bar?key”, the
     VALUE argument is ‘NULL’; in contrast, a HTTP request to the URL
     “http://foo/bar?key=”, the VALUE argument is the empty string.  The
     normal case is that the URL contains “http://foo/bar?key=value” in
     which case VALUE would be the string “value” and KEY would contain
     the string “key”.

 -- 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 append an entry to the list of 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.  A value of ‘NULL’ for KEY can
     be used to lookup ’trailing’ values without a key, for example if a
     URI is of the form “http://example.com/?trailer”, a KEY of ‘NULL’
     can be used to access “tailer" The function returns ‘NULL’ if no
     matching item was found.


automatically generated by info2www version 1.2