diff -Naur --exclude='*.o' --exclude='utils.*' --exclude=Makefile --exclude=wget --exclude=config.h wget-1.11.4/src/http.c wget-1.11.4_mod/src/http.c
--- wget-1.11.4/src/http.c	2008-06-29 18:22:54.000000000 -0700
+++ wget-1.11.4_mod/src/http.c	2008-10-28 18:57:41.000000000 -0700
@@ -1374,6 +1374,7 @@
 
   int sock = -1;
   int flags;
+  bool first_try_rename = true;
 
   /* Set to 1 when the authorization has already been sent and should
      not be tried again. */
@@ -2263,9 +2264,66 @@
               return FOPEN_EXCL_ERR;
             }
         }
-      if (!fp)
+        
+      /* Check to see if file failed to open due to long file name. */
+      if (!fp && errno == ENAMETOOLONG)
+        {    
+            /* Keep removing NAME_CHOMP_AMT characters from the file/path name
+               until we either get a legal filename or some other fopen error
+               occurs.  We aren't handling any other error types right now. */
+            first_try_rename = true;
+            do /* while(!fp && errno == ENAMETOOLONG) */
+              {
+                /* Print some info to the log on first pass through this loop.
+                   Some of this is probably just useful for debugging wget. */
+                if (first_try_rename)
+                  {
+                    logprintf (LOG_NOTQUIET, "%s: %s\n", 
+                        hs->local_file, strerror (errno));
+                    logprintf (LOG_NOTQUIET, "File name is %d chars long.\n", 
+                        (int) strlen(hs->local_file));
+                    logprintf (LOG_NOTQUIET, "NAME_MAX: pathconf(%s) = %ld\n", 
+                        hs->local_file, pathconf(hs->local_file, _PC_NAME_MAX));
+                    logprintf (LOG_NOTQUIET, "PATH_MAX: pathconf(%s) = %ld\n", 
+                        hs->local_file, pathconf(hs->local_file, _PC_PATH_MAX));
+                    logprintf (LOG_NOTQUIET, "Going to do my best to shorten ");
+                    logprintf (LOG_NOTQUIET, "the file name.\n");
+                  }
+                first_try_rename = false;
+                
+                /* Crudely chomp characters off the end of the path name. */
+                (hs->local_file)[strlen(hs->local_file)-NAME_CHOMP_AMT] = '\0';
+                /* Unique-ify the name. */
+        	    char* unique = unique_name(hs->local_file, 0);
+        	    xfree(hs->local_file);
+                hs->local_file = unique;
+                /* Open file according to previously supplied options. */
+        	    if (hs->restval)
+        	       fp = fopen (hs->local_file, "ab");
+      		    else if (ALLOW_CLOBBER)
+        	       fp = fopen (hs->local_file, "wb");     
+        	    else
+        	      {
+                   fp = fopen_excl (hs->local_file, true);
+          		   if (!fp && errno == EEXIST)
+                     {
+                 /* We should never get to this branch if unique_name() did its
+                 job, right?  If that's the case, eliminate this branch. */
+              		    logprintf (LOG_NOTQUIET,
+              		        _("%s has sprung into existence.\n"),
+                            hs->local_file);
+                        logprintf (LOG_NOTQUIET, "But that's OK for now?\n");
+             		    CLOSE_INVALIDATE (sock);
+              		    return FOPEN_EXCL_ERR;
+            	      }
+        	       }              
+              } while(!fp && errno == ENAMETOOLONG);
+        }
+      /* If it failed for a reason other than filename length, bail as usual. */
+      else if (!fp)
         {
-          logprintf (LOG_NOTQUIET, "%s: %s\n", hs->local_file, strerror (errno));
+          logprintf (LOG_NOTQUIET, "%s: %s\n", 
+            hs->local_file, strerror (errno));
           CLOSE_INVALIDATE (sock);
           return FOPENERR;
         }
diff -Naur --exclude='*.o' --exclude='utils.*' --exclude=Makefile --exclude=wget --exclude=config.h wget-1.11.4/src/http.h wget-1.11.4_mod/src/http.h
--- wget-1.11.4/src/http.h	2008-04-26 21:48:23.000000000 -0700
+++ wget-1.11.4_mod/src/http.h	2008-10-28 18:25:00.000000000 -0700
@@ -30,6 +30,8 @@
 #ifndef HTTP_H
 #define HTTP_H
 
+#define NAME_CHOMP_AMT 3
+
 struct url;
 
 uerr_t http_loop (struct url *, char **, char **, const char *, int *,
