From e803c82044c16bfdace47dd4c9ab45ff42dafeb3 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 14 Feb 2013 23:18:10 +0800 Subject: [PATCH] create user alloc for http if requested Signed-off-by: Andy Green --- lib/handshake.c | 7 +++++++ libwebsockets-api-doc.html | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/lib/handshake.c b/lib/handshake.c index 0c2cecf..74e67cd 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -118,6 +118,13 @@ libwebsocket_read(struct libwebsocket_context *context, lwsl_info("HTTP request for '%s'\n", lws_hdr_simple_ptr(wsi, WSI_TOKEN_GET_URI)); + if (libwebsocket_ensure_user_space(wsi) == NULL) { + /* drop the header info */ + if (wsi->u.hdr.ah) + free(wsi->u.hdr.ah); + goto bail; + } + wsi->state = WSI_STATE_HTTP; n = 0; if (wsi->protocol->callback) diff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html index 17d9e5b..b041e74 100644 --- a/libwebsockets-api-doc.html +++ b/libwebsockets-api-doc.html @@ -611,6 +611,11 @@ That's important because it uses a slot in the total number of client connections allowed set by MAX_CLIENTS. +

LWS_CALLBACK_HTTP_WRITEABLE

+
+you can write more down the http protocol +link now. +

LWS_CALLBACK_HTTP_FILE_COMPLETION

a file requested to be send down -- 2.7.4