Commit Graph

66 Commits

Author SHA1 Message Date
Antoine Pitrou d532321f7b Issue #5639: Add a *server_hostname* argument to `SSLContext.wrap_socket`
in order to support the TLS SNI extension.  `HTTPSConnection` and
`urlopen()` also use this argument, so that HTTPS virtual hosts are now
supported.
2010-10-22 18:19:07 +00:00
Georg Brandl 1f7fffb308 #2830: add html.escape() helper and move cgi.escape() uses in the standard library to it. It defaults to quote=True and also escapes single quotes, which makes casual use safer. The cgi.escape() interface is not touched, but emits a (silent) PendingDeprecationWarning. 2010-10-15 15:57:45 +00:00
Antoine Pitrou 8060399654 Typo. It is rather obvious that this code isn't tested :/ 2010-10-13 10:45:16 +00:00
Antoine Pitrou 803e6d670c Issue #9003: http.client.HTTPSConnection, urllib.request.HTTPSHandler and
urllib.request.urlopen now take optional arguments to allow for
server certificate checking, as recommended in public uses of HTTPS.
2010-10-13 10:36:15 +00:00
Antoine Pitrou fa9c38d8e9 FakeSocket is (supposed to be) gone in 3.x 2010-10-06 18:38:22 +00:00
Senthil Kumaran 58d5dbf80b Fix Issue10012 - httplib headers, which are (sometimes mistakenly) int are explicitly cast to str (bytes - in py3k). 2010-10-03 18:22:42 +00:00
Senthil Kumaran 4271372a71 Fix Issue9272 - Change CGIHTTPServer to give the child program a copy of os.environ 2010-10-03 17:55:45 +00:00
Senthil Kumaran 5a2da3b3ad Use proper variable name 'data' instead of 'str' in the send method. 2010-10-02 10:33:13 +00:00
Senthil Kumaran 0f476d49f8 Issue1491 - BaseHTTPServer incorrectly implements response code 100 2010-09-30 06:09:18 +00:00
Senthil Kumaran 9f8dc4441f Fix Issue8572 - httplib getheader() throws error instead of default 2010-08-02 11:04:58 +00:00
Georg Brandl b16e38b825 #8826: the "expires" attribute value is a date string with spaces, but apparently not all user-agents put it in quotes. Handle that as a special case. 2010-08-01 09:06:34 +00:00
Georg Brandl 87a1564f24 #5147: revert accidental indentation of header constant for MozillaCookieJar. 2010-07-31 22:11:11 +00:00
Georg Brandl 62e2ca2193 #8292: Fix three instances of truth tests on return values of filter() (which is always true in Python 3). 2010-07-31 21:54:24 +00:00
Georg Brandl 76e155a157 #3788: more tests for http.cookies, now at 95% coverage. Also bring coding style in the module up to PEP 8, where it does not break backwards compatibility. 2010-07-31 21:04:00 +00:00
Victor Stinner 756f547b9a #9032: XML-RPC client: Transport.request() retries on EPIPE error
The EPIPE error occurs when the server closes the socket and the client sends a
"big" XML-RPC request (I don't know exactly the size threshold).

request() just have to ignore the error because single_request() closes the
socket on error, and so the next call to single_request() will open a new
socket.

Remove also a comment in the HTTP client because it's now wrong: see r70643
and issue #5542.
2010-07-24 02:24:55 +00:00
Gregory P. Smith 41e6c3df8b Fixes Issue #3704: http.cookiejar was not properly handling URLs with a / in
the parameters.  (This is jjlee's issue3704.patch ported to py3k)
2010-07-19 23:17:22 +00:00
Benjamin Peterson 3e5cd1d04e Merged revisions 81465-81466,81468,81679,81735,81760,81868,82183 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81465 | georg.brandl | 2010-05-22 06:29:19 -0500 (Sat, 22 May 2010) | 2 lines

  Issue #3924: Ignore cookies with invalid "version" field in cookielib.
........
  r81466 | georg.brandl | 2010-05-22 06:31:16 -0500 (Sat, 22 May 2010) | 1 line

  Underscore the name of an internal utility function.
........
  r81468 | georg.brandl | 2010-05-22 06:43:25 -0500 (Sat, 22 May 2010) | 1 line

  #8635: document enumerate() start parameter in docstring.
........
  r81679 | benjamin.peterson | 2010-06-03 16:21:03 -0500 (Thu, 03 Jun 2010) | 1 line

  use a set for membership testing
........
  r81735 | michael.foord | 2010-06-05 06:46:59 -0500 (Sat, 05 Jun 2010) | 1 line

  Extract error message truncating into a method (unittest.TestCase._truncateMessage).
........
  r81760 | michael.foord | 2010-06-05 14:38:42 -0500 (Sat, 05 Jun 2010) | 1 line

  Issue 8302. SkipTest exception is setUpClass or setUpModule is now reported as a skip rather than an error.
........
  r81868 | benjamin.peterson | 2010-06-09 14:45:04 -0500 (Wed, 09 Jun 2010) | 1 line

  fix code formatting
........
  r82183 | benjamin.peterson | 2010-06-23 15:29:26 -0500 (Wed, 23 Jun 2010) | 1 line

  cpython only gc tests
........
2010-06-27 21:45:24 +00:00
Senthil Kumaran 447f82f95f Merged revisions 81687 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81687 | senthil.kumaran | 2010-06-04 22:02:14 +0530 (Fri, 04 Jun 2010) | 3 lines

  Fix issue6312 - close the resp object for HEAD response.
........
2010-06-04 16:38:00 +00:00
Senthil Kumaran 71fb6c88a8 Merged revisions 80583 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80583 | senthil.kumaran | 2010-04-28 22:50:43 +0530 (Wed, 28 Apr 2010) | 3 lines

  Fixed Issue6312 - httplib fails with HEAD requests to pages with "transfer-encoding: chunked"
........
2010-04-28 17:39:48 +00:00
Benjamin Peterson 11dbfd4195 Merged revisions 78417 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78417 | dirkjan.ochtman | 2010-02-23 22:49:00 -0600 (Tue, 23 Feb 2010) | 1 line

  Issue #7427: improve the representation of httplib.BadStatusLine exceptions.
........
2010-03-21 22:50:04 +00:00
Benjamin Peterson 90f5ba538b convert shebang lines: python -> python3 2010-03-11 22:53:45 +00:00
Senthil Kumaran 7aa2621720 Merged revisions 78299 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78299 | senthil.kumaran | 2010-02-22 16:25:08 +0530 (Mon, 22 Feb 2010) | 4 lines

  Fix Issue7172 - BaseHTTPServer.BaseHTTPRequestHandler.responses[405] - changing
  server to resource in the 405 response msg.
........
2010-02-22 11:00:50 +00:00
Gregory P. Smith b4066374db Merged revisions 77263-77264 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77263 | gregory.p.smith | 2010-01-02 17:29:44 -0800 (Sat, 02 Jan 2010) | 4 lines

  Adds an optional source_address parameter to socket.create_connection().

  For use by issue3972.
........
  r77264 | gregory.p.smith | 2010-01-02 18:06:07 -0800 (Sat, 02 Jan 2010) | 5 lines

  issue3972: HTTPConnection and HTTPSConnection now support a
  source_address parameter.

  Also cleans up an annotation in the socket documentation.
........
2010-01-03 03:28:29 +00:00
Senthil Kumaran 47fff87027 Merged revisions 76908 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76908 | senthil.kumaran | 2009-12-20 11:35:13 +0530 (Sun, 20 Dec 2009) | 4 lines

  Fix for issue 7291 - urllib2 cannot handle https with proxy requiring auth
  Refactored HTTPHandler tests and added testcase for proxy authorization.
........
2009-12-20 07:10:31 +00:00
Senthil Kumaran e29cd162ed Merged revisions 76208 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76208 | senthil.kumaran | 2009-11-11 07:04:44 +0530 (Wed, 11 Nov 2009) | 3 lines

  CGIHTTPRequestHandler.run_cgi() to use subprocess for Non Unix platforms. Fix
  based on Issue1235.
........
2009-11-11 04:17:53 +00:00
Antoine Pitrou ead1d62d32 [NOTE: the original bug doesn't exist in py3k but this adds Kirk's tests and fixes
another bug in the process]


Merged revisions 75134 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75134 | antoine.pitrou | 2009-09-29 19:48:18 +0200 (mar., 29 sept. 2009) | 4 lines

  Issue #6790: Make it possible again to pass an `array.array` to
  `httplib.HTTPConnection.send`. Patch by Kirk McDonald.
........
2009-09-29 18:44:53 +00:00
Benjamin Peterson 8719ad5dde Merged revisions 74277,74321,74323,74326,74355,74465,74467,74488,74492,74513,74531,74549,74553,74625,74632,74643-74644,74647,74652,74666,74671,74727,74739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74277 | sean.reifschneider | 2009-08-01 18:54:55 -0500 (Sat, 01 Aug 2009) | 3 lines

  - Issue #6624: yArg_ParseTuple with "s" format when parsing argument with
    NUL: Bogus TypeError detail string.
........
  r74321 | guilherme.polo | 2009-08-05 11:51:41 -0500 (Wed, 05 Aug 2009) | 1 line

  Easier reference to find (at least while svn continues being used).
........
  r74323 | guilherme.polo | 2009-08-05 18:48:26 -0500 (Wed, 05 Aug 2009) | 1 line

  Typo.
........
  r74326 | jesse.noller | 2009-08-05 21:05:56 -0500 (Wed, 05 Aug 2009) | 1 line

  Fix issue 4660: spurious task_done errors in multiprocessing, remove doc note for from_address
........
  r74355 | gregory.p.smith | 2009-08-12 12:02:37 -0500 (Wed, 12 Aug 2009) | 2 lines

  comment typo fix
........
  r74465 | vinay.sajip | 2009-08-15 18:23:12 -0500 (Sat, 15 Aug 2009) | 1 line

  Added section on logging to one file from multiple processes.
........
  r74467 | vinay.sajip | 2009-08-15 18:34:47 -0500 (Sat, 15 Aug 2009) | 1 line

  Refined section on logging to one file from multiple processes.
........
  r74488 | vinay.sajip | 2009-08-17 08:14:37 -0500 (Mon, 17 Aug 2009) | 1 line

  Further refined section on logging to one file from multiple processes.
........
  r74492 | r.david.murray | 2009-08-17 14:26:49 -0500 (Mon, 17 Aug 2009) | 2 lines

  Issue 6685: 'toupper' -> 'upper' in cgi doc example explanation.
........
  r74513 | skip.montanaro | 2009-08-18 09:37:52 -0500 (Tue, 18 Aug 2009) | 1 line

  missing module ref (issue6723)
........
  r74531 | vinay.sajip | 2009-08-20 17:04:32 -0500 (Thu, 20 Aug 2009) | 1 line

  Added section on exceptions raised during logging.
........
  r74549 | benjamin.peterson | 2009-08-24 12:42:36 -0500 (Mon, 24 Aug 2009) | 1 line

  fix pdf building by teaching latex the right encoding package
........
  r74553 | r.david.murray | 2009-08-26 20:04:59 -0500 (Wed, 26 Aug 2009) | 2 lines

  Remove leftover text from end of sentence.
........
  r74625 | benjamin.peterson | 2009-09-01 17:27:57 -0500 (Tue, 01 Sep 2009) | 1 line

  remove the check that classmethod's argument is a callable
........
  r74632 | georg.brandl | 2009-09-03 02:27:26 -0500 (Thu, 03 Sep 2009) | 1 line

  #6828: fix wrongly highlighted blocks.
........
  r74643 | georg.brandl | 2009-09-04 01:59:20 -0500 (Fri, 04 Sep 2009) | 2 lines

  Issue #2666: Handle BROWSER environment variable properly for unknown browser names in the webbrowser module.
........
  r74644 | georg.brandl | 2009-09-04 02:55:14 -0500 (Fri, 04 Sep 2009) | 1 line

  #5047: remove Monterey support from configure.
........
  r74647 | georg.brandl | 2009-09-04 03:17:04 -0500 (Fri, 04 Sep 2009) | 2 lines

  Issue #5275: In Cookie's Cookie.load(), properly handle non-string arguments as documented.
........
  r74652 | georg.brandl | 2009-09-04 06:25:37 -0500 (Fri, 04 Sep 2009) | 1 line

  #6756: add some info about the "acct" parameter.
........
  r74666 | georg.brandl | 2009-09-05 04:04:09 -0500 (Sat, 05 Sep 2009) | 1 line

  #6841: remove duplicated word.
........
  r74671 | georg.brandl | 2009-09-05 11:47:17 -0500 (Sat, 05 Sep 2009) | 1 line

  #6843: add link from filterwarnings to where the meaning of the arguments is covered.
........
  r74727 | benjamin.peterson | 2009-09-08 18:04:22 -0500 (Tue, 08 Sep 2009) | 1 line

  #6865 fix ref counting in initialization of pwd module
........
  r74739 | georg.brandl | 2009-09-11 02:55:20 -0500 (Fri, 11 Sep 2009) | 1 line

  Move function back to its section.
........
2009-09-11 22:24:02 +00:00
Chris Withers 9c33cbfbef Fixes issue #6838: use a list to accumulate the value instead of repeatedly concatenating strings. 2009-09-04 17:04:16 +00:00
Georg Brandl 9cf32a12a1 Turn some comments into docstrings. 2009-09-04 08:28:01 +00:00
Georg Brandl 4eff9f7ff7 Remove pseudo-end markers from http.cookies. 2009-09-04 08:22:00 +00:00
Senthil Kumaran 97f0c6be46 Fixed Issue1424152 in Py3k: urllib2 fails with HTTPS over Proxy. 2009-07-25 04:24:38 +00:00
Kristján Valur Jónsson 985fc6a304 http://bugs.python.org/issue6267
porting revision 73638 to py3k
2009-07-01 10:01:31 +00:00
Georg Brandl 706824f19f More codestring -> codebytes. 2009-06-04 09:42:55 +00:00
Benjamin Peterson a7deeeeed7 port r72246 2009-05-08 20:54:42 +00:00
Benjamin Peterson ad71f0f016 Merged revisions 71303 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71303 | gregory.p.smith | 2009-04-06 01:33:26 -0500 (Mon, 06 Apr 2009) | 3 lines

  - Issue #2254: Fix CGIHTTPServer information disclosure.  Relative paths are
    now collapsed within the url properly before looking in cgi_directories.
........
2009-04-11 20:12:10 +00:00
Alexandre Vassalotti b5292a2e27 Make http.server main program nicer for interactive use.
Remove unreachable calls to test().

This restores the behavior of SimpleHTTPServer, where a user could
type "python -m SimpleHTTPServer" and get a simple server for sharing
files. Now, you can do the same thing with "python3 -m http.server".
2009-04-03 07:16:55 +00:00
Senthil Kumaran 3e2ea79bda Fixing the issue4860. Escaping the embedded '"' in the js_output method of Morsel class. 2009-04-02 03:02:03 +00:00
Jeremy Hylton a7cff0230b An HTTPResponse is, by its nature, readable. 2009-04-01 02:35:56 +00:00
Jeremy Hylton 6c5e28c383 Simplify the Request class. The basic components of the parsed
Request are now available as public attributes, e.g. full_url and
host.  The accessor methods are deprecated.  The implementation
replace the complicated __getattr__ machinery with a _parse() method.

The response from an HTTP request is now an HTTPResponse instance
instead of an addinfourl() wrapper instance.  The wrapper provided
minimal extract functionality and was undocumented.  The API of
addinfourl() was preserved, except for close hooks, by adding a few
methods and public attributes to the HTTPResponse class.
2009-03-31 14:35:53 +00:00
Jeremy Hylton 636950f925 Remove special logic that closes HTTPConnection socket on EPIPE.
http://bugs.python.org/issue5542

If the socket is closed, the client has no chance to read the response
from the server.  EPIPE means that it isn't possible to write more
data from the socket, but not that it is impossible to read.

Also, various formatting changes.
2009-03-28 04:34:21 +00:00
Jeremy Hylton 236654b82d Fix some string encoding issues with entity bodies in HTTP requests.
RFC 2616 says that iso-8859-1 is the default charset for HTTP entity
bodies, but we encoded strings using ascii.  See
http://bugs.python.org/issue5314.  Changed docs and code to use
iso-8859-1.

Also fix some brokenness with passing a file as the body instead of a
string.

Add tests to show that some of this behavior actually works.
2009-03-27 20:24:34 +00:00
Jeremy Hylton 98eb6c2838 Fix compatibility issue with HTTPMessage class.
The server needs to use MessageClass to parse.
2009-03-27 18:31:36 +00:00
Jeremy Hylton 914ab45d0a Sort import list. 2009-03-27 17:16:06 +00:00
Jeremy Hylton e6fdd04b37 Replace duplicate code in http.server with call to http.client.parse_headers(). 2009-03-27 17:14:18 +00:00
Jeremy Hylton ef9f48e578 Simplify complex expression. 2009-03-26 22:04:05 +00:00
Benjamin Peterson 6accb988a1 Merged revisions 70107 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70107 | benjamin.peterson | 2009-03-02 16:41:42 -0600 (Mon, 02 Mar 2009) | 1 line

  give httplib.IncompleteRead a more sane repr #4308
........
2009-03-02 22:50:25 +00:00
Antoine Pitrou b353c12a9c Issue #4631: Fix urlopen() result when an HTTP response uses chunked encoding. 2009-02-11 00:39:14 +00:00
Benjamin Peterson f72d9fb02f revert 69416; it didn't help much 2009-02-08 00:29:20 +00:00
Benjamin Peterson ded0c033c2 fix typo and test_urllib failures 2009-02-07 22:55:24 +00:00
Kristján Valur Jónsson 7e11b3f522 merging / reimplementing r68532 from the trunk to Py3k
Enable buffering for HTTPResponse's fp.  read() behaves identically for buffered and non-buffered IO.  read(n) also won't block if n bytes are availble on the socket.  There is therefore no reason not to use buffering.  The reason 2.x disables buffering by default, that some clients may be accessing the underlying socket directly and so bypass the buffering buffer, doesn't apply in 3.x with its redesigned IO library.
See issue 4448 and issue 4879
2009-02-02 16:04:04 +00:00