On Tue, Mar 05, 2019 at 04:21:30PM +0000, Rivo Nurges wrote:
> Hi!
> 
> RFC 6455 4.2.1 states:
> 4.   A |Connection| header field that *includes* the token "Upgrade",
>       treated as an ASCII case-insensitive value.
> 
> In my test case Firefox sends: Connection: keep-alive, Upgrade
> 
> Relayd currently expects Connection to equal Upgrade, not include Upgrade.
> 
> I haven't figured out how to configure Thunderbird to send proper diffs, 
> so I'm sending bas64 encoded version too.
> 
> Index: usr.sbin/relayd/relay_http.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/relayd/relay_http.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 relay_http.c
> --- usr.sbin/relayd/relay_http.c      4 Mar 2019 21:25:03 -0000       1.72
> +++ usr.sbin/relayd/relay_http.c      5 Mar 2019 16:03:56 -0000
> @@ -400,7 +400,7 @@ relay_read_http(struct bufferevent *bev,
>               if (cre->line != 1) {
>                       if (cre->dir == RELAY_DIR_REQUEST) {
>                               if (strcasecmp("Connection", key) == 0 &&
> -                                 strcasecmp("Upgrade", value) == 0)
> +                                 strcasecmp("Upgrade", value) >= 0)
>                                       priv->http_upgrade_req |=
>                                           HTTP_CONNECTION_UPGRADE;
>                               if (strcasecmp("Upgrade", key) == 0 &&
> 

I guess that this would need strcasestr() instead of strcasecmp(), since you
are looking for the substring "Upgrade" in value. Maybe more is needed if
we want to be sure that 'Connection: Upgrade-maybe' does not match.

-- 
:wq Claudio

Reply via email to