File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -323,8 +323,8 @@ req.__defineGetter__('isXMLHttpRequest', isxhr);
323323req . __defineGetter__ ( 'xhr' , isxhr ) ;
324324
325325/**
326- * Return the protocol string "http" or "https",
327- * when requested with TLS. When the "trust proxy"
326+ * Return the protocol string "http" or "https"
327+ * when requested with TLS. When the "trust proxy"
328328 * setting is enabled the "X-Forwarded-Proto" header
329329 * field will be trusted. If you're running behind
330330 * a reverse proxy that supplies https for you this
@@ -334,11 +334,24 @@ req.__defineGetter__('xhr', isxhr);
334334 * @api public
335335 */
336336
337- req . __defineGetter__ ( 'protocol' , function ( trustProxy ) {
338- var trustProxy = this . app . settings [ 'trust proxy' ] ;
339- return this . secure
337+ req . __defineGetter__ ( 'protocol' , function ( ) {
338+ var trustProxy = this . app . get ( 'trust proxy' ) ;
339+ return this . connection . encrypted
340340 ? 'https'
341341 : trustProxy
342- ? ( this . header ( 'X-Forwarded-Proto' ) || 'http' )
342+ ? ( this . get ( 'X-Forwarded-Proto' ) || 'http' )
343343 : 'http' ;
344344} ) ;
345+
346+ /**
347+ * Short-hand for:
348+ *
349+ * req.protocol == 'https'
350+ *
351+ * @return {Boolean }
352+ * @api public
353+ */
354+
355+ req . __defineGetter__ ( 'secure' , function ( ) {
356+ return 'https' == this . protocol ;
357+ } ) ;
You can’t perform that action at this time.
0 commit comments