Skip to content

Commit

Permalink
Expanding regex for header name matching to also include digits and u…
Browse files Browse the repository at this point in the history
…nderscore.
  • Loading branch information
brentscheffler committed Dec 4, 2024
1 parent 187e931 commit c9046fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Handler/CurlHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function buildCurlRequestOptions(RequestInterface $request, ResponseIn
$response = $response->withProtocolVersion($httpResponse[1]);
}

elseif( \preg_match("/^([\w\-]+)\: (\N+)\R?+$/", \trim($header), $httpHeader) ){
elseif( \preg_match("/^([\w\d\-_]+)\: (\N+)\R?+$/", \trim($header), $httpHeader) ){
$response = $response->withAddedHeader($httpHeader[1], $httpHeader[2]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Handler/StreamContextHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private function parseRawResponse(string $raw_response, ResponseInterface $respo
$response = $response->withProtocolVersion($httpResponse[1]);
}

elseif( \preg_match("/^([\w\-]+)\: (\N+)\R?+$/", \trim($line), $httpHeader) ){
elseif( \preg_match("/^([\w\d\-_]+)\: (\N+)\R?+$/", \trim($line), $httpHeader) ){
$response = $response->withAddedHeader($httpHeader[1], $httpHeader[2]);
}
}
Expand Down

0 comments on commit c9046fa

Please sign in to comment.