Unify and simplify escaping of slashes

Description

Currently, escaping of slashes are done differently for different circumstances:

  • GET-Requests : Here, a rather strange (and complicated) escaping is used as described in the reference manual (see also attachment)

  • Pathes in POST Requests: In POST request, when a 'path' is given which contains slashes, ecaping is done with a backslash (), however backslashes themselves cannot be escaped

This should be unified to a common behaviour:

  • A slash (/) gets escaped with a backslash (\) ---> "/" as part of a MBean Name, attribute, path ... becomes "\/"

  • A backslash gets escaped with a bascklash --> "\" becomes "\\"

Most of the current escaping code can be found in PathUtil where it should be refactored.

Backwards compatibility must not be kept. The Java and Javascript client must be updated accordingly.

Environment

None

Attachments

1

Balsamiq Wireframes

Activity

Show:

Roland Huss September 23, 2011 at 3:31 PM

Finished work.

Roland Huss September 23, 2011 at 3:30 PM

Fixed and verified Javascript Lib, which exhibits now the same behaviour as the Java library.

Roland Huss September 23, 2011 at 10:21 AM

List handling in the Java-Client: Constructors has been extended to either use a list of path elements (in which case the elements are expected to be not escaped) or a single path string (which must already be properly escaped)

Still to verify: Javascript library.

Roland Huss September 23, 2011 at 10:19 AM

Updated documentation and merged into trunk. Released a 1.0-SNAPSHOT including the changes. Also, jmx4perl was adapted to work with this new client (and has --legacy-escape option for check_jmx4perl for backwards compatibility for old agents)

Roland Huss September 22, 2011 at 5:33 AM
Edited

The first implementation can be found on branch path-escape. PathUtil has been renamed to EscapeUtil.

Escaping is used in ...

  • GET requests for the URL when slashes needs to be escaped. Escape character is !, escaped char is /

  • inner pathes for POST requests are escaped the same way (! for escape char, / escaped char)

  • For upstream serialization, when unserializing an array, it , can be escaped with a \ for separating the single array elements.

  • For the JVM-JDK agent startup options (as given on the command line with the -javaagent:.... option) commas , and equal signs = can be escaped with a \

Backwards comptability was given up in order to have a clean 1.0 start. This will be the only time it will be done that careless. Promised.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created September 17, 2011 at 6:03 AM
Updated September 23, 2011 at 3:31 PM
Resolved September 23, 2011 at 3:31 PM