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 — Update engine · Cyclonecode/mysql-notification@8a6dc1b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • package-lock.json
  • package.json
  • scripts
    • server.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎package-lock.json‎

Copy file name to clipboardExpand all lines: package-lock.json
+3-3Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.2.3",
44
"description": "Example of a user defined function (UDF) in MySQL",
55
"engines": {
6-
"node": ">= 14.0.0",
6+
"node": ">= 14.15.3",
77
"npm": ">= 6.0.0"
88
},
99
"dependencies": {
Collapse file

‎scripts/server.js‎

Copy file name to clipboardExpand all lines: scripts/server.js
+16-9Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ net
5555
.listen(SERVER_PORT);
5656

5757
// create a http server
58-
const server = http.createServer(credentials, (request, response) => {
59-
logger.debug(new Date() + ` Received request for ${request.url}`);
60-
response.writeHead(404);
61-
response.end();
58+
const server = http.createServer(credentials, (req, res) => {
59+
fs.readFile(__dirname + '/../' + req.url, function (err,data) {
60+
if (err) {
61+
res.writeHead(404);
62+
res.end(JSON.stringify(err));
63+
return;
64+
}
65+
res.writeHead(200);
66+
res.end(data);
67+
});
6268
});
6369
server.listen(WEBSOCKET_PORT, () => {
6470
logger.info(
@@ -123,16 +129,17 @@ function originIsAllowed(origin) {
123129
});
124130
})();
125131

126-
wsServer.on('request', (request) => {
127-
if (!originIsAllowed(request.origin)) {
132+
wsServer.on('request', (req) => {
133+
const url = new URL(req.origin);
134+
if (!originIsAllowed(url.hostname)) {
128135
// Make sure we only accept requests from an allowed origin
129-
request.reject();
136+
req.reject();
130137
logger.warn(
131-
new Date() + ` Connection from origin ${request.origin} rejected.`,
138+
new Date() + ` Connection from origin ${req.origin} rejected.`,
132139
);
133140
return;
134141
}
135-
const connection = request.accept('echo-protocol', request.origin);
142+
const connection = req.accept('echo-protocol', req.origin);
136143
connections.push(connection);
137144
connection.on('message', (message) => {
138145
if (message.type === 'utf8') {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.