dirty HTTP redirects
[1/2] from: hallvard::ystad::helpinhand::com at: 26-Nov-2001 14:51
Hello folks,
Some web servers accept (ignore) double slashes in URL paths (e.g.
http://www.rebol.com//some//path), others don't. On Mirror Image's server,
I found a redirect to such a path (look below), and Mirror Image's server
is among those who don't accept it. This causes rebol not to get to the
correct URL. All browsers seem to handle this (tested MSIE, Netscape4.76,
Netscape6.2, Opera). Does anyone know a workaround for it that doesn't
imply re-writing 'read?
Here's from my console session:
>> trace/net on
>> t: open
http://www.mirror-image.com/news/frame_latest.cfm?news_item_id=339
URL Parse: none none www.mirror-image.com none news/
frame_latest.cfm?news_item_id=3
39
Net-log: ["Opening tcp for" HTTP]
connecting to: www.mirror-image.com
Net-log: {GET /news/frame_latest.cfm?news_item_id=339 HTTP/1.0
Accept: */*
Connection: close
User-Agent: 007. Bond. James Bond.
Host: www.mirror-image.com
}
Net-log: "HTTP/1.1 302 Moved Temporarily"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.mirror-image.com
Net-log: {GET //news/pressrelease.cfm?news_item_id=339 HTTP/1.0
Accept: */*
Connection: close
User-Agent: 007. Bond. James Bond.
Host: www.mirror-image.com
}
Net-log: "HTTP/1.1 404 Not found"
** User Error: Error. Target url:
http://www.mirror-image.com//news/pressrelease.cf
m?news_item_id=339 could not be retrieved. Server response: HTTP/1.1 404
Not found
** Near: t: open
http://www.mirror-image.com/news/frame_latest.cfm?news_item_id=339
>>
~H
[2/2] from: hallvard:ystad:helpinhand at: 26-Nov-2001 17:22
This is a hack:
site: make port! full-url
open site
double-slash: split-path to-url site/url
if find at double-slash/1 (index? find double-slash/1 "//") + 2 "//" [
open to-url to-string head remove find at double-slash/1 (index? find
double-slash/1 "//") + 2 "//"
]
... but it really shouldn't be neccessary, should it?
~H
Dixit Hallvard Ystad (Monday 26.11.2001, kl. 14.51):