mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #12989 from overleaf/jpa-req-socket-null
[misc] add patches for gracefully handling missing req.socket/connection GitOrigin-RevId: fd0b067d5a4b5a96857ac94a577460b82bba7672
This commit is contained in:
13
patches/express++finalhandler+1.2.0.patch
Normal file
13
patches/express++finalhandler+1.2.0.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/node_modules/express/node_modules/finalhandler/index.js b/node_modules/express/node_modules/finalhandler/index.js
|
||||
index f628e42..72f17d6 100644
|
||||
--- a/node_modules/express/node_modules/finalhandler/index.js
|
||||
+++ b/node_modules/express/node_modules/finalhandler/index.js
|
||||
@@ -125,7 +125,7 @@ function finalhandler (req, res, options) {
|
||||
// cannot actually respond
|
||||
if (headersSent(res)) {
|
||||
debug('cannot %d after headers sent', status)
|
||||
- req.socket.destroy()
|
||||
+ if (req.socket) req.socket.destroy()
|
||||
return
|
||||
}
|
||||
|
||||
13
patches/finalhandler+1.1.2.patch
Normal file
13
patches/finalhandler+1.1.2.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/node_modules/finalhandler/index.js b/node_modules/finalhandler/index.js
|
||||
index 5673507..40f4684 100644
|
||||
--- a/node_modules/finalhandler/index.js
|
||||
+++ b/node_modules/finalhandler/index.js
|
||||
@@ -125,7 +125,7 @@ function finalhandler (req, res, options) {
|
||||
// cannot actually respond
|
||||
if (headersSent(res)) {
|
||||
debug('cannot %d after headers sent', status)
|
||||
- req.socket.destroy()
|
||||
+ if (req.socket) req.socket.destroy()
|
||||
return
|
||||
}
|
||||
|
||||
13
patches/forwarded+0.2.0.patch
Normal file
13
patches/forwarded+0.2.0.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/node_modules/forwarded/index.js b/node_modules/forwarded/index.js
|
||||
index b2b6bdd..75e6254 100644
|
||||
--- a/node_modules/forwarded/index.js
|
||||
+++ b/node_modules/forwarded/index.js
|
||||
@@ -46,7 +46,7 @@ function forwarded (req) {
|
||||
function getSocketAddr (req) {
|
||||
return req.socket
|
||||
? req.socket.remoteAddress
|
||||
- : req.connection.remoteAddress
|
||||
+ : req.connection && req.connection.remoteAddress
|
||||
}
|
||||
|
||||
/**
|
||||
13
patches/passport-oauth2+1.6.1.patch
Normal file
13
patches/passport-oauth2+1.6.1.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/node_modules/passport-oauth2/lib/utils.js b/node_modules/passport-oauth2/lib/utils.js
|
||||
index 486f9e1..4584507 100644
|
||||
--- a/node_modules/passport-oauth2/lib/utils.js
|
||||
+++ b/node_modules/passport-oauth2/lib/utils.js
|
||||
@@ -24,7 +24,7 @@ exports.originalURL = function(req, options) {
|
||||
var trustProxy = options.proxy;
|
||||
|
||||
var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
|
||||
- , tls = req.connection.encrypted || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0])
|
||||
+ , tls = (req.connection && req.connection.encrypted) || (trustProxy && 'https' == proto.split(/\s*,\s*/)[0])
|
||||
, host = (trustProxy && req.headers['x-forwarded-host']) || req.headers.host
|
||||
, protocol = tls ? 'https' : 'http'
|
||||
, path = req.url || '';
|
||||
Reference in New Issue
Block a user