changeset 1288:a07f81bb47c0

change no_proxy test from substring to suffix
author corvid <corvid@lavabit.com>
date Sun, 30 Aug 2009 18:18:36 +0000
parents 50ef0236a45e
children b317bfe7cf6f
files src/IO/http.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/IO/http.c	Sun Aug 23 09:38:21 2009 -0400
+++ b/src/IO/http.c	Sun Aug 30 18:18:36 2009 +0000
@@ -396,9 +396,15 @@
    if (HTTP_Proxy) {
       ret = 1;
       if (prefs.no_proxy) {
+         const char *host = URL_HOST(url);
+         size_t host_len = strlen(host);
+
          np = dStrdup(prefs.no_proxy);
          for (p = np; (tok = dStrsep(&p, " "));  ) {
-            if (dStristr(URL_AUTHORITY(url), tok)) {
+            int start = host_len - strlen(tok);
+
+            if (start >= 0 && dStrcasecmp(host + start, tok) == 0) {
+               /* no_proxy token is suffix of host string */
                ret = 0;
                break;
             }