[plt-scheme] Request for small API change in web-server request structure

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Nov 11 00:57:38 EST 2006


Yes, the docs are changed too.


On 11/11/06, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
> Hi everyone,
> Noel's XMLRPC client has to go through some ugly kludges to try to get
> around a fundamental API problem in web-server.  I'd like to propose a
> fix.
> Currently, here's what's going when his code needs to decode the XMLRPC
> payload:
> ;; Within xmlrpc's server-core.ss
>    (define (extract-xmlrpc-bindings request)
>      (let ([raw-bindings (request-bindings/raw request)])
>        ;; This string-append is because the bindings come in
>        ;; mangled for XML-RPC content; it seems like the webserver
>        ;; tears it up in a syntactically bogus location (w.r.t. the
>        ;; structure of the XML document.)
>        (apply string-append
>               (map (lambda (b)
>                      (format "~a~a"
>                              (binding-id b)
>                              (binding:form-value b)))
>                    raw-bindings))))
> Unfortunately, the comment is all too true: it is fundamentally wrong to
> try to reconstruct the payload from the bindings this way, because some of
> the POST content in the payload gets munged by processes such as
> form-urlencoded-decode.  Concretely, plus signs in the payload get munged
> into spaces.  It's not an invertable process.  I fought with this for
> about ten minutes before finally realizing I was being silly.
> I'm proposing adding in another field into request structures called
> post-data/raw.  I've attached a diff that does the necessary work to store
> the raw bytes that are otherwise parsed as bindings.
> Would this be acceptable?  If so, then Noel can get rid of that ugly
> kludge in the server-core, and I'll be able to actually send off XMLRPC
> messages with the content "(+ 1 2)" ... *grin*
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Jay McCarthy <jay.mccarthy at gmail.com>

Posted on the users mailing list.