GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: prefer server vs srv and client vs clt · nodejs/node@220ea0c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • http.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+9-9Lines changed: 9 additions & 9 deletions
  • Display the source diff
  • Display the rich diff
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 } = new URL(`http://${req.url}`);
380-
const srvSocket = net.connect(port || 80, hostname, () => {
381-
cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
380+
const serverSocket = 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
const http = require('http');
526526

527527
// Create an HTTP server
528-
const srv = http.createServer((req, res) => {
528+
const server = 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
const options = {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.