Summary
The stitch function in the URL handling code returns InvalidURL when trying to resolve relative paths containing ../ that would navigate above the domain root. This causes issues when fetching web pages with relative resource links.
Steps to Reproduce
This is a real URL
- Try to resolve a relative path like ../static/bootstrap.min.css with base URL https://alas.aws.amazon.com/alas2.html
- The function returns InvalidURL error
Expected Behavior
The function should resolve the path to https://alas.aws.amazon.com/static/bootstrap.min.css (staying at domain root), similar to how other web browsers handle such cases.
Note: The ../ specification that goes beyond the domain root is incorrect, but there are surely countless sites like this.