[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: websocket_threaded_example.c: min
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: websocket_threaded_example.c: minor improvement and warning fixes |
Date: |
Thu, 29 Oct 2020 16:48:55 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 2f4438ab websocket_threaded_example.c: minor improvement and warning
fixes
2f4438ab is described below
commit 2f4438ab7a9575e605c4a746614cb2b453b8f48d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 29 18:41:12 2020 +0300
websocket_threaded_example.c: minor improvement and warning fixes
---
src/examples/websocket_threaded_example.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/examples/websocket_threaded_example.c
b/src/examples/websocket_threaded_example.c
index 13e75dab..536c0a09 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -491,8 +491,8 @@ ws_get_accept_value (const char *key, char **val)
{
return MHD_NO;
}
- strcpy (str, key);
- strcat (str, WS_GUID);
+ strncpy (str, key, (WS_KEY_LEN + WS_GUID_LEN + 1));
+ strncat (str, WS_GUID, (WS_GUID_LEN + 1));
SHA1Reset (&ctx);
SHA1Input (&ctx, (const unsigned char *) str, WS_KEY_GUID_LEN);
SHA1Result (&ctx, hash);
@@ -816,6 +816,7 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char
*url,
const char *ws_key_header;
char *ws_ac_value;
enum MHD_Result ret;
+ size_t key_size;
(void) cls; /* Unused. Silent compiler warning. */
(void) url; /* Unused. Silent compiler warning. */
@@ -848,9 +849,9 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char
*url,
{
return send_upgrade_required (con);
}
- ws_key_header = MHD_lookup_connection_value (
- con, MHD_HEADER_KIND, MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY);
- if ((NULL == ws_key_header) || (strlen (ws_key_header) != 24))
+ ws_key_header = MHD_lookup_connection_value_n (
+ con, MHD_HEADER_KIND, MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY, &key_size);
+ if ((NULL == ws_key_header) || (key_size != WS_KEY_LEN))
{
return send_bad_request (con);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: websocket_threaded_example.c: minor improvement and warning fixes,
gnunet <=