diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-05-02 21:48:03 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-05-02 21:48:03 +0200 |
commit | 427e9e3beba63e05f5d158336e767bcf55f8c3ae (patch) | |
tree | 0da0b28a0d233144c62d74a697e381ad235aa00d | |
parent | 837894b153407936105bf5b358f235b6600bbd42 (diff) | |
download | xine-lib-427e9e3beba63e05f5d158336e767bcf55f8c3ae.tar.gz xine-lib-427e9e3beba63e05f5d158336e767bcf55f8c3ae.tar.bz2 |
Fix proxy usage when the hostnames cannot be resolved.
Thanks to Jeff Mitchell for reporting and testing the fix.
This change reverses the meaning of _x_use_proxy() function to be the one
expected by human logic (1 -> use proxy, 0 -> don't use proxy), this way
a failure in hostname resolution would result in the proxy being used
rather than discarded.
Basically now you can use xine behind a proxy when you can't get out to
the DNS servers (or where the DNS servers don't resolve Internet hosts
that you are not allowed to connect to).
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/input/input_http.c | 15 |
2 files changed, 9 insertions, 8 deletions
@@ -1,6 +1,8 @@ xine-lib (1.1.7) (unreleased) * Support libdca (new name for libdts) by shuffling around the dts.h file. * Add support for MDHD version 1 atom in demux_qt. [bug #1679398] + * Fix proxy usage when the hostnames cannot be resolved. Thanks to Jeff + Mitchell for reporting and testing the fix. xine-lib (1.1.6) * Split the DirectFB plugin into X11 and non-X versions. diff --git a/src/input/input_http.c b/src/input/input_http.c index 3adbc836b..6b7ae9158 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -181,7 +181,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { /* \177\0\0\1 is the *octal* representation of 127.0.0.1 */ if ( info->h_addrtype == AF_INET && !memcmp(info->h_addr_list[0], "\177\0\0\1", 4) ) { lprintf("host '%s' is localhost\n", host); - return 1; + return 0; } /* TODO: IPv6 check */ } @@ -200,13 +200,13 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { /* special-case domain beginning with '=' -> is a host name */ if (domain[0] == '=' && strcmp(target, domain + 1) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } noprox_len = strlen(domain); /* special-case host==domain, avoiding dot checks */ if (host_len == noprox_len && strcmp(target, domain) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } /* check for host in domain, and require that (if matched) the domain * name is preceded by a dot, either in the host or domain strings, @@ -216,7 +216,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { && (domain[0] == '.' || target[host_len - noprox_len - 1] == '.') && strcmp(target + host_len - noprox_len, domain) == 0) { lprintf("host '%s' is in no-proxy domain '%s'\n", target, domain); - return 1; + return 0; } lprintf("host '%s' isn't in no-proxy domain '%s'\n", target, domain); } @@ -225,7 +225,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { } free(no_proxy); - return 0; + return 1; } static int http_plugin_basicauth (const char *user, const char *password, char* dest, int len) { @@ -663,9 +663,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) { _x_message(this->stream, XINE_MSG_GENERAL_WARNING, "malformed url", NULL); return 0; } - if (use_proxy && _x_use_proxy(this_class, this->host)) { - use_proxy = 0; - } + use_proxy = use_proxy && _x_use_proxy(this_class, this->host); + if (this->port == 0) this->port = DEFAULT_HTTP_PORT; |