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

Feature request: API to get the local and remote hosts and port. #115

Open
informatimago opened this issue Sep 11, 2021 · 0 comments
Open

Comments

@informatimago
Copy link

informatimago commented Sep 11, 2021

When http-request is called with :want-stream t (or even when nil), it would be nice to have a public API to retrieve the local and remove address and port of the TCP connection.

Currently, we have wrapped streams over the native connection stream, which should be considered drakma implementation details, (and I assume could vary depending on the options, chunked/not chunked, ssl, proxy?), and the connection stream is CL implementation specific (assuming usocket is not used, I've not looked, drakma implementaiton detail). So it would be quite inconvenient to access those elements.

This issue is linked to #116

I would suggest to add two opaque objects in the result values of http-request one for the socket information, and one (optional) for the security information, with the reader API to query them.

An alternative could be to provide the API directly on the stream returned, but this may be inconvenient in case the socket is closed (we'd still want to remember the addresses and port used), or because of the various implementations and wrapper streams on those sockets.

So instead, I'm suggesting an opaque object that could be filled by http-request before losing forgetting the reference to the usocket:socket, with readers similar to the usocket API on it:

(GET-LOCAL-ADDRESS stream-info) -> (or string (vector (unsigned-byte 8)))
(GET-LOCAL-PORT stream-info)    -> (unsigned-byte 16)
(GET-PEER-ADDRESS stream-info)  -> (or string (vector (unsigned-byte 8)))
(GET-PEER-PORT stream-info)     -> (unsigned-byte 16)

optionally, drakma could also provide (which return the list of address and port):

(GET-LOCAL-NAME stream-info)    -> string
(GET-PEER-NAME stream-info)     -> string
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

1 participant