On 09/23/2014 04:08 PM, Sergey Mironov wrote:
Basis.clientIP function is really a nonsense for non-http backends. And yes, non-http backends may lack access to the client's IP address at all (I may imagine there may be an apache plugin for setting HTTP header containing this information). From the other hand, it is sad that programmer can't touch transport level even by using methods labeled 'unsafe'. I would have written an FFI-module If I only could access the socket to pass to [getpeername]. Here is another possible scenario I am thinking about: we may store backend-specific file handle into uw_context (maybe under [void*] type for safety) and provide users with a C function like [int uw_handle(uw_context *ctx)] returning this handle. This would make it possible to move the responsibility to FFIs and allow me to write one to do the job. Basis API will stay unchanged this way. What do you think?

Apologies for the long delay (blah blah, research-paper deadlines, blah blah), but I believe I've now implemented the very simple change that you suggested. It makes sense to me as a good way of addressing the issue.

The one essential difference in my version is that I did decide to keep the type of this mysterious data as 'int' instead of 'void*'.

Also, since the function name you suggested was already taken, here's the one to be calling to get the socket (if any) for a context:
    int uw_remoteSock(uw_context);
It returns -1 when no socket has been set.

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to