diff options
Diffstat (limited to 'src/netops.c')
-rw-r--r-- | src/netops.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/netops.c b/src/netops.c index 3257e7749..7a61ef820 100644 --- a/src/netops.c +++ b/src/netops.c @@ -609,6 +609,9 @@ int gitno_connection_data_from_url( data->use_ssl = true; } + if (url[0] == '/') + default_port = data->use_ssl ? "443" : "80"; + if (!default_port) { giterr_set(GITERR_NET, "Unrecognized URL prefix"); goto cleanup; @@ -618,6 +621,13 @@ int gitno_connection_data_from_url( &data->host, &data->port, &data->user, &data->pass, url, default_port); + if (url[0] == '/') { + /* Relative redirect; reuse original host name and port */ + git__free(data->host); + data->host = original_host; + original_host = NULL; + } + if (!error) { const char *path = strchr(url, '/'); size_t pathlen = strlen(path); |