| @@ 80-90 (lines=11) @@ | ||
| 77 | // Look for CR/LF or simple LF as line separator, |
|
| 78 | // (even though it is not valid http) |
|
| 79 | $pos = strpos($data, "\r\n\r\n"); |
|
| 80 | if ($pos || is_int($pos)) { |
|
| 81 | $bd = $pos + 4; |
|
| 82 | } else { |
|
| 83 | $pos = strpos($data, "\n\n"); |
|
| 84 | if ($pos || is_int($pos)) { |
|
| 85 | $bd = $pos + 2; |
|
| 86 | } else { |
|
| 87 | // No separation between response headers and body: fault? |
|
| 88 | $bd = 0; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | if ($bd) { |
|
| 92 | // this filters out all http headers from proxy. |
|
| 93 | // maybe we could take them into account, too? |
|
| @@ 122-133 (lines=12) @@ | ||
| 119 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
|
| 120 | // (even though it is not valid http) |
|
| 121 | $pos = strpos($data, "\r\n\r\n"); |
|
| 122 | if ($pos || is_int($pos)) { |
|
| 123 | $bd = $pos + 4; |
|
| 124 | } else { |
|
| 125 | $pos = strpos($data, "\n\n"); |
|
| 126 | if ($pos || is_int($pos)) { |
|
| 127 | $bd = $pos + 2; |
|
| 128 | } else { |
|
| 129 | // No separation between response headers and body: fault? |
|
| 130 | // we could take some action here instead of going on... |
|
| 131 | $bd = 0; |
|
| 132 | } |
|
| 133 | } |
|
| 134 | // be tolerant to line endings, and extra empty lines |
|
| 135 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
|
| 136 | while (list(, $line) = @each($ar)) { |
|