File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,46 @@ static const char *default_port_for_scheme(const char *scheme)
3535 return NULL ;
3636}
3737
38+ int git_net_url_dup (git_net_url * out , git_net_url * in )
39+ {
40+ if (in -> scheme ) {
41+ out -> scheme = git__strdup (in -> scheme );
42+ GIT_ERROR_CHECK_ALLOC (out -> scheme );
43+ }
44+
45+ if (in -> host ) {
46+ out -> host = git__strdup (in -> host );
47+ GIT_ERROR_CHECK_ALLOC (out -> host );
48+ }
49+
50+ if (in -> port ) {
51+ out -> port = git__strdup (in -> port );
52+ GIT_ERROR_CHECK_ALLOC (out -> port );
53+ }
54+
55+ if (in -> path ) {
56+ out -> path = git__strdup (in -> path );
57+ GIT_ERROR_CHECK_ALLOC (out -> path );
58+ }
59+
60+ if (in -> query ) {
61+ out -> query = git__strdup (in -> query );
62+ GIT_ERROR_CHECK_ALLOC (out -> query );
63+ }
64+
65+ if (in -> username ) {
66+ out -> username = git__strdup (in -> username );
67+ GIT_ERROR_CHECK_ALLOC (out -> username );
68+ }
69+
70+ if (in -> password ) {
71+ out -> password = git__strdup (in -> password );
72+ GIT_ERROR_CHECK_ALLOC (out -> password );
73+ }
74+
75+ return 0 ;
76+ }
77+
3878int git_net_url_parse (git_net_url * url , const char * given )
3979{
4080 struct http_parser_url u = {0 };
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ typedef struct git_net_url {
2121
2222#define GIT_NET_URL_INIT { NULL }
2323
24+ /** Duplicate a URL */
25+ extern int git_net_url_dup (git_net_url * out , git_net_url * in );
26+
2427/** Parses a string containing a URL into a structure. */
2528extern int git_net_url_parse (git_net_url * url , const char * str );
2629
You can’t perform that action at this time.
0 commit comments