jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <>
Subject Domain value returns by getDomain()
Date Tue, 15 Dec 2015 20:40:04 GMT
I would like to know if it's a bug or regular.

In the below Test case, we have a cookie which domain attribute is "domain=."
But the built cookie by HttpClient return "" , it's explicitely in
the code of BasicDomainHandler#domainMatch.

I suppose it's voluntary right ?

Thanks in advance.

package org.apache.http.client.protocol;

import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
import org.apache.http.HttpVersion;
import org.apache.http.client.CookieStore;
import org.apache.http.cookie.Cookie;
import org.apache.http.cookie.CookieOrigin;
import org.apache.http.cookie.CookieSpec;
import org.apache.http.cookie.SM;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.cookie.DefaultCookieSpec;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class TestCookieDomain {

    private CookieOrigin cookieOrigin;
    private CookieSpec cookieSpec;
    private CookieStore cookieStore;

    public void setUp() throws Exception {
        this.cookieOrigin = new CookieOrigin("", 80,
"/path", false);
        this.cookieSpec = new DefaultCookieSpec();
        this.cookieStore = new BasicCookieStore();

    public void testDomainWithDot() throws Exception {
        final HttpResponse response = new BasicHttpResponse(
                HttpVersion.HTTP_1_1, 200, "OK");
        response.addHeader(SM.SET_COOKIE, "SMTRYNO=1; path=/;

        final HttpClientContext context = HttpClientContext.create();

        final HttpResponseInterceptor interceptor = new
        interceptor.process(response, context);
        final List<Cookie> clientCookies = this.cookieStore.getCookies();
        Assert.assertEquals(1, clientCookies.size());
        for (Cookie cookie : clientCookies) {
            Assert.assertEquals("", cookie.getDomain());

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message