Skip to content

Commit c07ff4c

Browse files
committed
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.
1 parent ed72465 commit c07ff4c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/transports/http.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef struct {
7070
git_smart_subtransport parent;
7171
transport_smart *owner;
7272
git_stream *io;
73-
gitno_connection_data connection_data;
73+
gitno_connection_data gitserver_data;
7474
bool connected;
7575

7676
/* Parser structures */
@@ -153,7 +153,7 @@ static int auth_context_match(
153153
}
154154

155155
if (!context) {
156-
if (scheme->init_context(&context, &t->connection_data) < 0)
156+
if (scheme->init_context(&context, &t->gitserver_data) < 0)
157157
return -1;
158158
else if (!context)
159159
return 0;
@@ -172,10 +172,10 @@ static int apply_credentials(git_buf *buf, http_subtransport *t)
172172
git_http_auth_context *context;
173173

174174
/* Apply the credentials given to us in the URL */
175-
if (!cred && t->connection_data.user && t->connection_data.pass) {
175+
if (!cred && t->gitserver_data.user && t->gitserver_data.pass) {
176176
if (!t->url_cred &&
177177
git_cred_userpass_plaintext_new(&t->url_cred,
178-
t->connection_data.user, t->connection_data.pass) < 0)
178+
t->gitserver_data.user, t->gitserver_data.pass) < 0)
179179
return -1;
180180

181181
cred = t->url_cred;
@@ -200,17 +200,17 @@ static int gen_request(
200200
size_t content_length)
201201
{
202202
http_subtransport *t = OWNING_SUBTRANSPORT(s);
203-
const char *path = t->connection_data.path ? t->connection_data.path : "/";
203+
const char *path = t->gitserver_data.path ? t->gitserver_data.path : "/";
204204
size_t i;
205205

206206
git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url);
207207

208208
git_buf_puts(buf, "User-Agent: ");
209209
git_http__user_agent(buf);
210210
git_buf_puts(buf, "\r\n");
211-
git_buf_printf(buf, "Host: %s", t->connection_data.host);
212-
if (strcmp(t->connection_data.port, gitno__default_port(&t->connection_data)) != 0) {
213-
git_buf_printf(buf, ":%s", t->connection_data.port);
211+
git_buf_printf(buf, "Host: %s", t->gitserver_data.host);
212+
if (strcmp(t->gitserver_data.port, gitno__default_port(&t->gitserver_data)) != 0) {
213+
git_buf_printf(buf, ":%s", t->gitserver_data.port);
214214
}
215215
git_buf_puts(buf, "\r\n");
216216

@@ -367,7 +367,7 @@ static int on_headers_complete(http_parser *parser)
367367

368368
error = t->owner->cred_acquire_cb(&t->cred,
369369
t->owner->url,
370-
t->connection_data.user,
370+
t->gitserver_data.user,
371371
allowed_auth_types,
372372
t->owner->cred_acquire_payload);
373373

@@ -412,7 +412,7 @@ static int on_headers_complete(http_parser *parser)
412412
return t->parse_error = PARSE_ERROR_GENERIC;
413413
}
414414

415-
if (gitno_connection_data_from_url(&t->connection_data, t->location, s->service_url) < 0)
415+
if (gitno_connection_data_from_url(&t->gitserver_data, t->location, s->service_url) < 0)
416416
return t->parse_error = PARSE_ERROR_GENERIC;
417417

418418
/* Set the redirect URL on the stream. This is a transfer of
@@ -577,7 +577,7 @@ static int apply_proxy_config(http_subtransport *t)
577577
char *url;
578578
git_proxy_options opts = GIT_PROXY_OPTIONS_INIT;
579579

580-
if ((error = git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &url)) < 0)
580+
if ((error = git_remote__get_http_proxy(t->owner->owner, !!t->gitserver_data.use_ssl, &url)) < 0)
581581
return error;
582582

583583
opts.credentials = t->owner->proxy.credentials;
@@ -610,13 +610,13 @@ static int http_connect(http_subtransport *t)
610610
t->connected = 0;
611611
}
612612

613-
if (t->connection_data.use_ssl) {
614-
error = git_tls_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
613+
if (t->gitserver_data.use_ssl) {
614+
error = git_tls_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
615615
} else {
616616
#ifdef GIT_CURL
617-
error = git_curl_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
617+
error = git_curl_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
618618
#else
619-
error = git_socket_stream_new(&t->io, t->connection_data.host, t->connection_data.port);
619+
error = git_socket_stream_new(&t->io, t->gitserver_data.host, t->gitserver_data.port);
620620
#endif
621621
}
622622

@@ -639,7 +639,7 @@ static int http_connect(http_subtransport *t)
639639
return error;
640640

641641
giterr_clear();
642-
error = t->owner->certificate_check_cb(cert, is_valid, t->connection_data.host, t->owner->message_cb_payload);
642+
error = t->owner->certificate_check_cb(cert, is_valid, t->gitserver_data.host, t->owner->message_cb_payload);
643643

644644
if (error == GIT_PASSTHROUGH)
645645
error = is_valid ? 0 : GIT_ECERTIFICATE;
@@ -1014,8 +1014,8 @@ static int http_action(
10141014
if (!stream)
10151015
return -1;
10161016

1017-
if ((!t->connection_data.host || !t->connection_data.port || !t->connection_data.path) &&
1018-
(ret = gitno_connection_data_from_url(&t->connection_data, url, NULL)) < 0)
1017+
if ((!t->gitserver_data.host || !t->gitserver_data.port || !t->gitserver_data.path) &&
1018+
(ret = gitno_connection_data_from_url(&t->gitserver_data, url, NULL)) < 0)
10191019
return ret;
10201020

10211021
if ((ret = http_connect(t)) < 0)
@@ -1072,8 +1072,8 @@ static int http_close(git_smart_subtransport *subtransport)
10721072

10731073
git_vector_clear(&t->auth_contexts);
10741074

1075-
gitno_connection_data_free_ptrs(&t->connection_data);
1076-
memset(&t->connection_data, 0x0, sizeof(gitno_connection_data));
1075+
gitno_connection_data_free_ptrs(&t->gitserver_data);
1076+
memset(&t->gitserver_data, 0x0, sizeof(gitno_connection_data));
10771077

10781078
return 0;
10791079
}

0 commit comments

Comments
 (0)