Comparing version 0.4.3 to 0.4.4
@@ -42,3 +42,3 @@ const zlib = require('zlib') | ||
var cb = getCallback(arguments) | ||
if (closed) return cb && cb() | ||
if (isEnded()) return cb && cb() | ||
@@ -83,3 +83,3 @@ if (data) { | ||
function isEnded() { | ||
return closed || res.headersSent | ||
return closed || buf === null | ||
} | ||
@@ -113,4 +113,8 @@ | ||
// Write the response head and body | ||
if (headArgs) res.writeHead.apply(res, headArgs) | ||
// Write the response head | ||
if (headArgs && !res.headersSent) { | ||
res.writeHead.apply(res, headArgs) | ||
} | ||
// Write body | ||
res.write(finalBody, finalEncoding) | ||
@@ -124,3 +128,3 @@ | ||
// Finally, send EOF | ||
// Send EOF | ||
res.end(cb) | ||
@@ -127,0 +131,0 @@ } |
{ | ||
"name": "rocky", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Full-featured, middleware-oriented HTTP and WebSocket proxy supporting traffic replay and intercept", | ||
@@ -5,0 +5,0 @@ "repository": "h2non/rocky", |
@@ -79,2 +79,3 @@ # rocky [](https://travis-ci.org/h2non/rocky) [](https://codeclimate.com/github/h2non/rocky) [](https://www.npmjs.org/package/rocky) | ||
- As HTTP proxy for performance testing | ||
- As traditional forward HTTP proxy (e.g: Squid) | ||
- For HTTP session manipulation and debugging | ||
@@ -81,0 +82,0 @@ - For HTTP traffic recording and inspection |
172358
4284
1014