[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: check rvalues from MHD_add_respon
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: check rvalues from MHD_add_response_header in examples |
Date: |
Mon, 25 Sep 2023 21:30:12 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 9327a8cc check rvalues from MHD_add_response_header in examples
9327a8cc is described below
commit 9327a8cc466f2ab76401e4840644688ca1c0af88
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Sep 25 21:30:03 2023 +0200
check rvalues from MHD_add_response_header in examples
---
src/examples/websocket_threaded_example.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/examples/websocket_threaded_example.c
b/src/examples/websocket_threaded_example.c
index eec1f557..c397df2f 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -471,8 +471,13 @@ send_upgrade_required (struct MHD_Connection *con)
MHD_create_response_from_buffer_static (strlen (UPGRADE_REQUIRED_PAGE),
(const void *)
UPGRADE_REQUIRED_PAGE);
- MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION,
- WS_SEC_WEBSOCKET_VERSION);
+ if (MHD_YES !=
+ MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION,
+ WS_SEC_WEBSOCKET_VERSION))
+ {
+ MHD_destroy_response (res);
+ return MHD_NO;
+ }
ret = MHD_queue_response (con, MHD_HTTP_UPGRADE_REQUIRED, res);
MHD_destroy_response (res);
return ret;
@@ -891,10 +896,21 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char
*url,
return ret;
}
res = MHD_create_response_for_upgrade (&uh_cb, NULL);
- MHD_add_response_header (res, MHD_HTTP_HEADER_UPGRADE, WS_UPGRADE_VALUE);
- MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT,
- ws_ac_value);
+ if (MHD_YES !=
+ MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT,
+ ws_ac_value))
+ {
+ free (ws_ac_value);
+ MHD_destroy_response (res);
+ return MHD_NO;
+ }
free (ws_ac_value);
+ if (MHD_YES !=
+ MHD_add_response_header (res, MHD_HTTP_HEADER_UPGRADE, WS_UPGRADE_VALUE))
+ {
+ MHD_destroy_response (res);
+ return MHD_NO;
+ }
ret = MHD_queue_response (con, MHD_HTTP_SWITCHING_PROTOCOLS, res);
MHD_destroy_response (res);
return ret;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated: check rvalues from MHD_add_response_header in examples,
gnunet <=