[Patches] [ python-Patches-827559 ] SimpleHTTPServer directory-indexing " bug" fix

SourceForge.net noreply at sourceforge.net
Fri Dec 22 20:09:07 CET 2006


Patches item #827559, was opened at 2003-10-21 10:49
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=827559&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
>Group: Python 2.5
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Chris Gonnerman (solomoriah)
>Assigned to: A.M. Kuchling (akuchling)
Summary: SimpleHTTPServer directory-indexing "bug" fix

Initial Comment:
The SimpleHTTPServer.py module, when presented with a
URL of the form:

      http://some.site.com/directory

should redirect the browser to:

      http://some.site.com/directory/

This is evidently a standard behavior of major
webservers (Apache and IIS at least).  SimpleHTTPServer
does not do this, but fortunately it is simple to
implement (patch attached, naturally).

I am providing a fix for 2.2 but this problem appears
to be in earlier versions, and is also in 2.3.  This
patch appears to work fine for 2.3.



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

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-12-22 14:09

Message:
Logged In: YES 
user_id=11375
Originator: NO

Committed to the trunk in rev. 53147 and to 25-maint in rev. 53148. 
Thanks for the fix!


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

Comment By: Titus Brown (titus)
Date: 2004-12-19 03:20

Message:
Logged In: YES 
user_id=23486

Clearly a bug, IMO: a reference to a directory name w/o a slash
will return the directory listing, but relative links do not then work.
(Does this need more explication or ???)

Patch works against latest CVS & fixes behavior.  Recommend 
application.

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

Comment By: Chris Gonnerman (solomoriah)
Date: 2003-11-14 00:28

Message:
Logged In: YES 
user_id=321948

Oops.  Allow me to clarify.  Directory names without a
trailing slash need to be redirected to the same name with
the trailing slash to avoid breaking relative links from the
page.

I use SimpleHTTPServer to test websites which will be
deployed via Apache.  Relative links on default directory
pages (index.html) are broken using SimpleHTTPServer but
work correctly on Apache.

This is a de facto standard at least (I haven't read the
RFC's but both IE and Mozilla expect this behavior).


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

Comment By: Martin v. Löwis (loewis)
Date: 2003-11-13 10:54

Message:
Logged In: YES 
user_id=21627

Why is this a bug? SimpleHTTPServer already returns the
directory content if only the directory name is given, with
or without trailing slash. I believe Apache does that only
as an implementation detail, and it is unfortunate that this
detail is exposed to clients.

So unless you can report a specific problem with the
approach taken by SimpleHTTPServer, I'm tempted to reject
this patch.

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

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


More information about the Patches mailing list