Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Redirect URL

Redirect URL
Thread Tools
Junior Member
Join Date: Oct 2002
Status: Offline
Reply With Quote
Nov 6, 2002, 12:14 PM
 
Given a HTTP URL I need to get the redirect URL, i. e. what you get from a 30x HTTP error code.

I don't want to download something, just get hold of the "real" URL that a browser would be redirected to.

How could I get this?
(Last edited by manfreds; Nov 7, 2002 at 02:11 PM. )
Turn your web browser into a great PDF viewer – with PDF Browser Plugin
     
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Nov 6, 2002, 09:29 PM
 
Originally posted by manfreds:
Given a HTTP URL I need to get the redirect URL, i. e. what you get from a 30x HTTP error code.

I don't want to download something, just get hold of the "real" URL that a browser would be redirected to.

How could I get this?
If you just look at the HTTP header, you can get the information you want. For instance, try "curl --head www.war.com", and note the "Location: " field in the reply.
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
Junior Member
Join Date: Oct 2002
Status: Offline
Reply With Quote
Nov 7, 2002, 09:13 AM
 
Originally posted by Mactoid:
For instance, try "curl --head www.war.com", and note the "Location: " field in the reply.
Does this resolve 302 errors?

I ask because hdid doesn't seem to be able to handle redirects. At least for

hdid http://www.schubert-it.com/download/vektor3.dmg -verbose

for example it returns something like "failed - http code 302". Or is this not the cause why hdid can not mount this image?

curl --head http://www.schubert-it.com/download/vektor3.dmg

doesn't show any location field.
Turn your web browser into a great PDF viewer – with PDF Browser Plugin
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Nov 7, 2002, 01:19 PM
 
If you're not trying to automate it, you can do it manually. Open a terminal window and type what's in red below (note TWO return characters after the HOST: line):

% telnet www.schubert-it.com 80
Trying 192.67.198.55...
Connected to iiweb5.webmailer.de.
Escape character is '^]'.
HEAD /download/vektor3.dmg HTTP/1.0
HOST:www.schubert-it.com


HTTP/1.1 200 OK
Date: Thu, 07 Nov 2002 19:13:50 GMT
Server: Apache/1.3.26 (Unix) mod_script
Vary: Host
Last-Modified: Wed, 06 Nov 2002 09:42:57 GMT
ETag: "1279820-44f2d0-3dc8e421"
Accept-Ranges: bytes
Content-Length: 4518608
Content-Type: application/octet-stream
X-Cache: MISS from www.schubert-it.com
Connection: close

Connection closed by foreign host.


However, as you can see, this gives a 200 (OK), not a 302 redirect. If it were a 302, you should see the redirect in the headers. If not, replace the 'HEAD' command with a 'GET' to return the entire page (although it's not a good idea to download a binary file in the manner in a terminal )
Gods don't kill people - people with Gods kill people.
     
Junior Member
Join Date: Oct 2002
Status: Offline
Reply With Quote
Nov 7, 2002, 02:03 PM
 
Originally posted by Camelot:
If you're not trying to automate it, you can do it manually.
Automating it was the idea. If it's not moved, then why does hdid give me that error? Here's what it says:

hdid http://www.schubert-it.com/download/vektor3.dmg -verbose
hdid: DILoadDriver: checking for disk image driver

hdid: DILoadDriver: DI_kextExists() returned 0x00000000 (0)

DIBackingStoreInstantiatorProbe: interface 0, score -1000, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface 1, score 100, CHTTPBackingStore
DIBackingStoreInstantiatorProbe: interface 2, score -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface 3, score -1000, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface 4, score -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface 5, score 200, CCURLBackingStore
DIBackingStoreInstantiatorProbe: selecting CCURLBackingStore
hdid: CCURLBackingStore::statImage() failed - http code 302.

hdid: "http://www.schubert-it.com/download/vektor3.dmg" unrecognized: internal error.


What does that mean?
Turn your web browser into a great PDF viewer – with PDF Browser Plugin
     
Junior Member
Join Date: Oct 2002
Status: Offline
Reply With Quote
Nov 10, 2002, 07:20 AM
 
Is there anybody who knows this?
Turn your web browser into a great PDF viewer – with PDF Browser Plugin
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Nov 12, 2002, 02:06 PM
 
Originally posted by manfreds:
Is there anybody who knows this?
Probably www.schubert-it.com is on virtual hosting. I posted an explanation of what causes the problem in this thread:

http://forums.macnn.com/showthread.p...81#post1088989

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Nov 13, 2002, 11:55 AM
 
Alternatively, instead of telnetting to port 80, you can use curl -I, e.g.,

curl -I http://somehost.com/somefile
[Wevah setPostCount:[Wevah postCount] + 1];
     
Junior Member
Join Date: Oct 2002
Status: Offline
Reply With Quote
Nov 13, 2002, 08:49 PM
 
Originally posted by CharlesS:

Probably www.schubert-it.com is on virtual hosting. I posted an explanation of what causes the problem in this thread.
Sure it is. Thanks for the explanation.

Unfortunately there doesn't seem to be a way to get the "real directory" of the file then.
Turn your web browser into a great PDF viewer – with PDF Browser Plugin
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:18 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2