...
|
...
|
@@ -12,6 +12,7 @@
|
12
|
12
|
|
13
|
13
|
#include <curl/curl.h>
|
14
|
14
|
|
|
15
|
+#include "target.h"
|
15
|
16
|
#include "libclamav/clamav.h"
|
16
|
17
|
#include "libclamav/others.h"
|
17
|
18
|
#include "shared/misc.h"
|
...
|
...
|
@@ -146,7 +147,8 @@ const char *presigned_get_string(json_object *ps_json_obj, char *key)
|
146
|
146
|
|
147
|
147
|
int main(int argc, char *argv[])
|
148
|
148
|
{
|
149
|
|
- int status = 1;
|
|
149
|
+ int status = 1;
|
|
150
|
+ char userAgent[128];
|
150
|
151
|
CURL *clam_curl = NULL, *aws_curl = NULL;
|
151
|
152
|
CURLcode res;
|
152
|
153
|
int ch;
|
...
|
...
|
@@ -175,6 +177,16 @@ int main(int argc, char *argv[])
|
175
|
175
|
goto cleanup;
|
176
|
176
|
}
|
177
|
177
|
|
|
178
|
+ memset(userAgent, 0, sizeof(userAgent));
|
|
179
|
+ snprintf(userAgent, sizeof(userAgent),
|
|
180
|
+ PACKAGE "/%s (OS: " TARGET_OS_TYPE ", ARCH: " TARGET_ARCH_TYPE ", CPU: " TARGET_CPU_TYPE ")",
|
|
181
|
+ get_version());
|
|
182
|
+ userAgent[sizeof(userAgent) - 1] = 0;
|
|
183
|
+
|
|
184
|
+ if (CURLE_OK != curl_easy_setopt(clam_curl, CURLOPT_USERAGENT, userAgent)) {
|
|
185
|
+ fprintf(stderr, "!create_curl_handle: Failed to set CURLOPT_USERAGENT (%s)!\n", userAgent);
|
|
186
|
+ }
|
|
187
|
+
|
178
|
188
|
while ((ch = my_getopt(argc, argv, OPTS)) > 0) {
|
179
|
189
|
switch (ch) {
|
180
|
190
|
case 'v':
|
...
|
...
|
@@ -383,6 +395,10 @@ int main(int argc, char *argv[])
|
383
|
383
|
goto cleanup;
|
384
|
384
|
}
|
385
|
385
|
|
|
386
|
+ if (CURLE_OK != curl_easy_setopt(aws_curl, CURLOPT_USERAGENT, userAgent)) {
|
|
387
|
+ fprintf(stderr, "!create_curl_handle: Failed to set CURLOPT_USERAGENT (%s)!\n", userAgent);
|
|
388
|
+ }
|
|
389
|
+
|
386
|
390
|
if (g_debug) {
|
387
|
391
|
/* ask libcurl to show us the verbose output */
|
388
|
392
|
if (CURLE_OK != curl_easy_setopt(aws_curl, CURLOPT_VERBOSE, 1L)) {
|
...
|
...
|
@@ -397,7 +413,7 @@ int main(int argc, char *argv[])
|
397
|
397
|
fprintf(stderr, "ERROR: Failed to set HTTP version to 1.1 (to prevent 2.0 responses which we don't yet parse properly)!\n");
|
398
|
398
|
}
|
399
|
399
|
|
400
|
|
-#ifdef _WIN32
|
|
400
|
+#if defined(C_DARWIN) || defined(_WIN32)
|
401
|
401
|
if (CURLE_OK != curl_easy_setopt(aws_curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function)) {
|
402
|
402
|
fprintf(stderr, "ERROR: Failed to set SSL CTX function!\n");
|
403
|
403
|
}
|