From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.user Subject: Re: open-socket-for-uri returns string, but integer is needed Date: Sat, 30 Jan 2021 11:23:50 -0800 Message-ID: References: <20210130073542.Horde.fnEmi9P7VryWvgZpnJCOvPv@www.stihie.net> <20210130092300.Horde.SbZuJPXArIaP1-IqlxpsQAz@www.stihie.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2596"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: mbcladwell@stihie.net Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jan 30 20:24:19 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5vr1-0000bD-IF for guile-user@m.gmane-mx.org; Sat, 30 Jan 2021 20:24:19 +0100 Original-Received: from localhost ([::1]:46852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5vr0-0007YV-KA for guile-user@m.gmane-mx.org; Sat, 30 Jan 2021 14:24:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5vqp-0007Y9-KR for guile-user@gnu.org; Sat, 30 Jan 2021 14:24:07 -0500 Original-Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:35701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5vqm-0007kd-5a for guile-user@gnu.org; Sat, 30 Jan 2021 14:24:06 -0500 Original-Received: by mail-pj1-x102f.google.com with SMTP id e9so8587532pjj.0 for ; Sat, 30 Jan 2021 11:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=jQRQCge0d7lNK9u8y8kjOvolJgyvYrregKbQ3cVzcAo=; b=m0qJnVUpY6bZJ1I8QrGXFXdy5E6xXR0iwCyGMnOckze5IGTB6hn3C31Uc3zoQOPbU0 kbiC906M0bPqX5G2lrFhPmb4vh6bsFvlidNR+IXsOiasrCBNtHTpl4xiq9rEvS8LIhKx 0lHVratuQRUbTc+Toe0PsqFxcqAbcDnS/VpQOEt+M5prdb161ZeFXSq3uFOmHpkqFQLP yAkgDVi0PbioO1f0rKqIt215irQ326VrudhRyTtJ2n+sKG4l5sREzLXaFjzc5XXvRyLs /VzqKOf89Fs5lo5I9wdgWm1/8F+JS4as2IucGQXeLJDxL9XN6lzyqfLEui/Ng6KdGGwf 9VQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=jQRQCge0d7lNK9u8y8kjOvolJgyvYrregKbQ3cVzcAo=; b=H0nAm27yBve1cTQtc4vvvkRYKAj1Lf/eYEYMWWrr63UzY9LuTG2Al2FBfmO6KPLbLD twWVfb7vANwqdC4WkA36UTM1/cU15lDg1jdiGwY7DMdrzWfPOfXioszyG6tPs5rwZq/H cEAvDMXWlneRcIcx80FNByGkDuelqnqaqc+bLElGVL+5DpAHLUTo4aL8HCW3OwJGmHAz EyoF/621fGZwP+fRQj4q8X2uymxeHJIvRAaXEgxPVhpW7O0ftNxFRqq/oXpRqE9BAEjz yM2R/PUq7YRnO0m8R2quijS87PNWQGELjCPcW4vQWVzER1Uc2ZqPzjcqLIQJXY6AorrS OKew== X-Gm-Message-State: AOAM530sJK6kpox6V7sMfH3637DxSFxbgB5t+1lE7Ky1q0kFTYVepoGR yy9OMsvb6mP9aGyTRHI3YSv03OSqPCDfESelzWc= X-Google-Smtp-Source: ABdhPJzO64i/GTTMYDR/YS/gdmSHyYO6nBdfnQW6DqcPc6reqqcedwW3LLuMwBq5Bt2Hd60bQPS/xvQ13b/jS2N5iaw= X-Received: by 2002:a17:90a:f2c6:: with SMTP id gt6mr9959240pjb.35.1612034641348; Sat, 30 Jan 2021 11:24:01 -0800 (PST) In-Reply-To: <20210130092300.Horde.SbZuJPXArIaP1-IqlxpsQAz@www.stihie.net> Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=aconchillo@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17208 Archived-At: Hi, I've tried this on macOS and I get the following (note the port type is not socket, but neither file): scheme@(guile-user)> (open-socket-for-uri "https://blockchain.info/q/24hrpr= ice") $7 =3D # If I do the following I get an error (see below): scheme@(guile-user)> (define s (open-socket-for-uri "https://blockchain.info/q/24hrprice")) wait a bit... then: scheme@(guile-user)> (http-request "https://blockchain.info/q/24hrprice" #:port s) ice-9/boot-9.scm:1669:16: In procedure raise-exception: Bad Read-Header-Line header: # However, if I do the following: scheme@(guile-user)> (http-request "https://blockchain.info/q/24hrprice" #:port (open-socket-for-uri "https://blockchain.info/q/24hrprice")) The request works fine. So, if I do the following quickly enough: scheme@(guile-user)> (define s (open-socket-for-uri "https://blockchain.info/q/24hrprice")) scheme@(guile-user)> (http-request "https://blockchain.info/q/24hrprice" #:port s) it works fine. So it seems a timing issue. What is exactly failing and when in your case? Aleix On Sat, Jan 30, 2021 at 7:23 AM wrote: > > Yes it is installed. > > mbc@HP8300:~$ dpkg -s guile-gnutls > Package: guile-gnutls > Status: install ok installed > > How do I test that it is properly configured? For example I can: > > scheme@(guile-user)> (cdar (json-string->scm (utf8->string (receive > (response-status response-body) > (http-request > "https://api.blockchain.com/v3/exchange/tickers/LTC-USD") > response-body)))) > $1 =3D 134.3 > > Thanks > Mortimer > > Quoting Aleix Conchillo Flaqu=C3=A9 : > > > Hi, > > > > This is just a guess but do you have GnuTLS Guile bindings installed? Y= ou > > are using https on the first one. > > > > In Debian I believe it's guile-gnutls. > > > > Best, > > > > Aleix > > > > > > On Sat, Jan 30, 2021, 5:38 AM wrote: > > > >> > >> Hi, > >> On Debian 10, Guile 3.0.4 I need to create a socket: > >> > >> mbc@HP8300:~$ guile > >> GNU Guile 3.0.4 > >> Copyright (C) 1995-2020 Free Software Foundation, Inc. > >> Enter `,help' for help. > >> scheme@(guile-user)> (use-modules (web client)) > >> scheme@(guile-user)> (open-socket-for-uri > >> "https://blockchain.info/q/24hrprice") > >> $1 =3D # > >> scheme@(guile-user)> (open-socket-for-uri "http://localhost:3000/123") > >> $2 =3D # > >> scheme@(guile-user)> > >> > >> A local http looks good - returns an integer socket. > >> A remote https uri returns file 7f09b60b0e00 which is rejected by > >> downstream functions requiring a port/integer e.g. (http-get .... > >> #:port ) > >> > >> I get the same results on Guile 2.2.7 in a Guix protected environment. > >> What am I doing wrong - how do I get an integer returned? > >> Thanks > >> Mortimer > >> > >> > >> > > >