code: private static int guessCookieVersion(String header) {
          int version = 0;
  
          header = header.toLowerCase();
          if (header.indexOf("expires=") != -1) {
              // only netscape cookie using 'expires'
              version = 0;
          } else if (header.indexOf("version=") != -1) {
              // version is mandatory for rfc 2965/2109 cookie
              version = 1;
          } else if (header.indexOf("max-age") != -1) {
              // rfc 2965/2109 use 'max-age'
              version = 1;
          } else if (startsWithIgnoreCase(header, SET_COOKIE2)) {
              // only rfc 2965 cookie starts with 'set-cookie2'
              version = 1;
          }
  
          return version;
      }
docs: /*
  try to guess the cookie version through set-cookie header string