[REBOL] Re: how to properly set-up proxy for ftp?
From: gjones05:mail:orion at: 20-Jun-2001 6:14
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! #"@"
If this works, perhaps we should submit a possible bug alert to RT.
Best wishes,
--Scott Jones