In order to do that you can create a tcp server (net module) and listen for any requests on a port. If it is plaintext request it's http, otherwise it's https. Simple enough.
 
You can even put ssh server on the same port if you aren't so scary of a witchcraft :)
 
So, the general idea is to create three servers, http, https and net. Net server would receive all connections and proxy them to others. I've done that using three different ports (1 external, 2 internal), but I'm quite sure you can simulate connection to a http(s) server internally without binding it to a port. Maybe it's "request" event I don't know, you can look in node.js source code how it can be done.
 
--
// alex
 
 
06.02.2013, 23:05, "V'Raj Kanwade" <[email protected]>:
I am building a proxy server which needs to listen for both http and https proxy on same port.
 
http.createServer does not call response handler for https traffic.
 
So I created the server using net.createServer. The question I have is, how can I leverage the http functionality once I have the input request?
 
For eg. when I see the start of request is GET http://nodejs.org/ HTTP/1.1, I want to convert it into a http request so that the headers etc are parsed accordingly and if the request starts with CONNECT, I can implement my own tunneling?

 

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to