* 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.
This commit is contained in:
David Shaw 2004-12-22 19:19:10 +00:00
parent f3c33b8768
commit 97b8f41b08
6 changed files with 42 additions and 5 deletions

View File

@ -1,5 +1,14 @@
2004-12-22 David Shaw <dshaw@jabberwocky.com>
* 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.
* gpgkeys_curl.c (get_key, writer): New function to wrap around
fwrite to avoid DLL access problem on win32.

View File

@ -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. */

View File

@ -502,8 +502,10 @@ 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;
}
continue;

View File

@ -949,8 +949,10 @@ 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;
}
continue;

View File

@ -311,8 +311,10 @@ 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;
}
continue;

View File

@ -1763,8 +1763,10 @@ 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;
}
continue;