OLD | NEW |
1 function get_host_info() { | 1 function get_host_info() { |
2 var ORIGINAL_HOST = '127.0.0.1'; | 2 var ORIGINAL_HOST = '127.0.0.1'; |
3 var REMOTE_HOST = 'localhost'; | 3 var REMOTE_HOST = 'localhost'; |
4 // TODO(mkwst): This should be a host that WPT supports. I don't know why we'r
e using 'example.test'. | 4 var UNAUTHENTICATED_HOST = 'example.test'; |
5 var OTHER_HOST = 'example.test'; | |
6 var HTTP_PORT = 8000; | 5 var HTTP_PORT = 8000; |
7 var HTTPS_PORT = 8443; | 6 var HTTPS_PORT = 8443; |
8 try { | 7 try { |
9 // In W3C test, we can get the hostname and port number in config.json | 8 // In W3C test, we can get the hostname and port number in config.json |
10 // using wptserve's built-in pipe. | 9 // using wptserve's built-in pipe. |
11 // http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes | 10 // http://wptserve.readthedocs.org/en/latest/pipes.html#built-in-pipes |
12 HTTP_PORT = eval('{{ports[http][0]}}'); | 11 HTTP_PORT = eval('{{ports[http][0]}}'); |
13 HTTPS_PORT = eval('{{ports[https][0]}}'); | 12 HTTPS_PORT = eval('{{ports[https][0]}}'); |
14 ORIGINAL_HOST = eval('\'{{host}}\''); | 13 ORIGINAL_HOST = eval('\'{{host}}\''); |
15 REMOTE_HOST = 'www1.' + ORIGINAL_HOST; | 14 REMOTE_HOST = 'www1.' + ORIGINAL_HOST; |
16 } catch (e) { | 15 } catch (e) { |
17 } | 16 } |
18 return { | 17 return { |
19 HTTP_ORIGIN: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT, | 18 HTTP_ORIGIN: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT, |
20 HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT, | 19 HTTPS_ORIGIN: 'https://' + ORIGINAL_HOST + ':' + HTTPS_PORT, |
| 20 HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + ':' + HTTPS_PO
RT, |
21 HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT, | 21 HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT, |
22 HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT, | 22 HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT, |
23 UNAUTHENTICATED_ORIGIN: 'http://' + OTHER_HOST + ':' + HTTP_PORT, | 23 HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + ':' + HTT
PS_PORT, |
24 AUTHENTICATED_ORIGIN: 'https://' + OTHER_HOST + ':' + HTTPS_PORT | 24 UNAUTHENTICATED_ORIGIN: 'http://' + UNAUTHENTICATED_HOST + ':' + HTTP_PORT |
25 }; | 25 }; |
26 } | 26 } |
OLD | NEW |