Пример #1
0
 public static function stream_headers_function($existing_headers)
 {
     return function ($curl, $header_string) use($existing_headers) {
         $http_status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
         http_response_code($http_status_code);
         if (preg_match(UBHTTP::$powered_by_header_regex, $header_string) == 1) {
             $result = UBHTTP::rewrite_x_powered_by_header($header_string, $existing_headers);
             header($result);
         } elseif (preg_match(UBHTTP::$forward_headers, $header_string)) {
             // false means don't replace the exsisting header
             header($header_string, false);
         }
         // We must show curl that we've processed every byte of the input header
         return strlen($header_string);
     };
 }