explicit proxy setting for curl-loader-0.47
Status: Alpha
Brought to you by:
coroberti
|
From: <Fra...@ma...> - 2009-01-14 03:04:13
|
Dear Curl-Loader maintainers,
I needed a way to switch off or explicitly set the curl proxy string for
curl-loader, without touching the environment or .curlrc.
I couldn't find a hint in the docs or FAQ, so I implemented the "-x"
option from curl in a quick and dirty way to curl-loader.
Now I am able to do:
./curl-loader -x "" -f ssl-loadtest
Where '-x ""' unsets the proxy. It might be of interest for others and I
believe it is worth implementing, so I attach the diffs.
I couldn't find quick enough the size for the proxy string, I simply set
it to char[255] but it might be worth to look up or use the definition
from the curl sources.
I am also not sure if I placed the curl_easy_setopt (handle,
CURLOPT_PROXY, config_proxy); call optimal in loader.c, But it works fine
for me at the moment.
Cheers,
Frank
fm@mlp09325:~/dev/curl-loader-0.47> diff conf.h.orig conf.h
114a115,120
> Name of the configuration proxy.
> */
> extern char config_proxy[254 + 1];
>
>
> /*
fm@mlp09325:~/dev/curl-loader-0.47> diff conf.c.orig conf.c
74a75,77
> /* Name of the configuration file */
> char config_proxy[254 + 1];
>
87c90
< while ((rget_opt = getopt (argc, argv, "c:dehf:i:l:m:op:rst:vuw"))
!= EOF)
---
> while ((rget_opt = getopt (argc, argv, "c:dehf:i:l:m:op:rst:vuwx:"))
!= EOF)
187a191,200
> case 'x': /* set/unset proxy */
> if (optarg)
> strcpy(config_proxy, optarg);
> else
> {
> fprintf (stderr, "%s error: -x option should be followed
by a proxy IP or name.\n", __func__);
> return -1;
> }
> break;
>
223a237
> fprintf (stderr, " -x[set|unset proxy]\n");
fm@mlp09325:~/dev/curl-loader-0.47> diff loader.c loader.c.orig
483,485d482
<
< /* set|unset the curl proxy */
< curl_easy_setopt (handle, CURLOPT_PROXY, config_proxy); |