HtmlUnit supports passing the credentials for basic authentication right in the URL:
http://john.smith:secret@localhost/foo.html
However, in some edge cases the credentials could get lost before the request is actually made. This happens if the passed URL needs to be modified because of
In all these cases a new URL will be created, but without the credentials from the original URL.
Attached are two patches, one that adds some new test cases and another one with a potential fix for this issue.
As always, thanks for the patch.
Changes are in SVN; will update the snapshot if the build is fine.