Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URI not being properly encoded #131

Closed
edarzins opened this issue Feb 7, 2017 · 2 comments
Closed

URI not being properly encoded #131

edarzins opened this issue Feb 7, 2017 · 2 comments

Comments

@edarzins
Copy link

edarzins commented Feb 7, 2017

When trying to access a node resource with a name of "172.16.1.5%0" on a BIG-IP, the BIG-IP returned an error.

Bad Request for uri: https://10.190.21.52:443/mgmt/tm/ltm/node/~test~172.16.1.5%0

It appears that the URI is not being encoded, the "%" in the node name should be encoded to "%25" before it's sent to the BIG-IP.

@jasonrahm
Copy link

jasonrahm commented Apr 9, 2019

@edarzins I know this is old but I'm trying to clean up. Using the route domain address as the node name is probably pretty rare. I'd just do the encoding for the name as part of your code. Directly for this library, that would look like:

>>> from icontrol.session import iControlRESTSession
>>> import urllib

>>> b = iControlRESTSession('admin', 'admin')
>>> partition = 'test'
>>> name = '172.16.1.5%0'
>>> encoded_name = urllib.quote(name)
>>> node = b.get('https://localhost:13443/mgmt/tm/ltm/node/~{}~{}'.format(partition, encoded_name))
>>> node.text
u'{"kind":"tm:ltm:node:nodestate","name":"172.16.1.5%0","partition":"test","fullPath":"/test/172.16.1.5%0","generation":1443,"selfLink":"https://localhost/mgmt/tm/ltm/node/~test~172.16.1.5%250?ver=13.1.1.4","address":"172.16.1.5","connectionLimit":0,"dynamicRatio":1,"ephemeral":"false","fqdn":{"addressFamily":"ipv4","autopopulate":"disabled","downInterval":5,"interval":"3600"},"logging":"disabled","monitor":"default","rateLimit":"disabled","ratio":1,"session":"user-enabled","state":"unchecked"}'

However, if this isn't as rare as I think, I can try to add a check for the name kwarg and encode them appropriately.

@f5-rahm
Copy link
Contributor

f5-rahm commented Sep 14, 2020

archiving this repo, this request will not be implemented.

@f5-rahm f5-rahm closed this as completed Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants