From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] url: Wrap cookie headers in url-http--encode-string. Date: Wed, 07 Sep 2016 18:52:15 +0200 Message-ID: <87inu7k5z4.fsf@toke.dk> References: <20160907153014.15752-1-toke@toke.dk> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1473267201 32518 195.159.176.226 (7 Sep 2016 16:53:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Sep 2016 16:53:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 07 18:53:17 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhg62-0007Gu-Rq for ged-emacs-devel@m.gmane.org; Wed, 07 Sep 2016 18:53:10 +0200 Original-Received: from localhost ([::1]:42066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhg60-0005q5-Qo for ged-emacs-devel@m.gmane.org; Wed, 07 Sep 2016 12:53:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhg5J-0005jX-Qb for emacs-devel@gnu.org; Wed, 07 Sep 2016 12:52:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhg5G-0005it-CU for emacs-devel@gnu.org; Wed, 07 Sep 2016 12:52:25 -0400 Original-Received: from mail2.tohojo.dk ([77.235.48.147]:43869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhg5G-0005io-35 for emacs-devel@gnu.org; Wed, 07 Sep 2016 12:52:22 -0400 X-Virus-Scanned: amavisd-new at mail2.tohojo.dk DKIM-Filter: OpenDKIM Filter v2.10.3 mail2.tohojo.dk 5315340D5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=201310; t=1473267136; bh=3yTNUvWogFUzVScYIPP4FrpxEpdxFkFodrvhbTMym5w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=mJUT8YmkRpUOsnrJM60xok5ax5NYmFR5arzmIBn+TtfipMxM0W3dc4ZicVG8orhXY K+l5e7+EYdw15QfUveUmIogm+9PwrasyH7yaPe0Hge+8TEWlar9zyyIii0Sj6jlHTy 28hGvuIkwwH8db7LXJ7o4dJ+zQ9W5feovy1vWieE= Original-Received: by alrua-kau.kau.toke.dk (Postfix, from userid 1000) id 8ECC2C4027D; Wed, 7 Sep 2016 18:52:15 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Wed, 07 Sep 2016 12:40:40 -0400") X-Clacks-Overhead: GNU Terry Pratchett X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.235.48.147 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207256 Archived-At: Stefan Monnier writes: >> In some cases the output of url-cookie-generate-header can be multibyte, > > Hmmm... I think this is a problem in itself. So rather than encode the > result of url-cookie-generate-header-lines, we should change > url-cookie-generate-header-lines so that it always returns a unibyte > string. Right, well, I'm not actually sure that there's any multibyte *content* in the cookie header. But somehow, without this patch, if there's an UTF-8 payload, (string-bytes request) returns an extra byte for each UTF-8 octet. I have no idea why that is; basically, what I would see was: (string-bytes url-http-data) == (length url-http-data) but (string-bytes (substring request (* -1 (length (url-http-data))))) being two bytes longer (for a single UTF-8 character in the payload). -Toke