From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Diane Murray Newsgroups: gmane.emacs.devel Subject: url-http.el: Set cookies in the order they were sent. Date: Sun, 01 Apr 2007 01:42:13 +0200 Message-ID: <878xddyo8a.fsf@x3y2z1.net> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1175384403 26133 80.91.229.12 (31 Mar 2007 23:40:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 31 Mar 2007 23:40:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 01 01:40:01 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HXnAt-0007tq-Qs for ged-emacs-devel@m.gmane.org; Sun, 01 Apr 2007 01:40:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HXnDk-0001Pa-Mb for ged-emacs-devel@m.gmane.org; Sat, 31 Mar 2007 18:42:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HXnDh-0001PJ-0t for emacs-devel@gnu.org; Sat, 31 Mar 2007 19:42:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HXnDe-0001Ov-Ra for emacs-devel@gnu.org; Sat, 31 Mar 2007 19:42:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HXnDe-0001Os-LR for emacs-devel@gnu.org; Sat, 31 Mar 2007 18:42:50 -0500 Original-Received: from mailout09.sul.t-online.com ([194.25.134.84]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HXnAn-00050l-0f for emacs-devel@gnu.org; Sat, 31 Mar 2007 19:39:53 -0400 Original-Received: from fwd32.aul.t-online.de by mailout09.sul.t-online.com with smtp id 1HXnAl-0002DF-01; Sun, 01 Apr 2007 01:39:51 +0200 Original-Received: from spargel (TD5-EOZEgeyEUE5g3VmnEMjuxl7Xt99YBOzKJj85SE-lEZSry4p7cq@[84.189.252.61]) by fwd32.sul.t-online.de with esmtp id 1HXnAg-1oEheK0; Sun, 1 Apr 2007 01:39:46 +0200 X-ID: TD5-EOZEgeyEUE5g3VmnEMjuxl7Xt99YBOzKJj85SE-lEZSry4p7cq@t-dialin.net X-TOI-MSGID: 580f1cb8-e113-4b9a-9a62-1e6ee1a26f39 X-detected-kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68870 Archived-At: In `url-http-handle-cookies', `mail-fetch-field' returns a list of Set-Cookie headers in reverse, and the cookies are then set in that order. This causes problems when a site tries to set the same cookie more than once (with different values) in a single response, for example, if a certain site "deletes" then sets the real value of some session cookies all in one request. This can be fixed by calling `reverse' on the list of cookies before setting them. 2007-03-31 Diane Murray * url-http.el (url-http-handle-cookies): Reverse the list returned by `mail-fetch-field', so that cookies are set in the correct order. *** url-http.el 21 Mar 2007 18:39:05 +0100 1.50 --- url-http.el 01 Apr 2007 01:28:04 +0200 *************** *** 379,386 **** "Handle all set-cookie / set-cookie2 headers in an HTTP response. The buffer must already be narrowed to the headers, so `mail-fetch-field' will work correctly." ! (let ((cookies (mail-fetch-field "Set-Cookie" nil nil t)) ! (cookies2 (mail-fetch-field "Set-Cookie2" nil nil t))) (and cookies (url-http-debug "Found %d Set-Cookie headers" (length cookies))) (and cookies2 (url-http-debug "Found %d Set-Cookie2 headers" (length cookies2))) (while cookies --- 379,386 ---- "Handle all set-cookie / set-cookie2 headers in an HTTP response. The buffer must already be narrowed to the headers, so `mail-fetch-field' will work correctly." ! (let ((cookies (reverse (mail-fetch-field "Set-Cookie" nil nil t))) ! (cookies2 (reverse (mail-fetch-field "Set-Cookie2" nil nil t)))) (and cookies (url-http-debug "Found %d Set-Cookie headers" (length cookies))) (and cookies2 (url-http-debug "Found %d Set-Cookie2 headers" (length cookies2))) (while cookies