mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-72349 filelib: update strip_double_headers function
This commit is contained in:
parent
d9632ca8b2
commit
de07d85f23
2 changed files with 151 additions and 2 deletions
|
@ -4201,14 +4201,14 @@ class curl {
|
|||
$crlf = "\r\n";
|
||||
return preg_replace(
|
||||
// HTTP version and status code (ignore value of code).
|
||||
'~^HTTP/1\..*' . $crlf .
|
||||
'~^HTTP/[1-9](\.[0-9])?.*' . $crlf .
|
||||
// Header name: character between 33 and 126 decimal, except colon.
|
||||
// Colon. Header value: any character except \r and \n. CRLF.
|
||||
'(?:[\x21-\x39\x3b-\x7e]+:[^' . $crlf . ']+' . $crlf . ')*' .
|
||||
// Headers are terminated by another CRLF (blank line).
|
||||
$crlf .
|
||||
// Second HTTP status code, this time must be 200.
|
||||
'(HTTP/1.[01] 200 )~', '$1', $input);
|
||||
'(HTTP/[1-9](\.[0-9])? 200)~', '$2', $input);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue