Lines Matching refs:context
23 function context() {
31 function get_CN($context) {
33 $ary = stream_context_get_options($context);
43 function do_http_test($url, $context) {
45 $fh = fopen($url, 'r', false, $context);
48 var_dump(get_CN($context));
51 function do_ssl_test($url, $context) {
54 ini_get("default_socket_timeout"), STREAM_CLIENT_CONNECT, $context);
57 var_dump(get_CN($context));
60 function do_enable_crypto_test($url, $context) {
63 ini_get("default_socket_timeout"), STREAM_CLIENT_CONNECT, $context);
69 var_dump(get_CN($context));
75 do_http_test('https://alice.sni.velox.ch/', context());
78 do_http_test('https://bob.sni.velox.ch/', context());
81 do_http_test('https://bob.sni.velox.ch./', context());
85 $context = context();
86 stream_context_set_option($context, 'ssl', 'SNI_server_name', 'bob.sni.velox.ch');
87 stream_context_set_option($context, 'http', 'header', b'Host: bob.sni.velox.ch');
88 do_http_test('https://alice.sni.velox.ch/', $context);
92 $context = context();
93 stream_context_set_option($context, 'ssl', 'SNI_enabled', false);
94 do_http_test('https://bob.sni.velox.ch/', $context);
99 do_ssl_test('ssl://bob.sni.velox.ch:443', context());
102 do_ssl_test('ssl://mallory.sni.velox.ch:443', context());
106 $context = context();
107 stream_context_set_option($context, 'ssl', 'SNI_server_name', 'bob.sni.velox.ch');
109 do_ssl_test('ssl://mallory.sni.velox.ch:443', $context);
113 $context = context();
114 stream_context_set_option($context, 'ssl', 'SNI_enabled', false);
116 do_ssl_test('ssl://mallory.sni.velox.ch:443', $context);
122 do_enable_crypto_test('tcp://bob.sni.velox.ch:443', context());
126 do_enable_crypto_test('tcp://mallory.sni.velox.ch:443', context());
130 $context = context();
131 stream_context_set_option($context, 'ssl', 'SNI_server_name', 'bob.sni.velox.ch');
133 do_enable_crypto_test('tcp://mallory.sni.velox.ch:443', $context);
137 $context = context();
138 stream_context_set_option($context, 'ssl', 'SNI_enabled', false);
140 do_enable_crypto_test('tcp://mallory.sni.velox.ch:443', $context);
144 $context = context();
145 stream_context_set_option($context, 'ssl', 'SNI_server_name', str_repeat('a.', 500) . '.sni.velox.c…
147 do_enable_crypto_test('tcp://mallory.sni.velox.ch:443', $context);