From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8HA+Ka1+aGFuKAAAgWs5BA (envelope-from ) for ; Thu, 14 Oct 2021 21:02:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uA3yJK1+aGFsIQAAB5/wlQ (envelope-from ) for ; Thu, 14 Oct 2021 19:02:05 +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 587FCF0B7 for ; Thu, 14 Oct 2021 21:02:05 +0200 (CEST) Received: from localhost ([::1]:49966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mb5zP-00062N-EN for larch@yhetil.org; Thu, 14 Oct 2021 15:02:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mb5yp-00060u-Rg for guix-devel@gnu.org; Thu, 14 Oct 2021 15:01:28 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mb5ym-0004Rt-Qm for guix-devel@gnu.org; Thu, 14 Oct 2021 15:01:27 -0400 Received: by mail-wr1-x42a.google.com with SMTP id u18so22187740wrg.5 for ; Thu, 14 Oct 2021 12:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=FOUvpGBHprB84d3uW6w4rIS/sz1Uyk3pqz2kSKx1SHc=; b=LQshl0ckhCrzbInT3StEu7C4X3AzG/nWZSL5EarPp+E5X9RJwm8mEbQsmmwhQi9t5O NBU9uAaAGmF/Kt20nPEW7yCbL402HefnPPZ4SHX8w+DK3ui6TpNF/iMNAT9VXoapatcf j7OYCZY/jV7ddCncMAqdeLLqhlN7tDIDCQQ1ScrlSWW+i5ynrQ21XHjvcrLv+AGsx9IO c+jrnx8wdepHHzNpg9iPIj7GF+0VKDGbIQmG+1njDG1IUf6IVeOBd5ZNgkxyp217pNnE BJwu/ETX5p1timURyoVQcBAKSKh09CAnQkg2dSwVzg1blvvPyDfzzJmvhvhj4Kt+Q9uc c8AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=FOUvpGBHprB84d3uW6w4rIS/sz1Uyk3pqz2kSKx1SHc=; b=u9O+0gOC5fCIlf5DVY6vuaG2T9wS6bnsyK1XpY1Mr4qK29iP4jCW3I8lrGQ6bWxyDj riYz4A0DZJR2cZq6q0BYeSWce3u0/cqbIvCsqSFsyg48zkimvJUT29eZxQ5TDBi9icb5 MzYkExw2Opd6MuMsYU7g/KWxwDrvzOoxWN4KiA3yZW3hHiwwECVKMu7PZ1hhf1aRH38U jrSfqlP/jj+EpDyeEOQfRnhozUWGSYg8Oz+kxmS0PHqojdS634oL5GX7wPB862OaFPjT gpzCoCrKHaJZ5coGC0kcPTm87flsM7SqVAjHXC4lp0++7Or5/VoRv/c3w0weP+fL/XYA UtlQ== X-Gm-Message-State: AOAM532hNk07MsWn5u2mMW6PU4RzOWuiQ4Z8bhXMcmSDlm6X1VgLhQm3 938TlqAPPMRXzUybwE8OsSHVUBVUW+Y= X-Google-Smtp-Source: ABdhPJzIhh+pE3v025eRrCkX2XABD29JaLVJ4CEIts718yA9fOYhKKH9KRE2tTVoRs0lc35dHXrpgA== X-Received: by 2002:adf:f48a:: with SMTP id l10mr8975913wro.228.1634238083235; Thu, 14 Oct 2021 12:01:23 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id a63sm7061896wmd.34.2021.10.14.12.01.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 12:01:22 -0700 (PDT) From: zimoun To: Guix Devel Subject: Re: issue with SWH ratelimit (authorization via HTTP header) In-Reply-To: <86tuhjpif8.fsf@gmail.com> References: <86tuhjpif8.fsf@gmail.com> Date: Thu, 14 Oct 2021 21:01:15 +0200 Message-ID: <86o87rph1g.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42a.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: , 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=1634238125; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=FOUvpGBHprB84d3uW6w4rIS/sz1Uyk3pqz2kSKx1SHc=; b=arCFtiSPOvLehhg/uHk1ePBguYL94VcHiBXB0/xklOnEXiG2Sc5pD0DZEkzhh2ayAcVEmC xf0F3kk/xKD/t3WXs+qBblvI0BtiQQLTAgvPxS909q+of6mie1LiS1PvypLQGhKf5LdqRH AybmkA3bK6kIKQtY3DgC5fHfuwx/6HbxUjkR0ZoxOM6zNaXazx6WB0bi9ueNDIN+HqClWv Q7J5t5pme2saB44GJGzliaAUqn33QzhVbIEetaOlSnpu6PukffChcQJrMo5IxQs5gsbUzd McUSL0NEX0JZhyKy+ymw+NAH6LgcZ5ov3vV+m1Zzw878EjBtonabUXQgCG0BaQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634238125; a=rsa-sha256; cv=none; b=FOQ01o7yZrGUDr6hANSOcOE5pdTOLeomH9bBBWROe/zJx4UPWxj0q/qv5lJhbyDljU6VCI OHSanbdUj9Kui38MXtIcJfpWl4c4djirkURJ4ZOrGxqlz2lcIaiJkf/dHhXOlft1cESnkh VhDmKqJGngamIMa7aU+vBMzYxC/XZdM/wgGnZQaymIp7LNnGeepAy/3Abk5Aynpm4N27Up KXoWG/7uzlSzZNJcCDrHt3jtBMtYubRzp+sZCz1gePebGWiZ8vXRTOI6xRd5DGwqY9rsE3 DMuKBMa3wjhDMO2OJjX8zY0FN8zOv76ZbS5LyaN/XQWDt2YRoEdwQ3V3U+VCGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LQshl0ck; 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: -4.02 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LQshl0ck; 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: 587FCF0B7 X-Spam-Score: -4.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: Bf/uFr+Fc9c0 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: --8<---------------cut here---------------start------------->8--- 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) --8<---------------cut here---------------end--------------->8--- 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 server.= The buffer *httpd* lists what is happening. In another terminal, let run the request above. Tadam! --8<---------------cut here---------------start------------->8--- (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" "")) --8<---------------cut here---------------end--------------->8--- Now, with the correct header, it works: --8<---------------cut here---------------start------------->8--- scheme@(guix-user)> ,use(web client) scheme@(guix-user)> (http-request "https://archive.softwareheritage.org/api= /1/stat/counters/" #:method 'POST #:headers `((authorization . (Bearer ,tok= en)))) $2 =3D #< version: (1 . 1) code: 405 reason-phrase: "Method Not A= llowed" headers: ((date . #) (server . "gunicorn/19.9.0"= ) (content-type application/json) (vary accept cookie) (allow GET OPTIONS H= EAD OPTIONS) (x-ratelimit-limit . "1200") (x-ratelimit-remaining . "137") (= x-ratelimit-reset . "1634237954") (x-frame-options . "SAMEORIGIN") (content= -length . 72) (via "1.1 archive.softwareheritage.org") (x-varnish . "357726= 07") (age . 0) (via "1.1 varnish (Varnish/6.1)") (strict-transport-security= . "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 1= 04 111 100 78 111 116 65 108 108 111 119 101 100 34 44 34 114 101 97 115 11= 1 110 34 58 34 77 101 116 104 111 100 32 92 34 80 79 83 84 92 34 32 110 111= 116 32 97 108 108 111 119 101 100 46 34 125) --8<---------------cut here---------------end--------------->8--- Cheers, simon 1: