From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mC+qH2WsaWF2CAEAgWs5BA (envelope-from ) for ; Fri, 15 Oct 2021 18:29:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EC8tG2WsaWFCSQAAbx9fmQ (envelope-from ) for ; Fri, 15 Oct 2021 16:29:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4025E125D7 for ; Fri, 15 Oct 2021 18:29:25 +0200 (CEST) Received: from localhost ([::1]:52186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbQ5E-0008Vk-Et for larch@yhetil.org; Fri, 15 Oct 2021 12:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbQ51-0008VX-VC for guix-devel@gnu.org; Fri, 15 Oct 2021 12:29:11 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:41477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbQ50-00043B-97 for guix-devel@gnu.org; Fri, 15 Oct 2021 12:29:11 -0400 Received: by mail-qk1-x72f.google.com with SMTP id r15so8978100qkp.8 for ; Fri, 15 Oct 2021 09:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=QkkmfCQImKykY8TjCMk7Z0Rryj3fn4nYn0HAI640fRU=; b=pZKk6eBHSADccrzIpxpXcuq5O9PumV5tTEXS9Atx08ZZuyjzOtBqYKD4+2dL1/dPbm fC0E3e5e9DCNZuijAlo7ZBSAW2UkDJXFMjkbPAvlQw/JxEsffRYnJ+lWvGwEr39wpatu sStFBOz84RSKxkss/sBWcMuH+C2ZZYjtMCdjTi+i7I5YOoMLQruYXvP/bhESLiAzfbUi Q7DfjZ4Q24gA+lnbz8Vw0n3Upk8n8G8fIEbTkBbdkDUBEGwPo5wQGSfJK4Bjw3MpP3QO IMJoXEfHG+9pBbV5njuZf8BzDl3RrLK5CSWPcaCeYCneIy3TwPBAQ2Vs2j4xshMqi188 HcZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=QkkmfCQImKykY8TjCMk7Z0Rryj3fn4nYn0HAI640fRU=; b=2kis8BZRx6WLCB3+Bpapbp7L1OeMbN+qI+Om5uH+1D3RkNEq58JYAq5pjpPFjhDIpz akriYZu3n+olyCyr5gj1whCFq9sW03+gFJJXeAkx/sYCfYnvzx3daKPdEK1KSJmvpdmQ RpEHhtJ5hN4UmS6KK6eWHaiu/6IbAEv6zcYWIjNbvDioTkJwr60khnxHvBXLrFQ6ZDwJ q+V63fRQE61tKgTqMkp+j6E4s1WyLLU8vJyzzpjpXDyi88XWMxKABr+ZBHlk/EJPQurJ G+yy5PvGHwruX5PbB0pgxsnJFjO3TAoi4MLNUAApXudG1cC2DnDa4UKOZXEfBR41Qt6R 5zBQ== X-Gm-Message-State: AOAM531owgzM54QwSrMjDxp215tKFyG75Lxc4GTx+xMEoT8xkjTAnDik NkPbwIbLaL6J2Tr1/DpaQcEoUqmv8AiqoA== X-Google-Smtp-Source: ABdhPJxwuzxxEmV2dwsupFx1X+QsUvLi6tt04HHpkSgwKg+qh/zEgm1ckIvWU98jGStub0xSBfiMBA== X-Received: by 2002:a37:ae43:: with SMTP id x64mr10722822qke.55.1634315349030; Fri, 15 Oct 2021 09:29:09 -0700 (PDT) Received: from hurd (dsl-10-146-97.b2b2c.ca. [72.10.146.97]) by smtp.gmail.com with ESMTPSA id o190sm2792204qka.16.2021.10.15.09.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 09:29:08 -0700 (PDT) From: Maxim Cournoyer To: zimoun Subject: Re: issue with SWH ratelimit (authorization via HTTP header) References: <86tuhjpif8.fsf@gmail.com> <86o87rph1g.fsf@gmail.com> Date: Fri, 15 Oct 2021 12:29:06 -0400 In-Reply-To: <86o87rph1g.fsf@gmail.com> (zimoun's message of "Thu, 14 Oct 2021 21:01:15 +0200") Message-ID: <87h7dil0a5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x72f.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: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634315365; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=QkkmfCQImKykY8TjCMk7Z0Rryj3fn4nYn0HAI640fRU=; b=jZBDxvMyg217C0R4FsO4QOaAKRpgxrzEGa/LnRqrjLfq+V/CS5NfHjtrL4t40B0YU9WU9s CyhjaSmFEXb8ue8Na6JJPO0hxzePNKMVntIJoVkVF9xbwoyb229V0F51s0RUsyW9gl/kV3 MikTzFZ1zfOzeX9hAfxcpmN0ByRrTJsvqi4+ZSko3z61wx7dRYqc9anfftJCjt7PbZbH4n mfzv1W0Bfd52EFyyZsPlApr9cG/RVuN0bT4d9G1EEGKUbB55Hvga3cNc6vDgH1GVPD6bot JVYtxUb6H/LaWpJmkA6amd9WxL4gCeX5FtoTPldLXMWNNxQjZGI4KHHjVmjSng== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634315365; a=rsa-sha256; cv=none; b=Zt5L3pUypmgU0Q2Jz7W5zujHhlLrDVz5hjGR3sGGXOczoeaql1rlvuXNPONCGBj4FZnAoY RfXqvX+D/FlaexV/G1+yemF21SSdujUSDwoA5iJ7VYIOd9G6/rWcp4fEteiiiR2/7KY/Zv vX05RTII5YvNAwJJSXLSGjWuVuuxvRFOgIIv/PS+RBnSxSs9/78GSD7ENt7lsrL95qj//T v4LaPAvuaYVD3D7fds/wCt8vbKfiLQMJdpcH56+xD1cyq5EPCPyYPZSud/uJB3Tks1Sc1o M4B5x7UBrcaaIBPQSvw/lAbUl6DOlMqn1Te6gr0NkgpcLTOVpP3oXceJgWo0Dw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pZKk6eBH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.51 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pZKk6eBH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 4025E125D7 X-Spam-Score: -2.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: +kP9k5bpZ2yx Hello, zimoun writes: > Hi, > > Thanks to Ricardo on #guix-hpc, the issue is: > > `((authorization . (Bearer ,token)))) > > and not =E2=80=99bearer=E2=80=99. Maybe the process can help. > > It is misleading because the documentation [1] says to use: > > Enter `,help' for help. > scheme@(guix-user)> ,use(web http) > scheme@(guix-user)> (parse-header 'authorization "Bearer eyJh=E2=80=A6") > $1 =3D (bearer eyJh=E2=80=A6) > > > But it is not what > > (http-request URL #:method 'POST #:headers `((authorization . (bearer= ,token)))) > > returns. > > Let open a terminal and run =E2=80=99emacs-simple-httpd=E2=80=99 as serve= r. The buffer > *httpd* lists what is happening. In another terminal, let run the > request above. Tadam! > > (request > (date "Thu, 14 Oct 2021 18:41:51 GMT") > (address "127.0.0.1") > (get "/") > (headers > ("POST" "/" "HTTP/1.1") > ("Host" "localhost:8080") > ("Connection" "close") > ("Authorization" "Bearer eyJh=E2=80=A6$ > ("Content" "")) > > > Now, with the correct header, it works: > > scheme@(guix-user)> ,use(web client) > scheme@(guix-user)> (http-request "https://archive.softwareheritage.org/a= pi/1/stat/counters/" #:method 'POST #:headers `((authorization . (Bearer ,t= oken)))) > $2 =3D #< version: (1 . 1) code: 405 reason-phrase: "Method Not= Allowed" headers: ((date . #) (server . "gunicorn/19.9.= 0") (content-type application/json) (vary accept cookie) (allow GET OPTIONS= HEAD OPTIONS) (x-ratelimit-limit . "1200") (x-ratelimit-remaining . "137")= (x-ratelimit-reset . "1634237954") (x-frame-options . "SAMEORIGIN") (conte= nt-length . 72) (via "1.1 archive.softwareheritage.org") (x-varnish . "3577= 2607") (age . 0) (via "1.1 varnish (Varnish/6.1)") (strict-transport-securi= ty . "max-age=3D15768000;") (connection close)) port: #> > $4 =3D #vu8(123 34 101 120 99 101 112 116 105 111 110 34 58 34 77 101 116= 104 111 100 78 111 116 65 108 108 111 119 101 100 34 44 34 114 101 97 115 = 111 110 34 58 34 77 101 116 104 111 100 32 92 34 80 79 83 84 92 34 32 110 1= 11 116 32 97 108 108 111 119 101 100 46 34 125) Cool debugging session! Thanks for sharing, Maxim