[plt-scheme] Getting raw bytes in a servlet

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon May 15 09:34:13 EDT 2006

The request parsing will be written to always use bytes in the future, but
for the moment it does not always.

However, it uses bytes when the `enctype' of the HTML form is given as
"multipart/form-data" [1]. You can simulate this by producing the
appropriate HTTP header in your POST request, although you'll have to change
`post-impure-port' to do so.

I can write up a small example if this is not clear.

Jay

1. http://www.ietf.org/rfc/rfc2388.txt

On 5/15/06, Jepri <jepri at babylon.alphacomplex.org> wrote:
>
> Hi all, I'm having a little trouble moving a "binary" file from a HTTP
> client program to a HTTP servlet, both written in PLT scheme.  I can
> upload files fine until I send a "binary" file which contains incorrect
> UTF-8 codes (e.g. an executable file).  It looks like the web server is
> interpreting my data as a UTF-8 string because the data I get in the
> servlet is a string with some bytes like *FF* replaced with question
> marks.  The relevant code I am using is:
>
> client:
> (post-impure-port full-url my-bytes)
>
> and on the server I'm trying to get at the bytes with
>
> servlet:
> (define start initial-request)
>    (request-bindings/raw initial-request)
>    ...
>
> and that nearly works.  So my questions are... can I persuade the PLT
> server to give my servlet raw bytes instead of a UTF-8 string?  Is there
> a different web server I could use that would just hand me a port
> instead of a data structure?  How could I do a HEAD request from the
> client?  The docs only mention get-xxxx-port and post-xxxx-port, I
> couldn't find head-xxxx-port anywhere.
>
> And on a completely unrelated note, how do I get the type of a variable?
> (display  ... ) seems to know, but I can't find the right command in the
> manual.
>
> Thanks in advance,
> Jeremy
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Jay McCarthy <jay at cs.brown.edu>
http://jay.makeoutcity.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20060515/92d1e219/attachment.html>

Posted on the users mailing list.