MCPcopy Create free account
hub / github.com/git/git / git_proxy_connect

Function git_proxy_connect

connect.c:1008–1032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006}
1007
1008static struct child_process *git_proxy_connect(int fd[2], char *host)
1009{
1010 const char *port = STR(DEFAULT_GIT_PORT);
1011 struct child_process *proxy;
1012
1013 get_host_and_port(&host, &port);
1014
1015 if (looks_like_command_line_option(host))
1016 die(_("strange hostname '%s' blocked"), host);
1017 if (looks_like_command_line_option(port))
1018 die(_("strange port '%s' blocked"), port);
1019
1020 proxy = xmalloc(sizeof(*proxy));
1021 child_process_init(proxy);
1022 strvec_push(&proxy->args, git_proxy_command);
1023 strvec_push(&proxy->args, host);
1024 strvec_push(&proxy->args, port);
1025 proxy->in = -1;
1026 proxy->out = -1;
1027 if (start_command(proxy))
1028 die(_("cannot start proxy %s"), git_proxy_command);
1029 fd[0] = proxy->out; /* read from proxy stdout */
1030 fd[1] = proxy->in; /* write to proxy stdin */
1031 return proxy;
1032}
1033
1034static char *get_port(char *host)
1035{

Callers 1

git_connect_gitFunction · 0.85

Calls 7

get_host_and_portFunction · 0.85
child_process_initFunction · 0.85
strvec_pushFunction · 0.85
start_commandFunction · 0.85
dieFunction · 0.70
xmallocFunction · 0.70

Tested by

no test coverage detected