Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
abbd44e2
Commit
abbd44e2
authored
8 years ago
by
Deomid Ryabkov
Committed by
Cesanta Bot
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix WS handshake nonce generation
PUBLISHED_FROM=ae8d436db9aee9aec7b5ac1cbee6bc4e32d8c6cf
parent
13e80e6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
mongoose.c
mongoose.c
+7
-4
No files found.
mongoose.c
View file @
abbd44e2
...
@@ -5228,11 +5228,14 @@ void mg_set_protocol_http_websocket(struct mg_connection *nc) {
...
@@ -5228,11 +5228,14 @@ void mg_set_protocol_http_websocket(struct mg_connection *nc) {
void
mg_send_websocket_handshake2
(
struct
mg_connection
*
nc
,
const
char
*
path
,
void
mg_send_websocket_handshake2
(
struct
mg_connection
*
nc
,
const
char
*
path
,
const
char
*
host
,
const
char
*
protocol
,
const
char
*
host
,
const
char
*
protocol
,
const
char
*
extra_headers
)
{
const
char
*
extra_headers
)
{
/* pretty poor source of randomness, TODO fix */
char
key
[
25
];
unsigned
long
random
=
(
unsigned
long
)
(
uintptr_t
)
path
;
uint32_t
nonce
[
4
];
char
key
[
sizeof
(
random
)
*
3
];
nonce
[
0
]
=
mg_ws_random_mask
();
nonce
[
1
]
=
mg_ws_random_mask
();
nonce
[
2
]
=
mg_ws_random_mask
();
nonce
[
3
]
=
mg_ws_random_mask
();
mg_base64_encode
((
unsigned
char
*
)
&
nonce
,
sizeof
(
nonce
),
key
);
mg_base64_encode
((
unsigned
char
*
)
&
random
,
sizeof
(
random
),
key
);
mg_printf
(
nc
,
mg_printf
(
nc
,
"GET %s HTTP/1.1
\r\n
"
"GET %s HTTP/1.1
\r\n
"
"Upgrade: websocket
\r\n
"
"Upgrade: websocket
\r\n
"
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment