diff -uNr polipo-1.0.4.1/auth.c polipo-1.0.4.1.patch/auth.c
--- polipo-1.0.4.1/auth.c       2010-02-01 07:13:20.000000000 +0800
+++ polipo-1.0.4.1.patch/auth.c 2013-06-03 14:34:24.000000000 +0800
@@ -58,6 +58,11 @@
     if(authRealm == NULL || authCredentials == NULL)
         return 0;

+    int x, y, z, port;
+    parseUrl(url->string, url->length, &x, &y, &port, &z);
+    if(port < 0)
+        return 0;
+
     if(auth == NULL)
         code = buildClientAuthHeaders(url, "required", &message, &headers);
     else if(auth->length >= 6 || lwrcmp(auth->string, "basic ", 6) == 0) {