You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Andreas Fagschlunger (JIRA)" <ji...@apache.org> on 2011/04/08 11:31:05 UTC

[jira] [Created] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
--------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-1077
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpCookie
    Affects Versions: 4.1.1
         Environment: JVM where de default Locale ist not Locale.US.
            Reporter: Andreas Fagschlunger
            Priority: Minor


In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:

2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu

We are using Cookie-Policy RFC2109:

        httpClient = new DefaultHttpClient(connectionManager);
        httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);

The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:

[Java]
        System.out.println("Locale=" + Locale.getDefault());
        String[] datePatterns = new String[] {
            DateUtils.PATTERN_ASCTIME,
            DateUtils.PATTERN_RFC1036,
            DateUtils.PATTERN_RFC1123 };
        for (String pattern : datePatterns) {
            try {
                SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
                dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
            } catch (ParseException e) {
                System.out.println("Pattern '" + pattern + "' failed.");
            }
        }
[/Java]

The output for me is following:

Locale=de_AT
Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.

Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:

Locale=en_US
Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.

So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:

http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29

I hope I didn't waste your time and this is realy a bug.

Best regards,
Billie




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018764#comment-13018764 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1077:
-----------------------------------------------

> Please also note that HttpClient 3.1 was able to handle such Cookies. 

So is HttpClient 4.x when using BEST_MATCH policy, which is default.

Oleg

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>         Attachments: HTTPCLIENT-1077.zip
>
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Andreas Fagschlunger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017429#comment-13017429 ] 

Andreas Fagschlunger commented on HTTPCLIENT-1077:
--------------------------------------------------

Hm, the error message is "Unable to parse expires attribute: Thu ", the Expires-String is "Thu, 01-Dec-94 16:00:00 GMT". According to the BasicExpiresHandler the whole Expires-String should be displayed in the log message:

http://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/apache/http/impl/cookie/BasicExpiresHandler.html

Maybe there is something wrong with the whole cookie format? Is it possible that the Cookie-Spec RFC 2109 don't likes the comma (,) in the Expires-Date-String?

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>         Attachments: HTTPCLIENT-1077.zip
>
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Andreas Fagschlunger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Fagschlunger updated HTTPCLIENT-1077:
---------------------------------------------

    Attachment: HTTPCLIENT-1077.zip

Full Log-File including start up.The Cookie ist always set in Response to the /appl/ebp/sbp/startCardSession.html-Request (2011-04-08 13:52:01,943).

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>         Attachments: HTTPCLIENT-1077.zip
>
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017402#comment-13017402 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1077:
-----------------------------------------------

That's bizarre. As far as I can tell US locale is explicitly set when creating instances of SimpleDateFormat [1]. Am I still missing something?

Oleg

[1] http://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/apache/http/impl/cookie/DateUtils.html#249 

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Andreas Fagschlunger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018753#comment-13018753 ] 

Andreas Fagschlunger commented on HTTPCLIENT-1077:
--------------------------------------------------

Please see section "10.1.2  Expires and Max-Age" of the RFC 2109:

http://www.ietf.org/rfc/rfc2109.txt

{code}
10.1.2  Expires and Max-Age

   Netscape's original proposal defined an Expires header that took a
   date value in a fixed-length variant format in place of Max-Age:

   Wdy, DD-Mon-YY HH:MM:SS GMT

   Note that the Expires date format contains embedded spaces, and that
   "old" cookies did not have quotes around values.  Clients that
   implement to this specification should be aware of "old" cookies and
   Expires.
{/code}

According to the Specification the HttpClient should be able to handle "old" cookies without quotes when CookiePolicy.RFC2109 is explicitly set? Or am I wrong? Please also note that HttpClient 3.1 was able to handle such Cookies.

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>         Attachments: HTTPCLIENT-1077.zip
>
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1077) CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1077.
-------------------------------------------

    Resolution: Invalid

Comma is a reserved character meant to separate header elements and may not be used in cookie values or attribute values unless quoted (enclosed with quote marks).

You should be using BROWSER_COMPATIBILITY or NETSCAPE policies if you want to be able to handle cookies like that.

In fact it is recommended to use BEST_MATCH policy and let HttpClient automatically pick up the most appropriate cookie specification for parsing and formatting of cookie headers.

Oleg

> CookiePolicy.RFC_2109: Unable to parse expires attribute (Thu, 01-Dec-94 16:00:00 GMT)
> --------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1077
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1077
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.1.1
>         Environment: JVM where de default Locale ist not Locale.US.
>            Reporter: Andreas Fagschlunger
>            Priority: Minor
>              Labels: coocki
>         Attachments: HTTPCLIENT-1077.zip
>
>
> In our Application we're facing problems using HttpClient 4.x (didn't have that problem with HttpClient 3.1). The HttpClient has problems parsing the Cookie's Expires-Attribute:
> 2011-04-08 10:14:21,647 [btpool0-0] WARN  org.apache.http.client.protocol.ResponseProcessCookies - Invalid cookie header: "Set-Cookie: dfName=""; Expires=Thu, 01-Dec-94 16:00:00 GMT; Path=/appl/ebp". Unable to parse expires attribute: Thu
> We are using Cookie-Policy RFC2109:
>         httpClient = new DefaultHttpClient(connectionManager);
>         httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
> The problems seems to be the JVM's default Locale, which is in our case de_AT and not en_US. See following Example:
> [Java]
>         System.out.println("Locale=" + Locale.getDefault());
>         String[] datePatterns = new String[] {
>             DateUtils.PATTERN_ASCTIME,
>             DateUtils.PATTERN_RFC1036,
>             DateUtils.PATTERN_RFC1123 };
>         for (String pattern : datePatterns) {
>             try {
>                 SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
>                 dateFormat.parse("Thu, 01-Dec-94 16:00:00 GMT");
>             } catch (ParseException e) {
>                 System.out.println("Pattern '" + pattern + "' failed.");
>             }
>         }
> [/Java]
> The output for me is following:
> Locale=de_AT
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEEE, dd-MMM-yy HH:mm:ss zzz' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> Setting the default Locale to US (Locale.setDefault(Locale.US)), the output changes:
> Locale=en_US
> Pattern 'EEE MMM d HH:mm:ss yyyy' failed.
> Pattern 'EEE, dd MMM yyyy HH:mm:ss zzz' failed.
> So the Date (Thu, 01-Dec-94 16:00:00 GMT) and the pattern (DateUtils.PATTERN_RFC1036: EEEE, dd-MMM-yy HH:mm:ss zzz) seem to be valid, just the Locale is not explicitly set for the SimpleDateFormat:
> http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#SimpleDateFormat%28java.lang.String,%20java.util.Locale%29
> I hope I didn't waste your time and this is realy a bug.
> Best regards,
> Billie

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org