Hi, I started working on migrating at least HC4CookieHandler to HC4.5.1 and I noticed that JUnit tests do not test HC4CookieHandler but only HC3CookieHandler. It explains why the issue was not found. I think there is a non regression test that catches it: testSendCookie2
I noticed also that switching to HC4CookieHandler makes 4 tests fail: - https://bz.apache.org/bugzilla/show_bug.cgi?id=58611 Regards On Wed, Oct 28, 2015 at 3:46 PM, Philippe Mouawad < [email protected]> wrote: > Hi, > For me it's a regression but as this cookie policy is deprecated in hc4.4 > and discouraged, not sure it will be fixed. > > This means we should maybe migrate this part in priority. > > Regarding the bug, if you provide a jUnit test case for jmeter, it may be > enough for Oleg. > I didn't provide much more for the mime Encoding bug. > regards > Philippe > > > On Wednesday, October 28, 2015, Andrey Pokhilko <[email protected]> wrote: > >> Hi Philippe, >> >> I'm not opening HttpClient bug as I'm not sure how to report it. I tried >> to take the sources of HttpClient, but they look different from what I >> see in JAR-files and I can't construct the reproduction using httpclient >> sources. >> >> There's no mention of cookie domain in test plan, it's just Cookie >> Manager added with default settings. >> Test plan do work on 4.2.6 and not works on 4.5 with no change. >> There is no Beanshell/Groovy manipulations. >> >> The unit test I've written is a result of my investigations, the issue >> reproduction boils down to that addCookieFromHeader call. >> >> Andrey Pokhilko >> >> On 10/28/2015 12:23 AM, Philippe Mouawad wrote: >> > Hello Andrei, >> > I suggest you open a bug on HttpClient project, usually Oleg is very >> > reactive. >> > >> > >> > Can you give more details on the bug ?: >> > >> > - Is the somewhere in the Test Plan a mention of the cookie domain ? >> > - Do the plan work with 4.2.6 and break in 4.5 without any change ? >> > - Is there some Beanshell or Groovy code manipulating the >> Header/Cookie ? >> > >> > If the answer is no, yes, no , then I tend to consider it a regression >> of >> > HttpClient. >> > >> > >> > Thanks Richard for the great analysis. >> > >> > >> > Regards >> > >> > Philippe M. >> > >> > >> > >> > On Tue, Oct 27, 2015 at 5:03 PM, Andrey Pokhilko <[email protected]> wrote: >> > >> >> Thanks, that is most likely the exact reason for the changed behavior. >> >> But it breaks existing scripts functioning, so isn't it a regression >> for >> >> HTTPClient? Or for JMeter? >> >> >> >> Andrey Pokhilko >> >> >> >> On 10/27/2015 06:00 PM, Richard Friedman wrote: >> >>> I believe this is because as of 4.4 they added support for RFC 6265 >> and >> >>> deprecated (but kept as default) old policy. Then in 4.5 dropped old. >> >>> >> >>> Specifically this change >> >>> >> >> >> https://github.com/apache/httpclient/blob/70489c4bb03491b6ea0bec60904fc78782963a3a/httpclient/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java#L121 >> >>> if (domain.startsWith(".")) { >> >>> domain = domain.substring(1); >> >>> } >> >>> >> >>> Which means the returned domain name would be bt.com instead of . >> bt.com >> >> ? >> >>> RFC 6256 >> >>> http://tools.ietf.org/html/rfc6265#section-5.2.3 >> >>> >> >>> If the first character of the attribute-value string is %x2E ("."): >> >>> >> >>> Let cookie-domain be the attribute-value without the leading >> %x2E >> >>> (".") character. >> >>> >> >>> >> >>> >> >>> >> >>> On Tue, Oct 27, 2015 at 11:32 AM, Andrey Pokhilko <[email protected]> wrote: >> >>> >> >>>> Hi, >> >>>> >> >>>> Today we've found an issue in using HTTPClient 4.5 in JMeter. If we >> just >> >>>> replace the libraries with no change to JMeter code, it stops >> processing >> >>>> wildcard domains for cookies. I've failed to understand if it is >> >>>> regression in HTTPClient or something else. >> >>>> >> >>>> I've managed to write a unit test for it, I can commit it into trunk >> if >> >>>> needed. Unit test works fine on old libraries, but fails with 4.5: >> >>>> >> >>>> package org.apache.jmeter.protocol.http.control; >> >>>> >> >>>> import org.apache.http.cookie.Cookie; >> >>>> import org.apache.jmeter.testelement.property.CollectionProperty; >> >>>> import org.junit.Assert; >> >>>> import org.junit.Test; >> >>>> >> >>>> import java.net.URL; >> >>>> import java.util.List; >> >>>> >> >>>> public class HC4CookieHandlerTest { >> >>>> >> >>>> @Test public void testAddCookieFromHeader_wildcard() throws >> >> Exception { >> >>>> HC4CookieHandler obj = new HC4CookieHandler("compatibility"); >> >>>> URL url = new URL("https://subdomain.bt.com/page"); >> >>>> CookieManager mgr = new CookieManager(); >> >>>> String headerLine = "SMTRYNO=1; path=/; domain=.bt.com"; >> >>>> obj.addCookieFromHeader(mgr, true, headerLine, url); >> >>>> CollectionProperty cp = mgr.getCookies(); >> >>>> List<Cookie> res = obj.getCookiesForUrl(cp, url, false); >> >>>> Assert.assertEquals(1, res.size()); >> >>>> for (Cookie cookie : res) { >> >>>> Assert.assertEquals(".bt.com", cookie.getDomain()); >> >>>> } >> >>>> } >> >>>> } >> >>>> >> >>>> >> >>>> >> >>>> Andrey Pokhilko >> >>>> >> >>>> On 07/04/2015 05:35 PM, Philippe Mouawad wrote: >> >>>>> Hello, >> >>>>> HttpClient 4.3 introduced a new set of APIs which makes migration >> from >> >>>>> 4.2.3 to 4.5 an important work. >> >>>>> >> >>>>> What are the risks and what do you think about the approach of >> >>>> progressive >> >>>>> migration: >> >>>>> >> >>>>> - We upgrade to 4.5 HttpClient/Mime and 4.4.1 (HttpCore) jars >> which >> >>>>> show many deprecations but not broken compilation >> >>>>> - Once done, we move progressively (not always possible) to 4.5 >> the >> >>>> code >> >>>>> If this is feasible then it would allow us to fix : >> >>>>> >> >>>>> - https://bz.apache.org/bugzilla/show_bug.cgi?id=57935 >> >>>>> >> >>>>> >> >>>>> Any trace of a migration documentation from 4.2.X to 4.3. ? >> >>>>> >> >> >> > >> >> > > -- > Cordialement. > Philippe Mouawad. > > > > -- Cordialement. Philippe Mouawad.
