=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/fetch.c,v retrieving revision 1.34 retrieving revision 1.35 diff -c -r1.34 -r1.35 *** src/usr.bin/ftp/fetch.c 2001/06/23 22:48:44 1.34 --- src/usr.bin/ftp/fetch.c 2001/10/03 18:49:39 1.35 *************** *** 1,4 **** ! /* $OpenBSD: fetch.c,v 1.34 2001/06/23 22:48:44 millert Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: fetch.c,v 1.35 2001/10/03 18:49:39 heko Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- *************** *** 38,44 **** */ #ifndef lint ! static char rcsid[] = "$OpenBSD: fetch.c,v 1.34 2001/06/23 22:48:44 millert Exp $"; #endif /* not lint */ /* --- 38,44 ---- */ #ifndef lint ! static char rcsid[] = "$OpenBSD: fetch.c,v 1.35 2001/10/03 18:49:39 heko Exp $"; #endif /* not lint */ /* *************** *** 362,378 **** errx(1, "Can't allocate memory."); if ((p = strchr(h, '%')) != NULL) *p = '\0'; ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: [%s]%s%s\r\n\r\n", ! path, h, port ? ":" : "", port ? port : ""); free(h); } else { ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: %s%s%s\r\n\r\n", ! path, host, port ? ":" : "", port ? port : ""); } } len = strlen(buf); if (write(s, buf, len) < len) { warn("Writing HTTP request"); goto cleanup_url_get; --- 362,395 ---- errx(1, "Can't allocate memory."); if ((p = strchr(h, '%')) != NULL) *p = '\0'; ! /* ! * Send port number only if it's specified and does not equal ! * 80. Some broken HTTP servers get confused if you explicitly ! * send them the port number. ! */ ! if (port && strcmp(port, "80") != 0) ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: [%s]:%s\r\n\r\n", ! path, h, port); ! else ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: [%s]\r\n\r\n", ! path, h); free(h); } else { ! if (port && strcmp(port, "80") != 0) ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: %s:%s\r\n\r\n", ! path, host, port); ! else ! snprintf(buf, sizeof(buf), ! "GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", ! path, host); } } len = strlen(buf); + if (debug) + fprintf(ttyout, "Sending request:\n%s", buf); if (write(s, buf, len) < len) { warn("Writing HTTP request"); goto cleanup_url_get;