diff options
author | David Shaw <[email protected]> | 2004-12-22 19:19:10 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-12-22 19:19:10 +0000 |
commit | 97b8f41b08c378ab20dbd00be1ab23453c8d3670 (patch) | |
tree | 2632e18ac44c2f9a363a80f8bd1f3c0947a2836d /keyserver/gpgkeys_curl.c | |
parent | * options.h, keyserver.c (parse_keyserver_uri): Properly parse auth data (diff) | |
download | gnupg-97b8f41b08c378ab20dbd00be1ab23453c8d3670.tar.gz gnupg-97b8f41b08c378ab20dbd00be1ab23453c8d3670.zip |
* gpgkeys_curl.c (main): New "follow-redirects" option. Takes an optional
numeric value for the maximum number of redirects to allow. Defaults to
5.
* gpgkeys_curl.c (main), gpgkeys_finger.c (main), gpgkeys_hkp.c (main),
gpgkeys_http.c (main), gpgkeys_ldap.c (main): Make sure that a "timeout"
option passed with no arguments is properly handled.
Diffstat (limited to 'keyserver/gpgkeys_curl.c')
-rw-r--r-- | keyserver/gpgkeys_curl.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/keyserver/gpgkeys_curl.c b/keyserver/gpgkeys_curl.c index 1d206e0c5..1d7544550 100644 --- a/keyserver/gpgkeys_curl.c +++ b/keyserver/gpgkeys_curl.c @@ -123,6 +123,7 @@ main(int argc,char *argv[]) char line[MAX_LINE]; char *thekey=NULL; unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT; + long follow_redirects=5; console=stderr; @@ -269,8 +270,19 @@ main(int argc,char *argv[]) { if(no) timeout=0; - else + else if(start[7]=='=') timeout=atoi(&start[8]); + else if(start[7]=='\0') + timeout=DEFAULT_KEYSERVER_TIMEOUT; + } + else if(strncasecmp(start,"follow-redirects",16)==0) + { + if(no) + follow_redirects=0; + else if(start[16]=='=') + follow_redirects=atoi(&start[17]); + else if(start[16]=='\0') + follow_redirects=-1; } continue; @@ -312,6 +324,14 @@ main(int argc,char *argv[]) goto fail; } + if(follow_redirects) + { + curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1); + if(follow_redirects>0) + curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects); + } + + /* If it's a GET or a SEARCH, the next thing to come in is the keyids. If it's a SEND, then there are no keyids. */ |