Skip to content

Commit 60e35d4

Browse files
andrewhughes101codebytere
authored andcommitted
doc: prefer server vs srv and client vs clt
PR-URL: #31224 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 04e2f41 commit 60e35d4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎doc/api/http.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,16 +374,16 @@ const proxy = http.createServer((req, res) =>{
374374
res.writeHead(200,{'Content-Type':'text/plain' });
375375
res.end('okay');
376376
});
377-
proxy.on('connect', (req, cltSocket, head) =>{
377+
proxy.on('connect', (req, clientSocket, head) =>{
378378
// Connect to an origin server
379379
const{port, hostname } =newURL(`http://${req.url}`);
380-
constsrvSocket=net.connect(port ||80, hostname, () =>{
381-
cltSocket.write('HTTP/1.1 200 Connection Established\r\n'+
380+
constserverSocket=net.connect(port ||80, hostname, () =>{
381+
clientSocket.write('HTTP/1.1 200 Connection Established\r\n'+
382382
'Proxy-agent: Node.js-Proxy\r\n'+
383383
'\r\n');
384-
srvSocket.write(head);
385-
srvSocket.pipe(cltSocket);
386-
cltSocket.pipe(srvSocket);
384+
serverSocket.write(head);
385+
serverSocket.pipe(clientSocket);
386+
clientSocket.pipe(serverSocket);
387387
});
388388
});
389389

@@ -525,11 +525,11 @@ A client server pair demonstrating how to listen for the `'upgrade'` event.
525525
consthttp=require('http');
526526

527527
// Create an HTTP server
528-
constsrv=http.createServer((req, res) =>{
528+
constserver=http.createServer((req, res) =>{
529529
res.writeHead(200,{'Content-Type':'text/plain' });
530530
res.end('okay');
531531
});
532-
srv.on('upgrade', (req, socket, head) =>{
532+
server.on('upgrade', (req, socket, head) =>{
533533
socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n'+
534534
'Upgrade: WebSocket\r\n'+
535535
'Connection: Upgrade\r\n'+
@@ -539,7 +539,7 @@ srv.on('upgrade', (req, socket, head) =>{
539539
});
540540

541541
// Now that server is running
542-
srv.listen(1337, '127.0.0.1', () =>{
542+
server.listen(1337, '127.0.0.1', () =>{
543543

544544
// make a request
545545
constoptions={

0 commit comments

Comments
(0)