redirecting from http to ftp
[1/11] from: ryan:christiansen:intellisol at: 28-Jun-2001 9:36
In Internet Explorer, when I go to this URL
http://www.bebits.com/bob/232/MailToI.zip
Internet Explorer redirects to this URL
ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
I am trying to make REBOL perform the same redirection. When I use the
following...
port: open http://www.bebits.com/bob/232/MailToI.zip
redirect-url: make url! probe port/url
REBOL gets "stuck" and simply reconnects over and over again to the http
URL and never receives the ftp URL as input.
What am I missing?
Ryan C. Christiansen
Web Developer
Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com
Global Leader in People Performance Software
_____________________________________
Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[ryan--christiansen--intellisol--com]
[2/11] from: ryan:christiansen:intellisol at: 28-Jun-2001 11:29
Whoah! As you can see from this echo output, REBOL keeps adding a "/" to
its GET operation and keeps trying... What's up with that?
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET /bob/232/MailToI.zip HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET //bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET ///bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET ////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET /////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET //////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET ///////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET ////////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET /////////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET //////////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET
///////////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET
////////////bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
}
Ryan C. Christiansen
Web Developer
Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com
Global Leader in People Performance Software
_____________________________________
Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[ryan--christiansen--intellisol--com]
[ryan--christiansen--inte]
llisol.com To: [rebol-list--rebol--com]
Sent by: cc:
[rebol-bounce--rebol--com] Subject: [REBOL] redirecting from http to ftp
06/28/2001 09:36 AM
Please respond to
rebol-list
In Internet Explorer, when I go to this URL
http://www.bebits.com/bob/232/MailToI.zip
Internet Explorer redirects to this URL
ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
I am trying to make REBOL perform the same redirection. When I use the
following...
port: open http://www.bebits.com/bob/232/MailToI.zip
redirect-url: make url! probe port/url
REBOL gets "stuck" and simply reconnects over and over again to the http
URL and never receives the ftp URL as input.
What am I missing?
Ryan C. Christiansen
Web Developer
Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com
Global Leader in People Performance Software
_____________________________________
Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[ryan--christiansen--intellisol--com]
[3/11] from: ryan:christiansen:intellisol at: 28-Jun-2001 11:25
Here is echo output with trace/net on if it helps at all.
}
Net-log: "HTTP/1.1 301 Moved Permanently"
Net-log: ["Opening tcp for" HTTP]
connecting to: www.bebits.com
Net-log: {GET //bob/232/ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 2.5.0.3.1
Host: www.bebits.com
[ryan--christiansen--inte]
llisol.com To: [rebol-list--rebol--com]
Sent by: cc:
[rebol-bounce--rebol--com] Subject: [REBOL] redirecting from http to ftp
06/28/2001 09:36 AM
Please respond to
rebol-list
In Internet Explorer, when I go to this URL
http://www.bebits.com/bob/232/MailToI.zip
Internet Explorer redirects to this URL
ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
I am trying to make REBOL perform the same redirection. When I use the
following...
port: open http://www.bebits.com/bob/232/MailToI.zip
redirect-url: make url! probe port/url
REBOL gets "stuck" and simply reconnects over and over again to the http
URL and never receives the ftp URL as input.
What am I missing?
Ryan C. Christiansen
Web Developer
Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com
Global Leader in People Performance Software
_____________________________________
Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[ryan--christiansen--intellisol--com]
[4/11] from: sterling:rebol at: 28-Jun-2001 9:54
The short version is "that's not right." The HTTP protocol is not
expecting to be forwarded to FTP, or any other different protocol for
that matter, so it makes no provision for that type of situation.
And, as shown by you, the results are rather unexpected.
Sterling
[5/11] from: ryanc:iesco-dms at: 28-Jun-2001 10:05
View handles the response a bit better...
>> system/version
== 1.2.1.3.1
>> read http://www.bebits.com/bob/232/MailToI.zip
** User Error: Error. Target url: http://www.bebits.com//bob/232/ftp://ftp.v
ortex.is/pub/be/jonr/MailToI.zip could not be retrieved. Circular forwarding
detected
** Near: read http://www.bebits.com/bob/232/MailToI.zip
>> ; Hmmm.
>> x-ray: func [f c][f: open f insert f c c: copy f close f c]
>> print x-ray tcp://www.bebits.com:80 "GET /bob/232/MailToI.zip http/1.0^/^/"
HTTP/1.1 301 Moved Permanently
Date: Thu, 28 Jun 2001 16:16:51 GMT
Server: Apache/1.3.9 (Unix) TARP/0.42-alpha PHP/4.0.4pl1 secured_by_Raven/1.4
.2
X-Powered-By: PHP/4.0.4pl1
Location: ftp://ftp.vortex.is/pub/be/jonr/MailToI.zip
Connection: close
Content-Type: text/html
>> save %http.txt system/schemes/http ; Enlightening in situations like these
A dirty fix might be to read the header for situations as this, but RT should
probably implement a special error for FTP redirect, so you can just do your
own redirection when it is encountered.
I heard their is another way to get that header info, anyone?
--Ryan
[ryan--christiansen--intellisol--com] wrote:
> In Internet Explorer, when I go to this URL
> http://www.bebits.com/bob/232/MailToI.zip
<<quoted lines omitted: 27>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
[6/11] from: ryan:christiansen:intellisol at: 28-Jun-2001 12:18
OK. So how can I fix it? I want the script to at least error out instead of
keep trying over and over again. Using an if error? try statement doesn't
help.
-Ryan
[sterling--rebo]
l.com To: [rebol-list--rebol--com]
Sent by: cc:
rebol-bounce@ Subject: [REBOL] Re: redirecting from http to ftp
rebol.com
06/28/2001
11:54 AM
Please
respond to
rebol-list
The short version is "that's not right." The HTTP protocol is not
expecting to be forwarded to FTP, or any other different protocol for
that matter, so it makes no provision for that type of situation.
And, as shown by you, the results are rather unexpected.
Sterling
[7/11] from: rotenca:telvia:it at: 29-Jun-2001 2:57
> OK. So how can I fix it? I want the script to at least error out instead of
> keep trying over and over again. Using an if error? try statement doesn't
> help.
I'm new with rebol, but to learn i have written this script.
------------------------------------------------------------------------------
REBOL[
Title: "Redirecting HTTP to FTP"
Author: "Romano Paolo Tenca"
Version: 1.0.0
Date: 29/06/01
Purpose: {
Try a http url
if fail for error 800 (redirect to a ftp site)
return a custom object (redir)
with info for the ftp
Perhaps worked better if it was an object
with a public routine embedded but it is
my first Rebol routine
}
History: [
"It doesn't check ftp error" 29/06/01
]
]
HttpRedir?: function [url [url!]]
[rule err porterr redir-str]
[
rule:[to "http://" to "ftp://" copy redir-str to " could" "could" "not" "be"
retrieved.
"Circular" "forwarding" "detected" to end]
redir: make object! [
net: "http" ;type of connection
success: true ;false for failure
urlpath: url ;url (http or ftp)
urlob: decode-url url ;standard object! purl
err: ;standard object! error
type: none ;type of fftp url ("file" | "dir")
]
if error? porterr: try [info? url][
err: disarm porterr
redir/success: false
redir/err: err
if err/code = 800 [
redir-str: copy ""
parse err/arg1 rule
if redir-str <> "" [
redir/success: true
redir/net: "ftp"
redir/urlpath: to-url redir-str
redir/urlob: decode-url redir-str
either dir? redir/urlpath [
;is a dir
redir/type: "dir"
][
;is a file
redir/type: "file"
]
]
]
]
return redir
]
r: HttpRedir? http://www.bebits.com/bob/232/MailToI.zip
either r/success = true [
print ["You can open" r/net r/urlpath "(ftp type" r/type ")"]
][
print ["Error on open http" r/err/code ]
]
[8/11] from: ryan:christiansen:intellisol at: 29-Jun-2001 11:04
Hmm... I tried this function, but it doesn't seem to behave any
differently than using 'open.
-Ryan
> OK. So how can I fix it? I want the script to at least error out instead
of
> keep trying over and over again. Using an if error? try statement doesn't
> help.
I'm new with rebol, but to learn i have written this script.
------------------------------------------------------------------------------
REBOL[
Title: "Redirecting HTTP to FTP"
Author: "Romano Paolo Tenca"
Version: 1.0.0
Date: 29/06/01
Purpose: {
Try a http url
if fail for error 800 (redirect to a ftp site)
return a custom object (redir)
with info for the ftp
Perhaps worked better if it was an object
with a public routine embedded but it is
my first Rebol routine
}
History: [
"It doesn't check ftp error" 29/06/01
]
]
HttpRedir?: function [url [url!]]
[rule err porterr redir-str]
[
rule:[to "http://" to "ftp://" copy redir-str to " could" "could" "not"
be
retrieved.
"Circular" "forwarding" "detected" to end]
redir: make object! [
net: "http" ;type of connection
success: true ;false for failure
urlpath: url ;url (http or ftp)
urlob: decode-url url ;standard object! purl
err: ;standard object! error
type: none ;type of fftp url ("file" | "dir")
]
if error? porterr: try [info? url][
err: disarm porterr
redir/success: false
redir/err: err
if err/code = 800 [
redir-str: copy ""
parse err/arg1 rule
if redir-str <> "" [
redir/success: true
redir/net: "ftp"
redir/urlpath: to-url redir-str
redir/urlob: decode-url redir-str
either dir? redir/urlpath [
;is a dir
redir/type: "dir"
][
;is a file
redir/type: "file"
]
]
]
]
return redir
]
r: HttpRedir? http://www.bebits.com/bob/232/MailToI.zip
either r/success = true [
print ["You can open" r/net r/urlpath "(ftp type" r/type ")"]
][
print ["Error on open http" r/err/code ]
]
[9/11] from: ryanc:iesco-dms at: 29-Jun-2001 9:45
Probably because he made it using View. View returns an error in this case--a
funny one, but still returns an error. Try upgrading, or maybe even patching
Cores http scheme with the one from View.
BTW, Romano, looks like nice work for a "beginner."
--Ryan
[ryan--christiansen--intellisol--com] wrote:
> Hmm... I tried this function, but it doesn't seem to behave any
> differently than using 'open.
<<quoted lines omitted: 75>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
[10/11] from: ryan:christiansen:intellisol at: 29-Jun-2001 12:17
It errors out nicely in View.
Thanks.
-Ryan
Ryan Cole
<[ryanc--iesco-] To: [rebol-list--rebol--com]
dms.com> cc:
Sent by: Subject: [REBOL] Re: R: Re: redirecting from http to ftp
rebol-bounce@
rebol.com
06/29/2001
11:45 AM
Please
respond to
rebol-list
Probably because he made it using View. View returns an error in this
case--a
funny one, but still returns an error. Try upgrading, or maybe even
patching
Cores http scheme with the one from View.
BTW, Romano, looks like nice work for a "beginner."
--Ryan
[ryan--christiansen--intellisol--com] wrote:
> Hmm... I tried this function, but it doesn't seem to behave any
> differently than using 'open.
>
> -Ryan
>
> > OK. So how can I fix it? I want the script to at least error out
instead
> of
> > keep trying over and over again. Using an if error? try statement
doesn't
> > help.
>
> I'm new with rebol, but to learn i have written this script.
>
------------------------------------------------------------------------------
> REBOL[
> Title: "Redirecting HTTP to FTP"
<<quoted lines omitted: 66>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
[11/11] from: rotenca:telvia:it at: 30-Jun-2001 18:27
> Probably because he made it using View. View returns an error in this
case--a
> funny one, but still returns an error. Try upgrading, or maybe even
patching
> Cores http scheme with the one from View.
Yes, i made it with View.
> BTW, Romano, looks like nice work for a "beginner."
Thank you very much!
> --Ryan
Romano Paolo Tenca
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted