[racket] Preventing get-impure-port from url-encoding the query

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Jul 11 13:46:43 EDT 2013

On Wed, Jul 10, 2013 at 5:27 PM, Evan Donahue <emdonahu at gmail.com> wrote:
> Hello, I am trying to use the racket networking libraries for a basic set of
> get and post requests. I need to send a url of the form:
>
> http://foo.com/?url=http://bar.com?baz=1000 (NOT form encoded)

As far as I can tell from URL specs, this is not a URL.

> however, the standard get-impure-port procedure seems to enforce
> url-encoding, which ends up submitting the request:
>
> http://foo.com/?url=http%3A%2F%2Fbar.com%3Fbaz%3D1000
>
> I was wondering if there was any built-in way to circumvent the url-encoding
> process at any stage of the get-impure-port function, or whether anyone
> could recommend the least invasive way to integrate the ability to make such
> requests into my usage of the other networking functions. I haven't used
> racket before, so I am not especially familiar with the typical patterns
> associated with the core libraries.

If you look at the net/url implementation, you could hack it to a take
a string rather than a URL and just use the string as access-string.

Jay


--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.