Andy,

I was surprised to find out that our entity handling for the "text"
method is not 100% conformant with the specification. We'll have a
closer look at this, and after that, method='text' should work as
expected.

Sorry for the confusion and thanks again for reporting the issue,
Christian
___________________________

On Sat, Jan 14, 2012 at 3:56 PM, Andy Bunce <bunce.a...@gmail.com> wrote:
> Hi Christian
>
> "format=no" works for me. Thanks.
>
>  I will need to take a look at what the EXPath HTTP Client Module spec is
> saying, as it seems like a real problem with the spec if it can not deal
> with this common case.
>
> /Andy
>
> On Sat, Jan 14, 2012 at 12:29 PM, Christian Grün <christian.gr...@gmail.com>
> wrote:
>>
>> 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&amp;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&amp;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 "&amp;" (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;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

Reply via email to