swh: Adjust for compatibility with Guile 2.2's (web client).
authorLudovic Courtès <ludo@gnu.org>
Wed, 5 May 2021 09:34:20 +0000 (11:34 +0200)
committerLudovic Courtès <ludo@gnu.org>
Wed, 5 May 2021 14:56:43 +0000 (16:56 +0200)
Guile <= 2.2.7 did not support #:verify-certificate? so work around it.

* guix/swh.scm (http-get*, http-post*) [! guile-3]: Add variant for
Guile 2.2.

guix/swh.scm

index 2402ec9..3005323 100644 (file)
       url
       (string-append url "/")))
 
-;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would
-;; be ignored (<https://bugs.gnu.org/40486>).
-(define* (http-get* uri #:rest rest)
-  (apply http-request uri #:method 'GET rest))
-(define* (http-post* uri #:rest rest)
-  (apply http-request uri #:method 'POST rest))
+(cond-expand
+  (guile-3
+   ;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would
+   ;; be ignored (<https://bugs.gnu.org/40486>).
+   (define* (http-get* uri #:rest rest)
+     (apply http-request uri #:method 'GET rest))
+   (define* (http-post* uri #:rest rest)
+     (apply http-request uri #:method 'POST rest)))
+  (else                                           ;Guile 2.2
+   ;; Guile 2.2 did not have #:verify-certificate? so ignore it.
+   (define* (http-get* uri #:key verify-certificate? streaming?)
+     (http-request uri #:method 'GET #:streaming? streaming?))
+   (define* (http-post* uri #:key verify-certificate? streaming?)
+     (http-request uri #:method 'POST #:streaming? streaming?))))
 
 (define %date-regexp
   ;; Match strings like "2014-11-17T22:09:38+01:00" or