comparison tests/test-commandserver.t @ 36426:23d12524a202

http: drop custom http client logic Eight and a half years ago, as my starter bug on code.google.com, I investigated a mysterious "broken pipe" error from seemingly random clients[0]. That investigation revealed a tragic story: the Python standard library's httplib was (and remains) barely functional. During large POSTs, if a server responds early with an error (even a permission denied error!) the client only notices that the server closed the connection and everything breaks. Such server behavior is implicitly legal under RFC 2616 (the latest HTTP RFC as of when I was last working on this), and my understanding is that later RFCs have made it explicitly legal to respond early with any status code outside the 2xx range. I embarked, probably foolishly, on a journey to write a new http library with better overall behavior. The http library appears to work well in most cases, but it can get confused in the presence of proxies, and it depends on select(2) which limits its utility if a lot of file descriptors are open. I haven't touched the http library in almost two years, and in the interim the Python community has discovered a better way[1] of writing network code. In theory some day urllib3 will have its own home-grown http library built on h11[2], or we could do that. Either way, it's time to declare our current confusingly-named "http2" client logic and move on. I do hope to revisit this some day: it's still garbage that we can't even respond with a 401 or 403 without reading the entire POST body from the client, but the goalposts on writing a new http client library have moved substantially. We're almost certainly better off just switching to requests and eventually picking up their http fixes than trying to live with something that realistically only we'll ever use. Another approach would be to write an adapter so that Mercurial can use pycurl if it's installed. Neither of those approaches seem like they should be investigated prior to a release of Mercurial that works on Python 3: that's where the mindshare is going to be for any improvements to the state of the http client art. 0: http://web.archive.org/web/20130501031801/http://code.google.com/p/support/issues/detail?id=2716 1: http://sans-io.readthedocs.io/ 2: https://github.com/njsmith/h11 Differential Revision: https://phab.mercurial-scm.org/D2444
author Augie Fackler <augie@google.com>
date Sun, 25 Feb 2018 23:51:32 -0500
parents 257071fd3357
children 5890e5872f36
comparison
equal deleted inserted replaced
36425:24c2c760c1cb 36426:23d12524a202
209 largefiles.usercache=$TESTTMP/.cache/largefiles 209 largefiles.usercache=$TESTTMP/.cache/largefiles
210 lfs.usercache=$TESTTMP/.cache/lfs 210 lfs.usercache=$TESTTMP/.cache/lfs
211 ui.slash=True 211 ui.slash=True
212 ui.interactive=False 212 ui.interactive=False
213 ui.mergemarkers=detailed 213 ui.mergemarkers=detailed
214 ui.usehttp2=true (?)
215 ui.foo=bar 214 ui.foo=bar
216 ui.nontty=true 215 ui.nontty=true
217 web.address=localhost 216 web.address=localhost
218 web\.ipv6=(?:True|False) (re) 217 web\.ipv6=(?:True|False) (re)
219 *** runcommand init foo 218 *** runcommand init foo
220 *** runcommand -R foo showconfig ui defaults 219 *** runcommand -R foo showconfig ui defaults
221 ui.slash=True 220 ui.slash=True
222 ui.interactive=False 221 ui.interactive=False
223 ui.mergemarkers=detailed 222 ui.mergemarkers=detailed
224 ui.usehttp2=true (?)
225 ui.nontty=true 223 ui.nontty=true
226 224
227 $ rm -R foo 225 $ rm -R foo
228 226
229 #if windows 227 #if windows