mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
@akhoury and his comments.. :p + jshinting
This commit is contained in:
@@ -15,17 +15,16 @@ var async = require('async'),
|
|||||||
|
|
||||||
SocketPosts = {},
|
SocketPosts = {},
|
||||||
|
|
||||||
// a shy request-wannabe build from a socket for spam detection purposes
|
|
||||||
reqFromSocket = function(socket) {
|
reqFromSocket = function(socket) {
|
||||||
var headers = socket.handshake.headers,
|
var headers = socket.handshake.headers,
|
||||||
host = headers['host'],
|
host = headers.host,
|
||||||
referer = headers['referer'];
|
referer = headers.referer;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ip: headers['x-forwarded-for'] || (socket.handshake.address || {}).address,
|
ip: headers['x-forwarded-for'] || (socket.handshake.address || {}).address,
|
||||||
host: host,
|
host: host,
|
||||||
protocol: headers['secure'] ? 'https' : 'http',
|
protocol: headers.secure ? 'https' : 'http',
|
||||||
secure: !!headers['secure'],
|
secure: !!headers.secure,
|
||||||
url: referer,
|
url: referer,
|
||||||
path: referer.substr(referer.indexOf(host) + host.length),
|
path: referer.substr(referer.indexOf(host) + host.length),
|
||||||
headers: headers
|
headers: headers
|
||||||
|
|||||||
Reference in New Issue
Block a user