Commit Graph

142 Commits

Author SHA1 Message Date
Fred Drake df6eca7eb7 Support manual proxy configuration for simple urlopen() operations.
This change is similar to the supplied patch, but does not save the opener
when a proxy configuration is specified.
This closes SF patch #523415.
2002-04-04 20:41:34 +00:00
Guido van Rossum 64e5aa9391 Fix for a bug in the fix for SF bug 503031. This time the OP verified
that it works.

Bugfix candidate (this and the previous checkin, obviously).
2002-04-02 14:38:16 +00:00
Guido van Rossum b955d6c41e Hopeful fix for SF bug 503031: urllib.py: open_http() host problem.
I really can't test this, but from reading the discussion in that bug
report, it's likely that this works.  It may also close a whole bunch
of other bug reports related to urllib and proxies on Windows, but who
knows.
2002-03-31 23:38:48 +00:00
Neal Norwitz aad1849e25 time and socket were already imported in the module, no need to re-import 2002-03-26 16:25:01 +00:00
Walter Dörwald 92b48b739f use stat attributes instead of tuple entries
and remove the unneccessary "import stat" statement.
2002-03-22 17:30:38 +00:00
Andrew M. Kuchling 56a42356b7 To make 'urllib.py -t' run again, change FTP URL to a file that actually
exists.
2002-03-18 22:18:46 +00:00
Neal Norwitz bc9bc187aa SF #515024 remove unused variable 2002-02-11 18:06:21 +00:00
Guido van Rossum b931bf3c55 SF patch #490515 (Joe A) urllib.open_https() protocol issue
open_http():
    In urllib.py library module, URLopener.open_https()
    returns a class instance of addinfourl() with its
    self.url property missing the protocol.

    Instead of "https://www.someurl.com", it becomes
    "://www.someurl.com".
