Skip to content

Commit 02d525c

Browse files
committed
Initial commit with payload
1 parent 9fc5cd6 commit 02d525c

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# https-proxy
2-
HTTPS proxy
2+
DEBUG ONLY! NOT SECURE!
3+
Eluminates https proxy complexity. Listens HTTP POST requests with options for subsequent https request and sends its response back via http.

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "https-proxy",
3+
"version": "0.0.0",
4+
"description": "DEBUG ONLY! NOT SECURE!\nEluminates https proxy complexity.\nListens HTTP POST requests with options for subsequent https request and sends its response back via http.",
5+
"main": "server.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"start": "node server.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/DyckGerman/https-proxy.git"
13+
},
14+
"author": "DyckGerman <[email protected]>",
15+
"license": "ISC",
16+
"bugs": {
17+
"url": "https://github.com/DyckGerman/https-proxy/issues"
18+
},
19+
"homepage": "https://github.com/DyckGerman/https-proxy#readme"
20+
}

server.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var https = require('https');
2+
var http = require('http');
3+
4+
var server = http.createServer((request, response) => {
5+
var body = '';
6+
request.on('data', (chunk) => {
7+
body += chunk;
8+
});
9+
request.on('end', () => {
10+
try {
11+
var options = JSON.parse(body);
12+
var httpsResult = '';
13+
var httpsRequest = https.request(options, (httpsResponse) => {
14+
httpsResponse.on('data', (data) => {
15+
httpsResult += data;
16+
});
17+
httpsResponse.on('end', () => {
18+
response.end(httpsResult);
19+
});
20+
});
21+
httpsRequest.end();
22+
} catch (error) {
23+
console.log(error);
24+
response.end(error);
25+
}
26+
});
27+
});
28+
29+
server.listen('4200');

0 commit comments

Comments
 (0)