Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hughes <Andrew.Hughes1@ibm.com>2020-01-07 13:11:11 +0300
committerRich Trott <rtrott@gmail.com>2020-01-09 08:36:09 +0300
commit41dd175f6d55a665f4c10d3b66ba701507102265 (patch)
tree418b4fb0d26e7d6d6f00bbb8367e3541404982e7 /doc/api/http.md
parentf2a089a754046c1bd950cebefd8bdb2960fdce32 (diff)
doc: prefer server vs srv and client vs clt
PR-URL: https://github.com/nodejs/node/pull/31224 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc/api/http.md')
-rw-r--r--doc/api/http.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index 48767107aff..3ca76cc92a5 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -374,16 +374,16 @@ const proxy = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
-proxy.on('connect', (req, cltSocket, head) => {
+proxy.on('connect', (req, clientSocket, head) => {
// Connect to an origin server
const { port, hostname } = new URL(`http://${req.url}`);
- const srvSocket = net.connect(port || 80, hostname, () => {
- cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
+ const serverSocket = net.connect(port || 80, hostname, () => {
+ clientSocket.write('HTTP/1.1 200 Connection Established\r\n' +
'Proxy-agent: Node.js-Proxy\r\n' +
'\r\n');
- srvSocket.write(head);
- srvSocket.pipe(cltSocket);
- cltSocket.pipe(srvSocket);
+ serverSocket.write(head);
+ serverSocket.pipe(clientSocket);
+ clientSocket.pipe(serverSocket);
});
});
@@ -525,11 +525,11 @@ A client server pair demonstrating how to listen for the `'upgrade'` event.
const http = require('http');
// Create an HTTP server
-const srv = http.createServer((req, res) => {
+const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
-srv.on('upgrade', (req, socket, head) => {
+server.on('upgrade', (req, socket, head) => {
socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'Upgrade: WebSocket\r\n' +
'Connection: Upgrade\r\n' +
@@ -539,7 +539,7 @@ srv.on('upgrade', (req, socket, head) => {
});
// Now that server is running
-srv.listen(1337, '127.0.0.1', () => {
+server.listen(1337, '127.0.0.1', () => {
// make a request
const options = {