1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Don't need 'content_remain' in libwebsocket_read

This commit is contained in:
Andrew Canaday 2014-07-14 20:19:50 +08:00 committed by Andy Green
parent afe26cf4a6
commit 3bb0650e6a
2 changed files with 2 additions and 7 deletions

View file

@ -63,7 +63,6 @@ libwebsocket_read(struct libwebsocket_context *context,
{
size_t n;
int body_chunk_len;
int content_remain = 0;
unsigned char *last_char;
switch (wsi->state) {

View file

@ -177,6 +177,7 @@ int lws_handshake_server(struct libwebsocket_context *context,
enum http_connection_type connection_type;
int http_version_len;
char content_length_str[32];
char http_version_str[10];
int n;
/* LWS_CONNMODE_WS_SERVING */
@ -274,24 +275,20 @@ int lws_handshake_server(struct libwebsocket_context *context,
/* Works for single digit HTTP versions. : */
http_version_len = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP);
if (http_version_len > 7) {
char http_version_str[10];
lws_hdr_copy(wsi, http_version_str,
sizeof(http_version_str) - 1, WSI_TOKEN_HTTP);
if (http_version_str[5] == '1' &&
http_version_str[7] == '1') {
http_version_str[7] == '1')
request_version = HTTP_VERSION_1_1;
}
}
wsi->u.http.request_version = request_version;
/* HTTP/1.1 defaults to "keep-alive", 1.0 to "close" */
if (request_version == HTTP_VERSION_1_1)
connection_type = HTTP_CONNECTION_KEEP_ALIVE;
else
connection_type = HTTP_CONNECTION_CLOSE;
/* Override default if http "Connection:" header: */
if (lws_hdr_total_length(wsi, WSI_TOKEN_CONNECTION)) {
char http_conn_str[20];
@ -328,7 +325,6 @@ int lws_handshake_server(struct libwebsocket_context *context,
wsi->user_space, uri_ptr, uri_len);
}
cleanup:
/* now drop the header info we kept a pointer to */
if (ah)
free(ah);