summaryrefslogtreecommitdiff
path: root/src/netops.h
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-09-25 20:41:56 -0700
committerBen Straub <bs@github.com>2013-09-25 20:41:56 -0700
commit8988688c479c6e511432187c7e7e746aefb23c08 (patch)
tree1d86d7baa31181681e8a401f855e6eafa1d77e6c /src/netops.h
parentac316e743878908df762cc0ea07a71cbee5c5802 (diff)
downloadlibgit2-8988688c479c6e511432187c7e7e746aefb23c08.tar.gz
Migrate redirect URL handling to common utility
Diffstat (limited to 'src/netops.h')
-rw-r--r--src/netops.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/netops.h b/src/netops.h
index d352bf3b6..0c6e571d9 100644
--- a/src/netops.h
+++ b/src/netops.h
@@ -66,6 +66,31 @@ int gitno_send(gitno_socket *socket, const char *msg, size_t len, int flags);
int gitno_close(gitno_socket *s);
int gitno_select_in(gitno_buffer *buf, long int sec, long int usec);
+typedef struct gitno_connection_data {
+ char *host;
+ char *port;
+ char *path;
+ char *user;
+ char *pass;
+ bool use_ssl;
+} gitno_connection_data;
+
+/*
+ * This replaces all the pointers in `data` with freshly-allocated strings,
+ * that the caller is responsible for freeing.
+ * `gitno_connection_data_free_ptrs` is good for this.
+ */
+
+int gitno_connection_data_from_url(
+ gitno_connection_data *data,
+ const char *url,
+ const char *service_suffix,
+ const char *original_host,
+ bool original_use_ssl);
+
+/* This frees all the pointers IN the struct, but not the struct itself. */
+void gitno_connection_data_free_ptrs(gitno_connection_data *data);
+
int gitno_extract_url_parts(
char **host,
char **port,