diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-03-11 11:43:08 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-06-10 19:58:22 +0100 |
commit | c6ab183e9c960b74471a7d106a4deb0c8b28a8ec (patch) | |
tree | c95f2f36156abd863337e7b6a18e9ec693a5a565 /src/netops.h | |
parent | f4584a1e8bf3095b90f5564c0f89878ef79855c5 (diff) | |
download | libgit2-c6ab183e9c960b74471a7d106a4deb0c8b28a8ec.tar.gz |
net: rename gitno_connection_data to git_net_url
"Connection data" is an imprecise and largely incorrect name; these
structures are actually parsed URLs. Provide a parser that takes a URL
string and produces a URL structure (if it is valid).
Separate the HTTP redirect handling logic from URL parsing, keeping a
`gitno_connection_data_handle_redirect` whose only job is redirect
handling logic and does not parse URLs itself.
Diffstat (limited to 'src/netops.h')
-rw-r--r-- | src/netops.h | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/netops.h b/src/netops.h index f376bd911..4c4bf78b0 100644 --- a/src/netops.h +++ b/src/netops.h @@ -11,6 +11,7 @@ #include "posix.h" #include "stream.h" +#include "net.h" #ifdef GIT_OPENSSL # include <openssl/ssl.h> @@ -64,38 +65,15 @@ int gitno_recv(gitno_buffer *buf); void gitno_consume(gitno_buffer *buf, const char *ptr); void gitno_consume_n(gitno_buffer *buf, size_t cons); -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, +int gitno_connection_data_handle_redirect( + git_net_url *data, const char *url, const char *service_suffix); -/* 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, - char **path, - char **username, - char **password, - const char *url, - const char *default_port); - -const char *gitno__default_port(gitno_connection_data *data); - #endif |