Commit Graph

294 Commits

Author SHA1 Message Date
Benjamin Peterson 3c2dca67ac in ftp cache pruning, avoid changing the size of a dict while iterating over it (closes #21463)
Patch by Skyler Leigh Amador.
2014-06-07 15:08:04 -07:00
Raymond Hettinger 122541bece Issue 21469: Mitigate risk of false positives with robotparser.
* Repair the broken link to norobots-rfc.txt.

* HTTP response codes >= 500 treated as a failed read rather than as a not
found.  Not found means that we can assume the entire site is allowed.  A 5xx
server error tells us nothing.

* A successful read() or parse() updates the mtime (which is defined to be "the
  time the robots.txt file was last fetched").

* The can_fetch() method returns False unless we've had a read() with a 2xx or
4xx response.  This avoids false positives in the case where a user calls
can_fetch() before calling read().

* I don't see any easy way to test this patch without hitting internet
resources that might change or without use of mock objects that wouldn't
provide must reassurance.
2014-05-12 21:56:33 -07:00
Senthil Kumaran 6117e5d8e3 urllib.response object to use _TemporaryFileWrapper (and _TemporaryFileCloser)
facility. Provides a better way to handle file descriptor close.

Address issue #15002 . Patch contributed by Christian Theune.
2014-04-20 09:41:29 -07:00
Senthil Kumaran d8e24f1f71 Convert urllib.request parse_proxy doctests to unittests. 2014-04-14 16:32:20 -04:00
Benjamin Peterson 78c8538461 fix typo 2014-04-01 16:27:30 -04:00
Benjamin Peterson 5dd3caed2b simplify check, since now there are only new-style classes 2014-04-01 14:20:56 -04:00
Victor Stinner d6a91a7ab6 Issue #20879: Delay the initialization of encoding and decoding tables for
base32, ascii85 and base85 codecs in the base64 module, and delay the
initialization of the unquote_to_bytes() table of the urllib.parse module, to
not waste memory if these modules are not used.
2014-03-17 22:38:41 +01:00
Serhiy Storchaka 5d83d1a814 Issue #20270: urllib.urlparse now supports empty ports. 2014-01-18 18:31:41 +02:00
Serhiy Storchaka ff97b08d00 Issue #20270: urllib.urlparse now supports empty ports. 2014-01-18 18:30:33 +02:00
Senthil Kumaran b6fac245b5 Backporing the fix from Issue #12692 2013-12-28 17:36:18 -08:00
Christian Heimes 67986f9431 Issue #19735: Implement private function ssl._create_stdlib_context() to
create SSLContext objects in Python's stdlib module. It provides a single
configuration point and makes use of SSLContext.load_default_certs().
2013-11-23 22:43:47 +01:00
Jason R. Coombs aae6a1d76f Issue #18978: A more elegant technique for resolving the method 2013-09-08 12:54:33 -04:00
Jason R. Coombs 7dc4f4bbab Issue #18978: Allow Request.method to be defined at the class level. 2013-09-08 12:47:07 -04:00
Senthil Kumaran d80f7be580 merge from 3.3
Improve urlencode docstring. Patch by Brian Brazil.
Closes issue #15350
2013-09-05 21:43:53 -07:00
Senthil Kumaran 324ae385fe Improve urlencode docstring. Patch by Brian Brazil. 2013-09-05 21:42:38 -07:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Senthil Kumaran caa00fec19 Fix #17967 - Fix related to regression on Windows.
os.path.join(*self.dirs) produces an invalid path on windows.
ftp paths are always forward-slash seperated like this. /pub/dir.
2013-06-02 11:59:47 -07:00
Senthil Kumaran dcdadfe39a Fix thishost helper funtion in urllib. Returns the ipaddress of localhost when
hostname is resolvable by socket.gethostname for local machine. This all fixes
certain freebsd builtbot failures.
2013-06-01 11:12:17 -07:00
Senthil Kumaran 4e42ae81f6 Fix #17967: For ftp urls CWD to target instead of hopping to each directory
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.
2013-06-01 08:27:06 -07:00
Senthil Kumaran c70a6ae49b #17403: urllib.parse.robotparser normalizes the urls before adding to ruleline.
This helps in handling certain types invalid urls in a conservative manner.
2013-05-29 05:54:31 -07:00
Senthil Kumaran 5ccf2ff3e9 merge from 3.3
Fix #17967 - Fix related to regression on Windows.

os.path.join(*self.dirs) produces an invalid path on windows.
ftp paths are always forward-slash seperated like this. /pub/dir.
2013-06-02 12:00:45 -07:00
Senthil Kumaran 88249b80d7 merge from 3.3
Fix thishost helper funtion in urllib. Returns the ipaddress of localhost when
hostname is resolvable by socket.gethostname for local machine. This all fixes
certain freebsd builtbot failures.
2013-06-01 11:12:52 -07:00
Senthil Kumaran e9ec2e173d merge from 3.3
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.
2013-06-01 08:27:53 -07:00
Senthil Kumaran 6b3026ce72 merge from 3.3
#17403: urllib.parse.robotparser normalizes the urls before adding to
ruleline. This helps in handling certain types invalid urls in a conservative
manner. Patch contributed by Mher Movsisyan.
2013-05-29 05:57:21 -07:00
Senthil Kumaran 8307075ce8 Fix #17272 - Make Request.full_url and Request.get_full_url return same result under all circumstances.
Document the change of Request.full_url to a property.
2013-05-24 09:14:12 -07:00
Benjamin Peterson fa6bdc6d86 merge 3.3 2013-05-12 19:02:05 -05:00
Benjamin Peterson 901a278861 use correct format code for exceptions 2013-05-12 19:01:52 -05:00
Senthil Kumaran 5238092592 Issue #17272: Making the urllib.request's Request.full_url a descriptor. Fixes
bugs with assignment to full_url. Patch by Demian Brecht.
2013-04-25 05:45:48 -07:00
Raymond Hettinger 56b0a3d89a Remove redundant imports 2013-04-06 20:53:12 -07:00
Senthil Kumaran 4a2ab120f3 Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request 2013-04-04 19:34:02 -07:00
R David Murray c616604a15 Merge: Use repr when printing unknown url type in urlopen. 2013-04-03 07:01:07 -04:00
R David Murray d8a46969f7 Use repr when printing unknown url type in urlopen. 2013-04-03 06:58:34 -04:00
Antoine Pitrou 9a8d6934df Issue #17483: remove unreachable code in urlopen(). 2013-04-01 18:55:35 +02:00
R David Murray 9cc7d45571 #17485: Delete the Content-Length header if the data attribute is deleted.
This is a follow on to issue 16464.  Original patch by Daniel Wozniak.
2013-03-20 00:10:51 -04:00
Senthil Kumaran 41518b4af0 #17474 - Remove the various deprecated methods of Request class. 2013-03-18 18:06:00 -07:00
Serhiy Storchaka c12956ddf2 Issue #1285086: Get rid of the refcounting hack and speed up
urllib.parse.unquote() and urllib.parse.unquote_to_bytes().
2013-03-14 21:34:55 +02:00
Serhiy Storchaka a9d24e6766 Issue #1285086: Get rid of the refcounting hack and speed up
urllib.parse.unquote() and urllib.parse.unquote_to_bytes().
2013-03-14 21:33:35 +02:00
Serhiy Storchaka 8ea4616f16 Issue #1285086: Get rid of the refcounting hack and speed up
urllib.parse.unquote() and urllib.parse.unquote_to_bytes().
2013-03-14 21:31:37 +02:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Senthil Kumaran 750909e618 Fix issue16713 - tel url parsing with params 2012-12-24 14:01:48 -08:00
Senthil Kumaran bd6667aae3 Fix issue16713 - tel url parsing with params 2012-12-24 14:01:13 -08:00
Senthil Kumaran ed30199e78 Fix issue16713 - tel url parsing with params 2012-12-24 14:00:20 -08:00
Senthil Kumaran 0a6b9eca68 merge from 3.2
Fix Issue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctly
2012-12-23 09:12:13 -08:00
Senthil Kumaran 41e66a26b0 Fix Issue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctly 2012-12-23 09:04:24 -08:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Andrew Svetlov 0832af6628 Issue #16717: get rid of socket.error, replace with OSError 2012-12-18 23:10:48 +02:00
Andrew Svetlov 3438fa496d Get rig of EnvironmentError (#16705) 2012-12-17 23:35:18 +02:00
Senthil Kumaran 5962cce050 Fix Issue15701 : add .headers attribute to urllib.error.HTTPError 2012-12-10 02:09:35 -08:00
Andrew Svetlov bff98fe536 Issue #16464: reset Request's Content-Length header on .data change.
It will be recalculated on sending request to HTTP server.

Patch by Alexey Kachayev
2012-11-27 23:06:19 +02:00