Hello,

I am working on a custom HTTP connection plugin and some related modules in 
order to access a proprietary REST API. For this purpose, I have to provide 
capabilities for basic create/update/delete operations on different 
entities. 

While developing the plugin, I have noticed the standard httpapi 
implimentation is relying on urllib_request.urlopen inside the open() 
method from module_utils/urls.py.

Further, the AbstractHTTPHandler provided by the urllib_request has the 
following limitation:

        # TODO(jhylton): Should this be redesigned to handle
        # persistent connections?

        # We want to make an HTTP/1.1 request, but the addinfourl
        # class isn't prepared to deal with a persistent connection.
        # It will try to read all remaining data from the socket,
        # which will block while the server waits for the next request.
        # So make sure the connection gets closed after the (only)
        # request.
        headers["Connection"] = "close"

Therefore, I cannot create 'keep-alive' connections which further 
interferes with PUT or POST requests that have a payload which is send to 
the server in a separate request - check implementation in 
/usr/lib/python3/http/client.py, _send_output() method. 

Under these circumstances, is there any way to use urllib3 in Ansible for 
http connections? Or any workaround to keep the connection alive until the 
payload is send to the server?

Thank you for your time!

Regards,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/37ef0bd0-6d9b-4f93-a11e-8e5da07d023en%40googlegroups.com.

Reply via email to