how to get IP adress of a client behind a proxy?

how to get IP adress of a client behind a proxy?

Post by Boris Schaelin » Sat, 24 Apr 1999 04:00:00



Hi all!
I programme an Unix chat server. To log in a client uses a browser and loads
a HTML frame page. One frame contains a java applet, another frame connects
directly to the chat server with http://www.abc.xy:12345/. The chat server
has now to find out that these two connections belong to one client.
I used getpeername() to retrieve the IP adresses of the clients and to find
out what connections belong together.
This didn't work always, and meanwhile I know what the problem is (thanks to
Soumen in c.p.tcp-ip): If the client uses a proxy I get different IP
adresses. That is if I use getpeername() to get the IP adress the connection
to the java applet returns the IP adress of the client. But the connection
to the HTML page in the browser returns the IP adress of the proxy! With
different IP adresses it is impossible to the server to find out that the
two connections belong to one client.
How can I find out that the two connections belong to the same client? Is it
possible to get the IP adress of the client behind the proxy? I'd say it
should be possible because there is a connection between the server and the
client's HTML page - but how?

Thank you very much in advance,
Boris

 
 
 

how to get IP adress of a client behind a proxy?

Post by Barry Margoli » Sat, 24 Apr 1999 04:00:00




>Hi all!
>I programme an Unix chat server. To log in a client uses a browser and loads
>a HTML frame page. One frame contains a java applet, another frame connects
>directly to the chat server with http://www.abc.xy:12345/. The chat server
>has now to find out that these two connections belong to one client.
>I used getpeername() to retrieve the IP adresses of the clients and to find
>out what connections belong together.
>This didn't work always, and meanwhile I know what the problem is (thanks to
>Soumen in c.p.tcp-ip): If the client uses a proxy I get different IP
>adresses. That is if I use getpeername() to get the IP adress the connection
>to the java applet returns the IP adress of the client. But the connection
>to the HTML page in the browser returns the IP adress of the proxy! With
>different IP adresses it is impossible to the server to find out that the
>two connections belong to one client.
>How can I find out that the two connections belong to the same client? Is it
>possible to get the IP adress of the client behind the proxy? I'd say it
>should be possible because there is a connection between the server and the
>client's HTML page - but how?

I don't think there's any way to do this.  And even if you could, you
wouldn't want to.  Just because two clients have the same IP address
doesn't mean that they're the same user.  Consider a timesharing system
like Unix, which can have many users all with the same IP address.

The proper way to solve this problem is to pass a unique parameter to the
Java applet that identifies the user, and have the applet pass that along
when it connects to the chat server.  The server can remember which HTTP
client it gave each parameter to, and use that to match up the
corresponding chat connection.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

how to get IP adress of a client behind a proxy?

Post by Boris Schaelin » Sat, 24 Apr 1999 04:00:00






> >Hi all!
> >I programme an Unix chat server. To log in a client uses a browser and
loads
> >a HTML frame page. One frame contains a java applet, another frame
connects
> >directly to the chat server with http://www.abc.xy:12345/. The chat
server
> >has now to find out that these two connections belong to one client.
> >I used getpeername() to retrieve the IP adresses of the clients and to
find
> >out what connections belong together.
> >This didn't work always, and meanwhile I know what the problem is (thanks
to
> >Soumen in c.p.tcp-ip): If the client uses a proxy I get different IP
> >adresses. That is if I use getpeername() to get the IP adress the
connection
> >to the java applet returns the IP adress of the client. But the
connection
> >to the HTML page in the browser returns the IP adress of the proxy! With
> >different IP adresses it is impossible to the server to find out that the
> >two connections belong to one client.
> >How can I find out that the two connections belong to the same client? Is
it
> >possible to get the IP adress of the client behind the proxy? I'd say it
> >should be possible because there is a connection between the server and
the
> >client's HTML page - but how?

> I don't think there's any way to do this.  And even if you could, you
> wouldn't want to.  Just because two clients have the same IP address
> doesn't mean that they're the same user.  Consider a timesharing system
> like Unix, which can have many users all with the same IP address.

> The proper way to solve this problem is to pass a unique parameter to the
> Java applet that identifies the user, and have the applet pass that along
> when it connects to the chat server.  The server can remember which HTTP
> client it gave each parameter to, and use that to match up the
> corresponding chat connection.

Thanks for your answer, Barry! But I don't understand your proposal. Surely
I can pass a parameter to the java applet but this parameter has to be
returned by the browser through the HTML frame connection. And how should
this be done?
To make it clear:

Client                               Server
+ java applet <------------> } the two connections belong
+ html frame <-------------> } to the same client - how to determine?

Currently at first the java applet gets connected. After some handshaking
the applet gets order by the chat server to build a second connection to the
server. It does this by changing a frame in the HTML document using
http://www.abc.xy:12345/. I think I can't pass any parameter along this
browser-to-chat-server connection. Or can I?

Boris

 
 
 

how to get IP adress of a client behind a proxy?

Post by Barry Margoli » Sat, 24 Apr 1999 04:00:00




>Thanks for your answer, Barry! But I don't understand your proposal. Surely
>I can pass a parameter to the java applet but this parameter has to be
>returned by the browser through the HTML frame connection. And how should
>this be done?
>To make it clear:

>Client                               Server
>+ java applet <------------> } the two connections belong
>+ html frame <-------------> } to the same client - how to determine?

>Currently at first the java applet gets connected. After some handshaking
>the applet gets order by the chat server to build a second connection to the
>server. It does this by changing a frame in the HTML document using
>http://www.abc.xy:12345/. I think I can't pass any parameter along this
>browser-to-chat-server connection. Or can I?

You could put the parameter in the URL somewhere,
e.g. http://www.abc.xy:12345/path/to/file?parameter.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

how to get IP adress of a client behind a proxy?

Post by Boris Schaelin » Sun, 25 Apr 1999 04:00:00






> >Thanks for your answer, Barry! But I don't understand your proposal.
Surely
> >I can pass a parameter to the java applet but this parameter has to be
> >returned by the browser through the HTML frame connection. And how should
> >this be done?
> >To make it clear:

> >Client                               Server
> >+ java applet <------------> } the two connections belong
> >+ html frame <-------------> } to the same client - how to determine?

> >Currently at first the java applet gets connected. After some handshaking
> >the applet gets order by the chat server to build a second connection to
the
> >server. It does this by changing a frame in the HTML document using
> >http://www.abc.xy:12345/. I think I can't pass any parameter along this
> >browser-to-chat-server connection. Or can I?

> You could put the parameter in the URL somewhere,
> e.g. http://www.abc.xy:12345/path/to/file?parameter.

Ahhhh, forget my stupid question. That was easy.
Thanks for your help, Barry!

Boris