mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-27 04:09:31 +03:00
Updated POST-related API
This commit is contained in:
+74
-49
@@ -638,6 +638,12 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_INVALID = 40163
|
||||
,
|
||||
/**
|
||||
* The request does not have "Content-Type:" header and POST data cannot
|
||||
* be parsed
|
||||
*/
|
||||
MHD_SC_REQ_POST_PARSE_FAILED_NO_CNTN_TYPE = 40180
|
||||
,
|
||||
/**
|
||||
* The request cannot be processed. Sending error reply.
|
||||
*/
|
||||
@@ -1577,7 +1583,6 @@ MHD_FN_CONST_;
|
||||
* See also: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-2
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_HTTP_PostEncoding
|
||||
{
|
||||
/**
|
||||
@@ -3341,35 +3346,43 @@ struct MHD_EarlyUriCbData
|
||||
struct MHD_Request *request;
|
||||
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* Modifiable. Initially to NULL.
|
||||
* The full URI ("request target") from the HTTP request, including URI
|
||||
* parameters (the part after '?')
|
||||
*/
|
||||
void *request_app_context;
|
||||
struct MHD_String full_uri;
|
||||
|
||||
/**
|
||||
* The request HTTP method
|
||||
*/
|
||||
enum MHD_HTTP_Method method;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function called by MHD to allow the application to log the @a full_uri
|
||||
* of the new request.
|
||||
* If this callback is set then it is the first application function called
|
||||
* for the new request.
|
||||
* This is the only moment when unmodified URI is provided.
|
||||
* After this callback MHD parses the URI and modifies it by extracting
|
||||
* GET parameters in-place.
|
||||
* If #MHD_RequestTerminationCallback is set then it is guaranteed that
|
||||
* #MHD_RequestTerminationCallback is called for the same request. Application
|
||||
*
|
||||
* If this callback is set then it is the first application function called
|
||||
* for the new request.
|
||||
*
|
||||
* If #MHD_RequestEndedCallback is also set then it is guaranteed that
|
||||
* #MHD_RequestEndedCallback is called for the same request. Application
|
||||
* may allocate request specific data in this callback and de-allocate
|
||||
* the data in #MHD_RequestTerminationCallback.
|
||||
* the data in #MHD_RequestEndedCallback.
|
||||
*
|
||||
* @param cls client-defined closure
|
||||
* @param full_uri the full URI ("request target") from the HTTP request
|
||||
* including parameters (the part after '?')
|
||||
* @param[in,out] req_data the request data
|
||||
* @param req_data the request data
|
||||
* @param request_app_context_ptr the pointer to variable that can be set to
|
||||
* the application context for the request;
|
||||
* initially the variable set to NULL
|
||||
*/
|
||||
typedef void
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_INOUT_ (3)
|
||||
(MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_INOUT_ (3)
|
||||
*MHD_EarlyUriLogCallback)(void *cls,
|
||||
const struct MHD_String *full_uri,
|
||||
struct MHD_EarlyUriCbData *req_data);
|
||||
const struct MHD_EarlyUriCbData *req_data,
|
||||
void **request_app_context_ptr);
|
||||
|
||||
|
||||
/**
|
||||
@@ -3531,31 +3544,31 @@ typedef void
|
||||
|
||||
|
||||
/**
|
||||
* The `enum MHD_RequestTerminationCode` specifies reasons
|
||||
* why a request has been terminated (or completed).
|
||||
* The `enum MHD_RequestEndedCode` specifies reasons
|
||||
* why a request has been ended.
|
||||
* @ingroup request
|
||||
*/
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestTerminationCode
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestEndedCode
|
||||
{
|
||||
|
||||
/**
|
||||
* The response was successfully sent.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_COMPLETED_OK = 0
|
||||
MHD_REQUEST_ENDED_COMPLETED_OK = 0
|
||||
,
|
||||
/**
|
||||
* No activity on the connection for the number of seconds specified using
|
||||
* #MHD_C_OPTION_TIMEOUT().
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 10
|
||||
MHD_REQUEST_ENDED_TIMEOUT_REACHED = 10
|
||||
,
|
||||
/**
|
||||
* The connection was broken or TLS protocol error.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CONNECTION_ERROR = 20
|
||||
MHD_REQUEST_ENDED_CONNECTION_ERROR = 20
|
||||
,
|
||||
/**
|
||||
* The client terminated the connection by closing the socket either
|
||||
@@ -3563,44 +3576,44 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestTerminationCode
|
||||
* request.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CLIENT_ABORT = 30
|
||||
MHD_REQUEST_ENDED_CLIENT_ABORT = 30
|
||||
,
|
||||
/**
|
||||
* The request is not valid according to
|
||||
* HTTP specifications.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_HTTP_PROTOCOL_ERROR = 31
|
||||
MHD_REQUEST_ENDED_HTTP_PROTOCOL_ERROR = 31
|
||||
,
|
||||
/**
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ABORT = 40
|
||||
MHD_REQUEST_ENDED_BY_APP_ABORT = 40
|
||||
,
|
||||
/**
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ERROR = 41
|
||||
MHD_REQUEST_ENDED_BY_APP_ERROR = 41
|
||||
,
|
||||
/**
|
||||
* Error handling the connection due to resources exhausted.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_NO_RESOURCES = 50
|
||||
MHD_REQUEST_ENDED_NO_RESOURCES = 50
|
||||
,
|
||||
/**
|
||||
* Closing the session since MHD is being shut down.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 60
|
||||
MHD_REQUEST_ENDED_DAEMON_SHUTDOWN = 60
|
||||
};
|
||||
|
||||
/**
|
||||
* Additional information about request termination
|
||||
* Additional information about request ending
|
||||
*/
|
||||
union MHD_RequestTerminationDetail
|
||||
union MHD_RequestEndedDetail
|
||||
{
|
||||
/**
|
||||
* Reserved member.
|
||||
@@ -3612,21 +3625,21 @@ union MHD_RequestTerminationDetail
|
||||
/**
|
||||
* Request termination data structure
|
||||
*/
|
||||
struct MHD_RequestTerminationData
|
||||
struct MHD_RequestEndedData
|
||||
{
|
||||
/**
|
||||
* The request handle.
|
||||
* Note that most of the request data may be already unvailable.
|
||||
*/
|
||||
struct MHD_Request *req;
|
||||
/**
|
||||
* The code of the event
|
||||
*/
|
||||
enum MHD_RequestTerminationCode code;
|
||||
enum MHD_RequestEndedCode code;
|
||||
/**
|
||||
* Detailed information about termination event
|
||||
* Detailed information about the event
|
||||
*/
|
||||
union MHD_RequestTerminationDetail details;
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* NULL unless other value set by application when processing the request.
|
||||
*/
|
||||
void *request_app_context;
|
||||
union MHD_RequestEndedDetail details;
|
||||
};
|
||||
|
||||
|
||||
@@ -3634,16 +3647,20 @@ struct MHD_RequestTerminationData
|
||||
* Signature of the callback used by MHD to notify the application
|
||||
* about completed requests.
|
||||
*
|
||||
* This is the last callback called for any request (if provided by
|
||||
* the application).
|
||||
*
|
||||
* @param cls client-defined closure
|
||||
* @param data the details about the event
|
||||
* @param request_context request context value, as originally
|
||||
* returned by the #MHD_EarlyUriLogCallback
|
||||
* @param request_app_context the application request context, as possibly set
|
||||
by the #MHD_EarlyUriLogCallback
|
||||
* @see #MHD_R_OPTION_TERMINATION_CALLBACK()
|
||||
* @ingroup request
|
||||
*/
|
||||
typedef void
|
||||
(*MHD_RequestTerminationCallback) (void *cls,
|
||||
struct MHD_RequestTerminationData *data);
|
||||
(*MHD_RequestEndedCallback) (void *cls,
|
||||
const struct MHD_RequestEndedData *data,
|
||||
void *request_app_context);
|
||||
|
||||
|
||||
#include "microhttpd2_generated_response_options.h"
|
||||
@@ -4268,15 +4285,15 @@ MHD_R_OPTION_INSANITY_HEADER_CONTENT_LENGTH (
|
||||
|
||||
/**
|
||||
* Set a function to be called once MHD is finished with the request.
|
||||
* @param term_cb the function to call,
|
||||
* @param ended_cb the function to call,
|
||||
* NULL to not use the callback
|
||||
* @param term_cb_cls the closure for the callback
|
||||
* @param ended_cb_cls the closure for the callback
|
||||
* @return structure with the requested setting
|
||||
*/
|
||||
struct MHD_ResponseOptionAndValue
|
||||
MHD_R_OPTION_TERMINATION_CALLBACK (
|
||||
MHD_RequestTerminationCallback term_cb,
|
||||
void *term_cb_cls
|
||||
MHD_RequestEndedCallback ended_cb,
|
||||
void *ended_cb_cls
|
||||
);
|
||||
|
||||
/* End of generated code documenting how to use options */
|
||||
@@ -6163,6 +6180,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* This callback is called to incrementally process parsed POST data sent by
|
||||
* the client.
|
||||
*
|
||||
* @param req the request
|
||||
* @param cls user-specified closure
|
||||
* @param name 0-terminated key for the value
|
||||
* @param filename name of the uploaded file, NULL if not known
|
||||
@@ -6183,7 +6201,10 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @ingroup action
|
||||
*/
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataReader) (void *cls,
|
||||
(MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_NONNULL_ (4)
|
||||
MHD_FN_PAR_NONNULL_ (5) MHD_FN_PAR_NONNULL_ (6)
|
||||
*MHD_PostDataReader) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
const struct MHD_String *name,
|
||||
const struct MHD_StringNullable *filename,
|
||||
const struct MHD_StringNullable *content_type,
|
||||
@@ -6198,11 +6219,15 @@ typedef const struct MHD_UploadAction *
|
||||
* of the postprocessor upload data.
|
||||
* @param req the request
|
||||
* @param cls the closure
|
||||
* @param parsing_result the result of POST data parsing: MHD_SC_OK,
|
||||
MHD_SC_REQ_POST_PARSE_FAILED_NO_CNTN_TYPE or ...
|
||||
* @return the action to proceed
|
||||
*/
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls);
|
||||
(MHD_FN_PAR_NONNULL_ (1)
|
||||
*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
enum MHD_StatusCode parsing_result);
|
||||
|
||||
#define MHD_POST_DATA_READER_DEFINED 1
|
||||
#endif /* ! MHD_POST_DATA_READER_DEFINED */
|
||||
|
||||
@@ -98,18 +98,18 @@ With this option HTTP/1.0 server is emulated (with support for 'keep-alive' conn
|
||||
/**
|
||||
* Data for #MHD_R_O_TERMINATION_CALLBACK
|
||||
*/
|
||||
struct MHD_ResponeOptionValueTermCB
|
||||
struct MHD_ResponeOptionValueEndedCB
|
||||
{
|
||||
/**
|
||||
* the function to call,
|
||||
* NULL to not use the callback
|
||||
*/
|
||||
MHD_RequestTerminationCallback v_term_cb;
|
||||
MHD_RequestEndedCallback v_ended_cb;
|
||||
|
||||
/**
|
||||
* the closure for the callback
|
||||
*/
|
||||
void *v_term_cb_cls;
|
||||
void *v_ended_cb_cls;
|
||||
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ union MHD_ResponseOptionValue
|
||||
* the function to call,
|
||||
* NULL to not use the callback
|
||||
*/
|
||||
struct MHD_ResponeOptionValueTermCB termination_callback;
|
||||
struct MHD_ResponeOptionValueEndedCB termination_callback;
|
||||
|
||||
};
|
||||
|
||||
@@ -291,18 +291,18 @@ With this option HTTP/1.0 server is emulated (with support for 'keep-alive' conn
|
||||
MHD_RESTORE_WARN_COMPOUND_LITERALS_
|
||||
/**
|
||||
* Set a function to be called once MHD is finished with the request.
|
||||
* @param term_cb the function to call,
|
||||
* @param ended_cb the function to call,
|
||||
* NULL to not use the callback
|
||||
* @param term_cb_cls the closure for the callback
|
||||
* @param ended_cb_cls the closure for the callback
|
||||
* @return structure with the requested setting
|
||||
*/
|
||||
# define MHD_R_OPTION_TERMINATION_CALLBACK(term_cb,term_cb_cls) \
|
||||
# define MHD_R_OPTION_TERMINATION_CALLBACK(ended_cb,ended_cb_cls) \
|
||||
MHD_NOWARN_COMPOUND_LITERALS_ \
|
||||
(const struct MHD_ResponseOptionAndValue) \
|
||||
{ \
|
||||
.opt = MHD_R_O_TERMINATION_CALLBACK, \
|
||||
.val.termination_callback.v_term_cb = (term_cb), \
|
||||
.val.termination_callback.v_term_cb_cls = (term_cb_cls) \
|
||||
.val.termination_callback.v_ended_cb = (ended_cb), \
|
||||
.val.termination_callback.v_ended_cb_cls = (ended_cb_cls) \
|
||||
} \
|
||||
MHD_RESTORE_WARN_COMPOUND_LITERALS_
|
||||
|
||||
@@ -476,22 +476,22 @@ MHD_R_OPTION_INSANITY_HEADER_CONTENT_LENGTH (
|
||||
|
||||
/**
|
||||
* Set a function to be called once MHD is finished with the request.
|
||||
* @param term_cb the function to call,
|
||||
* @param ended_cb the function to call,
|
||||
* NULL to not use the callback
|
||||
* @param term_cb_cls the closure for the callback
|
||||
* @param ended_cb_cls the closure for the callback
|
||||
* @return structure with the requested setting
|
||||
*/
|
||||
static MHD_INLINE struct MHD_ResponseOptionAndValue
|
||||
MHD_R_OPTION_TERMINATION_CALLBACK (
|
||||
MHD_RequestTerminationCallback term_cb,
|
||||
void *term_cb_cls
|
||||
MHD_RequestEndedCallback ended_cb,
|
||||
void *ended_cb_cls
|
||||
)
|
||||
{
|
||||
struct MHD_ResponseOptionAndValue opt_val;
|
||||
|
||||
opt_val.opt = MHD_R_O_TERMINATION_CALLBACK;
|
||||
opt_val.val.termination_callback.v_term_cb = term_cb;
|
||||
opt_val.val.termination_callback.v_term_cb_cls = term_cb_cls;
|
||||
opt_val.val.termination_callback.v_ended_cb = ended_cb;
|
||||
opt_val.val.termination_callback.v_ended_cb_cls = ended_cb_cls;
|
||||
|
||||
return opt_val;
|
||||
}
|
||||
|
||||
@@ -1879,6 +1879,7 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* This callback is called to incrementally process parsed POST data sent by
|
||||
* the client.
|
||||
*
|
||||
* @param req the request
|
||||
* @param cls user-specified closure
|
||||
* @param name 0-terminated key for the value
|
||||
* @param filename name of the uploaded file, NULL if not known
|
||||
@@ -1899,7 +1900,10 @@ MHD_FN_PAR_NONNULL_ (1);
|
||||
* @ingroup action
|
||||
*/
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataReader) (void *cls,
|
||||
(MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_NONNULL_ (4)
|
||||
MHD_FN_PAR_NONNULL_ (5) MHD_FN_PAR_NONNULL_ (6)
|
||||
*MHD_PostDataReader) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
const struct MHD_String *name,
|
||||
const struct MHD_StringNullable *filename,
|
||||
const struct MHD_StringNullable *content_type,
|
||||
@@ -1914,11 +1918,15 @@ typedef const struct MHD_UploadAction *
|
||||
* of the postprocessor upload data.
|
||||
* @param req the request
|
||||
* @param cls the closure
|
||||
* @param parsing_result the result of POST data parsing: MHD_SC_OK,
|
||||
MHD_SC_REQ_POST_PARSE_FAILED_NO_CNTN_TYPE or ...
|
||||
* @return the action to proceed
|
||||
*/
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls);
|
||||
(MHD_FN_PAR_NONNULL_ (1)
|
||||
*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
enum MHD_StatusCode parsing_result);
|
||||
|
||||
#define MHD_POST_DATA_READER_DEFINED 1
|
||||
#endif /* ! MHD_POST_DATA_READER_DEFINED */
|
||||
|
||||
@@ -638,6 +638,12 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_StatusCode
|
||||
*/
|
||||
MHD_SC_REQ_COOKIE_INVALID = 40163
|
||||
,
|
||||
/**
|
||||
* The request does not have "Content-Type:" header and POST data cannot
|
||||
* be parsed
|
||||
*/
|
||||
MHD_SC_REQ_POST_PARSE_FAILED_NO_CNTN_TYPE = 40180
|
||||
,
|
||||
/**
|
||||
* The request cannot be processed. Sending error reply.
|
||||
*/
|
||||
@@ -1577,7 +1583,6 @@ MHD_FN_CONST_;
|
||||
* See also: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-2
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_HTTP_PostEncoding
|
||||
{
|
||||
/**
|
||||
@@ -3341,35 +3346,43 @@ struct MHD_EarlyUriCbData
|
||||
struct MHD_Request *request;
|
||||
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* Modifiable. Initially to NULL.
|
||||
* The full URI ("request target") from the HTTP request, including URI
|
||||
* parameters (the part after '?')
|
||||
*/
|
||||
void *request_app_context;
|
||||
struct MHD_String full_uri;
|
||||
|
||||
/**
|
||||
* The request HTTP method
|
||||
*/
|
||||
enum MHD_HTTP_Method method;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function called by MHD to allow the application to log the @a full_uri
|
||||
* of the new request.
|
||||
* If this callback is set then it is the first application function called
|
||||
* for the new request.
|
||||
* This is the only moment when unmodified URI is provided.
|
||||
* After this callback MHD parses the URI and modifies it by extracting
|
||||
* GET parameters in-place.
|
||||
* If #MHD_RequestTerminationCallback is set then it is guaranteed that
|
||||
* #MHD_RequestTerminationCallback is called for the same request. Application
|
||||
*
|
||||
* If this callback is set then it is the first application function called
|
||||
* for the new request.
|
||||
*
|
||||
* If #MHD_RequestEndedCallback is also set then it is guaranteed that
|
||||
* #MHD_RequestEndedCallback is called for the same request. Application
|
||||
* may allocate request specific data in this callback and de-allocate
|
||||
* the data in #MHD_RequestTerminationCallback.
|
||||
* the data in #MHD_RequestEndedCallback.
|
||||
*
|
||||
* @param cls client-defined closure
|
||||
* @param full_uri the full URI ("request target") from the HTTP request
|
||||
* including parameters (the part after '?')
|
||||
* @param[in,out] req_data the request data
|
||||
* @param req_data the request data
|
||||
* @param request_app_context_ptr the pointer to variable that can be set to
|
||||
* the application context for the request;
|
||||
* initially the variable set to NULL
|
||||
*/
|
||||
typedef void
|
||||
(MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_INOUT_ (3)
|
||||
(MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_INOUT_ (3)
|
||||
*MHD_EarlyUriLogCallback)(void *cls,
|
||||
const struct MHD_String *full_uri,
|
||||
struct MHD_EarlyUriCbData *req_data);
|
||||
const struct MHD_EarlyUriCbData *req_data,
|
||||
void **request_app_context_ptr);
|
||||
|
||||
|
||||
/**
|
||||
@@ -3531,31 +3544,31 @@ typedef void
|
||||
|
||||
|
||||
/**
|
||||
* The `enum MHD_RequestTerminationCode` specifies reasons
|
||||
* why a request has been terminated (or completed).
|
||||
* The `enum MHD_RequestEndedCode` specifies reasons
|
||||
* why a request has been ended.
|
||||
* @ingroup request
|
||||
*/
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestTerminationCode
|
||||
enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestEndedCode
|
||||
{
|
||||
|
||||
/**
|
||||
* The response was successfully sent.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_COMPLETED_OK = 0
|
||||
MHD_REQUEST_ENDED_COMPLETED_OK = 0
|
||||
,
|
||||
/**
|
||||
* No activity on the connection for the number of seconds specified using
|
||||
* #MHD_C_OPTION_TIMEOUT().
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 10
|
||||
MHD_REQUEST_ENDED_TIMEOUT_REACHED = 10
|
||||
,
|
||||
/**
|
||||
* The connection was broken or TLS protocol error.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CONNECTION_ERROR = 20
|
||||
MHD_REQUEST_ENDED_CONNECTION_ERROR = 20
|
||||
,
|
||||
/**
|
||||
* The client terminated the connection by closing the socket either
|
||||
@@ -3563,44 +3576,44 @@ enum MHD_FIXED_ENUM_MHD_SET_ MHD_RequestTerminationCode
|
||||
* request.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_CLIENT_ABORT = 30
|
||||
MHD_REQUEST_ENDED_CLIENT_ABORT = 30
|
||||
,
|
||||
/**
|
||||
* The request is not valid according to
|
||||
* HTTP specifications.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_HTTP_PROTOCOL_ERROR = 31
|
||||
MHD_REQUEST_ENDED_HTTP_PROTOCOL_ERROR = 31
|
||||
,
|
||||
/**
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ABORT = 40
|
||||
MHD_REQUEST_ENDED_BY_APP_ABORT = 40
|
||||
,
|
||||
/**
|
||||
* The application aborted request without response.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_BY_APP_ERROR = 41
|
||||
MHD_REQUEST_ENDED_BY_APP_ERROR = 41
|
||||
,
|
||||
/**
|
||||
* Error handling the connection due to resources exhausted.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_NO_RESOURCES = 50
|
||||
MHD_REQUEST_ENDED_NO_RESOURCES = 50
|
||||
,
|
||||
/**
|
||||
* Closing the session since MHD is being shut down.
|
||||
* @ingroup request
|
||||
*/
|
||||
MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 60
|
||||
MHD_REQUEST_ENDED_DAEMON_SHUTDOWN = 60
|
||||
};
|
||||
|
||||
/**
|
||||
* Additional information about request termination
|
||||
* Additional information about request ending
|
||||
*/
|
||||
union MHD_RequestTerminationDetail
|
||||
union MHD_RequestEndedDetail
|
||||
{
|
||||
/**
|
||||
* Reserved member.
|
||||
@@ -3612,21 +3625,21 @@ union MHD_RequestTerminationDetail
|
||||
/**
|
||||
* Request termination data structure
|
||||
*/
|
||||
struct MHD_RequestTerminationData
|
||||
struct MHD_RequestEndedData
|
||||
{
|
||||
/**
|
||||
* The request handle.
|
||||
* Note that most of the request data may be already unvailable.
|
||||
*/
|
||||
struct MHD_Request *req;
|
||||
/**
|
||||
* The code of the event
|
||||
*/
|
||||
enum MHD_RequestTerminationCode code;
|
||||
enum MHD_RequestEndedCode code;
|
||||
/**
|
||||
* Detailed information about termination event
|
||||
* Detailed information about the event
|
||||
*/
|
||||
union MHD_RequestTerminationDetail details;
|
||||
/**
|
||||
* Pointer to the application context for the request.
|
||||
* NULL unless other value set by application when processing the request.
|
||||
*/
|
||||
void *request_app_context;
|
||||
union MHD_RequestEndedDetail details;
|
||||
};
|
||||
|
||||
|
||||
@@ -3634,16 +3647,20 @@ struct MHD_RequestTerminationData
|
||||
* Signature of the callback used by MHD to notify the application
|
||||
* about completed requests.
|
||||
*
|
||||
* This is the last callback called for any request (if provided by
|
||||
* the application).
|
||||
*
|
||||
* @param cls client-defined closure
|
||||
* @param data the details about the event
|
||||
* @param request_context request context value, as originally
|
||||
* returned by the #MHD_EarlyUriLogCallback
|
||||
* @param request_app_context the application request context, as possibly set
|
||||
by the #MHD_EarlyUriLogCallback
|
||||
* @see #MHD_R_OPTION_TERMINATION_CALLBACK()
|
||||
* @ingroup request
|
||||
*/
|
||||
typedef void
|
||||
(*MHD_RequestTerminationCallback) (void *cls,
|
||||
struct MHD_RequestTerminationData *data);
|
||||
(*MHD_RequestEndedCallback) (void *cls,
|
||||
const struct MHD_RequestEndedData *data,
|
||||
void *request_app_context);
|
||||
|
||||
|
||||
#include "microhttpd2_generated_response_options.h"
|
||||
|
||||
@@ -92,10 +92,10 @@ Comment: Disable sanity check preventing clients from manually setting the HTTP
|
||||
|
||||
Name: termination_callback
|
||||
Value: 121
|
||||
Type: struct MHD_ResponeOptionValueTermCB
|
||||
Type: struct MHD_ResponeOptionValueEndedCB
|
||||
Comment: Set a function to be called once MHD is finished with the request.
|
||||
Argument1: MHD_RequestTerminationCallback term_cb
|
||||
Argument1: MHD_RequestEndedCallback ended_cb
|
||||
Description1: the function to call,
|
||||
+ NULL to not use the callback
|
||||
Argument2: void *term_cb_cls
|
||||
Argument2: void *ended_cb_cls
|
||||
Description2: the closure for the callback
|
||||
|
||||
+17
-45
@@ -33,6 +33,12 @@
|
||||
|
||||
#include "mhd_str_types.h"
|
||||
|
||||
#include "http_post_enc.h"
|
||||
|
||||
#ifdef HAVE_POST_PARSER
|
||||
# include "mhd_public_api.h"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* The type of the action requested by application
|
||||
@@ -132,62 +138,28 @@ struct mhd_UploadCallbacks
|
||||
#ifndef MHD_POST_DATA_READER_DEFINED
|
||||
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataReader) (void *cls,
|
||||
(MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3) MHD_FN_PAR_NONNULL_ (4)
|
||||
MHD_FN_PAR_NONNULL_ (5) MHD_FN_PAR_NONNULL_ (6)
|
||||
*MHD_PostDataReader) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
const struct MHD_String *name,
|
||||
const struct MHD_String *filename,
|
||||
const struct MHD_String *content_type,
|
||||
const struct MHD_String *encoding,
|
||||
const struct MHD_StringNullable *filename,
|
||||
const struct MHD_StringNullable *content_type,
|
||||
const struct MHD_StringNullable *encoding,
|
||||
const void *data,
|
||||
uint_fast64_t off,
|
||||
size_t size);
|
||||
|
||||
|
||||
typedef const struct MHD_UploadAction *
|
||||
(*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls);
|
||||
(MHD_FN_PAR_NONNULL_ (1)
|
||||
*MHD_PostDataFinished) (struct MHD_Request *req,
|
||||
void *cls,
|
||||
enum MHD_StatusCode parsing_result);
|
||||
|
||||
#define MHD_POST_DATA_READER_DEFINED 1
|
||||
#endif /* ! MHD_POST_DATA_READER_DEFINED */
|
||||
|
||||
#ifndef MHD_HTTP_POSTENCODING_DEFINED
|
||||
|
||||
enum MHD_FIXED_ENUM_MHD_APP_SET_ MHD_HTTP_PostEncoding
|
||||
{
|
||||
/**
|
||||
* No post encoding / broken data / unknown encoding
|
||||
*/
|
||||
MHD_HTTP_POST_ENCODING_OTHER = 0
|
||||
,
|
||||
/**
|
||||
* "application/x-www-form-urlencoded"
|
||||
* See https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#url-encoded-form-data
|
||||
* See https://url.spec.whatwg.org/#application/x-www-form-urlencoded
|
||||
* See https://datatracker.ietf.org/doc/html/rfc3986#section-2
|
||||
*/
|
||||
MHD_HTTP_POST_ENCODING_FORM_URLENCODED = 1
|
||||
,
|
||||
/**
|
||||
* "multipart/form-data"
|
||||
* See https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data
|
||||
* See https://www.rfc-editor.org/rfc/rfc7578.html
|
||||
*/
|
||||
MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA = 2
|
||||
,
|
||||
/**
|
||||
* "text/plain"
|
||||
* Introduced by HTML5
|
||||
* See https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
|
||||
* @warning Format is ambiguous. Do not use unless there is a very strong reason.
|
||||
*/
|
||||
MHD_HTTP_POST_ENCODING_TEXT_PLAIN = 3
|
||||
};
|
||||
|
||||
|
||||
/** @} */ /* end of group postenc */
|
||||
|
||||
#define MHD_HTTP_POSTENCODING_DEFINED 1
|
||||
#endif /* ! MHD_HTTP_POSTENCODING_DEFINED */
|
||||
|
||||
|
||||
// TODO: correct and describe
|
||||
struct mhd_PostParseActionData
|
||||
|
||||
Reference in New Issue
Block a user