Mercurial > gftp.yaz
comparison lib/protocols.c @ 313:32a6b26b7026
2003-11-9 Brian Masney <masneyb@gftp.org>
* lib/options.h lib/protoocols.c - added enable_ipv6 option.
* lib/rfc959.c lib/protocols.c - if there is an error creating a socket, log a more informative error about what kind of socket was attempted
to be created.
author | masneyb |
---|---|
date | Mon, 10 Nov 2003 01:59:51 +0000 |
parents | cc2eeb30b793 |
children | 0fcc6468a0af |
comparison
equal
deleted
inserted
replaced
312:a2ec3572dea2 | 313:32a6b26b7026 |
---|---|
1824 { | 1824 { |
1825 char *connect_host, *disphost; | 1825 char *connect_host, *disphost; |
1826 int port, sock; | 1826 int port, sock; |
1827 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) | 1827 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) |
1828 struct addrinfo hints, *res; | 1828 struct addrinfo hints, *res; |
1829 int errnum, enable_ipv6; | |
1829 char serv[8]; | 1830 char serv[8]; |
1830 int errnum; | |
1831 | 1831 |
1832 if ((request->use_proxy = gftp_need_proxy (request, service, | 1832 if ((request->use_proxy = gftp_need_proxy (request, service, |
1833 proxy_hostname, proxy_port)) < 0) | 1833 proxy_hostname, proxy_port)) < 0) |
1834 return (request->use_proxy); | 1834 return (request->use_proxy); |
1835 else if (request->use_proxy == 1) | 1835 else if (request->use_proxy == 1) |
1836 request->hostp = NULL; | 1836 request->hostp = NULL; |
1837 | 1837 |
1838 gftp_lookup_request_option (request, "enable_ipv6", &enable_ipv6); | |
1839 | |
1838 request->free_hostp = 1; | 1840 request->free_hostp = 1; |
1839 memset (&hints, 0, sizeof (hints)); | 1841 memset (&hints, 0, sizeof (hints)); |
1840 hints.ai_flags = AI_CANONNAME; | 1842 hints.ai_flags = AI_CANONNAME; |
1841 hints.ai_family = PF_UNSPEC; | 1843 |
1844 if (enable_ipv6) | |
1845 hints.ai_family = PF_UNSPEC; | |
1846 else | |
1847 hints.ai_family = AF_INET; | |
1848 | |
1842 hints.ai_socktype = SOCK_STREAM; | 1849 hints.ai_socktype = SOCK_STREAM; |
1843 | 1850 |
1844 if (request->use_proxy) | 1851 if (request->use_proxy) |
1845 { | 1852 { |
1846 connect_host = proxy_hostname; | 1853 connect_host = proxy_hostname; |
1924 request->hostp = NULL; | 1931 request->hostp = NULL; |
1925 | 1932 |
1926 if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) | 1933 if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) |
1927 { | 1934 { |
1928 request->logging_function (gftp_logging_error, request, | 1935 request->logging_function (gftp_logging_error, request, |
1929 _("Failed to create a socket: %s\n"), | 1936 _("Failed to create a IPv4 socket: %s\n"), |
1930 g_strerror (errno)); | 1937 g_strerror (errno)); |
1931 return (GFTP_ERETRYABLE); | 1938 return (GFTP_ERETRYABLE); |
1932 } | 1939 } |
1933 | 1940 |
1934 memset (&remote_address, 0, sizeof (remote_address)); | 1941 memset (&remote_address, 0, sizeof (remote_address)); |