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

[REBOL] Re: how to properly set-up proxy for ftp?

From: petr:krenzelok:trz:cz at: 20-Jun-2001 13:48

GS Jones wrote:
> Hi, Petr, > > Again, my usual disclaimers that I am not the ideal person to be answering these > questions. With that said, here it goes anyway:) > > From: "Petr Krenzelok" > > I still can't to sort it out. I contacted our admin and he told me, that we > > use typical port 21 for ftp connection, but separate port 20 for data > > connection, uh, is that normal case? > > If I recall correctly, the active connection mode uses port 20 for the second > port (or the sub-port in REBOL). > > > I connected to required host using Rebol and followind aproach: > > > > my-ftp: open/lines [scheme: 'tcp host: "proxy.sec.trz.cz" port-id: 21] > > insert my-ftp "USER [can--moon--rebol--cz]" ; account and host I want to > > connect to ... > > insert my-ftp "PASS my-password-here" > > > > then I am finally logged to 'can account on 'moon.rebol.cz server ... > > > > But how to get thru using ftp scheme? I echoed my ftp scheme and found out, > > that it can't open sub-port ... > > > > PS: aha! :-) Is it kind of forwarding or what? Following works: > > > > ble: read [scheme: 'ftp host: "proxy.sec.trz.cz" user: "[can--moon--rebol--cz]" > > pass: "my-pass-here"] > > > > Can I escape "@" in my direct > > ftp://[can--moon--rebol--cz]:[my-pass-here--proxy--sec--trz--cz] somehow? > > It looks like you may have uncovered another buglet. I thought that the URL > parser picked out the "@"s in either the USER or PASS part, but experimentation > readily confirmed what you found. Escaping with a %40 did not help. On further > inspection, the parser uses the following bitset as valid characters for the > USER part. I have previously asked if there is a way to get characters back > from a bitset, but there was no response. Most of the following is my > explanation of what and why I did, in case you were interested. Otherwise, skip > to "Summary" and give the result a try. > > The following is the bitset for the USER part: > > >> net-utils/url-parser/user-char > == make bitset! #{ > 00000000F87CFF2BFEFFFF87FEFFFF1700000000000000000000000000000000 > } > > This is the bitset for "@": > > >> make bitset! #"@" > == make bitset! #{ > 000000000000000001000000000000000000000000000000000000000000000 > } > > So I performed a union of the two and got: > > >> union net-utils/url-parser/user-char make bitset! #"@" > == make bitset! #{ > 00000000F87CFF2BFFFFFF87FEFFFF1700000000000000000000000000000000 > } > > which shows that a bit is flipped (E to F). > > Then I reset the user-char bitset to the following: > > >> net-utils/url-parser/user-char: union net-utils/url-parser/user-char make > bitset! #"@" > == make bitset! #{ > 00000000F87CFF2BFFFFFF87FEFFFF1700000000000000000000000000000000 > } > > With this change, url-parse seems to correctly parse an "@" in USER name. IT is > possible that that the FTP specification does not allow an "@" in the USER part, > or perhaps RT did not anticipate this possibility. :) > > End of win-bag explanation ... Petr, wake up, hey Petr... ;-) > > *****Summary******: > Try this line before your normal ftp usage: > > net-utils/url-parser/user-char: union net-utils/url-parser/user-char make > bitset! #"@" >
hey, it works :-)
> If this works, perhaps we should submit a possible bug alert to RT.
but I am not sure it is a bug. After all - I want to connect to 'moon.rebol.cz, account 'can, not to 'proxy.sec.trz.cz, so I want to do: print read ftp://can:[pass-here--moon--rebol--cz] ... the issue is, I was not able to find any acceptable solution using ftp/proxy object, which is used when you try to open port. Maybe there is not solved my scenario in ftp scheme? I looked at the source and saw where it hangs ... either all [ port/proxy/host bp: not in-bypass port/host port/proxy/bypass find [socks4 socks5 socks] port/proxy/type ] [ port/sub-port: net-utils/connect-proxy/sub-protocol port 'connect subproto ] [ sub-port: system/words/open/lines compose [ scheme: (to-lit-word subproto) host: either all [port/proxy/type = 'generic generic bp] [port/proxy/host] [port/proxy/host: none port/host] user: port/user pass: port/pass port-id: either all [port/proxy/type = 'generic generic bp] [port/proxy/port-id] [port/port-id] ] port/sub-port: sub-port as you can see - the big difference is if you use 'generic proxy or not. I don't understand, where does 'generic word comes from, but it is set to 'none (I mean the part of code in 'all condition block ... ) So, how to set-up proxy properly, to allow it work in a default way? -pekr-