Jump to content
Tuts 4 You
LCF-AT

How to handle proxy addresses?

Rate this topic

Recommended Posts

LCF-AT

Hi guys,

can anyone tell me how to handle a proxy using windows socket & OpenSSL functions?So I get all working on normal way to call any addresses and to get response but now I tried to do the same but with any proxy address but get some issues.So what is the correct way to handle the proxy address before handle the main request address / header?

Example:

Proxy: 123.123.123.123:8080
Request to google.com

inet_addr, proy address
filling peer struct
socket, AF_INET, SOCK_STREAM, IPPROTO_IP ; or IPPROTO_TCP
connect, s, addr peer, sizeof peer

Now on internet and in OpenSSL I see it does call send function...

CONNECT google.com:443 HTTP/1.0

...and after that revc function and get status 200 connection estalblished etc.

Is that correct so far?Has anyone any example for that or knows the rules how to do it right etc?

Thank you

Share this post


Link to post
Share on other sites
LCF-AT

Hi again,

I was checking and playing around and got some success but still not sure for 100 % yet.I tried diffrent proxy addresses for http and https connections.So it seems there diffrent handle methods for http & https about sending the request header field.

If I use a  proxy address and wanna send  this via SSL/TLS then I need to send a extra pre request header using CONNECT.

CONNECT google.com:443 HTTP/1.0
Host: google.com:443

Sending this via send function and getting respond via recv function and for SSL/TLS I get this back..

HTTP/1.1 200 Connection established

....after this I do call later SSL_write (send function) to send the main request header (GET / etc...)

...and for none SSL/TLS I get this...

HTTP/1.1 200 OK

Summary: Windows Socket with SSL: I need to send a pre request header with CONNECT followed by a send & recv function to get the small response header.Now after that I just work normal go on as usually.Calling the SSL functions (from OpenSSL),sending the main header request and reading bytes.

Windows Socket without SSL: I dont need to send any pre header request.Just calling socket / connect functions with the proxy address and sending main header request.

As I said I am not sure for 100% yet but it seems to work.I did called some diffrent IP sites to get the used IP in my app and it does show the IPs of the proxys I did used.Maybe anyone of you can confirm that or not whether its right so or not.Just wonder why I need to send a extra header request before sending the main header request for SSL.

greetz

Share this post


Link to post
Share on other sites
LCF-AT

Hi again,

I have a new small other question also about proxy.I was using the Fiddler Web Debugger tool to capture traffic.So each time if I wanna capture traffic from my browser (Firefox) then I need to change before the proxy settings in Firefox and set it to manually with the localhost address and port 8888 to get the traffic from browser captured.My question now is how to make Fiddler work without using the localhost address & port?I just wanna use any proxy address in browser settings instead and capture also with Fiddler.How can I make this work?

I have a test app where I use windows socket & WinInet function.Fiddler does capture the WinInet traffic but not the windows socket traffic.Is it also possible to capture the window socket traffic too etc?Maybe anyone can help with this and knows what settings I need to change if its doable.Thanks.

greetz

Share this post


Link to post
Share on other sites
NOP

In Fiddler, you can manually set the upstream proxy by clicking Tools->Options->Gateway

Proxy goes in there and set your browser to fiddler proxy as normal

:)

Edited by NOP (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...