##// END OF EJS Templates
http: drop custom http client logic...
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

File last commit:

r36444:23d12524 default
r36444:23d12524 default
Show More
test-check-code.t
53 lines | 1.5 KiB | text/troff | Tads3Lexer
/ tests / test-check-code.t
Pierre-Yves David
tests: move the '-hg' postfix for all style tests...
r27368 #require test-repo
timeless
tests: silence test-repo obsolete warning...
r29219 $ . "$TESTDIR/helpers-testrepo.sh"
Pierre-Yves David
tests: move the '-hg' postfix for all style tests...
r27368 $ check_code="$TESTDIR"/../contrib/check-code.py
$ cd "$TESTDIR"/..
New errors are not allowed. Warnings are strongly discouraged.
(The writing "no-che?k-code" is for not skipping this file when checking.)
Siddharth Agarwal
tests: disable lints on mercurial/thirdparty...
r34396 $ testrepohg locate \
> -X contrib/python-zstandard \
> -X hgext/fsmonitor/pywatchman \
> -X mercurial/thirdparty \
> | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
Pierre-Yves David
tests: move the '-hg' postfix for all style tests...
r27368 Skipping i18n/polib.py it has no-che?k-code (glob)
Gregory Szorc
statprof: vendor statprof.py...
r30253 Skipping mercurial/statprof.py it has no-che?k-code (glob)
Gregory Szorc
tests: add tests for poorly behaving HTTP server...
r32001 Skipping tests/badserverext.py it has no-che?k-code (glob)
Gregory Szorc
tests: add test that @commands in debugcommands.py are sorted...
r30540
@commands in debugcommands.py should be in alphabetical order.
>>> import re
>>> commands = []
>>> with open('mercurial/debugcommands.py', 'rb') as fh:
... for line in fh:
... m = re.match("^@command\('([a-z]+)", line)
... if m:
... commands.append(m.group(1))
>>> scommands = list(sorted(commands))
>>> for i, command in enumerate(scommands):
... if command != commands[i]:
... print('commands in debugcommands.py not sorted; first differing '
... 'command is %s; expected %s' % (commands[i], command))
... break
Jun Wu
test-check-code: prevent files being added to the root directory...
r31726
Prevent adding new files in the root directory accidentally.
Yuya Nishihara
tests: alias syshg and syshgenv so they can be switched conditionally
r33199 $ testrepohg files 'glob:*'
Alex Gaynor
phabricator: include the suggested arc config in the repo...
r33584 .arcconfig
Augie Fackler
clang-format: configuration for the clang-format source formatter...
r34799 .clang-format
Jun Wu
test-check-code: prevent files being added to the root directory...
r31726 .editorconfig
.hgignore
.hgsigs
.hgtags
av6
hgweb: add .jshintrc with some basic rules...
r35163 .jshintrc
Jun Wu
test-check-code: prevent files being added to the root directory...
r31726 CONTRIBUTING
CONTRIBUTORS
COPYING
Makefile
David Demelier
doc: rename README to README.rst...
r34580 README.rst
Jun Wu
test-check-code: prevent files being added to the root directory...
r31726 hg
hgeditor
hgweb.cgi
setup.py