FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/test/disabled/tls_client.js at master · objcode/node · GitHub
objcode
/
node
Public
forked from
nodejs/node-v0.x-archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
test
/
disabled
/
tls_client.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (34 loc) · 1.14 KB
Breadcrumbs
node
/
test
/
disabled
/
tls_client.js
Copy path
File metadata and controls
42 lines (34 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
common
=
require
(
"../common"
)
;
assert
=
common
.
assert
var
sys
=
require
(
'sys'
)
;
var
net
=
require
(
'net'
)
;
var
fs
=
require
(
'fs'
)
;
var
crypto
=
require
(
'crypto'
)
;
//var client = net.createConnection(4443, "localhost");
var
client
=
net
.
createConnection
(
443
,
"www.microsoft.com"
)
;
//var client = net.createConnection(443, "www.google.com");
var
caPem
=
fs
.
readFileSync
(
common
.
fixturesDir
+
"/msca.pem"
)
;
//var caPem = fs.readFileSync("ca.pem");
try
{
var
credentials
=
crypto
.
createCredentials
(
{
ca
:
caPem
}
)
;
}
catch
(
e
)
{
console
.
log
(
"Not compiled with OPENSSL support."
)
;
process
.
exit
(
)
;
}
client
.
setEncoding
(
"UTF8"
)
;
client
.
addListener
(
"connect"
,
function
(
)
{
console
.
log
(
"client connected."
)
;
client
.
setSecure
(
credentials
)
;
}
)
;
client
.
addListener
(
"secure"
,
function
(
)
{
console
.
log
(
"client secure : "
+
JSON
.
stringify
(
client
.
getCipher
(
)
)
)
;
console
.
log
(
JSON
.
stringify
(
client
.
getPeerCertificate
(
)
)
)
;
console
.
log
(
"verifyPeer : "
+
client
.
verifyPeer
(
)
)
;
client
.
write
(
"GET / HTTP/1.0\r\n\r\n"
)
;
}
)
;
client
.
addListener
(
"data"
,
function
(
chunk
)
{
common
.
error
(
chunk
)
;
}
)
;
client
.
addListener
(
"end"
,
function
(
)
{
console
.
log
(
"client disconnected."
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL