Created attachment 29443 [details] Enhancements to HttpClient including preparation for no-cookie tests Ref: "FormAuthenticatorTest for cases without cookies - implementation issues" on the tomcat dev list. The attached patch prepares the HttpClient abstract helper ready for use by new Authenticator unit test cases. The change includes style cleanup, new public methods, logic refactoring and new private methods. This change leaves the class 100% backward compatible with all existing unit tests. When each of the concrete Authenticator tests are eventually extended, the new logic in HttpClient will be fully used for existing as well as new test cases.
I wondered whether my refactoring might have broken the logic associated with processing the response body. I have reviewed my change, renamed an argument to make it self-explanatory, and fixed a typo in a comment. I have attached a new patch file for the entire change, so please ignore the original and implement only the new patch.
Created attachment 29455 [details] Minor improvements to original patch. This is a complete replacement for the original patch file, even though the differences are minor.
Fixed in trunk and 7.0.x and will be in 7.0.33 onwards.
Note that I removed the extractUriElements() from within the processBody() method. The response body might be not HTML, and in >=90% of test cases this information is not needed by the test. The extractUriElements() method was made public so that you can call it explicitly. See r1408520