*/
if (context->http_proxy_port) {
- plen = sprintf(context->service_buffer,
+ plen = sprintf((char *)context->service_buffer,
"CONNECT %s:%u HTTP/1.0\x0d\x0a"
"User-agent: libwebsockets\x0d\x0a"
/*Proxy-authorization: basic aGVsbG86d29ybGQ= */
char *p = (char *)&context->service_buffer[0];
int len;
char c;
-#ifdef LWS_OPENSSL_SUPPORT
- char ssl_err_buf[512];
-#endif
switch (wsi->mode) {
lwsl_err("SSL connect error %s\n",
ERR_error_string(ERR_get_error(),
- ssl_err_buf));
+ (char *)context->service_buffer));
return 0;
}
int
handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi)
{
- static const char *websocket_magic_guid_04 =
- "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
- char accept_buf[MAX_WEBSOCKET_04_KEY_LEN + 37];
unsigned char hash[20];
int n;
char *response;
goto bail;
}
- strcpy(accept_buf, wsi->u.hdr.hdrs[WSI_TOKEN_KEY].token);
- strcpy(accept_buf + wsi->u.hdr.hdrs[WSI_TOKEN_KEY].token_len,
- websocket_magic_guid_04);
+ n = snprintf((char *)context->service_buffer,
+ sizeof context->service_buffer,
+ "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
+ wsi->u.hdr.hdrs[WSI_TOKEN_KEY].token);
- SHA1((unsigned char *)accept_buf,
- wsi->u.hdr.hdrs[WSI_TOKEN_KEY].token_len +
- strlen(websocket_magic_guid_04), hash);
+ SHA1(context->service_buffer, n, hash);
- accept_len = lws_b64_encode_string((char *)hash, 20, accept_buf,
- sizeof accept_buf);
+ accept_len = lws_b64_encode_string((char *)hash, 20,
+ (char *)context->service_buffer,
+ sizeof context->service_buffer);
if (accept_len < 0) {
lwsl_warn("Base64 encoded hash too long\n");
goto bail;
"Upgrade: WebSocket\x0d\x0a"
"Connection: Upgrade\x0d\x0a"
"Sec-WebSocket-Accept: ");
- strcpy(p, accept_buf);
+ strcpy(p, (char *)context->service_buffer);
p += accept_len;
if (wsi->u.hdr.hdrs[WSI_TOKEN_PROTOCOL].token) {