From: Nick Hengeveld Date: Tue, 4 Apr 2006 17:11:29 +0000 (-0700) Subject: Set HTTP user agent to git/GIT_VERSION X-Git-Tag: v1.3.0-rc2~2 X-Git-Url: https://git.octo.it/?p=git.git;a=commitdiff_plain;h=20fc9bc5e4fdd4b1f7fd98fbd2e91879f945d7e1 Set HTTP user agent to git/GIT_VERSION Useful for diagnostics/troubleshooting to know which client versions are hitting your server. Signed-off-by: Nick Hengeveld Signed-off-by: Junio C Hamano --- diff --git a/Makefile b/Makefile index c79d6462..145099ad 100644 --- a/Makefile +++ b/Makefile @@ -510,6 +510,9 @@ git$X git.spec \ exec_cmd.o: exec_cmd.c $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $< +http.o: http.c + $(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $< + git-%$X: %.o $(GITLIBS) $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) diff --git a/http.c b/http.c index 9604e332..0cb42a85 100644 --- a/http.c +++ b/http.c @@ -195,6 +195,8 @@ static CURL* get_curl_handle(void) if (getenv("GIT_CURL_VERBOSE")) curl_easy_setopt(result, CURLOPT_VERBOSE, 1); + curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT); + return result; }