@@ 2328-2344 (lines=17) @@ | ||
2325 | // Look for CR/LF or simple LF as line separator, |
|
2326 | // (even though it is not valid http) |
|
2327 | $pos = strpos($data,"\r\n\r\n"); |
|
2328 | if($pos || is_int($pos)) |
|
2329 | { |
|
2330 | $bd = $pos+4; |
|
2331 | } |
|
2332 | else |
|
2333 | { |
|
2334 | $pos = strpos($data,"\n\n"); |
|
2335 | if($pos || is_int($pos)) |
|
2336 | { |
|
2337 | $bd = $pos+2; |
|
2338 | } |
|
2339 | else |
|
2340 | { |
|
2341 | // No separation between response headers and body: fault? |
|
2342 | $bd = 0; |
|
2343 | } |
|
2344 | } |
|
2345 | if ($bd) |
|
2346 | { |
|
2347 | // this filters out all http headers from proxy. |
|
@@ 2385-2402 (lines=18) @@ | ||
2382 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
|
2383 | // (even though it is not valid http) |
|
2384 | $pos = strpos($data,"\r\n\r\n"); |
|
2385 | if($pos || is_int($pos)) |
|
2386 | { |
|
2387 | $bd = $pos+4; |
|
2388 | } |
|
2389 | else |
|
2390 | { |
|
2391 | $pos = strpos($data,"\n\n"); |
|
2392 | if($pos || is_int($pos)) |
|
2393 | { |
|
2394 | $bd = $pos+2; |
|
2395 | } |
|
2396 | else |
|
2397 | { |
|
2398 | // No separation between response headers and body: fault? |
|
2399 | // we could take some action here instead of going on... |
|
2400 | $bd = 0; |
|
2401 | } |
|
2402 | } |
|
2403 | // be tolerant to line endings, and extra empty lines |
|
2404 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
|
2405 | while(list(,$line) = @each($ar)) |