Allow matching urls w/ default port and path
Fix #977
hi @henrahmagix
Thank you for the PR.
It would be good to add a spec to handle that scenario.
While there is no spec for that, I believe this change can break some integrations.
E.g. someone sets allowed "http://example.com" and the request URI is "http://example.com:80/foobar"
The existing code will match and allow network connection but with the introduced change, it now expects allowed pattern to include the path as well, therefore if this solution was to handle paths, it would require an additional condition, rather than replacing the current one.
btw. the allowed pattern was created for just scheme host and port, since only these are used for the actual connection. The path is only used for the HTTP requests after the connection has already been made. Though in most cases, we know the URL at the time of making the request and creating the connection, therefore I think this is acceptable to allow including path in allowed patterns.