[racket] escaping binary data in url

From: Veer (diggerrrrr at gmail.com)
Date: Sat Aug 13 00:07:37 EDT 2011

Since server part expects escaped data based on rfc 1738 , I "assume"
that it will not be able to interpret the data as base64 encoding.
As per bittorrent spec , the get request to tracker must have
info_hash(20 byte sha) escaped along with others.
Is there any other way to insert query part in url without getting
escaped twice , so that I can use existing function like get-pure-port
etc.

Thanks

On Fri, Aug 12, 2011 at 11:08 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> The library already does some URL encoding for you, as "%" is an
> illegal character in a query string, since that's the escape character
> itself for arbitrary bytes,  "%25" gets translated down to...
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> (integer->char (string->number "25" 16))
> #\%
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ... that percent sign.
>
>
> Would using base64-encode (from the net/base64 library) work for you?
> You can take your bytes and feed them through base64-encode; the
> result should be something that can be a part of URLs.
>



Posted on the users mailing list.