Page 2 of 2
Posted: Fri Jun 01, 2007 4:15 pm
by pedrotuga
mmm... it looks like both me and superdizign have been trying to solve this problem like rookies
I stoped for a while and made some http requests using command line curl.
It really is trivial.
if
http://mysite.com/path is a directory then the server answers a 301 and specifies the Location. Most of the clients will redirect the user to that location.
This means... i have to handle redirections... buuuh... more boring codding ahead.
I hope this thread to be of interest of other people having the same existential questions.
Thanks superezign for the chat

Posted: Fri Jun 01, 2007 4:30 pm
by Ollie Saunders
I don't believe it is possible. So many pages are dynamically generated these days. Any front controlled app for instance will direct all requests whether they look like directories or not to a single file. Ultimately though every request goes to a file the one that look like they are going to a directory are actually going to files only the web server configuration is choosing what that file is (usually index.html, index.htm or index.php)
Why do you need to know this?
Posted: Fri Jun 01, 2007 5:02 pm
by pedrotuga
ole wrote:I don't believe it is possible. So many pages are dynamically generated these days. Any front controlled app for instance will direct all requests whether they look like directories or not to a single file. Ultimately though every request goes to a file the one that look like they are going to a directory are actually going to files only the web server configuration is choosing what that file is (usually index.html, index.htm or index.php)
Why do you need to know this?
I wanted to know this in order to follow relative links properly.
It's not really a mater of how the sites are coded, it's more about the http protocol itself and the way webservers inplement it.
The problem is solved though. Read my last post.
Often we browse and even include links on sites like:
http://mysite.com/dir when we want to point to
http://mysite.com/dir/ . The servers handle this ambiguity by repplying a 301 error code ( permanently moved ) and providing the location. The browsers simply redirect you to the right location.
A directory url must allways end with a slash.
Posted: Fri Jun 01, 2007 5:40 pm
by Ollie Saunders
Oh yeah sorry I should have read your post. That's very interesting actually. Thanks for that.
Posted: Fri Jun 01, 2007 7:02 pm
by superdezign
I tried cURL, but I guess you've got better luck than me. I was just looking at the headers after your suggestion that it may be there.
There are way too many CURLOPTs. Makes my head spin.
Posted: Sat Jun 02, 2007 6:27 am
by pedrotuga
superdezign wrote:I tried cURL, but I guess you've got better luck than me. I was just looking at the headers after your suggestion that it may be there.
There are way too many CURLOPTs. Makes my head spin.
ehehe... who forgot to read the documentation? .... both of us
the option is
-I or
-head
try this on command line:
Code: Select all
curl -I http://java.sun.com/reference/docs/
it will download the page itself, look at the headers on top
now compare with this
Code: Select all
curl-I http://java.sun.com/reference/docs
allways check the good old friend man page
Posted: Sat Jun 02, 2007 7:49 am
by superdezign
Whoa. The guy who design cURL went all out.
