-
Bug
-
Resolution: Done
-
Major
-
None
-
2.1.0.GA
If I specify a selector with Python 2 byte string,
link_opts = [] ... link_opts.append(proton.reactor.Selector("""a LIKE \'%4sm50jZM\\%\' ESCAPE \'\\\'"""))) ... event.container.create_receiver(self.url, options=self.link_opts, ...)
Wireshark shows it is sent as vbin8,
Filter (map of 1 element) selector : apache.org:selector-filter:string (vbin8): 61204c494b4520272534736d35306a5a4d5c252720455343...
and when this gets to proton-j in broker, it becomes type Binary. Broker calls .toString() on it, tries to parse that string as selector and fails.
The problem is that backslashes are escaped as \x5c in the String representaion of Binary, so my original selector "a LIKE \'%4sm50jZM\\%\' ESCAPE \'\\\'" becomes "a LIKE '%4sm50jZM\x5c%' ESCAPE '\x5c'", which is invalid selector that the broker rejects.
If I use unicode in proton.reactor.Selector(u"""a LIKE \'%4sm50jZM\\%\' ESCAPE \'\\\'"""), then it is sent as
Filter (map of 1 element) selector : apache.org:selector-filter:string (str8-utf8): a LIKE '%4sm50jZM\%' ESCAPE '\'
and all works correctly.
I am not sure if this is an issue or just something to document. Should the broker be more permissive, maybe, and deal with selector in vbin8?
- is related to
-
AMQDOC-2469 [Python] Document Selectors with backslashes do not work unless they are given as unicode string
- Closed