Hi,
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%22)%5B2]
http://www.posttestserver.com/ reports the parameters as..
Post Params: key: 'a' value: '3' key: 'amp;b' value: '4' Empty post body.
/Andy
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%22)%5B2]
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
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.gruen@gmail.comwrote:
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%22)%5B2]
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
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.gruen@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%22)%5B2]
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
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%22)%5B2]
Hope this helps, Christian
[1] http://expath.org/spec/http-client#d2e362 [2] http://groups.google.com/group/expath/browse_thread/thread/91a795e59a92095f/... ___________________________
On Fri, Jan 13, 2012 at 11:07 PM, Christian Grün christian.gruen@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.gruen@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%22)%5B2]
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
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.gruen@gmail.comwrote:
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%22)%5B2]
Hope this helps, Christian
[1] http://expath.org/spec/http-client#d2e362 [2] http://groups.google.com/group/expath/browse_thread/thread/91a795e59a92095f/... ___________________________
On Fri, Jan 13, 2012 at 11:07 PM, Christian Grün christian.gruen@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.gruen@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%22)%5B2]
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
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.andy@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.gruen@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&b=4</http:body> </http:request> return http:send-request($r,"http://posttestserver.com/post.php%22)%5B2]
Hope this helps, Christian
[1] http://expath.org/spec/http-client#d2e362 [2] http://groups.google.com/group/expath/browse_thread/thread/91a795e59a92095f/... ___________________________
On Fri, Jan 13, 2012 at 11:07 PM, Christian Grün christian.gruen@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.gruen@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%22)%5B2]
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
The problem has been fixed in the latest snapshot. You may now use method='text' again (..and the EXPath http-client specification doesn't have any issues to be resolved).
On Sat, Jan 14, 2012 at 3:56 PM, Andy Bunce bunce.andy@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.gruen@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&b=4</http:body> </http:request> return http:send-request($r,"http://posttestserver.com/post.php%22)%5B2]
Hope this helps, Christian
[1] http://expath.org/spec/http-client#d2e362 [2] http://groups.google.com/group/expath/browse_thread/thread/91a795e59a92095f/... ___________________________
On Fri, Jan 13, 2012 at 11:07 PM, Christian Grün christian.gruen@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.gruen@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%22)%5B2]
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@mailman.uni-konstanz.de