I'm seeing what I consider to be odd behavior when getting HTTP request
header values via xdmp:get-request-header().  If the header value contains
the string "=?", those characters are missing when I get the header value.
If the header value contains an additional "?" character after the initial
"=?", then an XDMP-ENCODING error is thrown.  I think I understand why this
is happening, but not how to avoid it.

I wrote a module that simply returns the HTTP header values that were
provided on the request, and called the module via an HTTP app server.

Here's the code:
for $name in xdmp:get-request-header-names()
return
    fn:concat($name, ': ', xdmp:get-request-header($name) )

When I call the module with a header value containing "=?", it echos the
value back with the "=?" stripped out.  For example:
TestHeader1: Test=?Value
=> TestHeader1: TestValue

When I call the module with a header value containing "=?" and another "?"
anywhere in the remainder of the header value, I get nothing back and see
an XDMP-ENCODING error in the ErrorLog:
TestHeader1: Test=?Value?
=> (no response)

Error: AppRequestTask::run: XDMP-ENCODING: (err:XQST0087) Unsupported
character encoding: Value

I'm guessing this is because technically one is allowed to specify the
character encoding of an HTTP header value via MIME encoding, as described
here:
http://stackoverflow.com/questions/4400678/http-header-should-use-what-character-encoding

All of that brings me to my question ... in my case, the header value is
not encoded in any special way, but I do want to be able to use the
characters "=" and "?" in header values.  Is there a way to disable this
character encoding processing (as I have no need to use alternate encodings
in my header values at this time) ... or some other way to work around this
behavior?

Thanks!

-Bob

--
Bob Hodgeman
Consulting Engineer
LexisNexis
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to