mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 07:11:27 +00:00
fix http req over https
This commit is contained in:
parent
022902943f
commit
df1bc9911a
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
||||
.lock-wscript
|
||||
.svn
|
||||
.wafpickle-*
|
||||
tmp.txt
|
||||
CVS
|
||||
npm-debug.log
|
||||
cert/**/*.srl
|
||||
|
1
bin.js
1
bin.js
@ -16,4 +16,5 @@ if(program.clear){
|
||||
|
||||
}else{
|
||||
mainProxy.startServer(program.type,program.port, program.host);
|
||||
|
||||
}
|
@ -2,8 +2,9 @@ var http = require("http"),
|
||||
https = require("https");
|
||||
|
||||
function handler(req,userRes){
|
||||
console.log(req);
|
||||
|
||||
var ifHttps = !!req.connection.encrypted;
|
||||
var ifHttps = !!req.connection.encrypted && !/http:/.test(req.url);
|
||||
|
||||
var options = {
|
||||
hostname : req.headers.host,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "anyproxy",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "https proxy over http",
|
||||
"main": "proxy.js",
|
||||
"bin": "bin.js",
|
||||
|
3
proxy.js
3
proxy.js
@ -29,7 +29,7 @@ function startServer(type, port, hostname){
|
||||
//creat server
|
||||
function(callback){
|
||||
if(proxyType == T_TYPE_HTTPS){
|
||||
httpsServerMgr.getCertificate(proxyHost,function(err,keyContent,crtContent){
|
||||
certMgr.getCertificate(proxyHost,function(err,keyContent,crtContent){
|
||||
if(err){
|
||||
callback(err);
|
||||
}else{
|
||||
@ -44,6 +44,7 @@ function startServer(type, port, hostname){
|
||||
}else{
|
||||
httpProxyServer = http.createServer(requestHandler);
|
||||
callback(null);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user