Useful to note a few things.
1) xdmp:get-request-field("Param")
Will return the *decoded* field data (from the union of request URI's and form
body data.)
2) Rewriters can do very 'interesting' things if they put humpty dumpty back
together incorrectly. Double encoded, non-encoded , double-decoded, just plain
gibberish are not uncommon.
3) From v7 to v8 the server code involved in the initial decoding of *query
parameters* only was reworked to accommodate the Declarative Rewriter
https://docs.marklogic.com/guide/app-dev/XMLrewriter
Note the difference between how path components and query parameters are handled
https://docs.marklogic.com/guide/app-dev/XMLrewriter#id_82344
-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell: +1 812-630-7622
www.marklogic.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of "neil bradley"
Sent: Monday, October 12, 2015 5:30 AM
To: Geert Josten <[email protected]>; [email protected]
Subject: Re: [MarkLogic Dev General] bug in xdmp:get-request-field?
Geert,
Ah yes, I do. And that does appear to be the problem, even thougjh I do not
actually change that particular URL, the process of passing it through has
unescaped the characters. here are debug log entries:
2015-10-12 10:05:24.308 Info: xxx: ORIGINAL URL >>> [8040] [GET]
/TestHash.xqy?TextArea=123%23456<<<
2015-10-12 10:05:24.308 Info: xxx: UNCHANGED URL
>>>/TestHash.xqy?TextArea=123#456<<<
I wish I had thought to look at that! Thanks for pointing me in the right
direction.
Regards,
Neil.
on 12/10/15 10:20 AM, Geert Josten <[email protected]> wrote:
> Cannot reproduce on 7.0-5.1, nor on 8.0-3. Do you have any rewriting
> in between?
>
> Kind regards,
> Geert
>
> On 10/12/15, 11:07 AM, ""neil bradley"" <[email protected]> wrote:
>
>>Sorry, in my previous response I meant to say "note", not "not", which
>>changes the message somewhat - there IS a problem with & as well as
>>with #!
>>
>>I have jsut been testing with form data. The same thing happens with
>>the content of <textarea> at least, when I send data using GET or PUT
>>protocol.
>>But it works correctly if I send as POST.
>>
>>Neil.
>>
>>
>>
>>
>>on 12/10/15 9:46 AM, Geert Josten <[email protected]> wrote:
>>
>>> Hi Neil,
>>>
>>> What happens if you skip the url-decode? That should be unnecessary.
>>>Leave
>>> the url-encode in place though..
>>>
>>> Kind regards,
>>> Geert
>>>
>>> On 10/12/15, 10:39 AM, "[email protected] on
>>>behalf of "neil bradley"" <[email protected]
>>>on behalf of [email protected]> wrote:
>>>
>>>>I think there is a bug in xdmp:get-request-field() when the
>>>>parameter contains a # character, even when it is URL-encoded. It
>>>>seems that the code that returns the parameter value assumes that #
>>>>terminates the value. And it still happens even if I add another #
>>>>at the end of the URL.
>>>>
>>>>Here is some code that illustrates the issue:
>>>>
>>>> xdmp:set-response-content-type("text/html")
>>>> ,
>>>> <html>
>>>> <body>
>>>> <p><a
>>>>href="TestHash.xqy?Param={xdmp:url-encode('abc#def')}#x">abc#def</a>
>>>></
>>>>p>
>>>> <p>Param =
>>>>{xdmp:url-decode(xdmp:get-request-field("Param"))}</p>
>>>> </body>
>>>> </html>
>>>>
>>>>When I click on the link, I see the expected URL in the browser:
>>>>
>>>> http://localhost:8040/TestHash.xqy?Param=abc%23def#x
>>>>
>>>>Yes the displayed shows that the "#def" part of the value is missing::
>>>>
>>>> Param = abc
>>>>
>>>>Any ideas? Is this a bug or am I missing something?
>>>>_______________________________________________
>>>>General mailing list
>>>>[email protected]
>>>>Manage your subscription at:
>>>>http://developer.marklogic.com/mailman/listinfo/general
>>>
>>>
>>>
>>>
>
>
>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general