[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 class init_checkssl_test extends DokuWikiTest { 4 5 /** 6 * Running behind an SSL proxy, HTTP between server and proxy 7 * HTTPS not set 8 * HTTP_X_FORWARDED_PROTO 9 * set to https 10 */ 11 function test1() { 12 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; 13 14 $this->assertEquals(is_ssl(), true); 15 } 16 17 /** 18 * Running behind a plain HTTP proxy, HTTP between server and proxy 19 * HTTPS not set 20 * HTTP_X_FORWARDED_PROTO set to http 21 */ 22 function test2() { 23 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http'; 24 25 $this->assertEquals(is_ssl(), false); 26 } 27 28 /** 29 * Running behind an SSL proxy, HTTP between server and proxy 30 * HTTPS set to off, 31 * HTTP_X_FORWARDED_PROTO set to https 32 */ 33 function test3() { 34 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; 35 $_SERVER['HTTPS'] = 'off'; 36 37 $this->assertEquals(is_ssl(), true); 38 } 39 40 /** 41 * Not running behind a proxy, HTTPS server 42 * HTTPS set to on, 43 * HTTP_X_FORWARDED_PROTO not set 44 */ 45 function test4() { 46 $_SERVER['HTTPS'] = 'on'; 47 48 $this->assertEquals(is_ssl(), true); 49 } 50 51 /** 52 * Not running behind a proxy, plain HTTP server 53 * HTTPS not set 54 * HTTP_X_FORWARDED_PROTO not set 55 */ 56 function test5() { 57 $this->assertEquals(is_ssl(), false); 58 } 59 60 /** 61 * Not running behind a proxy, plain HTTP server 62 * HTTPS set to off 63 * HTTP_X_FORWARDED_PROTO not set 64 */ 65 function test6() { 66 $_SERVER['HTTPS'] = 'off'; 67 $this->assertEquals(is_ssl(), false); 68 } 69 70 /** 71 * Running behind an SSL proxy, SSL between proxy and HTTP server 72 * HTTPS set to on, 73 * HTTP_X_FORWARDED_PROTO set to https 74 */ 75 function test7() { 76 $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; 77 $_SERVER['HTTPS'] = 'on'; 78 79 $this->assertEquals(is_ssl(), true); 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body