PageSequenceMonitor double-URL-encodes query parameters
Description
Acceptance / Success Criteria
Lucidchart Diagrams
Activity
Stéphane Wartel November 5, 2011 at 10:07 AM
Using page sequence monitor, I get the same double-encode with % character when trying to POST xml data that need to be encoded first to an xmlrpc server.
Hope that it could be fix in the next stable 1.8.16.
Many thanks by advance
Benjamin Reed March 7, 2011 at 4:08 PM
OK, spent some time looking through the code, and it appears it will be non-trivial to backport this to 1.8. The APIs are different enough that it appears there isn't an obvious analog in the older commons-httpclient.
Benjamin Reed March 7, 2011 at 11:10 AM
This issue isn't HTTPClient4-specific, right? It's in our usage of new URL()? I assume it would affect 1.8 as well, then, and should be fixed there too.
If that's not the case, then we can re-close this.
Seth Leger March 3, 2011 at 5:18 PM
This is caused by the fact that the java.net.URI(String, String, String, int, String, String, String) constructor will escape '%' characters in the query string, including % characters that are already being used to escape URI content. I've switched instances where we call this constructor to use org.apache.http.client.utils.URIUtils.createURI() since it is designed as a replacement for this constructor and will do the right thing. This change affected the PageSequenceMonitor and HttpCollector classes.
If you think you are affected by this bug, note that this will only affect <page> elements that contain URL-escapable content (non-alphanumeric characters), which is probably a minority.
commit 295fe1441e8edec7636a48bc1a06a13ce237a1ec
Seth Leger March 3, 2011 at 3:25 PM
I think this also happens if you specify the query parameters by using the "query" attribute on the page element, for example:
<page virtual-host="localhost" path="/opennms/alarm/list.htm" query="filter=severity%3D1" port="8980" response-range="200"/>
will fail the same way.
Details
Assignee
Benjamin ReedBenjamin ReedReporter
Seth LegerSeth LegerComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Reporter
Components
Fix versions
Affects versions
Priority
PagerDuty
PagerDuty Incident
PagerDuty
PagerDuty Incident
PagerDuty

If you specify query parameters in an XML page-sequence configuration that contain values that need to be URL encoded (like '=', '%') then the characters will be double-escaped inside the PageSequenceMonitor code before they are sent to the server.This will cause the page sequences to fail because the parameters will be malformed. For example:
<page-sequence>
<page virtual-host="localhost" path="/opennms/alarm/list.htm" port="8980" response-range="200">
<parameter key="filter" value="severity=1"/>
</page>
</page-sequence>
will cause the following GET to be issued to the server:
GET /opennms/alarm/list.htm?filter=severity%253D1
In this case, the '=' sign was escaped once to '%3D' (which is what we would expect) but then the '%' in that clause is escaped again resulting in the final string '%253D'.