[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: Fixed websocket example.
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: Fixed websocket example. |
Date: |
Fri, 10 Apr 2020 18:55:09 +0200 |
This is an automated email from the git hooks/post-receive script.
silvioprog pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new 08134cf8 Fixed websocket example.
08134cf8 is described below
commit 08134cf85ade4eb39b6a384af1df58db7af9266b
Author: silvioprog <address@hidden>
AuthorDate: Fri Apr 10 13:50:12 2020 -0300
Fixed websocket example.
---
src/examples/websocket_threaded_example.c | 43 ++++++++++++++++---------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/examples/websocket_threaded_example.c
b/src/examples/websocket_threaded_example.c
index 449b9aba..ac4bb839 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -133,7 +133,7 @@ struct SHA1Context
uint32_t length_low;
uint32_t length_high;
int_least16_t message_block_index;
- char message_block[64];
+ unsigned char message_block[64];
int computed;
int corrupted;
};
@@ -269,7 +269,8 @@ SHA1Reset (struct SHA1Context *context)
static enum SHA1_RESULT
-SHA1Result (struct SHA1Context *context, char Message_Digest[SHA1HashSize])
+SHA1Result (struct SHA1Context *context, unsigned char
+ Message_Digest[SHA1HashSize])
{
int i;
@@ -302,7 +303,7 @@ SHA1Result (struct SHA1Context *context, char
Message_Digest[SHA1HashSize])
static enum SHA1_RESULT
-SHA1Input (struct SHA1Context *context, const char *message_array,
+SHA1Input (struct SHA1Context *context, const unsigned char *message_array,
unsigned length)
{
if (! length)
@@ -477,7 +478,7 @@ static enum MHD_Result
ws_get_accept_value (const char *key, char **val)
{
struct SHA1Context ctx;
- char hash[SHA1HashSize];
+ unsigned char hash[SHA1HashSize];
char *str;
ssize_t len;
@@ -493,7 +494,7 @@ ws_get_accept_value (const char *key, char **val)
strcpy (str, key);
strcat (str, WS_GUID);
SHA1Reset (&ctx);
- SHA1Input (&ctx, (const char *) str, WS_KEY_GUID_LEN);
+ SHA1Input (&ctx, (const unsigned char *) str, WS_KEY_GUID_LEN);
SHA1Result (&ctx, hash);
free (str);
len = BASE64Encode (hash, SHA1HashSize, val);
@@ -527,7 +528,7 @@ make_blocking (MHD_socket fd)
static size_t
-send_all (MHD_socket sock, const char *buf, size_t len)
+send_all (MHD_socket sock, const unsigned char *buf, size_t len)
{
ssize_t ret;
size_t off;
@@ -556,8 +557,8 @@ send_all (MHD_socket sock, const char *buf, size_t len)
static int
ws_send_frame (int sock, const char *msg, size_t length)
{
- char *response;
- char frame[10];
+ unsigned char *response;
+ unsigned char frame[10];
unsigned char idx_first_rdata;
int idx_response;
int output;
@@ -580,14 +581,14 @@ ws_send_frame (int sock, const char *msg, size_t length)
else
{
frame[1] = 127;
- frame[2] = (char) ((length >> 56) & 0xFF);
- frame[3] = (char) ((length >> 48) & 0xFF);
- frame[4] = (char) ((length >> 40) & 0xFF);
- frame[5] = (char) ((length >> 32) & 0xFF);
- frame[6] = (char) ((length >> 24) & 0xFF);
- frame[7] = (char) ((length >> 16) & 0xFF);
- frame[8] = (char) ((length >> 8) & 0xFF);
- frame[9] = (char) (length & 0xFF);
+ frame[2] = (unsigned char) ((length >> 56) & 0xFF);
+ frame[3] = (unsigned char) ((length >> 48) & 0xFF);
+ frame[4] = (unsigned char) ((length >> 40) & 0xFF);
+ frame[5] = (unsigned char) ((length >> 32) & 0xFF);
+ frame[6] = (unsigned char) ((length >> 24) & 0xFF);
+ frame[7] = (unsigned char) ((length >> 16) & 0xFF);
+ frame[8] = (unsigned char) ((length >> 8) & 0xFF);
+ frame[9] = (unsigned char) (length & 0xFF);
idx_first_rdata = 10;
}
idx_response = 0;
@@ -626,12 +627,12 @@ ws_send_frame (int sock, const char *msg, size_t length)
static unsigned char *
ws_receive_frame (unsigned char *frame, ssize_t *length, int *type)
{
+ unsigned char masks[4];
+ unsigned char mask;
unsigned char *msg;
- char masks[4];
- char mask;
- char flength;
- char idx_first_mask;
- char idx_first_data;
+ unsigned char flength;
+ unsigned char idx_first_mask;
+ unsigned char idx_first_data;
ssize_t data_length;
int i;
int j;
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: Fixed websocket example.,
gnunet <=