thanks for bringing it up again, i always have to patch multiple relayds after 
upgrades. -.-

Sent from my iPad

> On 4. Dec 2020, at 14:18, Marcus MERIGHI <mcmer-open...@tor.at> wrote:
> 
> Hello!
> 
> This patch wasn't commited and not discussed (publicly). 
> 
> It lets me use relayd as a front-end to the mattermost-server.
> 
> Just a friendly reminder...
> 
> @franz: Thank you!
> 
> Marcus
> 
> fr...@bett.ag (Franz Bettag), 2020.03.04 (Wed) 17:52 (CET):
>> After migrating my home setup from nginx reverse proxying to relayd, i
>> noticed my iOS devices having issues connecting through Websockets.
>> After debugging, i noticed that relayd adds the "Connection: close"
>> regardless of upgrade being requested.
>> 
>> This issue is also reported on a blog-post using relayd as a Websocket
>> Client. https://deftly.net/posts/2019-10-23-websockets-with-relayd.html
>> 
>> This resulted in the response having two Connection Headers, one
>> "Connection: upgrade" and one "Connection: close", which iOS strict
>> implementation does not allow.
>> 
>> I have fixed the if condition that leads to this issue.
>> 
>> The fix has been tested with Apple iOS 13 and the problem can be
>> observed using Firefox and just connecting to something Websocket over
>> relayd. Both "Connection:" headers will appear.
>> 
>> best regards
>> 
>> Franz
>> 
>> 
>> diff --git usr.sbin/relayd/relay_http.c usr.sbin/relayd/relay_http.c
>> index 960d4c54a..3a6678790 100644
>> --- usr.sbin/relayd/relay_http.c
>> +++ usr.sbin/relayd/relay_http.c
>> @@ -524,9 +524,11 @@ relay_read_http(struct bufferevent *bev, void *arg)
>> 
>>        /*
>>         * Ask the server to close the connection after this request
>> -         * since we don't read any further request headers.
>> +         * since we don't read any further request headers, unless
>> +         * an Upgrade is requested, in which case we do NOT want to add
>> +         * this header.
>>         */
>> -        if (cre->toread == TOREAD_UNLIMITED)
>> +        if (cre->toread == TOREAD_UNLIMITED && upgrade == NULL)
>>            if (kv_add(&desc->http_headers, "Connection",
>>                "close", 0) == NULL)
>>                goto fail;
>> 

Reply via email to