| @@ 2256-2272 (lines=17) @@ | ||
| 2253 | // Look for CR/LF or simple LF as line separator, |
|
| 2254 | // (even though it is not valid http) |
|
| 2255 | $pos = strpos($data,"\r\n\r\n"); |
|
| 2256 | if($pos || is_int($pos)) |
|
| 2257 | { |
|
| 2258 | $bd = $pos+4; |
|
| 2259 | } |
|
| 2260 | else |
|
| 2261 | { |
|
| 2262 | $pos = strpos($data,"\n\n"); |
|
| 2263 | if($pos || is_int($pos)) |
|
| 2264 | { |
|
| 2265 | $bd = $pos+2; |
|
| 2266 | } |
|
| 2267 | else |
|
| 2268 | { |
|
| 2269 | // No separation between response headers and body: fault? |
|
| 2270 | $bd = 0; |
|
| 2271 | } |
|
| 2272 | } |
|
| 2273 | if ($bd) |
|
| 2274 | { |
|
| 2275 | // this filters out all http headers from proxy. |
|
| @@ 2313-2330 (lines=18) @@ | ||
| 2310 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
|
| 2311 | // (even though it is not valid http) |
|
| 2312 | $pos = strpos($data,"\r\n\r\n"); |
|
| 2313 | if($pos || is_int($pos)) |
|
| 2314 | { |
|
| 2315 | $bd = $pos+4; |
|
| 2316 | } |
|
| 2317 | else |
|
| 2318 | { |
|
| 2319 | $pos = strpos($data,"\n\n"); |
|
| 2320 | if($pos || is_int($pos)) |
|
| 2321 | { |
|
| 2322 | $bd = $pos+2; |
|
| 2323 | } |
|
| 2324 | else |
|
| 2325 | { |
|
| 2326 | // No separation between response headers and body: fault? |
|
| 2327 | // we could take some action here instead of going on... |
|
| 2328 | $bd = 0; |
|
| 2329 | } |
|
| 2330 | } |
|
| 2331 | // be tolerant to line endings, and extra empty lines |
|
| 2332 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
|
| 2333 | while(list(,$line) = @each($ar)) |
|