Commit Graph

30 Commits

Author SHA1 Message Date
Jun Wu
2946a1c198 codemod: use single blank line
Summary: This makes test-check-code cleaner.

Reviewed By: ryanmce

Differential Revision: D6937934

fbshipit-source-id: 8f92bc32f75b9792ac67db77bb3a8756b37fa941
2018-04-13 21:51:08 -07:00
Pierre-Yves David
c4d32111df httpclient: don't use mutable default argument value
Caught by pylint.
2017-03-14 23:49:25 -07:00
Augie Fackler
6a644ad048 httpclient: update to 54868ef054d2 of httpplus
As of that revision, httpplus fully supports Python 3, including
mimicing all the subtle behavior changes around headers in Python 3's
http.client.
2016-06-27 11:53:50 -04:00
Augie Fackler
31c27da2fc httpclient: update to upstream revision 2995635573d2
This is mostly Python 3 compat work thanks to timeless.
2016-05-09 21:13:50 -04:00
timeless
70411b9a13 httpclient: reverse accidental damage from c91cccd0719b 2016-04-20 21:33:02 +00:00
timeless
f77cdcd3b1 pycompat: switch to util.stringio for py3 compat 2016-04-10 20:55:37 +00:00
Augie Fackler
f19af9e9c4 httpclient: update to 938f2107d6e2 of httpplus
This enhances proxy support in httpclient a little bit, though I don't
know that we used that functionality at all. It also switches httpplus
to using absolute_import.
2015-12-31 13:19:20 -05:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Augie Fackler
ea14145f1e httpclient: import 4bb625347d4a to provide SSL wrapper injection
This lets us inject our own ssl.wrap_socket equivalent into
httpclient, which means that any changes we make to our ssl handling
can be *entirely* on our side without having to muck with httpclient,
which sounds appealing. For example, an extension could wrap
sslutil.ssl_wrap_socket with an api-compatible wrapper and then tweak
SSL settings more precisely or use GnuTLS instead of OpenSSL.
2013-09-20 09:15:09 -04:00
Matt Mackall
4831f68cac merge with stable 2013-09-18 14:52:16 -05:00
Augie Fackler
401f0a3a21 httpclient: apply upstream revision da7579b034a4 to fix SSL problems (issue4038) 2013-09-18 14:45:28 -04:00
Augie Fackler
dfecda13f3 httpclient: update to revision 9517a2b56fe9 of httpplus (issue3905)
Includes upstream change "socketutil: force SSLv3 by default, as it is
safer" which should fix issue 3905.
2013-07-24 14:45:29 -04:00
Augie Fackler
16812584f2 httpclient: import 0d1b0a8bc549 to fix bug involving late-arriving RST after a response
After a day of hunting this defect, I'm now unable to reproduce the
bug without this patch applied. Regardless, this should fix the
problem I was observing with wireshark. Hopefully this fixes any
flakiness in the buildbot from http2.
2013-08-23 16:16:22 -04:00
Augie Fackler
2b894133a5 httpclient: upgrade to fe8c09e4db64 of httpplus 2013-05-11 20:25:15 -05:00
Brendan Cully
6d209b275f http2: sane readline
It turns out that it pays off to read more than a byte at a time with
a select in between :)
2013-02-01 15:00:23 -08:00
Brendan Cully
ce866bfa51 http2: make read use pushchunk/popchunk, eschew itertools
The itertools approach was showing up high in the profile output.
2013-02-01 14:41:35 -08:00
Brendan Cully
720c8502c6 http2: track available data as it changes instead of recomputing it
With a large amount of available data, this computation can become
costly.
2013-02-01 14:41:33 -08:00
Augie Fackler
a65f6b11d8 httpclient: apply change df9aea1def3e: remove use of two-argument raise 2013-01-01 13:25:07 -06:00
Mads Kiilerich
5e3dc3e383 avoid using abbreviations that look like spelling errors 2012-08-27 23:14:27 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Augie Fackler
c0cf243849 httpclient: omit tests for the client since we don't run them anyway 2012-05-19 09:34:25 -05:00
Augie Fackler
ad6bc369b7 httpclient: update to c5abd358e543 of httpplus 2012-05-18 17:05:17 -05:00
Augie Fackler
68b99d0585 httpclient: update to revision 892730fe7f46 of httpplus 2012-05-04 16:00:33 -05:00
Augie Fackler
3b65f30ba9 httpclient: update to 07d8c356f4d1 of py-nonblocking-http
This addresses a defect when the server closes the socket before
finishing a response (if it crashes, for example) first spotted in
Issue2951.
2011-10-10 17:57:40 -05:00
Augie Fackler
a8600f4669 httpclient: import ca33b88d143c from py-nonblocking-http (issue2932) 2011-07-29 12:46:45 -05:00
Augie Fackler
5086ed5b5d httpclient: import revision fc731618702a of py-nonblocking-http 2011-05-17 10:28:03 -05:00
Augie Fackler
5ace1beee1 httpclient: import revision b8c3511a8cae from py-nonblocking-http
Fixes issues with SSL_ERROR_WANT_READ incorrectly breaking the
response read.
2011-05-12 10:48:31 -05:00
Augie Fackler
21a2956afa httpclient: import f4c380237fd5 to fix keepalive not working 2011-05-11 08:00:48 -05:00
Augie Fackler
1753857f5b Import new http library as mercurial.httpclient.
This is revision a4229f13c374 of
http://py-nonblocking-http.googlecode.com/ with a no-check-code
comment added to the end of each file using `for fi in $(hg manifest |
grep mercurial/httpclient/) ; echo '# no-check-code' >> $fi`.
2011-05-06 09:57:55 -05:00