Why do we need the HTTP CONNECT Tunnel in Fiddler? - fiddler

I saw many Tunnel to host:443 in Fiddler traffic interception, when I click it I saw below info:
The selected session is a HTTP CONNECT Tunnel. This tunnel enables a client to send raw traffic (e.g. HTTPS-encrypted streams or WebSocket messages) through a HTTP Proxy Server (like Fiddler).
I also searched this -
Fiddler2: Decrypt HTTPS traffic and Tunnel to host:443
But these didn't answer my question, why do we need the HTTP CONNECT Tunnel? Why does a client need to send raw traffic?

See https://textslashplain.com/2015/11/19/understanding-connect-tunnels/
tl;dr: Browsers need to send CONNECT tunnel requests to proxies in order for the proxy to know to what server the traffic should be sent.
The encryption provided by HTTPS prevents the proxy server from seeing the URLs or HOST headers of the requests, and these are how a proxy normally decides where to send the requests. So, for HTTPS traffic, a different approach is needed-- that approach is that the client tells the proxy: "Hey, give me a tunnel to example.com and let me know when it's ready." The proxy does so and tells the client HTTP/200 Connection established. At that point, the proxy becomes a blind byte-shuffler that takes bytes from the client and sends them to the server and returns the bytes the server replied with back to the client.

Related

How to handle HTTP CONNECT tunnel on client side?

I am adding support for HTTP CONNECT request to a client and I can't seem to handle the tunnel properly.
I am able to send a CONNECT request to the proxy which response with a status code of 200. This RFC tell me that the tunnel has been formed with the end server.
How do I use this tunnel from a socket perspective?
On the client side, the socket I opened receives the 200 response from proxy initially. After checking the response should I just send more data into that socket?
I tried this approach and the client just hangs. The data doesn't seem to reach the final server. How to use this socket to do normal HTTP(S) after the tunnel is created?
After checking the response should I just send more data into that socket?
Yes. If you are speaking HTTPS you now start a TLS handshake and then send a properly formed HTTP request and read the response, both via TLS.
I tried this approach and the client just hangs. The data doesn't seem to reach the final server.
So either your handshake was wrong or your HTTP was malformed.

Difference between sip proxy and sip outbound proxy

I'm little bit confused about sip proxy and sip outbound proxy? What is the basic difference between sip proxy and sip outbound proxy? Is it mandatory to use sip outbound proxy along with sip proxy? Can anyone point me out from the below image which one is the sip proxy and outbound proxy?
As your attached picture, it should be:
User Agent: Client
SIP outbound proxies: SIP Proxy port 5060 & SIP Proxy port 5070 when they're receiving incoming request from UA
A sip proxy can be understood as an "outbound proxy" or an "inbound proxy".
Details explanation can be describe as below:
"Pretend you are a SIP User Agent, perhaps a very simple UA that
doesn't even do DNS lookups.
A call coming to you is "inbound".
It may hit your home proxy first, and receive treatment such as being
proxied to you based on your registered contact. This is an "inbound
service", and your home proxy is acting as an "inbound proxy".
Now you want to make a call. Since you're making the call, it is going
"out", or can be called "outbound". You send this call to a proxy,
which looks up the request URI in DNS and sends the call on towards
its destination. This proxy is providing the "outbound service" of DNS
resolution, and is acting as an "outbound proxy" for this call.
On any call there may be any number of inbound and outbound proxies
and services. Some proxies may even provide both sorts for a single
call.
Assume the simple network UA1----P1----P2----UA2
UA1 places a call to UA2."
//refer: https://www.ietf.org/mail-archive/web/sip/current/msg06276.html
SIP Proxy
A SIP proxy server receives a SIP request from a user agent or another
proxy and acts on behalf of the user agent in forwarding or responding
to the request.
Sip Outbound Proxy
An outbound Proxy: A proxy that receives requests from a client, even
though it may not be the server resolved by the Request-URI.
Typically, a SIP user agent is manually configured with an outbound proxy, or
can learn about one through auto-configuration protocols.
Basically they are the same, the only difference, is that SIP Proxy treats requests both for UAC (client) and UAS (server), but SIP Outbound Proxy receives requests from UAC.
And, no, it's not mandatory to use SIP Outbound Proxy along with SIP Proxy.
What about scheme from your image, these are not proxy servers, but are registrar servers which are used to register requests of the users and keep the information from these requests.

Accessing Proxy over HTTPS doesnt work

created a webserver(http port 80, https:443) and proxy server(http 8080,https:8081)
am seeing issue when I access proxy over https like
https://xyz:8081/
wireshark shows client(fireforx or chrome) is sending certificate data in HTTP packet , I see certificate text .
Any idea what could be wrong ? browser says no data received
If TLS session is already established(https webserver) would another TLS sessions is created if I try to access https proxy ?
I created SSL socket like
ctx_init
put the socket on select and did accept/sslaccept once I get
and then did SSL_Read
NB: Rest all access like http/https to webserver or http to proxy server works fine.
Updates: Issue was client was sending fragmented HTTP request
So for a GET request it was sent by client like this
Packet 1 was GE
Packet 2 was rest T ....\r\n\r\n
So in code I have to collect until until full HTTP packet is received

what is the difference between SIP proxy and outbound proxy

What is the difference between SIP Proxy server and Outbound proxy server.
I am using asterisk and I see two fields - proxy address and outbound proxy address.
Outbound proxy server is the server your sip request will be sent to; its similar to default gateway we set in IP configuration.
With respect to SIP
Proxy Server - Any server that proxies your request i.e. an entity between UAC and UAS, that forwards the request to UAS on your behalf.
Outbound Server - As earlier said by parag, its like default gateway. Any SIP request from you SIP client will go to this server. This is configured in your client. It can be used for policy enforcement.

BOSH sessions shares the HTTP connections with other HTTP traffic

The documentation of BOSH mentions that, "Each BOSH session MAY share the HTTP connections with other HTTP traffic ..." . Could anyone explain it a little bit more?
In the case of keep-alive http connections to the XMPP server, the browser may use the connection to access other HTTP services on the XMPP server.