Browse Source

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 <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Nick Hengeveld 19 years ago committed by Junio C Hamano
parent
commit
20fc9bc5e4
  1. 3
      Makefile
  2. 2
      http.c

3
Makefile

@ -510,6 +510,9 @@ git$X git.spec \
exec_cmd.o: exec_cmd.c exec_cmd.o: exec_cmd.c
$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $< $(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) git-%$X: %.o $(GITLIBS)
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)



2
http.c

@ -195,6 +195,8 @@ static CURL* get_curl_handle(void)
if (getenv("GIT_CURL_VERBOSE")) if (getenv("GIT_CURL_VERBOSE"))
curl_easy_setopt(result, CURLOPT_VERBOSE, 1); curl_easy_setopt(result, CURLOPT_VERBOSE, 1);


curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);

return result; return result;
} }



Loading…
Cancel
Save