File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,21 +10,21 @@ require 'server.inc';
1010
1111function probe (string $ label , string $ userinfo , string $ expected ): void
1212{
13- $ responses = array (
13+ $ responses = [
1414 "data://text/plain,HTTP/1.0 200 Ok \r\n\r\n" ,
15- ) ;
15+ ] ;
1616
1717 ['pid ' => $ pid , 'uri ' => $ uri ] = http_server ($ responses , $ output );
1818
19- $ url = preg_replace ('# ^http://# ' , 'http:// ' . $ userinfo . '@ ' , $ uri );
19+ $ url = preg_replace ('( ^http://) ' , 'http:// ' . $ userinfo . '@ ' , $ uri );
2020 file_get_contents ($ url );
2121
22- http_server_kill ($ pid );
23-
2422 fseek ($ output , 0 , SEEK_SET );
2523 $ output = stream_get_contents ($ output );
2624
27- if (preg_match ('/^Authorization:\s*Basic\s+(\S+)/mi ' , $ output , $ m )) {
25+ http_server_kill ($ pid );
26+
27+ if (preg_match ('(^Authorization:\s*Basic\s+(\S+))mi ' , $ output , $ m )) {
2828 $ decoded = base64_decode ($ m [1 ]);
2929 } else {
3030 $ decoded = '<no Authorization header> ' ;
You can’t perform that action at this time.
0 commit comments