Commit c07ff4cb by Edward Thomson

http: rename `connection_data` -> `gitserver_data`

Rename the `connection_data` struct member to `gitserver_data`, to
disambiguate future `connection_data`s that apply to the proxy, not the
final server endpoint.
parent ed72465e
...@@ -70,7 +70,7 @@ typedef struct { ...@@ -70,7 +70,7 @@ typedef struct {
git_smart_subtransport parent; git_smart_subtransport parent;
transport_smart *owner; transport_smart *owner;
git_stream *io; git_stream *io;
gitno_connection_data connection_data; gitno_connection_data gitserver_data;
bool connected; bool connected;
/* Parser structures */ /* Parser structures */
...@@ -153,7 +153,7 @@ static int auth_context_match( ...@@ -153,7 +153,7 @@ static int auth_context_match(
} }
if (!context) { if (!context) {
if (scheme->init_context(&context, &t->connection_data) < 0) if (scheme->init_context(&context, &t->gitserver_data) < 0)
return -1; return -1;
else if (!context) else if (!context)
return 0; return 0;
...@@ -172,10 +172,10 @@ static int apply_credentials(git_buf *buf, http_subtransport *t) ...@@ -172,10 +172,10 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
git_http_auth_context *context; git_http_auth_context *context;
/* Apply the credentials given to us in the URL */ /* Apply the credentials given to us in the URL */
if (!cred && t->connection_data.user && t->connection_data.pass) { if (!cred && t->gitserver_data.user && t->gitserver_data.pass) {
if (!t->url_cred && if (!t->url_cred &&
git_cred_userpass_plaintext_new(&t->url_cred, git_cred_userpass_plaintext_new(&t->url_cred,
t->connection_data.user, t->connection_data.pass) < 0) t->gitserver_data.user, t->gitserver_data.pass) < 0)
return -1; return -1;
cred = t->url_cred; cred = t->url_cred;
...@@ -200,7 +200,7 @@ static int gen_request( ...@@ -200,7 +200,7 @@ static int gen_request(
size_t content_length) size_t content_length)
{ {
http_subtransport *t = OWNING_SUBTRANSPORT(s); http_subtransport *t = OWNING_SUBTRANSPORT(s);
const char *path = t->connection_data.path ? t->connection_data.path : "/"; const char *path = t->gitserver_data.path ? t->gitserver_data.path : "/";
size_t i; size_t i;
git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url); git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url);
...@@ -208,9 +208,9 @@ static int gen_request( ...@@ -208,9 +208,9 @@ static int gen_request(
git_buf_puts(buf, "User-Agent: "); git_buf_puts(buf, "User-Agent: ");
git_http__user_agent(buf); git_http__user_agent(buf);
git_buf_puts(buf, "\r\n"); git_buf_puts(buf, "\r\n");
git_buf_printf(buf, "Host: %s", t->connection_data.host); git_buf_printf(buf, "Host: %s", t->gitserver_data.host);
if (strcmp(t->connection_data.port, gitno__default_port(&t->connection_data)) != 0) { if (strcmp(t->gitserver_data.port, gitno__default_port(&t->gitserver_data)) != 0) {
git_buf_printf(buf, ":%s", t->connection_data.port); git_buf_printf(buf, ":%s", t->gitserver_data.port);
} }
git_buf_puts(buf, "\r\n"); git_buf_puts(buf, "\r\n");
...@@ -367,7 +367,7 @@ static int on_headers_complete(http_parser *parser) ...@@ -367,7 +367,7 @@ static int on_headers_complete(http_parser *parser)
error = t->owner->cred_acquire_cb(&t->cred, error = t->owner->cred_acquire_cb(&t->cred,
t->owner->url, t->owner->url,
t->connection_data.user, t->gitserver_data.user,
allowed_auth_types, allowed_auth_types,
t->owner->cred_acquire_payload); t->owner->cred_acquire_payload);
...@@ -412,7 +412,7 @@ static int on_headers_complete(http_parser *parser) ...@@ -412,7 +412,7 @@ static int on_headers_complete(http_parser *parser)
return t->parse_error = PARSE_ERROR_GENERIC; return t->parse_error = PARSE_ERROR_GENERIC;
} }
if (gitno_connection_data_from_url(&t->connection_data, t->location, s->service_url) < 0) if (gitno_connection_data_from_url(&t->gitserver_data, t->location, s->service_url) < 0)
return t->parse_error = PARSE_ERROR_GENERIC; return t->parse_error = PARSE_ERROR_GENERIC;
/* Set the redirect URL on the stream. This is a transfer of /* Set the redirect URL on the stream. This is a transfer of
...@@ -577,7 +577,7 @@ static int apply_proxy_config(http_subtransport *t) ...@@ -577,7 +577,7 @@ static int apply_proxy_config(http_subtransport *t)
char *url; char *url;
git_proxy_options opts = GIT_PROXY_OPTIONS_INIT; git_proxy_options opts = GIT_PROXY_OPTIONS_INIT;
if ((error = git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &url)) < 0) if ((error = git_remote__get_http_proxy(t->owner->owner, !!t->gitserver_data.use_ssl, &url)) < 0)
return error; return error;
opts.credentials = t->owner->proxy.credentials; opts.credentials = t->owner->proxy.credentials;
...@@ -610,13 +610,13 @@ static int http_connect(http_subtransport *t) ...@@ -610,13 +610,13 @@ static int http_connect(http_subtransport *t)
t->connected = 0; t->connected = 0;
} }
if (t->connection_data.use_ssl) { if (t->gitserver_data.use_ssl) {
error = git_tls_stream_new(&t->io, t->connection_data.host, t->connection_data.port); error = git_tls_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
} else { } else {
#ifdef GIT_CURL #ifdef GIT_CURL
error = git_curl_stream_new(&t->io, t->connection_data.host, t->connection_data.port); error = git_curl_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
#else #else
error = git_socket_stream_new(&t->io, t->connection_data.host, t->connection_data.port); error = git_socket_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
#endif #endif
} }
...@@ -639,7 +639,7 @@ static int http_connect(http_subtransport *t) ...@@ -639,7 +639,7 @@ static int http_connect(http_subtransport *t)
return error; return error;
giterr_clear(); giterr_clear();
error = t->owner->certificate_check_cb(cert, is_valid, t->connection_data.host, t->owner->message_cb_payload); error = t->owner->certificate_check_cb(cert, is_valid, t->gitserver_data.host, t->owner->message_cb_payload);
if (error == GIT_PASSTHROUGH) if (error == GIT_PASSTHROUGH)
error = is_valid ? 0 : GIT_ECERTIFICATE; error = is_valid ? 0 : GIT_ECERTIFICATE;
...@@ -1014,8 +1014,8 @@ static int http_action( ...@@ -1014,8 +1014,8 @@ static int http_action(
if (!stream) if (!stream)
return -1; return -1;
if ((!t->connection_data.host || !t->connection_data.port || !t->connection_data.path) && if ((!t->gitserver_data.host || !t->gitserver_data.port || !t->gitserver_data.path) &&
(ret = gitno_connection_data_from_url(&t->connection_data, url, NULL)) < 0) (ret = gitno_connection_data_from_url(&t->gitserver_data, url, NULL)) < 0)
return ret; return ret;
if ((ret = http_connect(t)) < 0) if ((ret = http_connect(t)) < 0)
...@@ -1072,8 +1072,8 @@ static int http_close(git_smart_subtransport *subtransport) ...@@ -1072,8 +1072,8 @@ static int http_close(git_smart_subtransport *subtransport)
git_vector_clear(&t->auth_contexts); git_vector_clear(&t->auth_contexts);
gitno_connection_data_free_ptrs(&t->connection_data); gitno_connection_data_free_ptrs(&t->gitserver_data);
memset(&t->connection_data, 0x0, sizeof(gitno_connection_data)); memset(&t->gitserver_data, 0x0, sizeof(gitno_connection_data));
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment