[prev in list] [next in list] [prev in thread] [next in thread] 

List:       curl-users
Subject:    [ curl-Bugs-495215 ] Question / Answer to add to FAQ
From:       noreply () sourceforge ! net
Date:       2001-12-19 22:59:53
[Download RAW message or body]

Bugs item #495215, was opened at 2001-12-19 14:59
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=495215&group_id=976

Category: documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: Question / Answer to add to FAQ

Initial Comment:
Recently I've been writing a script with CURL, and I 
allow the user to specify a URL. When the user 
specifies a URL that is a directory, and does not 
include a trailing slash, some web servers (ie apache)
redirect them to the same URL with a trailing slash. 
If the location (-L) option is not specified, users 
are presented with :

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>301 Moved Permanently</TITLE>
</HEAD><BODY>
<H1>Moved Permanently</H1>
The document has moved <A 
HREF="http://same_url_now_with_a_trailing_slash/">here<
/A>.<P>
<HR>
<ADDRESS>Apache/1.3.22 Server at yourhost.com Port 
80</ADDRESS>
</BODY></HTML>

adding a trailing slash to the URL fixes the problem, 
or adding the -L option to the command line. Adding a 
trailing slash blindly isn't a great idea, but it 
works. (curlopt_FOLLOWLOCATION would be the equivalent 
from the API). I just spent a little while trying to 
figure it out, so I figured you might want to add it 
to the FAQ. Theoretically speaking, though shouldn't 
CURL check for trailing slashes on the ends of URLs 
and have an option to disable it just in case? I think 
most people are trying to get directories when they 
accidentally omit the trailing slash. Anyways, thanks 
for opensourcing such a useful tool. 

Ron Nessim. 

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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=495215&group_id=976
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic