Subject: Direct extension confirmation to the negotiated protocol's callback

Fixes #897

Notice this means if you want to globally ban an extension, you should
no longer include the extension at context creation time.
This commit is contained in:
emptyVoid 2017-05-27 22:51:58 +07:00 committed by Andy Green
parent 3ec32b1762
commit 348887ea53
3 changed files with 2 additions and 13 deletions

View file

@ -1016,8 +1016,7 @@ enum lws_callback_reasons {
* and with in being the extension name, len is 0 and user is
* valid. Note though at this time the ESTABLISHED callback hasn't
* happened yet so if you initialize user content there, user
* content during this callback might not be useful for anything.
* Notice this callback comes to protocols[0]. */
* content during this callback might not be useful for anything. */
LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED = 26,
/**< When a client
* connection is being prepared to start a handshake to a server,

View file

@ -128,7 +128,7 @@ lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
* ask user code if it's OK to apply it on this
* particular connection + protocol
*/
m = wsi->vhost->protocols[0].callback(wsi,
m = (wsi->protocol->callback)(wsi,
LWS_CALLBACK_CONFIRM_EXTENSION_OKAY,
wsi->user_space, ext_name, 0);

View file

@ -168,11 +168,6 @@ do_rx:
}
break;
#endif
case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED:
/* reject everything else except permessage-deflate */
if (strcmp(in, "permessage-deflate"))
return 1;
break;
default:
break;
@ -203,11 +198,6 @@ static const struct lws_extension exts[] = {
lws_extension_callback_pm_deflate,
"permessage-deflate; client_no_context_takeover; client_max_window_bits"
},
{
"deflate-frame",
lws_extension_callback_pm_deflate,
"deflate_frame"
},
{ NULL, NULL, NULL /* terminator */ }
};