@@ -759,33 +759,33 @@ function _parse_message($message)
759
759
}
760
760
761
761
$ headerDelimiterPosition = strpos ($ message , "\r\n\r\n" );
762
- $ rawHeaders = substr ($ message , 0 , $ headerDelimiterPosition + 2 ); // We preserve the last \r\n, hence +2
763
- $ startLineEndPosition = strpos ($ rawHeaders , "\r\n" );
762
+ $ rawHeaders = substr ($ message , 0 , $ headerDelimiterPosition + 2 ); // We preserve the last \r\n, hence +2
763
+ $ startLineEndPosition = strpos ($ rawHeaders , "\r\n" );
764
764
765
- $ result = [
766
- 'start-line ' => substr ($ rawHeaders , 0 , $ startLineEndPosition ),
767
- 'headers ' => [],
768
- 'body ' => (string ) substr ($ message , $ headerDelimiterPosition + 4 ),
769
- ];
765
+ $ result = [
766
+ 'start-line ' => substr ($ rawHeaders , 0 , $ startLineEndPosition ),
767
+ 'headers ' => [],
768
+ 'body ' => (string )substr ($ message , $ headerDelimiterPosition + 4 ),
769
+ ];
770
770
771
- $ rawHeaders = substr ($ rawHeaders , $ startLineEndPosition + 2 );
771
+ $ rawHeaders = substr ($ rawHeaders , $ startLineEndPosition + 2 );
772
772
773
- /** @var array[] $headerLines */
774
- $ count = preg_match_all (Rfc7230::HEADER_REGEX , $ rawHeaders , $ headerLines , PREG_SET_ORDER );
773
+ /** @var array[] $headerLines */
774
+ $ count = preg_match_all (Rfc7230::HEADER_REGEX , $ rawHeaders , $ headerLines , PREG_SET_ORDER );
775
775
776
- // If these aren't the same, then one line didn't match and there's an invalid header.
777
- if ($ count !== substr_count ($ rawHeaders , "\n" )) {
778
- // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
779
- if (preg_match (Rfc7230::HEADER_FOLD_REGEX , $ rawHeaders )) {
780
- throw new \InvalidArgumentException ('Invalid header syntax: Obsolete line folding ' );
781
- }
776
+ // If these aren't the same, then one line didn't match and there's an invalid header.
777
+ if ($ count !== substr_count ($ rawHeaders , "\n" )) {
778
+ // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
779
+ if (preg_match (Rfc7230::HEADER_FOLD_REGEX , $ rawHeaders )) {
780
+ throw new \InvalidArgumentException ('Invalid header syntax: Obsolete line folding ' );
781
+ }
782
782
783
- throw new \InvalidArgumentException ('Invalid header syntax ' );
784
- }
783
+ throw new \InvalidArgumentException ('Invalid header syntax ' );
784
+ }
785
785
786
- foreach ($ headerLines as $ headerLine ) {
787
- $ result ['headers ' ][strtolower ($ headerLine [1 ])][] = $ headerLine [2 ];
788
- }
786
+ foreach ($ headerLines as $ headerLine ) {
787
+ $ result ['headers ' ][strtolower ($ headerLine [1 ])][] = $ headerLine [2 ];
788
+ }
789
789
790
790
return $ result ;
791
791
}
0 commit comments