[BACK]Return to fetch.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ftp

Diff for /src/usr.bin/ftp/fetch.c between version 1.68 and 1.69

version 1.68, 2006/07/07 12:00:25 version 1.69, 2006/09/25 10:18:39
Line 118 
Line 118 
 static int  static int
 url_get(const char *origline, const char *proxyenv, const char *outfile)  url_get(const char *origline, const char *proxyenv, const char *outfile)
 {  {
         char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path;          char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path, ststr[4];
         char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL;          char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL;
         int error, i, isftpurl = 0, isfileurl = 0, isredirect = 0, rval = -1;          int error, i, isftpurl = 0, isfileurl = 0, isredirect = 0, rval = -1;
         struct addrinfo hints, *res0, *res;          struct addrinfo hints, *res0, *res;
Line 132 
Line 132 
         size_t len, wlen;          size_t len, wlen;
 #ifndef SMALL  #ifndef SMALL
         char *sslpath = NULL, *sslhost = NULL;          char *sslpath = NULL, *sslhost = NULL;
         int ishttpsurl = 0;          int ishttpsurl = 0, status;
         SSL_CTX *ssl_ctx = NULL;          SSL_CTX *ssl_ctx = NULL;
 #endif  #endif
         SSL *ssl = NULL;          SSL *ssl = NULL;
Line 486 
Line 486 
                 goto improper;                  goto improper;
         else          else
                 cp++;                  cp++;
         if (strncmp(cp, "301", 3) == 0 || strncmp(cp, "302", 3) == 0) {  
           strlcpy(ststr, cp, sizeof(ststr));
           status = strtonum(ststr, 200, 307, &errstr);
           if (errstr) {
                   warnx("Error retrieving file: %s", cp);
                   goto cleanup_url_get;
           }
   
           switch (status) {
           case 200:       /* OK */
                   break;
           case 301:       /* Moved Permanently */
           case 302:       /* Found */
           case 303:       /* See Other */
           case 307:       /* Temporary Redirect */
                 isredirect++;                  isredirect++;
                 if (redirect_loop++ > 10) {                  if (redirect_loop++ > 10) {
                         warnx("Too many redirections requested");                          warnx("Too many redirections requested");
                         goto cleanup_url_get;                          goto cleanup_url_get;
                 }                  }
         } else if (strncmp(cp, "200", 3)) {                  break;
           default:
                 warnx("Error retrieving file: %s", cp);                  warnx("Error retrieving file: %s", cp);
                 goto cleanup_url_get;                  goto cleanup_url_get;
         }          }

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.69