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

'dispatch ?? (was redirecting from http to ftp)

 [1/2] from: ryan:christiansen:intellisol at: 29-Jun-2001 11:46


I looked over all of the port-related functions in the dictionary and tried several of them to see if I could get REBOL to return an error on that URL, but it does not. I did find the function 'dispatch, however. My understanding is 'dispatch waits for activity from a port. Perhaps I could use 'dispatch and somehow just let ports which run amok continue until the script finishes? Can someone give me an example of using dispatch? Is there a way to place each 'open argument in "queue" and use dispatch to wait for a result? Again, here is the code I am using to read URL redirection: port: open full-url ; where full-url is created by previous code redirect-url: make url! probe port/url -Ryan [ryan--christiansen--inte] llisol.com To: [rebol-list--rebol--com] Sent by: cc: [rebol-bounce--rebol--com] Subject: [REBOL] Re: R: Re: redirecting from http to ftp 06/29/2001 11:04 AM Please respond to rebol-list 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 ] ]

 [2/2] from: ryanc::iesco-dms::com at: 29-Jun-2001 9:53


Dispatch wont help you with the http problem. [ryan--christiansen--intellisol--com] wrote:
> I looked over all of the port-related functions in the dictionary and tried > several of them to see if I could get REBOL to return an error on that URL,
<<quoted lines omitted: 98>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted