[Patches] [ python-Patches-454553 ] Content-Type header for ftp url

noreply@sourceforge.net noreply@sourceforge.net
Thu, 23 Aug 2001 07:33:13 -0700


Patches item #454553, was opened at 2001-08-23 05:59
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=454553&group_id=5470

Category: library
Group: None
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Content-Type header for ftp url

Initial Comment:
This patch changes urllib.URLOpener.open_ftp: A 
Content-Type header is included when the MIME type can 
be guessed via mimetypes.guess_type.

A patch to the documentation is included.

Example:
>>> import urllib
>>> urllib.urlopen
("ftp://ftp.python.org/pub/python/2.2/Python-
2.2a2.tgz").info().headers   
['Content-Type: application/x-tar\n', 'Content-Length: 
5980204\n']

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-23 07:33

Message:
Logged In: YES 
user_id=6380

Feel free to contribute a patch. (Does it do content-types
for local files yet?)

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2001-08-23 07:01

Message:
Logged In: YES 
user_id=89016

Equivalent changes should probably be made to 
urllib2.FTPHandler.ftp_open too.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-23 06:38

Message:
Logged In: YES 
user_id=6380

Thanks!  Applied to CVS (with minimal changes).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=454553&group_id=5470