[plt-scheme] Getting raw bytes in a servlet

From: Jepri (jepri at babylon.alphacomplex.org)
Date: Mon May 15 05:08:01 EDT 2006

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



Posted on the users mailing list.