2001-12-08 17:09:07 +00:00
Fred Drake c680ae8002 Added missing parameter in call to http_error_default();
reported by Neal Norwitz.
2001-10-13 18:37:07 +00:00
Jeremy Hylton 6d8c1aabff Add content-type header to ftp URLs (SF patch #454553)
Modify rfc822.formatdate() to always generate English names,
regardless of locale.  This is required by RFC 1123.

In open_local_file() of urllib and urllib2, use new formatdate() from
rfc822.
2001-08-27 20:16:53 +00:00
Guido van Rossum 88e0b5bee0 SF patch #454553 by Walter Dörwald: auto-guess content-type header for
ftp urls.
2001-08-23 13:38:15 +00:00
Martin v. Löwis 58682b7fe5 Only catch the errors that can actually occur, as reported in bug #411881. 2001-08-11 15:02:57 +00:00
Tim Peters ab9ba27dc0 Whitespace normalization. 2001-08-09 21:40:30 +00:00
Tim Peters 55c12d4d5b SF patch #403640: incomplete proxy handling in URLLIB
Look specific to Windows.  Don't know whether it works.
2001-08-09 18:04:14 +00:00
Guido van Rossum f0713d3f4d SF Patch #420725 by Walter Doerwald:
For local files urllib.py doesn't return the MIME
  headers that the documentation says it does:

  http://www.python.org/doc/current/lib/module-
  urllib.html#l2h-2187 states that "When the method is
  local-file, returned headers will include a Date
  representing the file's last-modified time, a Content-
  Length giving file size, and a Content-Type containing
  a guess at the file's type"

  But in Python 2.1 the only header that gets returned
  is the Content-Type:

  >>> import urllib
  >>> f = urllib.urlopen("gurk.txt")
  >>> f.info().headers
  ['Content-Type: text/plain\n']
2001-08-09 17:43:35 +00:00
Fred Drake ec3dfdee6a Only write out one blank line before the request data.
This closes SF patch #419459.
2001-07-04 05:18:29 +00:00
Guido van Rossum b8bf3bece2 Fix SF bug [ #416231 ] urllib.basejoin fails to apply some ../.
Reported by Juan M. Bello Rivas.
2001-04-15 20:47:33 +00:00
Moshe Zadka 5d87d47295 fixing 408085 - redirect from https becomes http
Even though relative redirects are illegal, they are common
urllib treated every relative redirect as though it was to http,
even if the original was https://
As long as we're compensating for server bugs, might as well do
it properly.
2001-04-09 14:54:21 +00:00
Skip Montanaro 44d5e0c418 updated __all__ to include several other names 2001-03-13 19:47:16 +00:00
Jack Jansen 282fed1363 Grr, splittag was also missing from __all__. 2001-03-05 13:45:38 +00:00
Jack Jansen 49985638fa Added url2pathname and pathname2url to __all__. 2001-03-05 13:41:14 +00:00
Guido van Rossum d74fb6b12a RISCOS changes by dschwertberger. 2001-03-02 06:43:49 +00:00
Skip Montanaro 40fc16059f final round of __all__ lists (I hope) - skipped urllib2 because Moshe may be
giving it a slight facelift
2001-03-01 04:27:19 +00:00
Tim Peters 85ba673b0a Whitespace normalization. 2001-02-28 08:26:44 +00:00
Moshe Zadka e99bd17ed6 Fixing bug #227562 by calling URLopener.http_error_default when
an invalid 401 request is being handled.
2001-02-27 06:27:04 +00:00
Skip Montanaro c3e11d6569 provide simple recovery/escape from apparent redirect recursion. If the
number of entries into http_error_302 exceeds the value set for the maxtries
attribute (which defaults to 10), the recursion is exited by calling
the http_error_500 method (or if that is not defined, http_error_default).
2001-02-15 16:56:36 +00:00
Tim Peters 658cba6706 Whitespace normalization. 2001-02-09 20:06:00 +00:00
Skip Montanaro 14f1ad4a94 allow first param urlencode to be a sequence of two-element tuples - in this
case, the order of parameters in the output matches the order of the inputs.
2001-01-28 21:11:12 +00:00
Skip Montanaro a5d23a19e6 modify urlencode so sequences in the dict are treated as multivalued
parameters.  This closes the code part of patch 103314.
2001-01-20 15:56:39 +00:00
Guido van Rossum e27a7b8074 Anonymous SF bug 129288: "The python 2.0 urllib has %%%x as a format
when quoting forbidden characters. There are scripts out there that
break with lower case, therefore I guess %%%X should be used."

I agree, so am fixing this.
2001-01-19 03:28:15 +00:00
Guido van Rossum afc4f0413a - Make sure to quote the username and password (SF patch #103236 by
dogfort).

- Don't drop the data argument when calling open_https() from the
  authentication error handler.
2001-01-15 18:31:13 +00:00
Tim Peters e119006e7d Whitespace normalization. Top level of Lib now fixed-point for reindent.py! 2001-01-15 03:34:38 +00:00
Moshe Zadka b2a0a838e0 Fixed bug which caused HTTPS not to work at all with string URLs 2001-01-08 07:09:25 +00:00
Guido van Rossum b2493f855a Get rid of string functions, except maketrans() (which is *not*
obsolete!).

Fix a bug in ftpwrapper.retrfile() where somehow ftplib.error_perm was
assumed to be a string.  (The fix applies str().)

Also break some long lines and change the output from test() slightly.
2000-12-15 15:01:37 +00:00
Martin v. Löwis 1d99433a58 Convert Unicode strings to byte strings before passing them into specific
protocols. Closes bug #119822.
2000-12-03 18:30:10 +00:00
Jeremy Hylton d52755f41c Provide a clearer error message when urlopen fails because of an
invalid proxy setting.

Minor change to call of unknown_url; always pass data argument
explicitly since data defaults to None.

PEP 42: Add as a feature that urllib handle proxy setting that contain
only the host and port of the proxy.
2000-10-02 23:04:02 +00:00
Fredrik Lundh b49f88bfc1 - Improved handling of win32 proxy settings (addresses bug #114256).
The earlier code assumed "protocol=host;protocol=host;..." or "host",
but Windows may also use "protocol=host" (just one entry), as well as
"protocol://host".  This code needs some more work, so I'll leave the
bug open for now.
2000-09-24 18:51:25 +00:00
Jeremy Hylton 7ae51bf82d Remove "," from the list of always_safe characters. It is a reserved
character according to RFC 2396. Add some text to quote doc string
that explains the quoting rules better.

This closes SF Bug #114427.

Add _fast_quote operation that uses a dictionary instead of a list
when the standard set of safe characters is used.
2000-09-14 16:59:07 +00:00
Jeremy Hylton 6102e29df2 fixes bug #111951
applies patch #101369 by Moshe Zadke
use explicit list of always safe characters instead of string.letters
add test case
2000-08-31 15:48:10 +00:00
Sjoerd Mullender d7b86f0056 Pass data on to retrieve method.
Don't people *test* their changes?
2000-08-25 11:23:36 +00:00
Guido van Rossum ba3113807d Promote the server version from a local variable to a class variable,
so that a subclass can override it.

This partly addresses Bug #112634 -- but the documentation is still
wrong, since it suggests that you can set self.version *after* calling
the base class __init__.  In fact it must be done *before*.

I'll fix that too.
2000-08-24 16:18:04 +00:00
Fred Drake 316a793a58 Randall Hopper <aa8vb@yahoo.com>>:
Make it easier to use HTTP POST with urlretrieve().
2000-08-24 01:01:26 +00:00
Skip Montanaro 79f1c1778d * added doc strings to urlopen and unquote_plus
* fixed type in doc string for quote
2000-08-22 03:00:52 +00:00
Fred Drake 567ca8e732 Patch from Paul Schreiber <paul@commerceflow.com>:
Patch description
-----------------
This addresses four issues:

(1) usernames and passwords in urls with special characters are now
    decoded properly. i.e. http://foo%2C:bar@www.whatever.com/

(2) Basic Auth support has been added to HTTPS, like it was in HTTP.

(3) Version 1.92 sent the POSTed data, but did not deal with errors
    (HTTP responses other than 200) properly. HTTPS now behaves the
    same way HTTP does.

(4) made URL-checking beahve the same way with HTTPS as it does with
    HTTP (changed == to !=).
2000-08-21 21:42:42 +00:00
Mark Hammond 4f570b9239 Patch #100873 - Use registry to find proxies for urllib on Win32
Note that this patch looks worse than it is - an existing function (getproxies() for all platforms other than Win/Mac) has been moved, renamed and indentation changed, but the body of that function is identical.  Windows now allows the environment variables to override the registry.
2000-07-26 07:04:38 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Fred Drake 9e94afd18d Fix bug #314, reported by Craig Allen <cba@mediaone.net>:
splittype():  Always lower-case the URL scheme; these are supposed to be
               normalized according to RFC 1738 anyway.
2000-07-01 07:03:30 +00:00
Andrew M. Kuchling 7ad4792307 Comment out an apparent debug print 2000-06-10 01:41:48 +00:00
Guido van Rossum c580dae6da Fix a problem reported by Oleg Broytmann, who complains that very
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.
2000-05-24 13:21:46 +00:00
Andrew M. Kuchling 43c5af026f Fix to previous patch: send the request data when it's provided 2000-04-24 14:17:06 +00:00