Winsock & Proxies
I'm trying to understand how proxies work, and have come up with quite a few doubts, so this will be a long post, excuse me... Let's paint this hipothetic situation: - "A" is a computer that connects to the internet directly - "B" is a computer that has a network connection to "A", but no connection to the internet, and therefore requires a proxy connection to "A" to "talk" to the internet... Now my question is, when "A" sends out a packet, it sends information on how that packet should return, something along the lines of: [To: www.yahoo.com | From: 192.160.34.101(A) | Data: "Get Page"] So, the above packet, sent out, finds its way to yahoo's servers, and the action "get page" is executed, and a packet of information built, that is returned back to "A", as: [To: 192.160.34.1 | From: yahoo.com | Data: "index.html"] This is all fine, until proxies get in the mix, and my less than perfect understanding of them. How does a packet sent from "B", routed through a proxy program in "A", get back to "B"? "B" connects to a certain port in "A", and send a similar packet to the one above, requesting Yahoo's page: [To: www.yahoo.com | From: B | Data: "Get Page"] Now if this packet where to be sent by "A", it would never return, because the server does not know the return address "B" (being it an internal address to the network, it would probably be something along the lines of 192.168.1.xxx or something...). So, i think that the proxy utility on "A" has to append a valid return address (A's of course), but then the question arises, when Yahoo's server responds to the request, how do we know to which network-internal computer to rout it to?
Proxy servers generally only deal with connection protocols [TCP].
A knows that the info from yahoo.com is going to B because the info came in on the connection it made for B, not the one it made for C...
Not sure if that's clear or not.
A knows that the info from yahoo.com is going to B because the info came in on the connection it made for B, not the one it made for C...
Not sure if that's clear or not.
Yes, it is clear.
Its the connection that is made between the Server (Proxy) and the Client that defines where the information, once received, goes to.
I still have doubts though...
How does A know that B is trying to access yahoo? I mean, is there an underlying protocol the proxy must adhere to?
How do the clients tell the proxy which internet page they want to connect to, and which information they want?
Thanks for the reply [wink]
Its the connection that is made between the Server (Proxy) and the Client that defines where the information, once received, goes to.
I still have doubts though...
How does A know that B is trying to access yahoo? I mean, is there an underlying protocol the proxy must adhere to?
How do the clients tell the proxy which internet page they want to connect to, and which information they want?
Thanks for the reply [wink]
If you are talking about HTTP Proxy, then yes, there is a specific protocol that a web proxy speaks, and that a web browser uses to talk to the configured web proxy. Most of the time, it's the same thing for other proxied protocols, although sometimes "transparent proxies" can be written with enough smarts in the gateway.
In this case, inside computer "B" would use the HTTP proxy protocol to talk to computer "A". Computer "A" would then figure out what the request is, and go out and get the data from the destination. Once "A" has the data, it will turn around and return the data to "B". As part of the proxy protocol, "A" may add headers indicating some things about the original requester, or it may not (for anonymizers, for example).
You MAY be talking about something different: Internet Connection Sharing devices. These do Network Address Translation, where each network packet has its addresses swizzled going out and coming back in, to allow most protocols to work through a single point of access (this is usually done in firewalls/routers, too). For more information, see for example my write-up on NAT punch-through.
In this case, inside computer "B" would use the HTTP proxy protocol to talk to computer "A". Computer "A" would then figure out what the request is, and go out and get the data from the destination. Once "A" has the data, it will turn around and return the data to "B". As part of the proxy protocol, "A" may add headers indicating some things about the original requester, or it may not (for anonymizers, for example).
You MAY be talking about something different: Internet Connection Sharing devices. These do Network Address Translation, where each network packet has its addresses swizzled going out and coming back in, to allow most protocols to work through a single point of access (this is usually done in firewalls/routers, too). For more information, see for example my write-up on NAT punch-through.
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement