Aug 20, 2015 5:23 PM
6 Posts

Accessing the request URL, not decoded

  • Category: Domino Server
  • Platform: All Platforms
  • Release: 9.0.1
  • Role: Developer
  • Tags: http java osgi xpages
  • Replies: 3

Hi,

I need to pass some encoded strings as part of my URL (ex: /users/user/cn%3Dphilippe riand%2Fo%3Dtrilog)  but, as far as I tried, all of the Java servlet methods return the URL as partially decoded (/users/user/cn=philippe%20riand/o=trilog). Because the '/' is being decoded, we cannot know what is an actual parameter separator or part of the value.

Is there a way to get the 'raw', undecoded URL, by accessing a CGI variable or whatever. Part of our code is native "C", so we can call a "C" function if necessary.

Phil.

Aug 21, 2015 8:51 AM
191 Posts
Some info
I'm not familiar with this area of the product, but I did find what appears to be a very similar SPR from the 8.5.2 timeframe. Here are the details on that case:

When using a url that contains encoded / in a segment, the encoded / is wrongly decoded by getRequestURI, causing behaviour problem in ISV API

Steps to reproduce:
use the following url from a browser: http://localhost/sample.nsf/api/data/documents/form/test%2Fform atom+xml 小野 充/
In the http request, the url is encoded as : http://localhost/sample.nsf/api/data/documents/form/test%2Fform%20atom+xml%20%E5%B0%8F%E9%87%8E%20%E5%85%85/
In the Domino Web Container, get RequestURI() returns:  http://localhost/sample.nsf/api/data/documents/form/test/form atom+xml 小野 充/

In one segment of the url, we use a form name called test/form atom+xml 小野 充. Notice that the %2F which is part of a segment of the original url is transformed in /, causing the ISV Api to not find the form name.

According to the servlet api spec: the following function should not be decoded by the webcontainer:
getRequestURI
getContextPath()
getQueryString()

The SPR is DTAB82LPFP, and it was fixed in 8.5.2. Assuming this is related to the issue you are reporting, it would seem the fix doesn't cover all cases, and we'd need to open a PMR to take a look. I didn't see any other ways to get the raw string, and since the behavior violated the specification, I would think there isn't another way outside of those standard APIs.
Aug 21, 2015 10:51 AM
6 Posts
I found the culprit...

Right, this is very similar. Actually this is not a Domino issue, but an IBM SBT SDK one. My request is going through the proxy component and that improperly decodes the url. I submitted an issue to the SBT team: https://github.com/OpenNTF/SocialSDK/issues/1704

Thanks for your reply!

Aug 21, 2015 3:52 PM
27 Posts
Raw uri
Could try asking for the following cgi var

"DOCUMENT_URI="

This appears to be set to the raw uri