Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New request parser breaks on local host names #538

Open
akadlec opened this issue Aug 10, 2024 · 0 comments
Open

New request parser breaks on local host names #538

akadlec opened this issue Aug 10, 2024 · 0 comments
Labels

Comments

@akadlec
Copy link

akadlec commented Aug 10, 2024

I'm using react/http on my local server which is creating server to interact with HomeKit. And the latest version break parsing incoming request because of host name.

Data which are sent by HomeKit to my server may look like this:

POST /pair-verify HTTP/1.1\r\n
Host: HomeKit\032Integration\0322509EB._hap._tcp.local\r\n
Content-Length: 37\r\n
Content-Type: application/pairing+tlv8\r\n
\r\n
\x06\x01\x01\x03 … \xE73o\xE1\xE0o\x82\xB6\xE1\x17

And this data are taken by RequestHeaderParser to parse -> ServerRequest -> new Uri and here it crashes:

if ($parts === false || (isset($parts['scheme']) && !\preg_match('#^[a-z]+$#i', $parts['scheme'])) || (isset($parts['host']) && \preg_match('#[\s_%+]#', $parts['host']))) {
                throw new \InvalidArgumentException('Invalid URI given');
}

because the uri is: http://HomeKit\032Integration\0322509EB._hap._tcp.local/pair-verify

@akadlec akadlec added the bug label Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant