|
@ -3,11 +3,12 @@ require('../common'); |
|
|
var sys=require('sys'); |
|
|
var sys=require('sys'); |
|
|
var net=require('net'); |
|
|
var net=require('net'); |
|
|
var fs=require('fs'); |
|
|
var fs=require('fs'); |
|
|
|
|
|
var crypto=require('crypto'); |
|
|
|
|
|
|
|
|
var keyPem = fs.readFileSync(fixturesDir + "/test_key.pem"); |
|
|
var keyPem = fs.readFileSync(fixturesDir + "/cert.pem"); |
|
|
var certPem = fs.readFileSync(fixturesDir + "/cert.pem"); |
|
|
var certPem = fs.readFileSync(fixturesDir + "/cert.pem"); |
|
|
|
|
|
|
|
|
var credentials = net.createCredentials({key:keyPem, cert:certPem}); |
|
|
var credentials = crypto.createCredentials({key:keyPem, cert:certPem}); |
|
|
var i = 0; |
|
|
var i = 0; |
|
|
var server = net.createServer(function (connection) { |
|
|
var server = net.createServer(function (connection) { |
|
|
connection.setSecure(credentials); |
|
|
connection.setSecure(credentials); |
|
@ -21,11 +22,11 @@ var server = net.createServer(function (connection) { |
|
|
sys.puts("recved: " + JSON.stringify(chunk)); |
|
|
sys.puts("recved: " + JSON.stringify(chunk)); |
|
|
connection.write("HTTP/1.0 200 OK\r\nContent-type: text/plain\r\nContent-length: 9\r\n\r\nOK : "+i+"\r\n\r\n"); |
|
|
connection.write("HTTP/1.0 200 OK\r\nContent-type: text/plain\r\nContent-length: 9\r\n\r\nOK : "+i+"\r\n\r\n"); |
|
|
i=i+1; |
|
|
i=i+1; |
|
|
connection.close(); |
|
|
connection.end(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
connection.addListener("end", function () { |
|
|
connection.addListener("end", function () { |
|
|
connection.close(); |
|
|
connection.end(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|