Bug #2460
escaped + in query string not being decoded?
100%
Description
dates containing "+00:00" for timezone encoded to "%2B00:00" are causing the fromDate (toDate) filtering to fail.
compare:
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00%2B00:00
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00+00:00
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00
https://cn-dev.dataone.org/cn/v1/object
(dataone escapes '+' to avoid overloaded semantics with URLEncoder where space becomes '+'
see d1_common_java: org.dataone.service.util.EncodingUtilities.java for decoding
Related issues
History
#1 Updated by Rob Nahf over 12 years ago
- Category set to Metacat
- Assignee set to Ben Leinfelder
#2 Updated by Ben Leinfelder over 12 years ago
Metacat seems to be handling these %2B encodings correctly. It does not like the "+" used directly in the URL because that indicates a space " " and so the UTC date parsing fails.
My hunch is that when routing through the CN proxy this gets confused on it's way to Metacat.
#3 Updated by Ben Leinfelder over 12 years ago
So the proxy seems to take the "+"
I wonder if it encodes this before passing it to Metacat so that Metacat receives the correctly encoded (%2B) string on the request. but when we pass %2B from the get go, the CN proxy encodes those characters too?
from cn-dev cn.log:¶
proxy.wrapper RequestURL: https://cn-dev.dataone.org/cn/v1/object
[ INFO] 2012-03-08 19:26:12,342 (AbstractProxyServiceImpl:debugWrapper:86) proxy.wrapper RequestURI: /knb/d1/cn/object
[ INFO] 2012-03-08 19:26:12,342 (AbstractProxyServiceImpl:debugWrapper:87) proxy.wrapper PathInfo: /object
[ INFO] 2012-03-08 19:26:12,342 (AbstractProxyServiceImpl:debugWrapper:88) proxy.wrapper PathTranslated: /d1/cn/object
[ INFO] 2012-03-08 19:26:12,342 (AbstractProxyServiceImpl:debugWrapper:89) proxy.wrapper QueryString: fromDate=2012-03-07T22:00:00+00:00
[ INFO] 2012-03-08 19:26:12,342 (AbstractProxyServiceImpl:debugWrapper:90) proxy.wrapper ContextPath: /knb
[ INFO] 2012-03-08 19:26:12,343 (AbstractProxyServiceImpl:debugWrapper:91) proxy.wrapper ServletPath: /d1/cn
[ INFO] 2012-03-08 19:26:12,343 (AbstractProxyServiceImpl:debugWrapper:92) proxy.wrapper Method: GET
[ INFO] 2012-03-08 19:26:12,343 (AbstractProxyServiceImpl:debugWrapper:93) proxy.wrapper toString: org.dataone.cn.servlet.http.ProxyServletRequestWrapper@c03ed32
[ INFO] 2012-03-08 19:26:12,343 (AbstractProxyServiceImpl:debugWrapper:101) proxy.wrapper.ParameterMap: fromDate 2012-03-07T22:00:00 00:00
#4 Updated by Ben Leinfelder over 12 years ago
For requests that come in with "%2B" you can see the Parameter Map has them decoded as "+":
[ INFO] 2012-03-08 19:19:16,884 (AbstractProxyServiceImpl:debugWrapper:60) proxy.request RequestURL: https://cn-dev.dataone.org/cn/v1/object
[ INFO] 2012-03-08 19:19:16,884 (AbstractProxyServiceImpl:debugWrapper:61) proxy.request RequestURI: /cn/v1/object
[ INFO] 2012-03-08 19:19:16,884 (AbstractProxyServiceImpl:debugWrapper:62) proxy.request PathInfo: null
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:63) proxy.request PathTranslated: null
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:64) proxy.request QueryString: fromDate=2012-03-07T22:00:00%2B00:00
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:65) proxy.request ContextPath: /cn
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:66) proxy.request ServletPath: /v1/object
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:67) proxy.request Method: GET
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:68) proxy.request toString:org.apache.catalina.connector.RequestFacade@1d81d812
[ INFO] 2012-03-08 19:19:16,885 (AbstractProxyServiceImpl:debugWrapper:74) proxy.request.ParameterMap: fromDate 2012-03-07T22:00:00+00:00
#5 Updated by Robert Waltz over 12 years ago
- Status changed from New to In Progress
Looks as though at sometime in the past it was necessary to pass to proxied services (mercury or metacat) the parameters as they were precisely on the query path.
I took that functionality out.
#6 Updated by Ben Leinfelder over 12 years ago
- Assignee changed from Ben Leinfelder to Robert Waltz
Robert has made changes to cn proxy for this bug -- reassigning to him (I think it is resolved but would like to double check)
#7 Updated by Ben Leinfelder over 12 years ago
- Status changed from In Progress to Closed
Verified on cn-dev and it works as expected now:
1. INVALID date:
https://cn-dev.dataone.org/cn/v1/object?fromDate=bad
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00+00:00
2. VALID dates:
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00
https://cn-dev.dataone.org/cn/v1/object?fromDate=2012-03-07T22:00:00%2B00:00