mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
Refactored MHD_connection_get_info_fixed_sz() and relevant types
Resulting values now are individual for each query value. Some names have been updated for clarity. Removed MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME and related types.
This commit is contained in:
@@ -65,7 +65,7 @@ req_cb (void *cls,
|
||||
|
||||
res =
|
||||
MHD_request_get_info_dynamic (request,
|
||||
MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME,
|
||||
MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_INFO,
|
||||
&req_data);
|
||||
if (MHD_SC_AUTH_ABSENT == res)
|
||||
return MHD_action_digest_auth_challenge_a (
|
||||
|
||||
+91
-117
@@ -7428,7 +7428,7 @@ MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_OUT_SIZE_ (5,4);
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthUsernameType
|
||||
{
|
||||
/**
|
||||
* No username parameter in in Digest Authorization header.
|
||||
* No username parameter is in Digest Authorization header.
|
||||
* Not used currently. Value #MHD_SC_REQ_AUTH_DATA_BROKEN is returned
|
||||
* by #MHD_request_get_info_dynamic_sz() if the request has no username.
|
||||
*/
|
||||
@@ -7695,72 +7695,6 @@ struct MHD_AuthDigestInfo
|
||||
uint_fast32_t nc;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Information from Digest Authorization client's header.
|
||||
*
|
||||
* @see #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME
|
||||
*/
|
||||
struct MHD_AuthDigestUsernameInfo
|
||||
{
|
||||
/**
|
||||
* The algorithm as defined by client.
|
||||
* Set automatically to MD5 if not specified by client.
|
||||
*/
|
||||
enum MHD_DigestAuthAlgo algo;
|
||||
|
||||
/**
|
||||
* The type of username used by client.
|
||||
* The 'invalid' and 'missing' types are not used in this structure,
|
||||
* instead #MHD_SC_REQ_AUTH_DATA_BROKEN is returned when
|
||||
* #MHD_request_get_info_dynamic_sz() called with
|
||||
* #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME and the request has
|
||||
* a broken username data.
|
||||
*/
|
||||
enum MHD_DigestAuthUsernameType uname_type;
|
||||
|
||||
/**
|
||||
* The username string.
|
||||
* Used only if username type is standard or extended, always NULL otherwise.
|
||||
* If extended notation is used, this string is pct-decoded string
|
||||
* with charset and language tag removed (i.e. it is original username
|
||||
* extracted from the extended notation).
|
||||
* When userhash is used by the client, this member is NULL and
|
||||
* @a userhash_hex and @a userhash_bin are set.
|
||||
* The buffer pointed by the @a username becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
*/
|
||||
struct MHD_StringNullable username;
|
||||
|
||||
/**
|
||||
* The userhash string.
|
||||
* Valid only if username type is userhash.
|
||||
* This is unqoted string without decoding of the hexadecimal
|
||||
* digits (as provided by the client).
|
||||
* The buffer pointed by the @a userhash_hex becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
* @sa #MHD_digest_auth_calc_userhash_hex()
|
||||
*/
|
||||
struct MHD_StringNullable userhash_hex;
|
||||
|
||||
/**
|
||||
* The userhash decoded to binary form.
|
||||
* Used only if username type is userhash, always NULL otherwise.
|
||||
* When not NULL, this points to binary sequence @a userhash_hex_len /2 bytes
|
||||
* long.
|
||||
* The valid size should be #MHD_digest_get_hash_size() bytes.
|
||||
* The buffer pointed by the @a userhash_bin becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
* @warning This is a binary data, no zero termination.
|
||||
* @warning To avoid buffer overruns, always check the size of the data before
|
||||
* use, because @a userhash_bin can point even to zero-sized
|
||||
* data.
|
||||
* @sa #MHD_digest_auth_calc_userhash()
|
||||
*/
|
||||
const uint8_t *userhash_bin;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The result of digest authentication of the client.
|
||||
*
|
||||
@@ -10320,33 +10254,37 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
{
|
||||
/**
|
||||
* Get the HTTP method used for the request (as a MHD_String).
|
||||
* The result is placed in @a v_str member.
|
||||
* The resulting string pointer in valid only until a response is provided.
|
||||
* The result is placed in @a v_http_method_string member.
|
||||
* @sa #MHD_REQUEST_INFO_FIXED_HTTP_METHOD
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STR = 1
|
||||
MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STRING = 1
|
||||
,
|
||||
/**
|
||||
* Get the URI used for the request (as a MHD_String), excluding
|
||||
* the parameter part (anything after '?').
|
||||
* The result is placed in @a v_str member.
|
||||
* The resulting string pointer in valid only until a response is provided.
|
||||
* The result is placed in @a v_uri_string member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_URI = 2
|
||||
,
|
||||
/**
|
||||
* Get the number of GET parameters (the decoded part of the original
|
||||
* URI string after '?')
|
||||
* The result is placed in @a v_sizet member.
|
||||
* Get the number of URI parameters (the decoded part of the original
|
||||
* URI string after '?'). Sometimes it is called "GET parameters".
|
||||
* The result is placed in @a v_number_uri_params_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_GET_PARAMS = 3
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_URI_PARAMS = 3
|
||||
,
|
||||
/**
|
||||
* Get the number of cookies in the request.
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_number_cookies_sizet member.
|
||||
* If cookies parsing is disabled in MHD build then the function returns
|
||||
* error code #MHD_SC_FEATURE_DISABLED.
|
||||
* If cookies parsing is disabled this daemon then the function returns
|
||||
* error code #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_COOKIES = 4
|
||||
@@ -10354,14 +10292,14 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
/**
|
||||
* Return length of the client's HTTP request header.
|
||||
* This is a total raw size of the header (after TLS decipher if any)
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_header_size_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE = 5
|
||||
,
|
||||
/**
|
||||
* Get the number of decoded POST entries in the request.
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_number_post_params_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_POST_PARAMS = 6
|
||||
@@ -10370,7 +10308,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get whether the upload content is present in the request.
|
||||
* The result is #MHD_YES if any upload content is present, even
|
||||
* if the upload content size is zero.
|
||||
* The result is placed in @a v_bool member.
|
||||
* The result is placed in @a v_upload_present_bool member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_PRESENT = 10
|
||||
@@ -10378,7 +10316,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
/**
|
||||
* Get whether the chunked upload content is present in the request.
|
||||
* The result is #MHD_YES if chunked upload content is present.
|
||||
* The result is placed in @a v_bool member.
|
||||
* The result is placed in @a v_upload_chunked_bool member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_CHUNKED = 11
|
||||
@@ -10387,7 +10325,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total content upload size.
|
||||
* Resulted in zero if no content upload or upload content size is zero,
|
||||
* #MHD_SIZE_UNKNOWN if size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_total_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TOTAL = 12
|
||||
@@ -10396,7 +10334,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total size of the content upload already received from the client.
|
||||
* This is the total size received, could be not yet fully processed by the
|
||||
* application.
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_recieved_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_RECIEVED = 13
|
||||
@@ -10405,7 +10343,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total size of the content upload left to be received from
|
||||
* the client.
|
||||
* Resulted in #MHD_SIZE_UNKNOWN if total size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_to_recieve_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_RECIEVE = 14
|
||||
@@ -10415,7 +10353,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* called and completed (if any)).
|
||||
* If the value is requested from #MHD_UploadCallback, then result does NOT
|
||||
* include the current data being processed by the callback.
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_processed_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_PROCESSED = 15
|
||||
@@ -10427,23 +10365,11 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* If the value is requested from #MHD_UploadCallback, then result includes
|
||||
* the current data being processed by the callback.
|
||||
* Resulted in #MHD_SIZE_UNKNOWN if total size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_to_process_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_PROCESS = 16
|
||||
,
|
||||
/**
|
||||
* Returns pointer to information about username in client's digest auth
|
||||
* request.
|
||||
* The resulting pointer is NULL if no digest auth header is set by
|
||||
* the client, the format of the digest auth header is broken, no
|
||||
* username is provided or the format of the username parameter is broken.
|
||||
* Pointers in the returned structure (if any) are valid until response
|
||||
* is provided for the request.
|
||||
* The result is placed in @a v_auth_digest_uname member.
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME = 41
|
||||
,
|
||||
/**
|
||||
* Returns pointer to information about digest auth in client request.
|
||||
* The resulting pointer is NULL if no digest auth header is set by
|
||||
@@ -10483,36 +10409,77 @@ union MHD_RequestInfoDynamicData
|
||||
{
|
||||
|
||||
/**
|
||||
* The MHD String type
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STRING query
|
||||
*/
|
||||
struct MHD_String v_str;
|
||||
/**
|
||||
* The size_t type
|
||||
*/
|
||||
size_t v_sizet;
|
||||
/**
|
||||
* The boolean type
|
||||
*/
|
||||
enum MHD_Bool v_bool;
|
||||
/**
|
||||
* The unsigned 64 bits integer
|
||||
*/
|
||||
uint_fast64_t v_uint64;
|
||||
struct MHD_String v_http_method_string;
|
||||
|
||||
/**
|
||||
* The information about client provided username for digest auth
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_URI query
|
||||
*/
|
||||
const struct MHD_AuthDigestUsernameInfo *v_auth_digest_uname;
|
||||
struct MHD_String v_uri_string;
|
||||
|
||||
/**
|
||||
* The information about client's digest auth
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_URI_PARAMS query
|
||||
*/
|
||||
size_t v_number_uri_params_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_COOKIES query
|
||||
*/
|
||||
size_t v_number_cookies_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE query
|
||||
*/
|
||||
size_t v_header_size_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_POST_PARAMS query
|
||||
*/
|
||||
size_t v_number_post_params_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_PRESENT query
|
||||
*/
|
||||
enum MHD_Bool v_upload_present_bool;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_CHUNKED query
|
||||
*/
|
||||
enum MHD_Bool v_upload_chunked_bool;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TOTAL query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_total_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_RECIEVED query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_recieved_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_RECIEVE query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_to_recieve_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_PROCESSED query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_processed_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_PROCESS query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_to_process_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_INFO query
|
||||
*/
|
||||
const struct MHD_AuthDigestInfo *v_auth_digest_info;
|
||||
|
||||
/**
|
||||
* The username and password provided by the client's basic auth header.
|
||||
* If #MHD_request_get_info_dynamic_sz() returns #MHD_SC_OK then this pointer
|
||||
* is NOT NULL and at least the username data is provided.
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_AUTH_BASIC_CREDS query
|
||||
*/
|
||||
const struct MHD_AuthBasicCreds *v_auth_basic_creds;
|
||||
};
|
||||
@@ -10524,7 +10491,8 @@ union MHD_RequestInfoDynamicData
|
||||
* Most of the data provided is available only when the request line or complete
|
||||
* request headers are processed and not available if responding has been
|
||||
* started.
|
||||
* The wrapper macro #MHD_request_get_info_dynamic() could be more convenient.
|
||||
*
|
||||
* The wrapper macro #MHD_request_get_info_dynamic() may be more convenient.
|
||||
*
|
||||
* Any pointers in the returned data are valid until any MHD_Action or
|
||||
* MHD_UploadAction is provided. If the data is needed beyond this point,
|
||||
@@ -10544,6 +10512,9 @@ union MHD_RequestInfoDynamicData
|
||||
* is being sent
|
||||
* #MHD_SC_TOO_EARLY if requested data is not yet ready (for example,
|
||||
* headers are not yet received),
|
||||
* #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the requested information is
|
||||
* not available for this request
|
||||
* due to used configuration/mode,
|
||||
* #MHD_SC_FEATURE_DISABLED if requested functionality is not supported
|
||||
* by this MHD build,
|
||||
* #MHD_SC_INFO_GET_BUFF_TOO_SMALL if @a output_buf_size is too small,
|
||||
@@ -10588,6 +10559,9 @@ MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_OUT_ (3);
|
||||
* is being sent
|
||||
* #MHD_SC_TOO_EARLY if requested data is not yet ready (for example,
|
||||
* headers are not yet received),
|
||||
* #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the requested information is
|
||||
* not available for this request
|
||||
* due to used configuration/mode,
|
||||
* #MHD_SC_FEATURE_DISABLED if requested functionality is not supported
|
||||
* by this MHD build,
|
||||
* #MHD_SC_AUTH_ABSENT if request does not have particular Auth data,
|
||||
|
||||
@@ -2806,7 +2806,7 @@ MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_OUT_SIZE_ (5,4);
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_DigestAuthUsernameType
|
||||
{
|
||||
/**
|
||||
* No username parameter in in Digest Authorization header.
|
||||
* No username parameter is in Digest Authorization header.
|
||||
* Not used currently. Value #MHD_SC_REQ_AUTH_DATA_BROKEN is returned
|
||||
* by #MHD_request_get_info_dynamic_sz() if the request has no username.
|
||||
*/
|
||||
@@ -3073,72 +3073,6 @@ struct MHD_AuthDigestInfo
|
||||
uint_fast32_t nc;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Information from Digest Authorization client's header.
|
||||
*
|
||||
* @see #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME
|
||||
*/
|
||||
struct MHD_AuthDigestUsernameInfo
|
||||
{
|
||||
/**
|
||||
* The algorithm as defined by client.
|
||||
* Set automatically to MD5 if not specified by client.
|
||||
*/
|
||||
enum MHD_DigestAuthAlgo algo;
|
||||
|
||||
/**
|
||||
* The type of username used by client.
|
||||
* The 'invalid' and 'missing' types are not used in this structure,
|
||||
* instead #MHD_SC_REQ_AUTH_DATA_BROKEN is returned when
|
||||
* #MHD_request_get_info_dynamic_sz() called with
|
||||
* #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME and the request has
|
||||
* a broken username data.
|
||||
*/
|
||||
enum MHD_DigestAuthUsernameType uname_type;
|
||||
|
||||
/**
|
||||
* The username string.
|
||||
* Used only if username type is standard or extended, always NULL otherwise.
|
||||
* If extended notation is used, this string is pct-decoded string
|
||||
* with charset and language tag removed (i.e. it is original username
|
||||
* extracted from the extended notation).
|
||||
* When userhash is used by the client, this member is NULL and
|
||||
* @a userhash_hex and @a userhash_bin are set.
|
||||
* The buffer pointed by the @a username becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
*/
|
||||
struct MHD_StringNullable username;
|
||||
|
||||
/**
|
||||
* The userhash string.
|
||||
* Valid only if username type is userhash.
|
||||
* This is unqoted string without decoding of the hexadecimal
|
||||
* digits (as provided by the client).
|
||||
* The buffer pointed by the @a userhash_hex becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
* @sa #MHD_digest_auth_calc_userhash_hex()
|
||||
*/
|
||||
struct MHD_StringNullable userhash_hex;
|
||||
|
||||
/**
|
||||
* The userhash decoded to binary form.
|
||||
* Used only if username type is userhash, always NULL otherwise.
|
||||
* When not NULL, this points to binary sequence @a userhash_hex_len /2 bytes
|
||||
* long.
|
||||
* The valid size should be #MHD_digest_get_hash_size() bytes.
|
||||
* The buffer pointed by the @a userhash_bin becomes invalid when a response
|
||||
* for the requested is provided (or request is aborted).
|
||||
* @warning This is a binary data, no zero termination.
|
||||
* @warning To avoid buffer overruns, always check the size of the data before
|
||||
* use, because @a userhash_bin can point even to zero-sized
|
||||
* data.
|
||||
* @sa #MHD_digest_auth_calc_userhash()
|
||||
*/
|
||||
const uint8_t *userhash_bin;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The result of digest authentication of the client.
|
||||
*
|
||||
@@ -5698,33 +5632,37 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
{
|
||||
/**
|
||||
* Get the HTTP method used for the request (as a MHD_String).
|
||||
* The result is placed in @a v_str member.
|
||||
* The resulting string pointer in valid only until a response is provided.
|
||||
* The result is placed in @a v_http_method_string member.
|
||||
* @sa #MHD_REQUEST_INFO_FIXED_HTTP_METHOD
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STR = 1
|
||||
MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STRING = 1
|
||||
,
|
||||
/**
|
||||
* Get the URI used for the request (as a MHD_String), excluding
|
||||
* the parameter part (anything after '?').
|
||||
* The result is placed in @a v_str member.
|
||||
* The resulting string pointer in valid only until a response is provided.
|
||||
* The result is placed in @a v_uri_string member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_URI = 2
|
||||
,
|
||||
/**
|
||||
* Get the number of GET parameters (the decoded part of the original
|
||||
* URI string after '?')
|
||||
* The result is placed in @a v_sizet member.
|
||||
* Get the number of URI parameters (the decoded part of the original
|
||||
* URI string after '?'). Sometimes it is called "GET parameters".
|
||||
* The result is placed in @a v_number_uri_params_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_GET_PARAMS = 3
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_URI_PARAMS = 3
|
||||
,
|
||||
/**
|
||||
* Get the number of cookies in the request.
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_number_cookies_sizet member.
|
||||
* If cookies parsing is disabled in MHD build then the function returns
|
||||
* error code #MHD_SC_FEATURE_DISABLED.
|
||||
* If cookies parsing is disabled this daemon then the function returns
|
||||
* error code #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_COOKIES = 4
|
||||
@@ -5732,14 +5670,14 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
/**
|
||||
* Return length of the client's HTTP request header.
|
||||
* This is a total raw size of the header (after TLS decipher if any)
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_header_size_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE = 5
|
||||
,
|
||||
/**
|
||||
* Get the number of decoded POST entries in the request.
|
||||
* The result is placed in @a v_sizet member.
|
||||
* The result is placed in @a v_number_post_params_sizet member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_NUMBER_POST_PARAMS = 6
|
||||
@@ -5748,7 +5686,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get whether the upload content is present in the request.
|
||||
* The result is #MHD_YES if any upload content is present, even
|
||||
* if the upload content size is zero.
|
||||
* The result is placed in @a v_bool member.
|
||||
* The result is placed in @a v_upload_present_bool member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_PRESENT = 10
|
||||
@@ -5756,7 +5694,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
/**
|
||||
* Get whether the chunked upload content is present in the request.
|
||||
* The result is #MHD_YES if chunked upload content is present.
|
||||
* The result is placed in @a v_bool member.
|
||||
* The result is placed in @a v_upload_chunked_bool member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_CHUNKED = 11
|
||||
@@ -5765,7 +5703,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total content upload size.
|
||||
* Resulted in zero if no content upload or upload content size is zero,
|
||||
* #MHD_SIZE_UNKNOWN if size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_total_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TOTAL = 12
|
||||
@@ -5774,7 +5712,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total size of the content upload already received from the client.
|
||||
* This is the total size received, could be not yet fully processed by the
|
||||
* application.
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_recieved_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_RECIEVED = 13
|
||||
@@ -5783,7 +5721,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* Get the total size of the content upload left to be received from
|
||||
* the client.
|
||||
* Resulted in #MHD_SIZE_UNKNOWN if total size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_to_recieve_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_RECIEVE = 14
|
||||
@@ -5793,7 +5731,7 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* called and completed (if any)).
|
||||
* If the value is requested from #MHD_UploadCallback, then result does NOT
|
||||
* include the current data being processed by the callback.
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_processed_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_PROCESSED = 15
|
||||
@@ -5805,23 +5743,11 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoDynamicType
|
||||
* If the value is requested from #MHD_UploadCallback, then result includes
|
||||
* the current data being processed by the callback.
|
||||
* Resulted in #MHD_SIZE_UNKNOWN if total size is not known (chunked upload).
|
||||
* The result is placed in @a v_uint64 member.
|
||||
* The result is placed in @a v_upload_size_to_process_uint64 member.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_PROCESS = 16
|
||||
,
|
||||
/**
|
||||
* Returns pointer to information about username in client's digest auth
|
||||
* request.
|
||||
* The resulting pointer is NULL if no digest auth header is set by
|
||||
* the client, the format of the digest auth header is broken, no
|
||||
* username is provided or the format of the username parameter is broken.
|
||||
* Pointers in the returned structure (if any) are valid until response
|
||||
* is provided for the request.
|
||||
* The result is placed in @a v_auth_digest_uname member.
|
||||
*/
|
||||
MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME = 41
|
||||
,
|
||||
/**
|
||||
* Returns pointer to information about digest auth in client request.
|
||||
* The resulting pointer is NULL if no digest auth header is set by
|
||||
@@ -5861,36 +5787,77 @@ union MHD_RequestInfoDynamicData
|
||||
{
|
||||
|
||||
/**
|
||||
* The MHD String type
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STRING query
|
||||
*/
|
||||
struct MHD_String v_str;
|
||||
/**
|
||||
* The size_t type
|
||||
*/
|
||||
size_t v_sizet;
|
||||
/**
|
||||
* The boolean type
|
||||
*/
|
||||
enum MHD_Bool v_bool;
|
||||
/**
|
||||
* The unsigned 64 bits integer
|
||||
*/
|
||||
uint_fast64_t v_uint64;
|
||||
struct MHD_String v_http_method_string;
|
||||
|
||||
/**
|
||||
* The information about client provided username for digest auth
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_URI query
|
||||
*/
|
||||
const struct MHD_AuthDigestUsernameInfo *v_auth_digest_uname;
|
||||
struct MHD_String v_uri_string;
|
||||
|
||||
/**
|
||||
* The information about client's digest auth
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_URI_PARAMS query
|
||||
*/
|
||||
size_t v_number_uri_params_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_COOKIES query
|
||||
*/
|
||||
size_t v_number_cookies_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE query
|
||||
*/
|
||||
size_t v_header_size_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_NUMBER_POST_PARAMS query
|
||||
*/
|
||||
size_t v_number_post_params_sizet;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_PRESENT query
|
||||
*/
|
||||
enum MHD_Bool v_upload_present_bool;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_CHUNKED query
|
||||
*/
|
||||
enum MHD_Bool v_upload_chunked_bool;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TOTAL query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_total_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_RECIEVED query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_recieved_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_RECIEVE query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_to_recieve_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_PROCESSED query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_processed_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_PROCESS query
|
||||
*/
|
||||
uint_fast64_t v_upload_size_to_process_uint64;
|
||||
|
||||
/**
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_INFO query
|
||||
*/
|
||||
const struct MHD_AuthDigestInfo *v_auth_digest_info;
|
||||
|
||||
/**
|
||||
* The username and password provided by the client's basic auth header.
|
||||
* If #MHD_request_get_info_dynamic_sz() returns #MHD_SC_OK then this pointer
|
||||
* is NOT NULL and at least the username data is provided.
|
||||
* The data for the #MHD_REQUEST_INFO_DYNAMIC_AUTH_BASIC_CREDS query
|
||||
*/
|
||||
const struct MHD_AuthBasicCreds *v_auth_basic_creds;
|
||||
};
|
||||
@@ -5902,7 +5869,8 @@ union MHD_RequestInfoDynamicData
|
||||
* Most of the data provided is available only when the request line or complete
|
||||
* request headers are processed and not available if responding has been
|
||||
* started.
|
||||
* The wrapper macro #MHD_request_get_info_dynamic() could be more convenient.
|
||||
*
|
||||
* The wrapper macro #MHD_request_get_info_dynamic() may be more convenient.
|
||||
*
|
||||
* Any pointers in the returned data are valid until any MHD_Action or
|
||||
* MHD_UploadAction is provided. If the data is needed beyond this point,
|
||||
@@ -5922,6 +5890,9 @@ union MHD_RequestInfoDynamicData
|
||||
* is being sent
|
||||
* #MHD_SC_TOO_EARLY if requested data is not yet ready (for example,
|
||||
* headers are not yet received),
|
||||
* #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the requested information is
|
||||
* not available for this request
|
||||
* due to used configuration/mode,
|
||||
* #MHD_SC_FEATURE_DISABLED if requested functionality is not supported
|
||||
* by this MHD build,
|
||||
* #MHD_SC_INFO_GET_BUFF_TOO_SMALL if @a output_buf_size is too small,
|
||||
@@ -5966,6 +5937,9 @@ MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_OUT_ (3);
|
||||
* is being sent
|
||||
* #MHD_SC_TOO_EARLY if requested data is not yet ready (for example,
|
||||
* headers are not yet received),
|
||||
* #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the requested information is
|
||||
* not available for this request
|
||||
* due to used configuration/mode,
|
||||
* #MHD_SC_FEATURE_DISABLED if requested functionality is not supported
|
||||
* by this MHD build,
|
||||
* #MHD_SC_AUTH_ABSENT if request does not have particular Auth data,
|
||||
|
||||
+2
-96
@@ -1011,7 +1011,7 @@ get_rq_extended_uname_copy_z (const char *restrict uname_ext,
|
||||
static size_t
|
||||
get_rq_uname (const struct mhd_AuthDigesReqParams *restrict params,
|
||||
enum MHD_DigestAuthUsernameType uname_type,
|
||||
struct MHD_AuthDigestUsernameInfo *restrict uname_info,
|
||||
struct MHD_AuthDigestInfo *restrict uname_info,
|
||||
uint8_t *restrict buf,
|
||||
size_t buf_size)
|
||||
{
|
||||
@@ -1167,95 +1167,6 @@ get_rq_nc (const struct mhd_AuthDigesReqParams *params,
|
||||
}
|
||||
|
||||
|
||||
static MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_
|
||||
enum MHD_StatusCode
|
||||
find_and_parse_auth_digest_uname (struct MHD_Request *restrict req)
|
||||
{
|
||||
enum MHD_StatusCode res;
|
||||
struct MHD_AuthDigestUsernameInfo *uname_info;
|
||||
enum MHD_DigestAuthUsernameType uname_type;
|
||||
size_t unif_buf_size;
|
||||
uint8_t *unif_buf_ptr;
|
||||
size_t unif_buf_used;
|
||||
|
||||
mhd_assert (NULL == req->auth.digest.info);
|
||||
mhd_assert (NULL == req->auth.digest.uname);
|
||||
|
||||
res = get_rq_auth_digest_params (req);
|
||||
if (MHD_SC_OK != res)
|
||||
return res;
|
||||
|
||||
mhd_assert (NULL != req->auth.digest.rqp);
|
||||
|
||||
uname_type = get_rq_uname_type (req->auth.digest.rqp);
|
||||
if ( (MHD_DIGEST_AUTH_UNAME_TYPE_MISSING == uname_type) ||
|
||||
(MHD_DIGEST_AUTH_UNAME_TYPE_INVALID == uname_type) )
|
||||
return MHD_SC_REQ_AUTH_DATA_BROKEN;
|
||||
|
||||
unif_buf_size = get_rq_unames_size (req->auth.digest.rqp, uname_type);
|
||||
|
||||
uname_info =
|
||||
(struct MHD_AuthDigestUsernameInfo *)
|
||||
mhd_stream_alloc_memory (mhd_CNTNR_PTR (req, struct MHD_Connection, rq),
|
||||
(sizeof(struct MHD_AuthDigestUsernameInfo))
|
||||
+ unif_buf_size);
|
||||
if (NULL == uname_info)
|
||||
return MHD_SC_CONNECTION_POOL_NO_MEM_AUTH_DATA;
|
||||
memset (uname_info,
|
||||
0,
|
||||
(sizeof(struct MHD_AuthDigestUsernameInfo)) + unif_buf_size);
|
||||
#ifndef HAVE_NULL_PTR_ALL_ZEROS
|
||||
uname_info->username.cstr = NULL;
|
||||
uname_info->userhash_hex.cstr = NULL;
|
||||
uname_info->userhash_bin = NULL;
|
||||
#endif
|
||||
|
||||
uname_info->algo = req->auth.digest.rqp->algo;
|
||||
unif_buf_ptr = (uint8_t *) (uname_info + 1);
|
||||
unif_buf_used = get_rq_uname (req->auth.digest.rqp,
|
||||
uname_type, uname_info,
|
||||
unif_buf_ptr,
|
||||
unif_buf_size);
|
||||
mhd_assert (unif_buf_size >= unif_buf_used);
|
||||
(void) unif_buf_used; /* Mute compiler warning on non-debug builds */
|
||||
mhd_assert (MHD_DIGEST_AUTH_UNAME_TYPE_MISSING != uname_info->uname_type);
|
||||
|
||||
req->auth.digest.uname = uname_info;
|
||||
if (MHD_DIGEST_AUTH_UNAME_TYPE_INVALID == uname_info->uname_type)
|
||||
return MHD_SC_REQ_AUTH_DATA_BROKEN;
|
||||
mhd_assert (uname_type == uname_info->uname_type);
|
||||
|
||||
return MHD_SC_OK;
|
||||
}
|
||||
|
||||
|
||||
MHD_INTERNAL MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_
|
||||
MHD_FN_PAR_OUT_ (2) enum MHD_StatusCode
|
||||
mhd_request_get_auth_digest_username (
|
||||
struct MHD_Request *restrict req,
|
||||
const struct MHD_AuthDigestUsernameInfo **restrict v_auth_digest_uname)
|
||||
{
|
||||
mhd_assert (mhd_HTTP_STAGE_HEADERS_PROCESSED <= \
|
||||
mhd_CNTNR_CPTR (req, struct MHD_Connection, rq)->stage);
|
||||
mhd_assert (mhd_HTTP_STAGE_REQ_RECV_FINISHED >= \
|
||||
mhd_CNTNR_CPTR (req, struct MHD_Connection, rq)->stage);
|
||||
|
||||
if (MHD_SC_OK != req->auth.digest.parse_result)
|
||||
return req->auth.digest.parse_result;
|
||||
|
||||
if (NULL == req->auth.digest.uname)
|
||||
req->auth.digest.parse_result = find_and_parse_auth_digest_uname (req);
|
||||
|
||||
if (MHD_SC_OK != req->auth.digest.parse_result)
|
||||
return req->auth.digest.parse_result; /* Failure exit point */
|
||||
|
||||
mhd_assert (NULL != req->auth.digest.uname);
|
||||
*v_auth_digest_uname = req->auth.digest.uname;
|
||||
|
||||
return MHD_SC_OK; /* Success exit point */
|
||||
}
|
||||
|
||||
|
||||
static MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_
|
||||
enum MHD_StatusCode
|
||||
find_and_parse_auth_digest_info (struct MHD_Request *restrict req)
|
||||
@@ -1312,8 +1223,7 @@ find_and_parse_auth_digest_info (struct MHD_Request *restrict req)
|
||||
if ( (MHD_DIGEST_AUTH_UNAME_TYPE_MISSING != uname_type) &&
|
||||
(MHD_DIGEST_AUTH_UNAME_TYPE_INVALID != uname_type) )
|
||||
unif_buf_used +=
|
||||
get_rq_uname (req->auth.digest.rqp, uname_type,
|
||||
(struct MHD_AuthDigestUsernameInfo *) info,
|
||||
get_rq_uname (req->auth.digest.rqp, uname_type, info,
|
||||
unif_buf_ptr + unif_buf_used,
|
||||
unif_buf_size - unif_buf_used);
|
||||
else
|
||||
@@ -1363,11 +1273,8 @@ find_and_parse_auth_digest_info (struct MHD_Request *restrict req)
|
||||
}
|
||||
|
||||
req->auth.digest.info = info;
|
||||
if (NULL == req->auth.digest.uname)
|
||||
req->auth.digest.uname = (struct MHD_AuthDigestUsernameInfo *) info;
|
||||
|
||||
mhd_assert (uname_type == info->uname_type);
|
||||
mhd_assert (uname_type == req->auth.digest.uname->uname_type);
|
||||
|
||||
if ((MHD_DIGEST_AUTH_UNAME_TYPE_MISSING == uname_type) ||
|
||||
(MHD_DIGEST_AUTH_UNAME_TYPE_INVALID == uname_type) ||
|
||||
@@ -1399,7 +1306,6 @@ mhd_request_get_auth_digest_info (
|
||||
return req->auth.digest.parse_result; /* Failure exit point */
|
||||
|
||||
mhd_assert (NULL != req->auth.digest.info);
|
||||
mhd_assert (NULL != req->auth.digest.uname);
|
||||
*v_auth_digest_info = req->auth.digest.info;
|
||||
|
||||
return MHD_SC_OK; /* Success exit point */
|
||||
|
||||
@@ -56,19 +56,6 @@ mhd_auth_digest_get_new_nonce (struct MHD_Connection *restrict c,
|
||||
char out_buf[mhd_AUTH_DIGEST_NONCE_LEN])
|
||||
MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_ (2);
|
||||
|
||||
/**
|
||||
* Find in request and parse Digest Authentication username information
|
||||
* @param req the request to use
|
||||
* @param[out] v_auth_digest_username the pointer to set to the found data
|
||||
* @return #MHD_SC_OK on success,
|
||||
* error code otherwise
|
||||
*/
|
||||
MHD_INTERNAL enum MHD_StatusCode
|
||||
mhd_request_get_auth_digest_username (
|
||||
struct MHD_Request *restrict req,
|
||||
const struct MHD_AuthDigestUsernameInfo **restrict v_auth_digest_uname)
|
||||
MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_ (2);
|
||||
|
||||
/**
|
||||
* Find in request and parse Digest Authentication information
|
||||
* @param req the request to use
|
||||
|
||||
@@ -348,12 +348,6 @@ struct mhd_ReqAuthDigestData
|
||||
* NULL if not yet parsed or not found.
|
||||
*/
|
||||
struct MHD_AuthDigestInfo *info;
|
||||
/**
|
||||
* The information about client's provided username.
|
||||
* May point to the same address as @a info.
|
||||
* NULL if not yet parsed or not found.
|
||||
*/
|
||||
struct MHD_AuthDigestUsernameInfo *uname;
|
||||
};
|
||||
#endif /* MHD_SUPPORT_AUTH_DIGEST */
|
||||
|
||||
|
||||
+48
-58
@@ -43,6 +43,10 @@
|
||||
# include "auth_digest.h"
|
||||
#endif
|
||||
|
||||
#ifdef MHD_SUPPORT_COOKIES
|
||||
# include "mhd_daemon.h"
|
||||
#endif
|
||||
|
||||
#include "mhd_public_api.h"
|
||||
|
||||
MHD_EXTERN_ MHD_FN_MUST_CHECK_RESULT_
|
||||
@@ -123,7 +127,7 @@ MHD_request_get_info_dynamic_sz (
|
||||
{
|
||||
switch (info_type)
|
||||
{
|
||||
case MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STR:
|
||||
case MHD_REQUEST_INFO_DYNAMIC_HTTP_METHOD_STRING:
|
||||
if (mhd_HTTP_STAGE_REQ_RECV_FINISHED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
@@ -131,9 +135,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (0 == request->method.len)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_str) > output_buf_size)
|
||||
if (sizeof(output_buf->v_http_method_string) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_str = request->method;
|
||||
output_buf->v_http_method_string = request->method;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_URI:
|
||||
if (mhd_HTTP_STAGE_REQ_LINE_RECEIVED >
|
||||
@@ -146,12 +150,12 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (sizeof(output_buf->v_str) > output_buf_size)
|
||||
if (sizeof(output_buf->v_uri_string) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_str.cstr = request->url;
|
||||
output_buf->v_str.len = request->url_len;
|
||||
output_buf->v_uri_string.cstr = request->url;
|
||||
output_buf->v_uri_string.len = request->url_len;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_NUMBER_GET_PARAMS:
|
||||
case MHD_REQUEST_INFO_DYNAMIC_NUMBER_URI_PARAMS:
|
||||
if (mhd_HTTP_STAGE_REQ_LINE_RECEIVED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
@@ -162,15 +166,20 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (sizeof(output_buf->v_sizet) > output_buf_size)
|
||||
if (sizeof(output_buf->v_number_uri_params_sizet) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_sizet =
|
||||
output_buf->v_number_uri_params_sizet =
|
||||
MHD_request_get_values_cb (request,
|
||||
MHD_VK_GET_ARGUMENT,
|
||||
NULL,
|
||||
NULL);
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_NUMBER_COOKIES:
|
||||
#ifdef MHD_SUPPORT_COOKIES
|
||||
if (mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
rq)->daemon->req_cfg.disable_cookies)
|
||||
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
@@ -181,18 +190,18 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (sizeof(output_buf->v_sizet) > output_buf_size)
|
||||
if (sizeof(output_buf->v_number_cookies_sizet) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
#ifdef MHD_SUPPORT_COOKIES
|
||||
output_buf->v_sizet =
|
||||
output_buf->v_number_cookies_sizet =
|
||||
MHD_request_get_values_cb (request,
|
||||
MHD_VK_COOKIE,
|
||||
NULL,
|
||||
NULL);
|
||||
#else
|
||||
output_buf->v_sizet = 0;
|
||||
#endif
|
||||
return MHD_SC_OK;
|
||||
#else
|
||||
return MHD_SC_FEATURE_DISABLED;
|
||||
#endif
|
||||
break;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_HEADER_SIZE:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
@@ -204,11 +213,12 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (sizeof(output_buf->v_sizet) > output_buf_size)
|
||||
if (sizeof(output_buf->v_header_size_sizet) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_sizet = request->header_size;
|
||||
output_buf->v_header_size_sizet = request->header_size;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_NUMBER_POST_PARAMS:
|
||||
#ifdef MHD_SUPPORT_POST_PARSER
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
@@ -219,27 +229,28 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
if (sizeof(output_buf->v_sizet) > output_buf_size)
|
||||
if (sizeof(output_buf->v_number_post_params_sizet) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
#ifdef MHD_SUPPORT_POST_PARSER
|
||||
output_buf->v_sizet =
|
||||
output_buf->v_number_post_params_sizet =
|
||||
MHD_request_get_values_cb (request,
|
||||
MHD_VK_POSTDATA,
|
||||
NULL,
|
||||
NULL);
|
||||
#else
|
||||
output_buf->v_sizet = 0;
|
||||
#endif
|
||||
return MHD_SC_OK;
|
||||
#else
|
||||
return MHD_SC_FEATURE_DISABLED;
|
||||
#endif
|
||||
break;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_PRESENT:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_bool) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_present_bool) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_bool = request->cntn.cntn_present ? MHD_YES : MHD_NO;
|
||||
output_buf->v_upload_present_bool =
|
||||
request->cntn.cntn_present ? MHD_YES : MHD_NO;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_CHUNKED:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
@@ -247,9 +258,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_bool) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_chunked_bool) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_bool =
|
||||
output_buf->v_upload_chunked_bool =
|
||||
(MHD_SIZE_UNKNOWN == request->cntn.cntn_size) ? MHD_YES : MHD_NO;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TOTAL:
|
||||
@@ -258,9 +269,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_uint64) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_size_total_uint64) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_uint64 = request->cntn.cntn_size;
|
||||
output_buf->v_upload_size_total_uint64 = request->cntn.cntn_size;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_RECIEVED:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
@@ -268,9 +279,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_uint64) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_size_recieved_uint64) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_uint64 = request->cntn.recv_size;
|
||||
output_buf->v_upload_size_recieved_uint64 = request->cntn.recv_size;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_RECIEVE:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
@@ -278,9 +289,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_uint64) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_size_to_recieve_uint64) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_uint64 =
|
||||
output_buf->v_upload_size_to_recieve_uint64 =
|
||||
(MHD_SIZE_UNKNOWN == request->cntn.cntn_size) ?
|
||||
MHD_SIZE_UNKNOWN : (request->cntn.cntn_size - request->cntn.recv_size);
|
||||
return MHD_SC_OK;
|
||||
@@ -290,9 +301,9 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_uint64) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_size_processed_uint64) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_uint64 = request->cntn.proc_size;
|
||||
output_buf->v_upload_size_processed_uint64 = request->cntn.proc_size;
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_UPLOAD_SIZE_TO_PROCESS:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
@@ -300,33 +311,12 @@ MHD_request_get_info_dynamic_sz (
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (sizeof(output_buf->v_uint64) > output_buf_size)
|
||||
if (sizeof(output_buf->v_upload_size_to_process_uint64) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
output_buf->v_uint64 =
|
||||
output_buf->v_upload_size_to_process_uint64 =
|
||||
(MHD_SIZE_UNKNOWN == request->cntn.cntn_size) ?
|
||||
MHD_SIZE_UNKNOWN : (request->cntn.cntn_size - request->cntn.proc_size);
|
||||
return MHD_SC_OK;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_USERNAME:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_EARLY;
|
||||
if (mhd_HTTP_STAGE_REQ_RECV_FINISHED <
|
||||
mhd_CNTNR_PTR (request, \
|
||||
struct MHD_Connection, \
|
||||
rq)->stage)
|
||||
return MHD_SC_TOO_LATE;
|
||||
#ifdef MHD_SUPPORT_AUTH_DIGEST
|
||||
if (sizeof(output_buf->v_auth_basic_creds) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
return mhd_request_get_auth_digest_username (request,
|
||||
&(output_buf->
|
||||
v_auth_digest_uname));
|
||||
#else /* ! MHD_SUPPORT_AUTH_DIGEST */
|
||||
return MHD_SC_FEATURE_DISABLED;
|
||||
#endif /* ! MHD_SUPPORT_AUTH_DIGEST */
|
||||
break;
|
||||
case MHD_REQUEST_INFO_DYNAMIC_AUTH_DIGEST_INFO:
|
||||
if (mhd_HTTP_STAGE_HEADERS_PROCESSED >
|
||||
mhd_CNTNR_PTR (request, \
|
||||
|
||||
Reference in New Issue
Block a user