summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
Commit message (Collapse)AuthorAgeFilesLines
* Comment out an apparent debug printAndrew M. Kuchling2000-06-101-1/+1
|
* Fix a problem reported by Oleg Broytmann, who complains that veryGuido van Rossum2000-05-241-1/+1
| | | | | | | | | | | | often, ftp URLs hang in the final close. Further analysis suggests that this is because the close hook in addclosehook() calls the hook before acually closing the connection. The hook, in this case, waits for the '226 Transfer complete' status from the server on the command socket. However, more and more ftp servers only send this status when the data socket has actually been closed -- causing a deadlock. The fix is simple: in addclosehook.close(), call addbase.close() *before* calling the closehook.
* Fix to previous patch: send the request data when it's providedAndrew M. Kuchling2000-04-241-0/+2
|
* Fixed bug reported by JP Calderone: https:// URL's didn't work.Andrew M. Kuchling2000-04-231-2/+8
| | | | The fix also adds support for POSTing to an https URL
* The third and final doc-string sweep by Ka-Ping Yee.Guido van Rossum2000-02-041-79/+108
| | | | | | | | The attached patches update the standard library so that all modules have docstrings beginning with one-line summaries. A new docstring was added to formatter. The docstring for os.py was updated to mention nt, os2, ce in addition to posix, dos, mac.
* Sjoerd Mullender writes:Guido van Rossum2000-02-011-5/+14
| | | | | | | | | | | | Fixed a TypeError: not enough arguments; expected 4, got 3. When authentication is needed, the default http_error_401 method calls retry_http_basic_auth. The default version of that method expected a data argument which wasn't provided, so now we provide the argument if it was given and we also made the data argument optional. Also changed other calls where data was optional to not pass data if it was not passed to the calling method (in line with other similar occurances).
* OpenSSL support. This is based on patches for a version of SSLeay byGuido van Rossum1999-12-071-5/+57
| | | | | | Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR.
* Patches by Michael Reilly to correctly deal with ftp URLs of the formGuido van Rossum1999-08-181-0/+1
| | | | | ftp://user@host//root/path: the double slash in the pathname means to go to the root directory even if the initial directory isn't the root.
* Sjoerd Mullender:Guido van Rossum1999-07-011-1/+1
| | | | | | In splithost, accept empty host part in URLs. This is required for file URLs that can have an empty host part. For such URLs, we should not return the initial 2 slashes as part of the file name.
* Sjoerd Mullender writes:Guido van Rossum1999-06-241-2/+8
| | | | | | | | | | | Urllib makes the URL of the opened file available through the geturl method of the returned object. For local files, this consists of file: plus the name of the file. This results in an invalid URL if the file name was relative. This patch fixes this so that the returned URL is just a relative URL in that case. When the file name is absolute, the URL returned is of the form file:///absolute/path. [I guess that a URL of the form "file:foo.html" is illegal... GvR]
* Updated lagging version#. Also added some comments about how quote()Guido van Rossum1999-06-091-1/+3
| | | | and quote_plus() can be optimized tenfold.
* Hack so that if a 302 or 301 redirect contains a relative URL, theGuido van Rossum1999-03-291-0/+2
| | | | right thing "just happens" (basejoin() with old URL).
* Yet another patch by Sjoerd Mullender:Guido van Rossum1999-03-151-2/+2
| | | | Don't convert URLs to URLs using pathname2url.
* From: Sjoerd MullenderGuido van Rossum1999-03-121-9/+2
| | | | | | The filename to URL conversion didn't properly quote special characters. The URL to filename didn't properly unquote special chatacters.
* open_http also had the 'data is None' test backwards. don't call with theGuido van Rossum1999-03-091-3/+2
| | | | extra argument if data is None.
* http_error had the 'data is None' test backwards. don't call with theJeremy Hylton1999-02-251-4/+3
| | | | extra argument if data is None.
* change indentation from 8 spaces to 4 spacesJeremy Hylton1999-02-251-878/+859
|
* pleasing the tabnannyJeremy Hylton1999-02-251-11/+11
|
* When performing a POST request, i.e. when the second argument toJeremy Hylton1999-02-241-11/+27
| | | | | | | urlopen is used to specify form data, make sure the second argument is threaded through all of the http_error_NNN calls. This allows error handlers like the redirect and authorization handlers to properly re-start the connection.
* As Des Barry points out, we need to call pathname2url(file) in twoGuido van Rossum1999-02-221-2/+2
| | | | calls to addinfourl() in open_file().
* In open_ftp(), check that retrlen is not None before using it in a %d format!Guido van Rossum1999-02-161-1/+1
|
* Sjoerd Mullender:Guido van Rossum1998-12-181-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | File names with "funny" characters get translated wrong by pathname2url (any variety). E.g. the (Unix) file "/ufs/sjoerd/#tmp" gets translated into "/ufs/sjoerd/#tmp" which, when interpreted as a URL is file "/ufs/sjoerd/" with fragment ID "tmp". Here's an easy fix. (An alternative fix would be to change the various implementations of pathname2url and url2pathname to include calls to quote and unquote. [The main problem is with the normal use of URLs: url = url2pathname(file) transmit url url, tag = splittag(url) urlopen(url) ] In addition, this patch fixes some uses of unquote: - the host part of URLs should be unquoted - the file path in the FTP URL should be unquoted before it is split into components. - because of the latter, I removed all unquoting from ftpwrapper, and moved it to the caller, but that is not essential
* Changes by Eric Raymond:Guido van Rossum1998-09-281-14/+32
| | | | | | | | | | | | 1. Generate a correct Content-Length header visible through the info() method if a request to open an FTP URL gets a length in the response to RETR. 2. Take a third argument to urlretrieve() that makes it possible to progress- meter an urlretrieve call (this is what I needed the above change for). See the second patch band below for details. 3. To avoid spurious errors, I commented out the gopher test. The target document no longer exists.
* On the Mac, use Internet Config to find the proxies (Jack Jansen).Guido van Rossum1998-08-061-15/+49
| | | | Also added two XXX comments about lingering thread unsafeness.
* Speed up the implementation of quote().Guido van Rossum1998-07-221-8/+17
| | | | | | | | Fix the implementation of quote_plus(). (It wouldn't treat '+' in the original data right.) Add urlencode(dict) which is handy to create the data for sending a POST request with urlopen().
* Oops! Of course, Tim is right -- when the item is not a hex number,Guido van Rossum1998-06-291-2/+2
| | | | the '%' should be put back in.
* Speed-up unquote(), inspired by post from Daniel Walton.Guido van Rossum1998-06-281-18/+16
|
* Rewrite the (test) main program so that when used as a script, it canGuido van Rossum1998-06-251-5/+29
| | | | retrieve one or more URLs to stdout. Use -t to run the self-test.
* Use the getpass module instead of having platform-specific echo on/offGuido van Rossum1998-06-121-18/+5
| | | | code here.
* Patches to make the proxy code work again. (Why does that always breakGuido van Rossum1998-05-051-2/+3
| | | | | | as soon as I change things even just a little bit? :-) Even works when accessing a password-protected page through the proxy. Prompted by complaints from, and correct operation verified by, Nigel O'Brian.
* Feeble attempt at making urlopen more robust -- don't call splituser()Guido van Rossum1998-04-271-2/+6
| | | | | when splithost() returned no useable host, to avoid calling splituser() on None.
* Oops -- remove some debug print statements!Guido van Rossum1998-04-111-4/+0
|
* Oops, pulled over by the tab police :-)Guido van Rossum1998-04-031-9/+9
|
* Change by Sjoerd (with minor reformatting):Guido van Rossum1998-04-031-4/+18
| | | | | | | | | | guess the mime type of a local file. Change suggested by Sjoerd (with different implementation): when retrieve() creates a temporary file, preserve the suffix. Corrollary of the first change: also return the mime type of a local file in retrieve().
* A few lines were indented using spaces instead of tabs -- fix them.Guido van Rossum1998-03-301-8/+8
|
* A few lines were indented using spaces instead of tabs -- fix them.Guido van Rossum1998-03-261-64/+65
|
* Added support for "data" URL, by Sjoerd Mullender.Guido van Rossum1998-03-121-0/+40
|
* Fix a horrible race condition -- various routines were storing theGuido van Rossum1998-02-131-9/+7
| | | | | | | | | | | most recently opened URL in self.openedurl of the URLopener instance. This doesn't really work if multiple threads share the same opener instance! Fix: openedurl was actually simply the type prefix (e.g. "http:") followed by the rest of the URL; since the rest of the URL is available and the type is effectively determined by where you are in the code, I can reconstruct the full URL easily, e.g. "http:" + url.
* Two suggested features by Sjoerd:Guido van Rossum1998-02-051-6/+7
| | | | | | - use the tempcache in the open() method, too. - use the "unwrap"ped url as key for the tempcache.
* (1) Use matchobj.groups(), not matchbj.group() to get all groups.Guido van Rossum1998-02-051-4/+8
| | | | | (2) Provisional hack to avoid dying when trying to turn echo on or off on Macs, where os.system() doesn't exist.
* Fix bad new bug in ftp code -- the test for existing file using NLSTGuido van Rossum1998-01-191-0/+4
| | | | would set the transfer to text mode instead of the specified mode.
* Solve two annoying problems with ftp URLs for Jack: when repeatedGuido van Rossum1997-12-281-0/+14
| | | | | | | | | | retrieving files from the same host and directory, you had to close the previous instance before opening a new one; and retrieving a non-existent file would return an empty file. (The latter fix relies on maybe an undocumented property of NLST -- NLST of a file returns just that file, while NLST of a non-existent file returns nothing. A side effect, unfortunately, seems to be that now ftp-retrieving an *empty* directory may fail. Ah well.)
* When a port is specified in an ftp:// URL, must convert it to a number!Guido van Rossum1997-12-021-0/+2
|
* Assert that the proxies object passed in to the URLopener constructorGuido van Rossum1997-11-181-0/+1
| | | | is indeed a dictionary (or a mapping).
* This should hopefully finally clean up the remaining __del__ relatedGuido van Rossum1997-10-271-9/+11
| | | | | problems with this module, even if an instance of a derived class is kept alive longer than the urllib module itself...
* splitpasswd(): The parameter is named "user", not "host".Fred Drake1997-10-141-1/+1
|
* Use sys.exc_info() where needed.Guido van Rossum1997-09-291-44/+106
| | | | Use "re" module, making it threadsafe.
* Initialize self.__tempfiles to [] in the constructor (else it remainsGuido van Rossum1997-09-081-0/+1
| | | | | a shared class variable -- but each instance will attempt to clean it up entirely ob cleanup).
* One patch from Sjoerd and one from Jack.Guido van Rossum1997-09-031-7/+14
| | | | | | | | | | | Sjoerd: add separate administration of temporary files created y URLopener.retrieve() so cleanup can properly remove them. The old code removed everything in tempcache which was a bad idea if the user had passed a non-temp file into it. (I added a line to delete the tempcache in cleanup() -- it still seems to make sense.) Jack: in basejoin(), interpret relative paths starting in "../". This is necessary if the server uses symbolic links.
* Explicitly close the socket and temp file in URLopener.retrieve(), soGuido van Rossum1997-08-261-0/+2
| | | | | | | | | that multiple retrievals using the same connection will work. This leaves open the more general problem that after f = urlopen("ftp://...") f must be closed before another retrieval from the same host should be attempted.