unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26314: [PATCH] substitute: Send ‘User-Agent’ header.
@ 2017-03-30 18:44 Tobias Geerinckx-Rice
  2017-03-31  8:12 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-03-30 18:44 UTC (permalink / raw)
  To: 26314

* guix/scripts/substitute.scm (narinfo-request): Pass ‘User-Agent’ #:headers
to ‘build-request’.
---

Guix,

This makes the User-Agent sent to substitute servers consistent.

Currently, ‘http-fetch’ (used to download .nars) sets it to ‘GNU Guile’,
while http-multiple-get (used to download .narinfos) leaves it empty.

(This brings the number of scattered '"GNU Guile"' user-agent settings
 in Guix to 5, but moving it to %guix-default-http-user-agent does not
 strike me as a meaningful improvement.)

Kind regards,

T G-R

 guix/scripts/substitute.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index faeb01912..d3bccf4dd 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -520,8 +520,9 @@ indicates that PATH is unavailable at CACHE-URL."
 (define (narinfo-request cache-url path)
   "Return an HTTP request for the narinfo of PATH at CACHE-URL."
   (let ((url (string-append cache-url "/" (store-path-hash-part path)
-                            ".narinfo")))
-    (build-request (string->uri url) #:method 'GET)))
+                            ".narinfo"))
+        (headers '((User-Agent . "GNU Guile"))))
+    (build-request (string->uri url) #:method 'GET #:headers headers)))
 
 (define* (http-multiple-get base-uri proc seed requests
                             #:key port (verify-certificate? #t))
-- 
2.37.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#26314: [PATCH] substitute: Send ‘User-Agent’ header.
  2017-03-30 18:44 bug#26314: [PATCH] substitute: Send ‘User-Agent’ header Tobias Geerinckx-Rice
@ 2017-03-31  8:12 ` Ludovic Courtès
  2017-03-31 13:42   ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-03-31  8:12 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: 26314

Heya!

Tobias Geerinckx-Rice <me@tobias.gr> skribis:

> * guix/scripts/substitute.scm (narinfo-request): Pass ‘User-Agent’ #:headers
> to ‘build-request’.
> ---
>
> Guix,
>
> This makes the User-Agent sent to substitute servers consistent.
>
> Currently, ‘http-fetch’ (used to download .nars) sets it to ‘GNU Guile’,
> while http-multiple-get (used to download .narinfos) leaves it empty.

Sounds good to me.

Did the lack of ‘User-Agent’ cause you any problems?

> (This brings the number of scattered '"GNU Guile"' user-agent settings
>  in Guix to 5, but moving it to %guix-default-http-user-agent does not
>  strike me as a meaningful improvement.)

Agreed.  :-)

Go for it!

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#26314: [PATCH] substitute: Send ‘User-Agent’ header.
  2017-03-31  8:12 ` Ludovic Courtès
@ 2017-03-31 13:42   ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-03-31 13:42 UTC (permalink / raw)
  To: ludo; +Cc: 26314-done


[-- Attachment #1.1: Type: text/plain, Size: 353 bytes --]

Ludo',

On 31/03/17 10:12, Ludovic Courtès wrote:
> Did the lack of ‘User-Agent’ cause you any problems?

I recently got stuck behind an alt-right proxy that didn't seem to like
it, and had to hack a tunnel through it. I hope such things are rare.

> Go for it!

Pushed as f264e838c0f8b63e93cd7b8a9d5d8e2208d82467.

Thanks!

T G-R


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 504 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-31 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 18:44 bug#26314: [PATCH] substitute: Send ‘User-Agent’ header Tobias Geerinckx-Rice
2017-03-31  8:12 ` Ludovic Courtès
2017-03-31 13:42   ` Tobias Geerinckx-Rice

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).