download-file: Limit to http or https urls only
This commit is contained in:
@@ -41,6 +41,11 @@
|
||||
(list->string result)))
|
||||
|
||||
(define (download-file url . download-path)
|
||||
(when (< (string-length url) 4)
|
||||
(error "download-file error: url too short" url))
|
||||
(when (and (not (string=? (string-copy url 0 4) "http"))
|
||||
(not (string=? (string-copy url 0 5) "https")))
|
||||
(error "download-file error: only http or https urls supported" url))
|
||||
(when (not (string? url))
|
||||
(error "download-file error: url must be string" url))
|
||||
(when (and (not (null? download-path))
|
||||
@@ -55,9 +60,6 @@
|
||||
(file-mode-cbv (string->c-bytevector "w"))
|
||||
(to-file-cbv (c-fopen to-path-cbv file-mode-cbv))
|
||||
(url-cbv (string->c-bytevector url)))
|
||||
(display "HERE: to-path ")
|
||||
(write to-path)
|
||||
(newline)
|
||||
(when (c-bytevector-null? to-file-cbv)
|
||||
(let* ((error-message "download-file error")
|
||||
(error-pointer (string->c-bytevector error-message)))
|
||||
|
||||
@@ -1 +1 @@
|
||||
Download file
|
||||
Download file using HTTP or HTTPS.
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.1.0
|
||||
1.0.0
|
||||
|
||||
Reference in New Issue
Block a user