From 0855cf7c25170edada0c3b2505ab3280330dce9c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 30 Jan 2013 12:26:14 +0800 Subject: [PATCH] server allow NULL protocol map to protocol 0 Signed-off-by: Andy Green --- lib/handshake.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/handshake.c b/lib/handshake.c index b6d3897..72f51d4 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -149,14 +149,16 @@ libwebsocket_read(struct libwebsocket_context *context, /* we didn't find a protocol he wanted? */ if (wsi->protocol->callback == NULL) { - if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token == NULL) - lwsl_err("[no protocol] " - "not supported (use NULL .name)\n"); - else + if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token == NULL) { + lwsl_info("[no protocol] " + "mapped to protocol 0 handler\n"); + wsi->protocol = &context->protocols[0]; + } else { lwsl_err("Requested protocol %s " "not supported\n", wsi->utf8_token[WSI_TOKEN_PROTOCOL].token); - goto bail; + goto bail; + } } /* -- 2.7.4