Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7582527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:27:22+00:00 2026-05-30T18:27:22+00:00

In an android application, when using DefaultHttpClient to get an URL content (executing HttpGet)

  • 0

In an android application, when using DefaultHttpClient to get an URL content (executing HttpGet) I receive the following warning in logs:

W/ResponseProcessCookies(20386): Invalid cookie header: "Set-Cookie: NSC_vbue_iuuq=ffff660; expires=; domain=private.false.name; path=/; isSecure=false". Unable to parse expires attribute:

I understand the warning because the expires field does not contain a valid date format. I understand it maybe because it is a ‘session cookie’ (without being expert). Thread about similar situation in Curl context

Searching the web I found mainly the

.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BEST_MATCH (or other) )

option to avoid warning by parsing correctly dates that contain a comma.

However, I would like to avoid that log. (not by disabling logs)
I believe internally all is fine since “I GUESS”, cookie.setExpiryDate() is simply not called.

Do you think I need a specific configuration of my HTTP client (I’ve not set specific configurations) to avoid that warning or to support empty expires?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:27:23+00:00Added an answer on May 30, 2026 at 6:27 pm

    If you do not mind altering the CookieSpec you can supply your own, more lenient, subclass.

    First, create a lenient CookieSpec that will accept null and empty values for the expires attribute, like this:

    class LenientCookieSpec extends BrowserCompatSpec {
        public LenientCookieSpec() {
            super();
            registerAttribHandler(ClientCookie.EXPIRES_ATTR, new BasicExpiresHandler(DATE_PATTERNS) {
                @Override public void parse(SetCookie cookie, String value) throws MalformedCookieException {
                    if (TextUtils.isEmpty(value)) {
                        // You should set whatever you want in cookie
                        cookie.setExpiryDate(null);
                    } else {
                        super.parse(cookie, value);
                    }
                }
            });
        }
    }
    

    Now you need to register & choose this new CookieSpec in your HTTP client.

    DefaultHttpClient client = new DefaultHttpClient();
    client.getCookieSpecs().register("lenient", new CookieSpecFactory() {
            public CookieSpec newInstance(HttpParams params) {
                return new LenientCookieSpec();
            }
        });
    HttpClientParams.setCookiePolicy(client.getParams(), "lenient");
    

    Something “like this” could work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android application using LocationManager get the cell network location and not
I have application using Android 2.1 which utilize LocationManager to get the altitude. But
I need to build my Android application using the command line, when I get
I'm currently developing an Android application that fetches images using http requests. It would
I am using the Android Emulator to debug my application, first off it is
My android application has several warnings of the following form when I run it
I am developing an Android application using android sdk v 2.1. In one page
i am developing an android application using google maps data.I can access google maps
I have an android application using an SQLite database. I open the database when
I'm developing Android application using third party libraries (Twitter4j). I want to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.