Created
March 14, 2013 20:43
-
-
Save geoffreak/5165048 to your computer and use it in GitHub Desktop.
Large files will not be uploaded via HTTPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| request = require 'request' | |
| fs = require 'fs' | |
| fs.createReadStream('./files/testfile.txt').pipe request.put 'http://localhost:8091/', (err, res, body) => | |
| console.log err, res, body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs, request, | |
| _this = this; | |
| request = require('request'); | |
| fs = require('fs'); | |
| fs.createReadStream('./files/testfile.txt').pipe(request.put('https://localhost:8091/', function(err, res, body) { | |
| return console.log(err, res, body); | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| request = require 'request' | |
| fs = require 'fs' | |
| fs.createReadStream('testfile.txt').pipe request.put 'https://localhost:8091/', (err, res, body) => | |
| console.log err, res, body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs, https, server; | |
| https = require('https'); | |
| fs = require('fs'); | |
| server = https.createServer({ | |
| cert: fs.readFileSync('https.crt'), | |
| key: fs.readFileSync('https.key') | |
| }, function(req, res) { | |
| console.log('data'); | |
| return setTimeout((function() { | |
| console.log('timeout'); | |
| req.pipe(fs.createWriteStream('upload.txt')); | |
| return req.on('end', function() { | |
| console.log('end'); | |
| res.writeHead(200, { | |
| 'Content-Type': 'text/plain' | |
| }); | |
| return res.end('ok'); | |
| }); | |
| }), 2000); | |
| }); | |
| server.listen('8091', '0.0.0.0', function() { | |
| return console.log("listening at 0.0.0.0:8091"); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http = require 'http' | |
| fs = require 'fs' | |
| server = http.createServer (req, res) -> | |
| console.log 'data' | |
| setTimeout (-> | |
| console.log 'timeout' | |
| req.pipe fs.createWriteStream 'upload.txt' | |
| req.on 'end', -> | |
| console.log 'end' | |
| res.writeHead 200, { 'Content-Type': 'text/plain' } | |
| res.end 'ok' | |
| ), 2000 | |
| server.listen '8091', '0.0.0.0', -> | |
| console.log "listening at 0.0.0.0:8091" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs, https, server; | |
| https = require('https'); | |
| fs = require('fs'); | |
| server = https.createServer({ | |
| cert: fs.readFileSync('../config/api.dev-st.info.crt'), | |
| key: fs.readFileSync('../config/dev-st.info.key') | |
| }, function(req, res) { | |
| console.log('data'); | |
| return setTimeout((function() { | |
| console.log('timeout'); | |
| req.pipe(fs.createWriteStream('upload.txt')); | |
| return req.on('end', function() { | |
| console.log('end'); | |
| res.writeHead(200, { | |
| 'Content-Type': 'text/plain' | |
| }); | |
| return res.end('ok'); | |
| }); | |
| }), 2000); | |
| }); | |
| server.listen('8091', '0.0.0.0', function() { | |
| return console.log("listening at 0.0.0.0:8091"); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https = require 'https' | |
| fs = require 'fs' | |
| server = https.createServer | |
| cert: fs.readFileSync 'https.crt' | |
| key: fs.readFileSync 'https.key' | |
| , (req, res) -> | |
| console.log 'data' | |
| setTimeout (-> | |
| console.log 'timeout' | |
| req.pipe fs.createWriteStream 'upload.txt' | |
| req.on 'end', -> | |
| console.log 'end' | |
| res.writeHead 200, { 'Content-Type': 'text/plain' } | |
| res.end 'ok' | |
| ), 2000 | |
| server.listen '8091', '0.0.0.0', -> | |
| console.log "listening at 0.0.0.0:8091" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs, request, | |
| request = require('request'); | |
| fs = require('fs'); | |
| fs.createReadStream('./files/testfile.txt').pipe(request.put('https://localhost:8091/', function(err, res, body) { | |
| return console.log(err, res, body); | |
| })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment