[plt-dev] Re: web-server support for arbitrary content in POST requests?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Feb 22 12:26:24 EST 2010

Some comments.

1. It seems like you should really be using the Transfer-Encoding
header. The Web Server does implement support for this, but it should
be easy for you to write a new request reader that does.

2. You would not require any changes if you used a PUT or put your
gzip'd data in a field of the POST or as a file transfer.

3. I think the 'right' thing to do is to do the parse-bindings lazily.
I'll do that later today.

Jay

On Sun, Feb 21, 2010 at 7:58 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> For one of my web-server applications, I've been trying to reduce the
> amount of data traffic by applying a gzip on the data attached to my
> POST requests.  However, web-server doesn't like it for the data to be
> an arbitrary bytes: it expects it to be an encoding of an association
> list, and throws exceptions if it isn't.  But this defeats the whole
> purpose of request-post-data/raw.
>
> Can the following be wrapped within the call to parse-bindings (in
> web-server/http/request), to accommodate non-standard data values?
>
> (define (parse-bindings raw)
>  (with-handlers ([exn:fail? (lambda (exn) (list))])
>     ;; ... rest of the implementation
>     ))
>
> I don't know if this is exactly the right solution.  I'd prefer to be
> able to configure the web-server http request handler so that incoming
> requests aren't parsed unless the user really wants the bindings of a
> request.  I haven't thought deeply about how this might affect the
> structure of the web-server code, but I suspect it might just be a
> call to make parse-bindings be lazily computed.
>



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

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


Posted on the dev mailing list.