From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 10:21:22 2020 Received: (at submit) by debbugs.gnu.org; 26 Feb 2020 15:21:22 +0000 Received: from localhost ([127.0.0.1]:57595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6yV0-0005t2-7x for submit@debbugs.gnu.org; Wed, 26 Feb 2020 10:21:22 -0500 Received: from lists.gnu.org ([209.51.188.17]:57098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6yTv-0005q6-It for submit@debbugs.gnu.org; Wed, 26 Feb 2020 10:20:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45592) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6yTu-0002Ws-8w for bug-guile@gnu.org; Wed, 26 Feb 2020 10:20:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6yTt-00066R-3Q for bug-guile@gnu.org; Wed, 26 Feb 2020 10:20:14 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6yTs-00060q-TO for bug-guile@gnu.org; Wed, 26 Feb 2020 10:20:13 -0500 Received: by mail-wm1-x32a.google.com with SMTP id a141so2777318wme.2 for ; Wed, 26 Feb 2020 07:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=9vE/l4BK0Hzhm5QEMoRPaUFTfpj5ecEvrIy048jmN+U=; b=hc6UaE0iab5xcBx9jIUurilY9g5y66rIHiS/yG+ZSdbB0tOu5KOez6yQ7HigbLF08e hCJ7+yieXXkUxAkV2rQ8n4gdWpxXoeZVd/ecJhyObSniylag2/x2F+JqqfTkIxT/dB2d FQFQsjJIIgub4MJrw34ofxGzyzS5PvvjTHcA+htX+jradmPzE06dWSzUOBj4spNVjpgr qAdfNg4K6ERb1YtD3UWgbKaJ5hFB0Gm3MRR63rhc4zzveBkg8tNNew4GpK+gnyOZo+b+ Kqh5BI5haLMTtqCjfYUknS0y//J6fDDs/WW4Y3z/HZrTdexcCQEUUP4P1pgens3tBNKQ NtOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=9vE/l4BK0Hzhm5QEMoRPaUFTfpj5ecEvrIy048jmN+U=; b=WlOVWSA6Gbo3wbKwPvtB4XZkTnWwM8ZN/LB+VtL1+KInstQ2kFZl9mOoTkxlBQwGB7 8Oh1Rgu1FLnnbBWiE7j0/68Hnc/jzrsW8eaVTyIGd94z1ogBg90IEwrgKij6F9jKVUBw namxVYqMpwwtalxM2w51nj+0S0GHKfmXConzPLY+kiP7VtzekH9GqsT9gD4QBv2pFlVZ VoHb7KxTb6KYdfbeXIok7SuRDDp97JAjQkGu0NPU458UW+JFDI+YLRuut9ylD0OecSAe r7OEcpXYDpXumJDvYxaylzt0Ot/lwF64DCHt9qWH5OT2nUh6qc60WApXz+tXw7jvr0GV mnPA== X-Gm-Message-State: APjAAAUGhSdie6zIPp2sworV0kG7UtLanxdHVWVQvw9EfHrn0crV0Y4X PMD2UtSBOsa4aRQ3FDp0LcgA6LM= X-Google-Smtp-Source: APXvYqzm5PJBn0dICKy5qs/oJVXOb/2RBF2D5PW0/4E7UaNOLUKbNm+5hEFleoW9TLGQt0es2LVsTw== X-Received: by 2002:a1c:f60e:: with SMTP id w14mr6063561wmc.188.1582730411152; Wed, 26 Feb 2020 07:20:11 -0800 (PST) Received: from [192.168.160.122] ([160.80.212.158]) by smtp.gmail.com with ESMTPSA id q12sm3841617wrg.71.2020.02.26.07.20.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Feb 2020 07:20:10 -0800 (PST) To: bug-guile@gnu.org From: "franco.rcr@gmail.com" Subject: gnutls guile bug receiving https data Message-ID: <7923a31f-d916-01e9-be04-44bf1f131b2a@gmail.com> Date: Wed, 26 Feb 2020 16:20:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: it X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 26 Feb 2020 10:21:21 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Hello, I installed gnutls for guile and checked the gnutls module with this simple code: ;;Guile version 3.0 and gnutls  from git ,show version GNU Guile 3.0.0.15-ff14b7 (gnutls-version) $6 = "3.6.12" ;;Now, submitting this simple https request, you get an exception (http-request "https://www.google.com") ice-9/boot-9.scm:1669:16: In procedure raise-exception: Throw to key `gnutls-error' with args `(# read_from_session_record_port)'. ;;instead, without https there are no errors (http-request "http://www.google.com") ;;works fine. The error happens only on https://www.google.com and does not throw with a lot of other https web sites. Furthermore the error is not throw if the method is HEAD, so it is related to the data part of the https answer. I tried to enter in the internal implementation of the http web client but after some tests I decided to do some simple tests at application level. I rewrote the get-bytevector-all, with a loop that reads one byte per time and the error was thrown anyway. I catched the error and I've got the complete answer from the google web server. In the following there is my applicative solution, where I rewrote the get-bytevector-all by adding the error checking and specifiyng to http-request that the data has to be returned as a port (#:streaming? #t). ;;A macro to catch errors (define-syntax my-noerr   (syntax-rules ()     ((_ __error-return exp ...)      (let          ((__st #f))        (catch #t          (lambda() exp ...)          (lambda (k . p) __error-return)))))) ;;The rewriting of get-bytevector-all (defun get-bytevector-all (port)   (u8-list->bytevector (let loop ((port port))      (let ((v (my-noerr (eof-object) (get-u8 port))))        (if (eof-object? v)        #nil        (cons v (loop port))))))) ;;the piece of code that now gives the correct result   (let-values (((a b)(http-request "https://www.google.com" #:streaming? #t)))     (bytevector->string (get-bytevector-all b) "ISO-8859-1")) As conclusion I can say that web modules read correctly the http answers and, with some (one for me, the google web site) https sites there is a misinterpretation of EOF in the layer between http and https. Franco. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 03 15:52:08 2020 Received: (at 39800) by debbugs.gnu.org; 3 Mar 2020 20:52:08 +0000 Received: from localhost ([127.0.0.1]:40060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j9EWO-0000sn-1J for submit@debbugs.gnu.org; Tue, 03 Mar 2020 15:52:08 -0500 Received: from fanzine.igalia.com ([178.60.130.6]:51937) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j9EWK-0000s4-S8 for 39800@debbugs.gnu.org; Tue, 03 Mar 2020 15:52:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=Q/EUypPXmIxr9C9K3THCbPYpqz2DMJE99gITE3YAfEI=; b=JZDPb6d7x9FGro05ylGLeiEfe4myisuCnWVTSDcJjkTBIkMHzQbcpsyOT6TK8FfWbp1vkN6Eqv9XtxnTI5qs+Az0AF9h2+HSRgbOYmGnLHJWIH9a+MJ24uHLnnE6tmrca1qoB/EBvakcAPgy9e7kImMGRNG34g7gfjIVIBn70Mak5nVazAG7npRxX/RvcleqirodqWsOAtF/RYlSFUuMHt+QvUh9zzkYZMpcsyDSU3Y/fmhrjmXQFN8ZQc0N5FKkPpTy8iSAQ7cEdPq5L6HoXx6UOLL5Ncbyvfn9RL7LiUHJQlZkvuVMpCCrxlokZFdJ4lMDTJkTE0M3VNgZBOatKw==; Received: from [88.123.12.110] (helo=sparrow) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1j9EWD-0001cF-QA; Tue, 03 Mar 2020 21:51:58 +0100 From: Andy Wingo To: "franco.rcr\@gmail.com" Subject: Re: bug#39800: gnutls guile bug receiving https data References: <7923a31f-d916-01e9-be04-44bf1f131b2a@gmail.com> Date: Tue, 03 Mar 2020 21:51:47 +0100 In-Reply-To: <7923a31f-d916-01e9-be04-44bf1f131b2a@gmail.com> (franco's message of "Wed, 26 Feb 2020 16:20:09 +0100") Message-ID: <87o8td17rw.fsf@igalia.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39800 Cc: ludo@gnu.org, 39800@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thanks very much for the report! I think this one may be a good one for Ludovic, if I may be so bold. Apologies for the top-post but I couldn't clip your excellent report. Cheers, Andy "franco.rcr@gmail.com" writes: > Hello, > I installed gnutls for guile and checked the gnutls module with this > simple code: > > > ;;Guile version 3.0 and gnutls=C2=A0 from git > > ,show version > GNU Guile 3.0.0.15-ff14b7 > > (gnutls-version) > $6 =3D "3.6.12" > > ;;Now, submitting this simple https request, you get an exception > (http-request "https://www.google.com") > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Throw to key `gnutls-error' with args `(# connessione TLS non =C3=83=C2=A8 stata terminata in modo corretto.> > read_from_session_record_port)'. > > ;;instead, without https there are no errors > (http-request "http://www.google.com") ;;works fine. > > > The error happens only on https://www.google.com and does not throw with > a lot of other https web sites. > Furthermore the error is not throw if the method is HEAD, so it is > related to the data part of the https answer. > I tried to enter in the internal implementation of the http web client > but after some tests I decided to do some simple tests at application > level. > I rewrote the get-bytevector-all, with a loop that reads one byte per > time and the error was thrown anyway. > I catched the error and I've got the complete answer from the google web > server. > > In the following there is my applicative solution, where I rewrote the > get-bytevector-all by adding the error checking and specifiyng to > http-request that the data has to be returned as a port (#:streaming? > #t). > > > ;;A macro to catch errors > (define-syntax my-noerr > =C2=A0 (syntax-rules () > =C2=A0=C2=A0=C2=A0 ((_ __error-return exp ...) > =C2=A0=C2=A0=C2=A0=C2=A0 (let > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((__st #f)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (catch #t > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda() exp ...) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda (k . p) __error-= return)))))) > > ;;The rewriting of get-bytevector-all > (defun get-bytevector-all (port) > =C2=A0 (u8-list->bytevector (let loop ((port port)) > =C2=A0=C2=A0=C2=A0=C2=A0 (let ((v (my-noerr (eof-object) (get-u8 port)))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (eof-object? v) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #nil > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cons v (loop port))))))) > > ;;the piece of code that now gives the correct result > =C2=A0 (let-values (((a b)(http-request "https://www.google.com" #:stream= ing? > #t))) > =C2=A0=C2=A0=C2=A0 (bytevector->string (get-bytevector-all b) "ISO-8859-1= ")) > > As conclusion I can say that web modules read correctly the http answers > and, with some (one for me, the google web site) https sites there is a > misinterpretation of EOF in the layer between http and https. > > Franco. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 17:46:45 2020 Received: (at 39800-done) by debbugs.gnu.org; 6 Mar 2020 22:46:45 +0000 Received: from localhost ([127.0.0.1]:45987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jALjx-0005IK-1U for submit@debbugs.gnu.org; Fri, 06 Mar 2020 17:46:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jALju-0005I6-QG for 39800-done@debbugs.gnu.org; Fri, 06 Mar 2020 17:46:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jALjp-0002oD-KQ; Fri, 06 Mar 2020 17:46:37 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=59712 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jALjp-0000VW-6j; Fri, 06 Mar 2020 17:46:37 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: "franco.rcr\@gmail.com" Subject: Re: bug#39800: gnutls guile bug receiving https data References: <7923a31f-d916-01e9-be04-44bf1f131b2a@gmail.com> Date: Fri, 06 Mar 2020 23:46:35 +0100 In-Reply-To: <7923a31f-d916-01e9-be04-44bf1f131b2a@gmail.com> (franco's message of "Wed, 26 Feb 2020 16:20:09 +0100") Message-ID: <87sgilje44.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39800-done Cc: 39800-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, "franco.rcr@gmail.com" skribis: > ;;Now, submitting this simple https request, you get an exception > (http-request "https://www.google.com") > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Throw to key `gnutls-error' with args `(# connessione TLS non =C3=83=C2=A8 stata terminata in modo corretto.> > read_from_session_record_port)'. That happens when passing #:keep-alive? #f (the default), specifically when reading the response body: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (http-request "https://www.google.com" #:keep-alive? #= f #:streaming? #t) $1 =3D #< version: (1 . 1) code: 200 reason-phrase: "OK" headers:= ((date . #) (expires . #) (cache-control = private (max-age . 0)) (content-type text/html (charset . "ISO-8859-1")) (p= 3p . "CP=3D\"This is not a P3P policy! See g.co/p3phelp for more info.\"") = (server . "gws") (x-xss-protection . "0") (x-frame-options . "SAMEORIGIN") = (set-cookie . "1P_JAR=3D2020-03-06-21; expires=3DSun, 05-Apr-2020 21:45:56 = GMT; path=3D/; domain=3D.google.com; Secure") (set-cookie . "NID=3D199=3DyX= gE_KAGvxJbZAIGEXLt8CsEe3pre-RRLm1Jqap3b3iJRqZZq_PJ9wCT798mfDZ2TC5_3mKnM5KAB= Sh8CguI64SsNoWHIc9EsW2osFltsIJnMswXhrtjQFDpfm_fUb6RDrWrqKHkOuvkG7Izp5im1Ys1= TzGdztrFmOQV4FOraJk; expires=3DSat, 05-Sep-2020 21:45:56 GMT; path=3D/; dom= ain=3D.google.com; HttpOnly") (alt-svc . "quic=3D\":443\"; ma=3D2592000; v= =3D\"46,43\",h3-Q050=3D\":443\"; ma=3D2592000,h3-Q049=3D\":443\"; ma=3D2592= 000,h3-Q048=3D\":443\"; ma=3D2592000,h3-Q046=3D\":443\"; ma=3D2592000,h3-Q0= 43=3D\":443\"; ma=3D2592000") (accept-ranges none) (vary accept-encoding) (= connection close)) port: #> $2 =3D # scheme@(guile-user)> (define bv (get-bytevector-all $2)) ice-9/boot-9.scm:1669:16: In procedure raise-exception: Throw to key `gnutls-error' with args `(# read_from_session_record_port)'. --8<---------------cut here---------------end--------------->8--- The reason for this is that google.com closes the connection right away, without sending a proper TLS =E2=80=9Cbye=E2=80=9D message as is convention= ally done. Fixed in commit 076276c4f580368b4106316a77752d69c8f1494a, which will be in 3.0.1. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 07 10:06:40 2020 Received: (at control) by debbugs.gnu.org; 7 Mar 2020 15:06:40 +0000 Received: from localhost ([127.0.0.1]:47315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAb2F-0005Fv-W5 for submit@debbugs.gnu.org; Sat, 07 Mar 2020 10:06:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAb2E-0005Fi-7X for control@debbugs.gnu.org; Sat, 07 Mar 2020 10:06:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAb27-0001we-Ea for control@debbugs.gnu.org; Sat, 07 Mar 2020 10:06:31 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=60274 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAb22-00056Z-EA for control@debbugs.gnu.org; Sat, 07 Mar 2020 10:06:31 -0500 Date: Sat, 07 Mar 2020 16:06:24 +0100 Message-Id: <87blp8jjbj.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #39800 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) retitle 39800 (web client) gracelessly handles premature TLS connection termination quit From unknown Sat Aug 16 18:42:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 05 Apr 2020 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator