This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 1/5] Remove direct(legacy) connection type


---
 ConnectionSetting.cc |   5 --
 Makefile.am          |   2 -
 net.cc               |   9 +--
 netio.cc             |  20 ------
 nio-ftp.cc           | 179 ---------------------------------------------------
 nio-ftp.h            |  41 ------------
 res.rc               |   2 -
 resource.h           |   1 -
 8 files changed, 3 insertions(+), 256 deletions(-)
 delete mode 100644 nio-ftp.cc
 delete mode 100644 nio-ftp.h

diff --git a/ConnectionSetting.cc b/ConnectionSetting.cc
index 1154d94..5baf76c 100644
--- a/ConnectionSetting.cc
+++ b/ConnectionSetting.cc
@@ -49,9 +49,6 @@ ConnectionSetting::~ConnectionSetting ()
       sprintf(port_str, "%d", NetIO::net_proxy_port);
       UserSettings::instance().set("net-proxy-port", port_str);
       break;
-    case IDC_NET_DIRECT_LEGACY:
-      UserSettings::instance().set("net-method", "Legacy");
-      break;
     default:
 	break;
     }
@@ -66,8 +63,6 @@ ConnectionSetting::typeFromString(const std::string& aType)
     return IDC_NET_IE5;
   if (!casecompare(aType, "Proxy"))
     return IDC_NET_PROXY;
-  if (!casecompare(aType, "Legacy"))
-    return IDC_NET_DIRECT_LEGACY;
 
   /* A sanish default */
   return IDC_NET_IE5;
diff --git a/Makefile.am b/Makefile.am
index a238d88..aca3ccc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -194,8 +194,6 @@ inilint_SOURCES = \
 	nio-ie5.h \
 	nio-file.cc \
 	nio-file.h \
-	nio-ftp.cc \
-	nio-ftp.h \
 	nio-http.cc \
 	nio-http.h \
 	package_db.cc \
diff --git a/net.cc b/net.cc
index fa6f1e3..5ff3713 100644
--- a/net.cc
+++ b/net.cc
@@ -37,7 +37,7 @@ extern ThreeBarProgressPage Progress;
 
 static StringOption ProxyOption ("", 'p', "proxy", "HTTP/FTP proxy (host:port)", false);
 
-static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, IDC_NET_DIRECT_LEGACY, 0 };
+static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 };
 static bool doing_loading = false;
 
 void
@@ -47,8 +47,7 @@ NetPage::CheckIfEnableNext ()
   DWORD ButtonFlags = PSWIZB_BACK;
 
   if (NetIO::net_method == IDC_NET_IE5 ||
-      NetIO::net_method == IDC_NET_DIRECT ||
-      NetIO::net_method == IDC_NET_DIRECT_LEGACY)
+      NetIO::net_method == IDC_NET_DIRECT)
     e = 1;
   else if (NetIO::net_method == IDC_NET_PROXY)
     {
@@ -132,8 +131,7 @@ NetPage::OnInit ()
 
   // Check to see if any radio buttons are selected. If not, select a default.
   if (SendMessage (GetDlgItem (IDC_NET_DIRECT), BM_GETCHECK, 0, 0) != BST_CHECKED
-      && SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) != BST_CHECKED
-      && SendMessage (GetDlgItem (IDC_NET_DIRECT_LEGACY), BM_GETCHECK, 0, 0) != BST_CHECKED)
+      && SendMessage (GetDlgItem (IDC_NET_PROXY), BM_GETCHECK, 0, 0) != BST_CHECKED)
     SendMessage (GetDlgItem (IDC_NET_IE5), BM_CLICK, 0, 0);
 }
 
@@ -169,7 +167,6 @@ NetPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
     case IDC_NET_IE5:
     case IDC_NET_DIRECT:
     case IDC_NET_PROXY:
-    case IDC_NET_DIRECT_LEGACY:
     case IDC_PROXY_HOST:
     case IDC_PROXY_PORT:
       save_dialog (GetHWND());
diff --git a/netio.cc b/netio.cc
index cf634c1..86bb69a 100644
--- a/netio.cc
+++ b/netio.cc
@@ -31,7 +31,6 @@
 #include "nio-file.h"
 #include "nio-ie5.h"
 #include "nio-http.h"
-#include "nio-ftp.h"
 #include "dialog.h"
 
 int NetIO::net_method;
@@ -147,23 +146,6 @@ NetIO::open (char const *url, bool cachable)
     rv = new NetIO_HTTP (url);
   else if (net_method == IDC_NET_DIRECT)
     rv = new NetIO_IE5 (url, true, cachable);
-  else if (net_method == IDC_NET_DIRECT_LEGACY)
-    {
-      switch (proto)
-	{
-	case http:
-	  rv = new NetIO_HTTP (url);
-	  break;
-	case ftp:
-	  rv = new NetIO_FTP (url);
-	  break;
-	case file:
-	  rv = new NetIO_File (url);
-	  break;
-	default:
-	  mbox (NULL, "Protocol not handled by legacy URL handler", "Cygwin Setup", MB_OK);
-	}
-    }
 
   if (rv && !rv->ok ())
     {
@@ -304,8 +286,6 @@ NetIO::net_method_name ()
       return "Direct";
     case IDC_NET_PROXY:
       return "Proxy";
-    case IDC_NET_DIRECT_LEGACY:
-      return "Direct (legacy)";
     default:
       return "Unknown";
     }
diff --git a/nio-ftp.cc b/nio-ftp.cc
deleted file mode 100644
index 65625d5..0000000
--- a/nio-ftp.cc
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Red Hat, Inc.
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     A copy of the GNU General Public License can be found at
- *     http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@cygnus.com>
- *
- */
-
-/* This file is responsible for implementing all direct FTP protocol
-   channels.  It is intentionally simplistic. */
-
-#include "nio-ftp.h"
-
-#include "LogSingleton.h"
-
-#include "win32.h"
-#include <winsock2.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "resource.h"
-#include "state.h"
-#include "simpsock.h"
-
-static SimpleSocket *cmd = 0;
-static char *cmd_host = 0;
-static int cmd_port = 0;
-
-static char *last_line;
-
-static int
-ftp_line (SimpleSocket * s)
-{
-  do
-    {
-      last_line = s->gets ();
-      Log (LOG_BABBLE) << "ftp > " << (last_line ? last_line : "error")
-        << endLog;
-    }
-  while (last_line && (!isdigit (last_line[0]) || last_line[3] != ' '));
-  return atoi (last_line ? : "0");
-}
-
-NetIO_FTP::NetIO_FTP (char const *Purl):NetIO (Purl)
-{
-  s = 0;
-  int
-    code;
-
-  if (port == 0)
-    port = 21;
-
-control_reconnect:
-  if ((cmd_host && strcmp (host, cmd_host) != 0) || port != cmd_port)
-    {
-      if (cmd)
-	cmd->printf ("QUIT\r\n");
-      delete cmd;
-      delete [] cmd_host;
-      cmd = 0;
-      cmd_host = 0;
-    }
-
-  if (cmd == 0)
-    {
-      SimpleSocket *
-	c = new SimpleSocket (host, port);
-      code = ftp_line (c);
-
-    auth_retry:
-      if (net_ftp_user)
-	c->printf ("USER %s\r\n", net_ftp_user);
-      else
-	c->printf ("USER anonymous\r\n");
-      code = ftp_line (c);
-      if (code == 331)
-	{
-	  if (net_ftp_passwd)
-	    c->printf ("PASS %s\r\n", net_ftp_passwd);
-	  else
-	    c->printf ("PASS cygwin-setup@\r\n");
-	  code = ftp_line (c);
-	}
-      if (code == 530)		/* Authentication failed, retry */
-	{
-	  get_ftp_auth (NULL);
-	  if (net_ftp_user && net_ftp_passwd)
-	    goto auth_retry;
-	}
-
-      if (code < 200 || code >= 300)
-	{
-	  delete
-	    c;
-	  return;
-	}
-
-      cmd = c;
-      cmd_host = new char [strlen (host) + 1];
-      strcpy (cmd_host, host);
-      cmd_port = port;
-
-      cmd->printf ("TYPE I\r\n");
-      code = ftp_line (cmd);
-    }
-
-  cmd->printf ("PASV\r\n");
-  do
-    {
-      code = ftp_line (cmd);
-    }
-  while (code == 226);		/* previous RETR */
-  if (code == 421)              /* Timeout, retry */
-    {
-      Log (LOG_BABBLE) << "FTP timeout -- reconnecting" << endLog;
-      delete [] cmd_host;
-      cmd_host = new char[1]; cmd_host[0] = '\0';
-      goto control_reconnect;
-    }
-  if (code != 227)
-    return;
-
-  char *
-    digit = strpbrk (last_line + 3, "0123456789");
-  if (!digit)
-    return;
-
-  int
-    i1, i2, i3, i4, p1, p2;
-  sscanf (digit, "%d,%d,%d,%d,%d,%d", &i1, &i2, &i3, &i4, &p1, &p2);
-  char
-    tmp[20];
-  sprintf (tmp, "%d.%d.%d.%d", i1, i2, i3, i4);
-  s = new SimpleSocket (tmp, p1 * 256 + p2);
-
-  cmd->printf ("RETR %s\r\n", path);
-  code = ftp_line (cmd);
-  if (code != 150 && code != 125)
-    {
-      delete
-	s;
-      s = 0;
-      return;
-    }
-}
-
-NetIO_FTP::~NetIO_FTP ()
-{
-  if (s)
-    delete s;
-}
-
-int
-NetIO_FTP::ok ()
-{
-  if (s && s->ok ())
-    return 1;
-  return 0;
-}
-
-int
-NetIO_FTP::read (char *buf, int nbytes)
-{
-  int rv;
-  if (!ok ())
-    return 0;
-  rv = s->read (buf, nbytes);
-  if (rv == 0)
-    ftp_line (cmd);
-  return rv;
-}
diff --git a/nio-ftp.h b/nio-ftp.h
deleted file mode 100644
index 6944fc1..0000000
--- a/nio-ftp.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Red Hat, Inc.
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     A copy of the GNU General Public License can be found at
- *     http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@cygnus.com>
- *
- */
-
-#ifndef SETUP_NIO_FTP_H
-#define SETUP_NIO_FTP_H
-
-#include "netio.h"
-
-/* Direct FTP (without proxy) */
-
-class SimpleSocket;
-
-class NetIO_FTP:public NetIO
-{
-  SimpleSocket *s;
-
-public:
-    NetIO_FTP (char const *url);
-    virtual ~ NetIO_FTP ();
-
-  /* If !ok() that means the transfer isn't happening. */
-  virtual int ok ();
-
-  /* Read `nbytes' bytes from the file.  Returns zero when the file
-     is complete. */
-  virtual int read (char *buf, int nbytes);
-};
-
-#endif /* SETUP_NIO_FTP_H */
diff --git a/res.rc b/res.rc
index 5b7d239..d89dd33 100644
--- a/res.rc
+++ b/res.rc
@@ -163,8 +163,6 @@ BEGIN
                     BS_AUTORADIOBUTTON | WS_TABSTOP,60,70,73,10
     CONTROL         "Use HTTP/FTP &Proxy:",IDC_NET_PROXY,"Button",
                     BS_AUTORADIOBUTTON | WS_TABSTOP,60,85,88,10
-    CONTROL         "&Direct Connection (legacy)",IDC_NET_DIRECT_LEGACY,"Button",
-                    BS_AUTORADIOBUTTON | WS_TABSTOP,60,150,94,10
     EDITTEXT        IDC_PROXY_HOST,120,105,120,12,ES_AUTOHSCROLL | 
                     WS_DISABLED | WS_GROUP
     EDITTEXT        IDC_PROXY_PORT,120,125,30,12,ES_AUTOHSCROLL | 
diff --git a/resource.h b/resource.h
index 70d90ca..59c19da 100644
--- a/resource.h
+++ b/resource.h
@@ -176,6 +176,5 @@
 #define IDC_FILE_INUSE_EDIT               590
 #define IDC_FILE_INUSE_MSG                591
 #define IDC_FILE_INUSE_HELP               592
-#define IDC_NET_DIRECT_LEGACY             593
 #define IDC_DOWNLOAD_EDIT                 594
 #define IDC_CHOOSE_DO_SEARCH              595
-- 
2.14.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]