From: Andy Green Date: Sun, 19 May 2013 06:04:10 +0000 (+0800) Subject: trac 28 - differentiate between http serving and accepted http connection X-Git-Tag: upstream/1.7.3~845 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7cf6cb00c26803b1a56bc0b0851efbfbef62d8b2;p=platform%2Fupstream%2Flibwebsockets.git trac 28 - differentiate between http serving and accepted http connection Signed-off-by: Andy Green --- diff --git a/lib/handshake.c b/lib/handshake.c index d2c9e1e..410355e 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -138,7 +138,7 @@ libwebsocket_read(struct libwebsocket_context *context, /* union transition */ memset(&wsi->u, 0, sizeof(wsi->u)); - wsi->mode = LWS_CONNMODE_HTTP_SERVING; + wsi->mode = LWS_CONNMODE_HTTP_SERVING_ACCEPTED; wsi->state = WSI_STATE_HTTP; n = 0; if (wsi->protocol->callback) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 983af5e..d312390 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -206,7 +206,7 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context, wsi->u.ws.close_reason = reason; - if (wsi->mode == LWS_CONNMODE_HTTP_SERVING && wsi->u.http.fd) { + if (wsi->mode == LWS_CONNMODE_HTTP_SERVING_ACCEPTED && wsi->u.http.fd) { lwsl_debug("closing http fd %d\n", wsi->u.http.fd); close(wsi->u.http.fd); wsi->u.http.fd = 0; @@ -962,6 +962,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context, #ifndef LWS_NO_SERVER case LWS_CONNMODE_HTTP_SERVING: + case LWS_CONNMODE_HTTP_SERVING_ACCEPTED: case LWS_CONNMODE_SERVER_LISTENER: case LWS_CONNMODE_SSL_ACK_PENDING: n = lws_server_socket_service(context, wsi, pollfd); diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index d1ca6d2..71b66e0 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -211,6 +211,7 @@ enum lws_rx_parse_state { enum connection_mode { LWS_CONNMODE_HTTP_SERVING, + LWS_CONNMODE_HTTP_SERVING_ACCEPTED, /* actual HTTP service going on */ LWS_CONNMODE_PRE_WS_SERVING_ACCEPT, LWS_CONNMODE_WS_SERVING, diff --git a/lib/server.c b/lib/server.c index 6ad30cc..8d12a81 100644 --- a/lib/server.c +++ b/lib/server.c @@ -140,6 +140,7 @@ int lws_server_socket_service(struct libwebsocket_context *context, switch (wsi->mode) { case LWS_CONNMODE_HTTP_SERVING: + case LWS_CONNMODE_HTTP_SERVING_ACCEPTED: /* handle http headers coming in */