Libcurl defaults to HTTP 2 but doesn't 100% work with a proxy on the other end

I spent the day chasing mysterious and unpredictable timeouts when creating diffs with ‘arc diff’, ala The issue was quite persistent (immediately and repeatedly retrying didn’t help), but only for some requests.

Our setup is in Google Cloud, behind their load balancer which terminates HTTPS then talks HTTP to the backend which runs Phabricator.

It turned out libcurl (within arc) was defaulting to HTTP 2 and this wasn’t working properly with the LB. This patch to libphutil fixed the issue conclusively for me:

I’m not the only one to have run into this, see The root cause seems to be curl just plain not supporting talking HTTP 2 to proxies while defaulting to HTTP 2.

I just wanted to raise this and see if you might consider baking the above curl_setopt() call into libphutil until curl supports this properly. Thanks for everything. :slight_smile:

At least at first glance, that analysis seems compelling and I expect to make a similar change as a result, although I’m going to go hunt down the constants first and make sure they exist in reasonably old versions of cURL.

I filed this upstream as, did a little more research, and couldn’t anticipate any problems with the patch as presented. I adopted a functionally identical patch in, which is now in “master”. Thanks for the report!