Software like CCProxy in windows allows you to setup a cascading proxy.
In squid we can do the same by mentioning a cache_peer directive?
How does this work at application and TCP/IP layer ? Does it form a socket connection to the upstream proxy server ? Any details or RFCs in relation to this?
PS - I want to implement it in Python for some testing purposes.
Cascading proxy is just the proxy connecting to an upstream proxy. It speaks the same HTTP proxy requests to the upstream proxy as  a browser does, e.g. using full urls (method://host[:port]/path..) in the requests instead of just /path and using CONNECT for https tunneling instead of directly connecting with SSL.
How does a cascading http proxy server works?