mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
check rvalues from MHD_post_process in examples
This commit is contained in:
@@ -95,9 +95,14 @@ send_page (struct MHD_Connection *connection,
|
|||||||
response = MHD_create_response_from_buffer_static (strlen (page), page);
|
response = MHD_create_response_from_buffer_static (strlen (page), page);
|
||||||
if (! response)
|
if (! response)
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
|
if (MHD_YES !=
|
||||||
MHD_add_response_header (response,
|
MHD_add_response_header (response,
|
||||||
MHD_HTTP_HEADER_CONTENT_TYPE,
|
MHD_HTTP_HEADER_CONTENT_TYPE,
|
||||||
"text/html");
|
"text/html"))
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"Failed to set content type header!\n");
|
||||||
|
}
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
status_code,
|
status_code,
|
||||||
response);
|
response);
|
||||||
|
|||||||
@@ -177,8 +177,11 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
|
|||||||
|
|
||||||
if (*upload_data_size != 0)
|
if (*upload_data_size != 0)
|
||||||
{
|
{
|
||||||
MHD_post_process (con_info->postprocessor, upload_data,
|
if (MHD_YES !=
|
||||||
*upload_data_size);
|
MHD_post_process (con_info->postprocessor,
|
||||||
|
upload_data,
|
||||||
|
*upload_data_size))
|
||||||
|
return MHD_NO;
|
||||||
*upload_data_size = 0;
|
*upload_data_size = 0;
|
||||||
|
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
|
|||||||
@@ -205,9 +205,10 @@ get_session (struct MHD_Connection *connection)
|
|||||||
* @param mime mime type to use
|
* @param mime mime type to use
|
||||||
* @param session session information
|
* @param session session information
|
||||||
* @param connection connection to process
|
* @param connection connection to process
|
||||||
* @param MHD_YES on success, MHD_NO on failure
|
* @param #MHD_YES on success, #MHD_NO on failure
|
||||||
*/
|
*/
|
||||||
typedef enum MHD_Result (*PageHandler)(const void *cls,
|
typedef enum MHD_Result
|
||||||
|
(*PageHandler)(const void *cls,
|
||||||
const char *mime,
|
const char *mime,
|
||||||
struct Session *session,
|
struct Session *session,
|
||||||
struct MHD_Connection *connection);
|
struct MHD_Connection *connection);
|
||||||
@@ -633,9 +634,11 @@ create_response (void *cls,
|
|||||||
if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
|
if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
|
||||||
{
|
{
|
||||||
/* evaluate POST data */
|
/* evaluate POST data */
|
||||||
|
if (MHD_YES !=
|
||||||
MHD_post_process (request->pp,
|
MHD_post_process (request->pp,
|
||||||
upload_data,
|
upload_data,
|
||||||
*upload_data_size);
|
*upload_data_size))
|
||||||
|
return MHD_NO;
|
||||||
if (0 != *upload_data_size)
|
if (0 != *upload_data_size)
|
||||||
{
|
{
|
||||||
*upload_data_size = 0;
|
*upload_data_size = 0;
|
||||||
|
|||||||
@@ -53,9 +53,14 @@ answer_to_connection (void *cls,
|
|||||||
|
|
||||||
response = MHD_create_response_from_buffer_static (strlen (page),
|
response = MHD_create_response_from_buffer_static (strlen (page),
|
||||||
(const void *) page);
|
(const void *) page);
|
||||||
|
if (MHD_YES !=
|
||||||
MHD_add_response_header (response,
|
MHD_add_response_header (response,
|
||||||
MHD_HTTP_HEADER_CONTENT_TYPE,
|
MHD_HTTP_HEADER_CONTENT_TYPE,
|
||||||
"text/html");
|
"text/html"))
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"Failed to set content type header!\n");
|
||||||
|
}
|
||||||
ret = MHD_queue_response (connection,
|
ret = MHD_queue_response (connection,
|
||||||
MHD_HTTP_OK,
|
MHD_HTTP_OK,
|
||||||
response);
|
response);
|
||||||
|
|||||||
Reference in New Issue
Block a user