http: get default user-agent from git_user_agent
This means we will respect the GIT_USER_AGENT build-time configuration and run-time environment variable. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 2, 2012 at 15:03 UTC
745c7c8e6252ba41430a1442e1fa8da2ec40e9c2
2 files changed
+3
-5
Makefile
+1
-4
@@ -2104,7 +2104,7 @@ configure: configure.ac
2104
$(RM) $<+
2105
2106
# These can record GIT_VERSION
2107
-version.o git.spec http.o \
2107
+version.o git.spec \
2108
$(patsubst %.sh,%,$(SCRIPT_SH)) \
2109
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
2110
: GIT-VERSION-FILE
@@ -2274,9 +2274,6 @@ attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
2274
gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
2275
-DGIT_LOCALE_PATH='"$(localedir_SQ)"'
2276
2277
-http.sp http.s http.o: EXTRA_CPPFLAGS = \
2278
- -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
2279
-
2277
ifdef NO_EXPAT
2278
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
2279
endif
http.c
+2
-1
@@ -4,6 +4,7 @@
4
#include "run-command.h"
5
#include "url.h"
6
#include "credential.h"
7
+#include "version.h"
8
9
int active_requests;
10
int http_is_verbose;
@@ -299,7 +300,7 @@ static CURL *get_curl_handle(void)
300
curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
301
302
curl_easy_setopt(result, CURLOPT_USERAGENT,
302
- user_agent ? user_agent : GIT_HTTP_USER_AGENT);
303
+ user_agent ? user_agent : git_user_agent());
304
305
if (curl_ftp_no_epsv)
306
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);