Hi Oleg,

Oleg Kalnichevski wrote:

Hi Padraig
The patch has been applied. Many thanks for having contributed it

Thanks a lot. With such quick response I won't hesitate to contribute further patches to HttpClient in the future !

Regards,

Padraig

Cheers

Oleg

On Fri, 2003-03-07 at 16:14, Padraig O'hIceadha wrote:


Hi Oleg,

That would be really excellent.

Thanks a lot,

Padraig

Kalnichevski, Oleg wrote:



Hi Padraig

Makes sense to me. If no one loudly objects, I'll apply the patch by Monday the latest (or shall I say monday? ;-))

Cheers

Oleg

-----Original Message-----
From: Padraig O'hIceadha [mailto:[EMAIL PROTECTED]
Sent: Freitag, 7. M�rz 2003 16:00
To: [EMAIL PROTECTED]
Subject: [PATCH] HttpClient was rejecting some cookies a browser would
accept


Hi,


I found that cookies generated by WebLogic were being rejected by HttpClient as it didn't like the format of the Expires field.

From reading the specs I think that HttpClient is not at fault, in that WebLogic does not seem to be using a 100% correct date format.

  However their error is minor (it uses incorrect case for the
day and month names) and I think it would be useful if HttpClient
were forgiving in this regard.

  For example, WebLogic sends
expires=thursday, 06-mar-2003 04:44:00 GMT
  where it should send
expires=Thursday, 06-Mar-2003 04:44:00 GMT

   This causes a problem in the parse method in HeaderElement
where it has extra code for recognising when a , in the cookie
string is part of a date.

   To check this it does a case sensitive match against all the
valid combinations ("Monday", "Tuesday" etc). As the match is
case sensitive it doesn't recognise the weblogic expires as a
date and the expires field ends up simply as "thursday", which
later fails parsing by SimpleDateFormat.

   The patch below changes this to use a case insensitive
comparison.

Regards,

Padraig

Index: HeaderElement.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HeaderElement.java,v
retrieving revision 1.16
diff -u -r1.16 HeaderElement.java
--- HeaderElement.java 31 Jan 2003 00:33:36 -0000 1.16
+++ HeaderElement.java 7 Mar 2003 14:41:07 -0000
@@ -300,22 +300,24 @@
* the expires date format is "Wdy, DD-Mon-YY HH:MM:SS GMT".
* Notice that there is always comma(',') sign.
* For the general cases, rfc1123-date, rfc850-date.
+ * NB some servers send the day & month names in the wrong case
*/
if (tokenizer.hasMoreTokens()) {
- if (nextToken.endsWith("Mon")
- || nextToken.endsWith("Tue")
- || nextToken.endsWith("Wed")
- || nextToken.endsWith("Thu")
- || nextToken.endsWith("Fri")
- || nextToken.endsWith("Sat")
- || nextToken.endsWith("Sun")
- || nextToken.endsWith("Monday")
- || nextToken.endsWith("Tuesday")
- || nextToken.endsWith("Wednesday")
- || nextToken.endsWith("Thursday")
- || nextToken.endsWith("Friday")
- || nextToken.endsWith("Saturday")
- || nextToken.endsWith("Sunday")) {
+ String possibleExpiresField = nextToken.toLowerCase();
+ if (possibleExpiresField.endsWith("mon")
+ || possibleExpiresField.endsWith("tue")
+ || possibleExpiresField.endsWith("wed")
+ || possibleExpiresField.endsWith("thu")
+ || possibleExpiresField.endsWith("fri")
+ || possibleExpiresField.endsWith("sat")
+ || possibleExpiresField.endsWith("sun")
+ || possibleExpiresField.endsWith("monday")
+ || possibleExpiresField.endsWith("tuesday")
+ || possibleExpiresField.endsWith("wednesday")
+ || possibleExpiresField.endsWith("thursday")
+ || possibleExpiresField.endsWith("friday")
+ || possibleExpiresField.endsWith("saturday")
+ || possibleExpiresField.endsWith("sunday")) {


                        nextToken += "," + tokenizer.nextToken();
                    }


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to