On Mon, Apr 29, 2002 at 07:21:37PM +0200, Martin Lund wrote:
> Im trying to connect to a ftp server using port 26000 through a http-proxy (squid).
>
> It seems that the port number is not appended correctly in the http GET request when 
>I specify username and password?

Thanks for report! I have fixed the bug. You can find the patch in attachment.

--
   Alexander.
Index: Http.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/Http.cc,v
retrieving revision 1.145
diff -u -p -u -r1.145 Http.cc
--- Http.cc     2002/04/18 10:37:22     1.145
+++ Http.cc     2002/04/30 05:57:25
@@ -392,32 +392,25 @@ void Http::SendRequest(const char *conne
    int efile_len;
 
    char *pfile=(char*)alloca(4+3+xstrlen(user)*6+3+xstrlen(pass)*3+1+
-                             strlen(hostname)*3+1+strlen(cwd)*3+1+
-                             strlen(efile)+1+6+1);
+                             strlen(hostname)*3+1+xstrlen(portname)*3+1+
+                             strlen(cwd)*3+1+strlen(efile)+1+6+1);
 
    if(proxy && !https)
    {
       const char *proto="http";
-      if(https)
-        proto="https";
       if(hftp)
+        proto="ftp";
+      sprintf(pfile,"%s://",proto);
+      if(hftp && user && pass)
       {
-        if(user && pass)
+        url::encode_string(user,pfile+strlen(pfile),URL_USER_UNSAFE);
+        if(!QueryBool("use-authorization",proxy))
         {
-           strcpy(pfile,"ftp://";);
-           url::encode_string(user,pfile+strlen(pfile),URL_USER_UNSAFE);
-           if(!QueryBool("use-authorization",proxy))
-           {
-              strcat(pfile,":");
-              url::encode_string(pass,pfile+strlen(pfile),URL_PASS_UNSAFE);
-           }
-           strcat(pfile,"@");
-           url::encode_string(hostname,pfile+strlen(pfile),URL_HOST_UNSAFE);
-           goto add_path;
+           strcat(pfile,":");
+           url::encode_string(pass,pfile+strlen(pfile),URL_PASS_UNSAFE);
         }
-        proto="ftp";
+        strcat(pfile,"@");
       }
-      sprintf(pfile,"%s://",proto);
       url::encode_string(hostname,pfile+strlen(pfile),URL_HOST_UNSAFE);
       if(portname)
       {
@@ -429,8 +422,6 @@ void Http::SendRequest(const char *conne
    {
       pfile[0]=0;
    }
-
-add_path:
 
    char *path_base=pfile+strlen(pfile);
 

Reply via email to