@@ -68,7 +68,7 @@ public function startserver() {
6868 $ response ->header ('Content-Type ' , 'application/octet-stream ' );
6969 $ response ->header ('Content-Disposition ' , $ allurl ['name ' ]);
7070 $ response ->header ('x-bmclapi-hash ' , $ downloadhash );
71- $ response ->sendfile ($ filepath ,$ start_byte ,$ length );
71+ $ result = $ response ->sendfile ($ filepath ,$ start_byte ,$ length );
7272 }
7373 else {
7474 global $ enable ;
@@ -81,29 +81,34 @@ public function startserver() {
8181 $ response ->header ('Content-Type ' , 'application/octet-stream ' );
8282 $ response ->header ('Content-Disposition ' , $ allurl ['name ' ]);
8383 $ response ->header ('x-bmclapi-hash ' , $ downloadhash );
84- $ response ->sendfile ($ filepath );
84+ $ result = $ response ->sendfile ($ filepath );
8585 }
8686 }
8787 else {
8888 $ code = 403 ;
8989 $ response ->status ($ code );
9090 $ response ->header ('Content-Type ' , 'text/html; charset=utf-8 ' );
91- $ response ->end ("<title>Error</title><pre>invalid sign</pre> " );
91+ $ result = $ response ->end ("<title>Error</title><pre>invalid sign</pre> " );
9292 }
9393 }
9494 else {
9595 $ code = 404 ;
9696 $ response ->status ($ code );
9797 $ response ->header ('Content-Type ' , 'text/html; charset=utf-8 ' );
98- $ response ->end ("<title>Error</title><pre>404 Not Found</pre> " );
98+ $ result = $ response ->end ("<title>Error</title><pre>404 Not Found</pre> " );
9999 }
100100 if (!isset ($ request ->server ['query_string ' ])){
101101 $ url = $ request ->server ['request_uri ' ];
102102 }
103103 else {
104104 $ url = $ request ->server ['request_uri ' ]."? " .$ request ->server ['query_string ' ];
105105 }
106- mlog (" Serve {$ code } | {$ request ->server ['remote_addr ' ]} | {$ request ->server ['server_protocol ' ]} | {$ url } | {$ request ->header ['user-agent ' ]}; " ) ;
106+ if ($ result ){
107+ mlog (" Serve {$ code } | {$ request ->server ['remote_addr ' ]} | {$ request ->server ['server_protocol ' ]} | {$ url } | {$ request ->header ['user-agent ' ]}; " ) ;
108+ }
109+ else {
110+ mlog ("HttpServer Error! " ,2 ) ;
111+ }
107112 });
108113 $ server ->handle ('/measure ' , function ($ request , $ response ) {
109114 $ measuresize = str_replace ('/measure/ ' , '' , $ request ->server ['request_uri ' ]);
0 commit comments