[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz 4588884c11 10/81: Changes
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz 4588884c11 10/81: Changes |
Date: |
Wed, 11 May 2022 17:57:58 -0400 (EDT) |
branch: externals/plz
commit 4588884c11ab88fb3418c875ee6c62ff859f08ec
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Changes
---
plz.el | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/plz.el b/plz.el
index e8acf3dde0..855df410ac 100644
--- a/plz.el
+++ b/plz.el
@@ -162,23 +162,25 @@
'("--silent"
"--compressed"
"--location"
- ;; TODO: Move timeout to a defcustom and use a function to build args list.
- "--connect-timeout" "5"
"--dump-header" "-")
"Default arguments to curl."
:type '(repeat string))
+(defcustom plz-connect-timeout 5
+ "Default connection timeout in seconds."
+ :type 'number)
+
;;;; Functions
-(cl-defun plz-get (url &key headers _connect-timeout sync
- success error)
- ;; TODO: Handle connect-timeout argument.
+(cl-defun plz-get (url &key headers sync success error
+ (connect-timeout plz-connect-timeout))
"Get HTTP URL with curl.
If SYNC is non-nil, return the response object; otherwise, return
the curl process object.
HEADERS may be an alist of extra headers to send with the
-request.
+request. CONNECT-TIMEOUT may be a number of seconds to timeout
+the initial connection attempt.
For asynchronous requests, SUCCESS and ERROR should be callback
functions, called when the curl process finishes with a single
@@ -186,18 +188,19 @@ argument: the `plz-response' object."
(plz--request 'get url
:sync sync
:headers headers
- ;; :connect-timeout timeout
+ :connect-timeout connect-timeout
:success success
:error error))
-(cl-defun plz--request (_method url &key headers _connect-timeout sync
+(cl-defun plz--request (_method url &key headers connect-timeout sync
success error)
"Return process or response for HTTP request to URL.
If SYNC is non-nil, return the response object; otherwise, return
the curl process object.
HEADERS may be an alist of extra headers to send with the
-request.
+request. CONNECT-TIMEOUT may be a number of seconds to timeout
+the initial connection attempt.
For asynchronous requests, SUCCESS and ERROR should be callback
functions, called when the curl process finishes with a single
@@ -208,6 +211,8 @@ argument: the `plz-response' object."
(header-args (cl-loop for (key . value) in headers
collect (format "--header %s: %s" key value)))
(curl-args (append plz-curl-default-args header-args
+ (when connect-timeout
+ (list "--connect-timeout" (number-to-string
connect-timeout)))
(list url))))
(pcase sync
(`nil (plz-request--async curl-args :success success :error error))
- [elpa] externals/plz 0b32c64f77 74/81: Notes: Rename file, (continued)
- [elpa] externals/plz 0b32c64f77 74/81: Notes: Rename file, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 7e456638a6 75/81: Meta: Move notes to orphan branch, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 69d5bf74f6 77/81: Fix: (plz--coding-system) Alist key, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 1d3efc036c 78/81: Add: (plz) DELETE method, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 9e308f1833 80/81: Meta: Tidy headers, etc. for ELPA, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 9156de9c59 81/81: Release: 0.1, ELPA Syncer, 2022/05/11
- [elpa] externals/plz bca0b3112b 20/81: Tidy, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 2b51ecd6be 27/81: Meta: Add test.yml for GitHub Actions, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4f74be6565 30/81: Notes: Add idea, ELPA Syncer, 2022/05/11
- [elpa] externals/plz fbdcd69950 09/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4588884c11 10/81: Changes,
ELPA Syncer <=
- [elpa] externals/plz 2c19b7f11d 11/81: Changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 6a21c7e809 12/81: Significant changes, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 5b00a61ce3 15/81: Rename functions, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 370d0bbc1a 21/81: Tidy, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 971077e1d3 23/81: Tests, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 30e48b1e6a 22/81: Tidy, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 05f93b0b6b 25/81: Meta: Update Makefile, makem.sh, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 19a0110109 33/81: Notes: Add ToC, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 9a1b119eff 38/81: Meta: Ignore sandbox/, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 0301272d8d 40/81: Add: plz-put, ELPA Syncer, 2022/05/11