Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: R: Re: redirecting from http to ftp

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" > 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 ] > ] > > -- > To unsubscribe from this list, please send an email to > [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes. > > -- > To unsubscribe from this list, please send an email to > [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400