summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-10-16 17:55:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-17 01:51:29 (GMT)
commit19113a26b667527dc983920bf526b5c938d475bb (patch)
tree1fa6c25904dce5ba4200ccb73e8a7105318bee6c /http.c
parent0c2f0d27038f2aa98082d8af35c53b2ec7e9ad92 (diff)
downloadgit-19113a26b667527dc983920bf526b5c938d475bb.zip
git-19113a26b667527dc983920bf526b5c938d475bb.tar.gz
git-19113a26b667527dc983920bf526b5c938d475bb.tar.bz2
http: tell server that the client understands v1
Tell a server that protocol v1 can be used by sending the http header 'Git-Protocol' with 'version=1' indicating this. Also teach the apache http server to pass through the 'Git-Protocol' header as an environment variable 'GIT_PROTOCOL'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/http.c b/http.c
index 9e40a46..ffb7192 100644
--- a/http.c
+++ b/http.c
@@ -12,6 +12,7 @@
#include "gettext.h"
#include "transport.h"
#include "packfile.h"
+#include "protocol.h"
static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
#if LIBCURL_VERSION_NUM >= 0x070a08
@@ -897,6 +898,21 @@ static void set_from_env(const char **var, const char *envname)
*var = val;
}
+static void protocol_http_header(void)
+{
+ if (get_protocol_version_config() > 0) {
+ struct strbuf protocol_header = STRBUF_INIT;
+
+ strbuf_addf(&protocol_header, GIT_PROTOCOL_HEADER ": version=%d",
+ get_protocol_version_config());
+
+
+ extra_http_headers = curl_slist_append(extra_http_headers,
+ protocol_header.buf);
+ strbuf_release(&protocol_header);
+ }
+}
+
void http_init(struct remote *remote, const char *url, int proactive_auth)
{
char *low_speed_limit;
@@ -927,6 +943,8 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
if (remote)
var_override(&http_proxy_authmethod, remote->http_proxy_authmethod);
+ protocol_http_header();
+
pragma_header = curl_slist_append(http_copy_default_headers(),
"Pragma: no-cache");
no_pragma_header = curl_slist_append(http_copy_default_headers(),