Hi Andy, true, my hint was pretty pointless ;) I looked at the http specification and our implementation, and I'm still not quite sure how the given case is to be correctly handled. The specification says that the request contents needs to be serialized, similar to the serialization of any other contents [1]. Because of this, ampersands and other characters are encoded (which is wrong for the given case), and not decoded by the receiving web server (which is correct). It seems that similar problems have already been discussed on the EXPath mailing list [2], so it may be that the specification has to be revised.
A possible workaround is provided by the serialization parameter "format=no" in BaseX; this way, none of the entities will be encoded by the serializer: let $r:=<http:request method='post' > <http:body media-type="application/x-www-form-urlencoded" format="no">a=3&b=4</http:body> </http:request> return http:send-request($r,"http://posttestserver.com/post.php")[2] Hope this helps, Christian [1] http://expath.org/spec/http-client#d2e362 [2] http://groups.google.com/group/expath/browse_thread/thread/91a795e59a92095f/8d37971df0276654 ___________________________ On Fri, Jan 13, 2012 at 11:07 PM, Christian Grün <christian.gr...@gmail.com> wrote: > Well, yes.. I'll have a closer look at that soon! > >> Heading in wrong direction ;-) >> >> http://www.posttestserver.com/data/2012/01/13/13.44.241401974484 >> /Andy >> >> >> On Fri, Jan 13, 2012 at 4:49 PM, Christian Grün <christian.gr...@gmail.com> >> wrote: >>> >>> Hi Andy, >>> >>> sorry for the late feedback. >>> >>> > Could there be an encoding issue with http:request post requests? >>> > I send.. >>> > let $r:=<http:request method='post' > >>> > <http:body media-type="application/x-www-form-urlencoded" >>> > method="text">a=3&b=4</http:body> >>> > </http:request> >>> > return http:send-request($r,"http://posttestserver.com/post.php")[2] >>> >>> You may be successful by additionally encoding "&" as "&" (didn't >>> try it, though): >>> >>> let $r:=<http:request method='post' > >>> <http:body media-type="application/x-www-form-urlencoded" >>> method="text">a=3&amp;b=4</http:body> >>> </http:request> >>> >>> Christian >> >> _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk