[hunchentoot-devel] When hunchetoot is listening on multiple addresses how can I find on which address was a specific request received?

My acceptor listens on *:80 . I have two interfaces on my machine and I would like to know for each request the specific ip on which it came through. Is that possible and how? Thanks.

Vassilis Radis <radisb@gmail.com> writes:
My acceptor listens on *:80 . I have two interfaces on my machine and I would like to know for each request the specific ip on which it came through. Is that possible and how? (acceptor-port (request-acceptor *request*))
-- With best regards, Stas.

But this returns the port , not the IP on which the request was received. Am I missing something? On Fri, Jan 18, 2013 at 3:20 PM, Stas Boukarev <stassats@gmail.com> wrote:
Vassilis Radis <radisb@gmail.com> writes:
My acceptor listens on *:80 . I have two interfaces on my machine and I would like to know for each request the specific ip on which it came through. Is that possible and how? (acceptor-port (request-acceptor *request*))
-- With best regards, Stas.
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Vassilis Radis <radisb@gmail.com> writes:
But this returns the port , not the IP on which the request was received. Am I missing something? (acceptor-address *acceptor*)
-- With best regards, Stas.

Well, (acceptor-address *acceptor*) returns nil if it has been started with no :address initarg. The acceptor-address returns the :address argument at the initialization of the acceptor which designates on which ip or hostname the server listens (if :address is not supplied server listens on all the interfaces), not on which ip address a request came through. Example: I have 2 interfaces on my machine: eth0 (192.168.1.1) and eth1 (8.8.8.8) . If I start an acceptor with no address supplied, hunchentoot receives requests on both of these interfaces and (acceptor-address *acceptor*) returns nil which implies that it listens on 0.0.0.0 .But each request has to come through one of them. How can I find on which one a request came through? On Fri, Jan 18, 2013 at 3:35 PM, Stas Boukarev <stassats@gmail.com> wrote:
Vassilis Radis <radisb@gmail.com> writes:
But this returns the port , not the IP on which the request was received. Am I missing something? (acceptor-address *acceptor*)
-- With best regards, Stas.
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Vassilis Radis <radisb@gmail.com> writes:
Well, (acceptor-address *acceptor*) returns nil if it has been started with no :address initarg. The acceptor-address returns the :address argument at the initialization of the acceptor which designates on which ip or hostname the server listens (if :address is not supplied server listens on all the interfaces), not on which ip address a request came through.
Example:
I have 2 interfaces on my machine: eth0 (192.168.1.1) and eth1 (8.8.8.8) . If I start an acceptor with no address supplied, hunchentoot receives requests on both of these interfaces and (acceptor-address *acceptor*) returns nil which implies that it listens on 0.0.0.0 .But each request has to come through one of them. How can I find on which one a request came through? NIL means 0.0.0.0
-- With best regards, Stas.

exactly, as I said in my example. But requests come in a "real" ip, not 0.0.0.0 . I want to know that ip On Fri, Jan 18, 2013 at 4:21 PM, Stas Boukarev <stassats@gmail.com> wrote:
Vassilis Radis <radisb@gmail.com> writes:
Well, (acceptor-address *acceptor*) returns nil if it has been started with no :address initarg. The acceptor-address returns the :address argument at the initialization of the acceptor which designates on which ip or hostname the server listens (if :address is not supplied server listens on all the interfaces), not on which ip address a request came through.
Example:
I have 2 interfaces on my machine: eth0 (192.168.1.1) and eth1 (8.8.8.8) . If I start an acceptor with no address supplied, hunchentoot receives requests on both of these interfaces and (acceptor-address *acceptor*) returns nil which implies that it listens on 0.0.0.0 .But each request has to come through one of them. How can I find on which one a request came through? NIL means 0.0.0.0
-- With best regards, Stas.
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

On Fri, Jan 18, 2013 at 3:58 PM, Vassilis Radis <radisb@gmail.com> wrote:
exactly, as I said in my example. But requests come in a "real" ip, not 0.0.0.0 . I want to know that ip
I have added the feature in https://github.com/edicl/hunchentoot/commit/aaefbd92c1639c0b9ec465bcf1be92b3... Please test the github version and let me know if it suits your requirements. -Hans

Strange. I could have sworn this was already in there somewhere... :) On Fri, Jan 18, 2013 at 5:58 PM, Hans Hübner <hans.huebner@gmail.com> wrote:
I have added the feature in https://github.com/edicl/hunchentoot/commit/aaefbd92c1639c0b9ec465bcf1be92b3... - Please test the github version and let me know if it suits your requirements.

Yes it works. I already patched it the same way(except i didnt add local-port since it cant be different from the listening port, can it?) and tested it. (with a liberal definition of "testing") Thanks, Bill On Fri, Jan 18, 2013 at 6:58 PM, Hans Hübner <hans.huebner@gmail.com> wrote:
On Fri, Jan 18, 2013 at 3:58 PM, Vassilis Radis <radisb@gmail.com> wrote:
exactly, as I said in my example. But requests come in a "real" ip, not 0.0.0.0 . I want to know that ip
I have added the feature in https://github.com/edicl/hunchentoot/commit/aaefbd92c1639c0b9ec465bcf1be92b3... Please test the github version and let me know if it suits your requirements.
-Hans
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

On Fri, Jan 18, 2013 at 10:23 PM, Vassilis Radis <radisb@gmail.com> wrote:
I already patched it the same way(except i didnt add local-port since it cant be different from the listening port, can it?) and tested it. (with a liberal definition of "testing")
It cannot be different than the listening port, but I've added it anyway so that if one wants to use the local port number, one does not need to go through the acceptor to get it. -Hans
participants (4)
-
Edi Weitz
-
Hans Hübner
-
Stas Boukarev
-
Vassilis Radis