code: protected void processCookieHeaders(
              final CookieSpec parser, 
              final Header[] headers, 
              final HttpState state, 
              final HttpConnection conn) {
          LOG.trace("enter HttpMethodBase.processCookieHeaders(Header[], HttpState, "
                    + "HttpConnection)");
  
          String host = this.params.getVirtualHost();
          if (host == null) {
              host = conn.getHost();
          }
          for (int i = 0; i < headers.length; i++) {
              Header header = headers[i];
              Cookie[] cookies = null;
              try {
                  cookies = parser.parse(
                    host,
                    conn.getPort(),
                    getPath(),
                    conn.isSecure(),
                    header);
              } catch (MalformedCookieException e) {
                  if (LOG.isWarnEnabled()) {
                      LOG.warn("Invalid cookie header: \"" 
                          + header.getValue() 
                          + "\". " + e.getMessage());
                  }
              }
              if (cookies != null) {
                  for (int j = 0; j < cookies.length; j++) {
                      Cookie cookie = cookies[j];
                      try {
                          parser.validate(
                            host,
                            conn.getPort(),
                            getPath(),
                            conn.isSecure(),
                            cookie);
                          state.addCookie(cookie);
                          if (LOG.isDebugEnabled()) {
                              LOG.debug("Cookie accepted: \"" 
                                  + parser.formatCookie(cookie) + "\"");
                          }
                      } catch (MalformedCookieException e) {
                          if (LOG.isWarnEnabled()) {
                              LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) 
                                  + "\". " + e.getMessage());
                          }
                      }
                  }
              }
          }
      }
docs: This method processes the specified cookie headers. It is invoked from
  within {@link #processResponseHeaders(HttpState,HttpConnection)}
  
  @param headers cookie {@link Header}s to be processed
  @param state the {@link HttpState state} information associated with
  this HTTP method
  @param conn the {@link HttpConnection connection} used to execute
  this HTTP method