Jump to content
Tuts 4 You

How to handle proxy addresses?


Recommended Posts

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?


Request to google.com

inet_addr, proy address
filling peer struct
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

Link to comment

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.


Link to comment

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.


Link to comment

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
  • Like 1
Link to comment
  • 6 months later...

Hi again,

just have again a question about Fiddler and how to capture any process who accessing internet via Windows Sockets.How was it working again?I just remember I need to set proxy address to in browser to get traffic captured from this browser but how was it for any process I do choose via process picker in Fiddler?

PS: Sorry,I just forgot it.


Link to comment


hmm.Dosent wanted to download another tool if I am using Fiddler already.Just forgot that Fiddler dosent capture apps using Windows Sockets. :( If I see it right then this proxifer dosent log the whole traffic similar Fiddler does right?Also dont see anything about WebSocket capturing in the manual.


Link to comment


Proxifer is only bridge, it will redirect any TCP connections (WinSock) to HTTP (Fiddler) or Socks Server, in proxifier you can only see log for domain or IP request. The combination for both app is HTTP Debugger Pro, it able to capture any connection including websocket from any app. another free alternative is wireshark.



Link to comment

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...