mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
use curl for GET as well as POST in snow (i(issue #549)
This commit is contained in:
parent
60c4007e6f
commit
0a503dc3ad
3 changed files with 8 additions and 4 deletions
|
@ -1168,7 +1168,7 @@
|
|||
(local-tmp (string-append local-path ".tmp."
|
||||
(number->string (current-second)) "-"
|
||||
(number->string (current-process-id))))
|
||||
(repo-str (utf8->string (resource->bytevector repo-uri)))
|
||||
(repo-str (utf8->string (resource->bytevector cfg repo-uri)))
|
||||
(repo (guard (exn (else #f))
|
||||
(let ((repo (read (open-input-string repo-str))))
|
||||
`(,(car repo) (url ,repo-uri) ,@(cdr repo))))))
|
||||
|
@ -2128,7 +2128,7 @@
|
|||
(install-file cfg (make-path dir src) dest)))
|
||||
|
||||
(define (fetch-package cfg url)
|
||||
(resource->bytevector url))
|
||||
(resource->bytevector cfg url))
|
||||
|
||||
(define (path-strip-top file)
|
||||
(let ((pos (string-find file #\/)))
|
||||
|
|
|
@ -25,10 +25,12 @@
|
|||
(lambda (out)
|
||||
(if (bytevector? x) (write-bytevector x out) (display x out)))))
|
||||
|
||||
(define (resource->bytevector uri)
|
||||
(define (resource->bytevector cfg uri)
|
||||
(let ((uri (if (uri? uri) uri (string->path-uri 'http uri))))
|
||||
(if (uri-host uri)
|
||||
(call-with-input-url uri port->bytevector)
|
||||
(if (conf-get cfg 'use-curl?)
|
||||
(process->bytevector `(curl --silent ,(uri->string uri)))
|
||||
(call-with-input-url uri port->bytevector))
|
||||
(file->bytevector (uri-path uri)))))
|
||||
|
||||
;; path-normalize either a uri or path, and return the result as a string
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
(scheme write)
|
||||
(scheme process-context)
|
||||
(srfi 1)
|
||||
(chibi config)
|
||||
(chibi net http)
|
||||
(chibi pathname)
|
||||
(chibi process)
|
||||
(chibi string)
|
||||
(chibi uri))
|
||||
(cond-expand
|
||||
|
|
Loading…
Add table
Reference in a new issue