Skip to content

Commit 5c76096

Browse files
committed
transport: provide a getter for the proxy options
As with the callbacks, third-party implementations of smart subtransports cannot reach into the opaque struct and thus cannot know what options the user set. Add a getter for these options to copy the proxy options into something external implementors can use.
1 parent f9d3b0d commit 5c76096

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/git2/sys/transport.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ GIT_EXTERN(int) git_transport_smart_certificate_check(git_transport *transport,
241241
*/
242242
GIT_EXTERN(int) git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods);
243243

244+
/**
245+
* Get a copy of the proxy options
246+
*
247+
* The url is copied and must be freed by the caller.
248+
*
249+
* @param out options struct to fill
250+
* @param transport the transport to extract the data from.
251+
*/
252+
GIT_EXTERN(int) git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport);
253+
244254
/*
245255
*** End of base transport interface ***
246256
*** Begin interface for subtransports for the smart transport ***

src/transports/smart.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ int git_transport_smart_credentials(git_cred **out, git_transport *transport, co
472472
return t->cred_acquire_cb(out, t->url, user, methods, t->cred_acquire_payload);
473473
}
474474

475+
int git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport)
476+
{
477+
transport_smart *t = (transport_smart *) transport;
478+
return git_proxy_options_dup(out, &t->proxy);
479+
}
480+
475481
int git_transport_smart(git_transport **out, git_remote *owner, void *param)
476482
{
477483
transport_smart *t;

0 commit comments

Comments
 (0)