File tree 1 file changed +24
-5
lines changed
1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -102,17 +102,36 @@ common.setupSocket = function(socket) {
102
102
return socket ;
103
103
} ;
104
104
105
+ /**
106
+ * Get the port number from the host. Or guess it based on the connection type.
107
+ *
108
+ * @param {Request } req Incoming HTTP request.
109
+ *
110
+ * @return {String } The port number.
111
+ *
112
+ * @api private
113
+ */
105
114
common . getPort = function ( req ) {
106
- var res = req . headers . host ? req . headers . host . match ( / : ( \d + ) / ) : "" ;
115
+ var res = req . headers . host ? req . headers . host . match ( / : ( \d + ) / ) : '' ;
116
+
107
117
return res ?
108
118
res [ 1 ] :
109
- req . connection . pair ? '443' : '80' ;
119
+ req . connection . pair ? '443' : '80' ;
110
120
} ;
111
121
112
- // OS-agnostic join (doesn't break on URLs like path.join does on Windows)
122
+ /**
123
+ * OS-agnostic join (doesn't break on URLs like path.join does on Windows)>
124
+ *
125
+ * @return {String } The generated path.
126
+ *
127
+ * @api private
128
+ */
129
+
113
130
common . urlJoin = function ( ) {
114
131
var args = Array . prototype . slice . call ( arguments ) ;
115
- // Join all strings, but remove empty strings so we don't get extra slashes from
132
+ // Join all strings, but remove empty strings so we don't get extra slashes from
116
133
// joining e.g. ['', 'am']
117
- return args . filter ( function ( a ) { return ! ! a ; } ) . join ( '/' ) . replace ( / \/ + / g, '/' ) ;
134
+ return args . filter ( function filter ( a ) {
135
+ return ! ! a ;
136
+ } ) . join ( '/' ) . replace ( / \/ + / g, '/' ) ;
118
137
} ;
You can’t perform that action at this time.
0 commit comments