home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / linux / apache / contrib / patches / 1.2 / netscapehost2.patch~ < prev    next >
Encoding:
Text File  |  1998-06-11  |  941 b   |  39 lines

  1. --- proxy_http.c.orig    Fri Jan 30 10:14:28 1998
  2. +++ proxy_http.c    Fri Apr 10 21:45:39 1998
  3. @@ -217,7 +217,34 @@
  4.      {
  5.      server.sin_port = htons(destport);
  6.      err = proxy_host2addr(desthost, &server_hp);
  7. -    if (err != NULL) return proxyerror(r, err); /* give up */
  8. +     if (err != NULL) {
  9. +             char try[HUGE_STRING_LEN];
  10. +         int l, changed=0;
  11. +         if(strncmp(desthost,"www.",4))
  12. +         {
  13. +             strcpy(try,"http://www.");
  14. +             strcat(try,desthost);
  15. +             changed=1;
  16. +         } else
  17. +             strcpy(try,desthost);
  18. +         l = strlen(desthost);
  19. +         if(l<=4 || strncmp(&desthost[l-4],".com",4)) {
  20. +             changed=1;
  21. +             strcat(try,".com");
  22. +             strcat(try,urlptr);
  23. +         }
  24. +         if(changed && !strchr(desthost,'.'))
  25. +         {
  26. +             r->status = 302;
  27. +             table_set(r->headers_out, "Location", try);
  28. +             send_http_header(r);
  29. +             return REDIRECT;
  30. +         }
  31. +         return proxyerror(r, err); /* give up */
  32. +     }
  33.      }
  34.  
  35.      sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  36.