From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#23750: 25.0.95; bug in url-retrieve or json.el Date: Mon, 13 Jun 2016 18:02:13 +0300 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------FD559A1CD007CA0220D99463" X-Trace: ger.gmane.org 1465830215 7480 80.91.229.3 (13 Jun 2016 15:03:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jun 2016 15:03:35 +0000 (UTC) Cc: Stefan Monnier To: Leo Liu , 23750@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 13 17:03:24 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bCTOc-0002s5-6P for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Jun 2016 17:03:22 +0200 Original-Received: from localhost ([::1]:57129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCTOb-0008AO-6q for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Jun 2016 11:03:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCTOO-00087c-MA for bug-gnu-emacs@gnu.org; Mon, 13 Jun 2016 11:03:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCTOJ-0005Hy-BO for bug-gnu-emacs@gnu.org; Mon, 13 Jun 2016 11:03:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCTOJ-0005Hs-7g for bug-gnu-emacs@gnu.org; Mon, 13 Jun 2016 11:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bCTOJ-00048p-1n for bug-gnu-emacs@gnu.org; Mon, 13 Jun 2016 11:03:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Jun 2016 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23750 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23750-submit@debbugs.gnu.org id=B23750.146583014315865 (code B ref 23750); Mon, 13 Jun 2016 15:03:02 +0000 Original-Received: (at 23750) by debbugs.gnu.org; 13 Jun 2016 15:02:23 +0000 Original-Received: from localhost ([127.0.0.1]:39127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCTNf-00047p-0J for submit@debbugs.gnu.org; Mon, 13 Jun 2016 11:02:23 -0400 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:36724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCTNd-00047R-Ua for 23750@debbugs.gnu.org; Mon, 13 Jun 2016 11:02:22 -0400 Original-Received: by mail-wm0-f51.google.com with SMTP id n184so82701862wmn.1 for <23750@debbugs.gnu.org>; Mon, 13 Jun 2016 08:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to; bh=IayAZzqIw8D2rLsZ147q7XaFRWYyB8xJwAS+VsZcmwY=; b=iNfwNObvIwZTxZvdUz9mlMLarqxhmoK4xRGlqp/Fm8TAfjjQwcAzpq1s4iDV9JF7pb dJSipF2fzU3O+YwgYBMv4Byr4HQ3ShLGRhr315+Hfdj+s8NMwKo51Nv5k+l0C5NgirSV WDqXf3CxPOII3s6BxiXr5J/kg898zFmNFmXF3nxqg82IeLn0TKl+F2DXTzYqZry+6Wpo gVCDveQMHBOlvM6Wo874wBrZp+gAeMUxtfaP491fKhHghLE55pomXVuT6SpzQrnnPnNq OigxX2GYHwmLVTsA3SHRAJQIN73B5N6epRY29OtVtCLjNMuVWY6pmka1sofy2RUC9nzx bAMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:cc:message-id :date:user-agent:mime-version:in-reply-to; bh=IayAZzqIw8D2rLsZ147q7XaFRWYyB8xJwAS+VsZcmwY=; b=Asz0yK8zcbyRzygiQnaShNo8WqMpSfZvv1ZKNep0LIGSM64QEjSQms8Qu8ZyIySP9R I2CbETDo70/d0v2WRFHJfUVydhlDnA5NsWzLgya+bHigUdBiyan9W9+ANCaq/J0FvjPx 5XwX2jSGHkDDU3ERDxjbNwwLydizZU9zhKcVFfcLCC/Rn6pT+61Q6BzA3l0IgypXlzyw y8mHn2m5URggo1sOmaOZLYFaOfDrO+YTz50EVnWXAmmgQDHDIaWxcs8+6yrMSIqgbanP VJKbv7MvC3XcezCY2ePRMWOXMmq9t4bXvNokwyvOL1UsgMvZ18xW8Yvz3PSRU65Dy8Ts 23xg== X-Gm-Message-State: ALyK8tK8DvOzdR5Ub4Nu/oa04GhafwpYuV1gMbJbb2s/V0kyfFZV0YdtDqquf3Vgtq+GyA== X-Received: by 10.194.246.129 with SMTP id xw1mr1638555wjc.142.1465830136221; Mon, 13 Jun 2016 08:02:16 -0700 (PDT) Original-Received: from [192.168.1.2] ([185.105.173.135]) by smtp.googlemail.com with ESMTPSA id i74sm223186wmg.21.2016.06.13.08.02.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Jun 2016 08:02:15 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119502 Archived-At: This is a multi-part message in MIME format. --------------FD559A1CD007CA0220D99463 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit On 06/12/2016 05:22 AM, Leo Liu wrote: > ¹ https://github.com/ternjs/tern/issues/719 Investigation shows that the problem occurs when url-http-data is multibyte and (length url-http-data) differs from (length (string-as-unibyte url-http-data)), because we send a wrong value in Content-length. Changing url-http-create-request like this will make the problem more obvious for anyone else that hits it, patch attached. Stefan, did you have a particular situation in mind where this might be bad, when you wrote the FIXME? --------------FD559A1CD007CA0220D99463 Content-Type: text/x-patch; name="url-http-unibyte.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="url-http-unibyte.diff" diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 5832e92..f7ec640 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -278,14 +278,10 @@ url-http-create-request ;; We used to concat directly, but if one of the strings happens ;; to being multibyte (even if it only contains pure ASCII) then ;; every string gets converted with `string-MAKE-multibyte' which - ;; turns the 127-255 codes into things like latin-1 accented chars - ;; (it would work right if it used `string-TO-multibyte' instead). + ;; turns the 127-255 codes into things like latin-1 accented chars. ;; So to avoid the problem we force every string to be unibyte. (mapconcat - ;; FIXME: Instead of `string-AS-unibyte' we'd want - ;; `string-to-unibyte', so as to properly signal an error if one - ;; of the strings contains a multibyte char. - 'string-as-unibyte + 'string-to-unibyte (delq nil (list ;; The request --------------FD559A1CD007CA0220D99463--