From: Jonathan McDowell <noodles@earth.li>
Date: Tue, 1 Oct 2013 16:08:38 +0000 (+0100)
Subject: Set the user agent to onak/<version> for HKP backend
X-Git-Tag: onak-0.4.3~62
X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=04327094c64c143143cc2e790aa33890a0e23bff;p=onak.git

Set the user agent to onak/<version> for HKP backend
---

diff --git a/keydb_hkp.c b/keydb_hkp.c
index f1dfe44..3802e49 100644
--- a/keydb_hkp.c
+++ b/keydb_hkp.c
@@ -31,6 +31,7 @@
 #include "mem.h"
 #include "onak-conf.h"
 #include "parsekey.h"
+#include "version.h"
 
 static CURL *curl = NULL;
 
@@ -43,6 +44,11 @@ static void hkp_initdb(bool readonly)
 {
 	curl_global_init(CURL_GLOBAL_DEFAULT);
 	curl = curl_easy_init();
+	if (curl == NULL) {
+		logthing(LOGTHING_CRITICAL, "Could not initialize CURL.");
+		exit(EXIT_FAILURE);
+	}
+	curl_easy_setopt(curl, CURLOPT_USERAGENT, "onak/" ONAK_VERSION);
 }
 
 /**