prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Issue downloading data (wildcards not supported in HTTP)
  I was wanting to have a case download all of the data it needs. First create an empty tmp inputdata directory, set the DIN env vars.  However, I got error below which seems like a problem with wget and wildcards?
  
  ```
          Refcase not found in /global/cscratch1/sd/ndk/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01, will attempt to download from inputdata
            Model refcase missing file refdir = '/global/cscratch1/sd/ndk/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01/'
          wget failed with output:  and errput Warning: wildcards not supported in HTTP.
          --2018-06-29 14:11:00--  https://web.lcrc.anl.gov/public/e3sm/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01/*
          Resolving web.lcrc.anl.gov (web.lcrc.anl.gov)... 140.221.74.23
          Connecting to web.lcrc.anl.gov (web.lcrc.anl.gov)|140.221.74.23|:443... connected.
          HTTP request sent, awaiting response... 404 Not Found
          2018-06-29 14:11:00 ERROR 404: Not Found.
  ```
  
  The test I was using: `SMS_Ld2.ne30_oECv3_ICG.A_WCYCL1850S_CMIP6.cori-knl_intel.allactive-v1cmip6`
  
  </issue>
  <code>
  [start of scripts/lib/CIME/Servers/wget.py]
  1 """
  2 WGET Server class.  Interact with a server using WGET protocol
  3 """
  4 # pylint: disable=super-init-not-called
  5 from CIME.XML.standard_module_setup import *
  6 from CIME.Servers.generic_server import GenericServer
  7 
  8 logger = logging.getLogger(__name__)
  9 
  10 class WGET(GenericServer):
  11     def __init__(self, address, user='', passwd=''):
  12         self._args = ''
  13         if user:
  14             self._args += "--user {}".format(user)
  15         if passwd:
  16             self._args += "--password {}".format(passwd)
  17 
  18         err = run_cmd("wget {} --spider {}".format(self._args, address))[0]
  19         expect(err == 0,"Could not connect to repo '{0}'\nThis is most likely either a proxy, or network issue .")
  20         self._server_loc = address
  21 
  22     def fileexists(self, rel_path):
  23         full_url = os.path.join(self._server_loc, rel_path)
  24         stat, out, err = run_cmd("wget {} --spider {}".format(self._args, full_url))
  25         if (stat != 0):
  26             logging.warning("FAIL: Repo '{}' does not have file '{}'\nReason:{}\n{}\n".format(self._server_loc, full_url, out.encode('utf-8'), err.encode('utf-8')))
  27             return False
  28         return True
  29 
  30     def getfile(self, rel_path, full_path):
  31         full_url = os.path.join(self._server_loc, rel_path)
  32         stat, output, errput = \
  33                 run_cmd("wget {} {} -nc --output-document {}".format(self._args, full_url, full_path))
  34         if (stat != 0):
  35             logging.warning("wget failed with output: {} and errput {}\n".format(output, errput))
  36             # wget puts an empty file if it fails.
  37             try:
  38                 os.remove(full_path)
  39             except OSError:
  40                 pass
  41             return False
  42         else:
  43             logging.info("SUCCESS\n")
  44             return True
  45 
  46     def getdirectory(self, rel_path, full_path):
  47         full_url = os.path.join(self._server_loc, rel_path)
  48         stat, output, errput = \
  49                 run_cmd("wget  {} {} -P {}".format(self._args, full_url+os.sep+'*', full_path+os.sep))
  50         if (stat != 0):
  51             logging.warning("wget failed with output: {} and errput {}\n".format(output, errput))
  52             # wget puts an empty file if it fails.
  53             try:
  54                 os.remove(full_path)
  55             except OSError:
  56                 pass
  57             return False
  58         else:
  59             logging.info("SUCCESS\n")
  60             return True
  61
  [end of scripts/lib/CIME/Servers/wget.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/scripts/lib/CIME/Servers/wget.py b/scripts/lib/CIME/Servers/wget.py
  --- a/scripts/lib/CIME/Servers/wget.py
  +++ b/scripts/lib/CIME/Servers/wget.py
  @@ -46,7 +46,9 @@
       def getdirectory(self, rel_path, full_path):
           full_url = os.path.join(self._server_loc, rel_path)
           stat, output, errput = \
  -                run_cmd("wget  {} {} -P {}".format(self._args, full_url+os.sep+'*', full_path+os.sep))
  +                run_cmd("wget  {} {} -r -N --no-directories ".format(self._args, full_url+os.sep), from_dir=full_path)
  +        logger.debug(output)
  +        logger.debug(errput)
           if (stat != 0):
               logging.warning("wget failed with output: {} and errput {}\n".format(output, errput))
               # wget puts an empty file if it fails.
  
verification_info: {"golden_diff": "diff --git a/scripts/lib/CIME/Servers/wget.py b/scripts/lib/CIME/Servers/wget.py\n--- a/scripts/lib/CIME/Servers/wget.py\n+++ b/scripts/lib/CIME/Servers/wget.py\n@@ -46,7 +46,9 @@\n     def getdirectory(self, rel_path, full_path):\n         full_url = os.path.join(self._server_loc, rel_path)\n         stat, output, errput = \\\n-                run_cmd(\"wget  {} {} -P {}\".format(self._args, full_url+os.sep+'*', full_path+os.sep))\n+                run_cmd(\"wget  {} {} -r -N --no-directories \".format(self._args, full_url+os.sep), from_dir=full_path)\n+        logger.debug(output)\n+        logger.debug(errput)\n         if (stat != 0):\n             logging.warning(\"wget failed with output: {} and errput {}\\n\".format(output, errput))\n             # wget puts an empty file if it fails.\n", "issue": "Issue downloading data (wildcards not supported in HTTP)\nI was wanting to have a case download all of the data it needs. First create an empty tmp inputdata directory, set the DIN env vars.  However, I got error below which seems like a problem with wget and wildcards?\r\n\r\n```\r\n        Refcase not found in /global/cscratch1/sd/ndk/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01, will attempt to download from inputdata\r\n          Model refcase missing file refdir = '/global/cscratch1/sd/ndk/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01/'\r\n        wget failed with output:  and errput Warning: wildcards not supported in HTTP.\r\n        --2018-06-29 14:11:00--  https://web.lcrc.anl.gov/public/e3sm/inputdata/e3sm_init/20171228.beta3rc13_1850.ne30_oECv3_ICG.edison/0331-01-01/*\r\n        Resolving web.lcrc.anl.gov (web.lcrc.anl.gov)... 140.221.74.23\r\n        Connecting to web.lcrc.anl.gov (web.lcrc.anl.gov)|140.221.74.23|:443... connected.\r\n        HTTP request sent, awaiting response... 404 Not Found\r\n        2018-06-29 14:11:00 ERROR 404: Not Found.\r\n```\r\n\r\nThe test I was using: `SMS_Ld2.ne30_oECv3_ICG.A_WCYCL1850S_CMIP6.cori-knl_intel.allactive-v1cmip6`\n", "before_files": [{"content": "\"\"\"\nWGET Server class.  Interact with a server using WGET protocol\n\"\"\"\n# pylint: disable=super-init-not-called\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.Servers.generic_server import GenericServer\n\nlogger = logging.getLogger(__name__)\n\nclass WGET(GenericServer):\n    def __init__(self, address, user='', passwd=''):\n        self._args = ''\n        if user:\n            self._args += \"--user {}\".format(user)\n        if passwd:\n            self._args += \"--password {}\".format(passwd)\n\n        err = run_cmd(\"wget {} --spider {}\".format(self._args, address))[0]\n        expect(err == 0,\"Could not connect to repo '{0}'\\nThis is most likely either a proxy, or network issue .\")\n        self._server_loc = address\n\n    def fileexists(self, rel_path):\n        full_url = os.path.join(self._server_loc, rel_path)\n        stat, out, err = run_cmd(\"wget {} --spider {}\".format(self._args, full_url))\n        if (stat != 0):\n            logging.warning(\"FAIL: Repo '{}' does not have file '{}'\\nReason:{}\\n{}\\n\".format(self._server_loc, full_url, out.encode('utf-8'), err.encode('utf-8')))\n            return False\n        return True\n\n    def getfile(self, rel_path, full_path):\n        full_url = os.path.join(self._server_loc, rel_path)\n        stat, output, errput = \\\n                run_cmd(\"wget {} {} -nc --output-document {}\".format(self._args, full_url, full_path))\n        if (stat != 0):\n            logging.warning(\"wget failed with output: {} and errput {}\\n\".format(output, errput))\n            # wget puts an empty file if it fails.\n            try:\n                os.remove(full_path)\n            except OSError:\n                pass\n            return False\n        else:\n            logging.info(\"SUCCESS\\n\")\n            return True\n\n    def getdirectory(self, rel_path, full_path):\n        full_url = os.path.join(self._server_loc, rel_path)\n        stat, output, errput = \\\n                run_cmd(\"wget  {} {} -P {}\".format(self._args, full_url+os.sep+'*', full_path+os.sep))\n        if (stat != 0):\n            logging.warning(\"wget failed with output: {} and errput {}\\n\".format(output, errput))\n            # wget puts an empty file if it fails.\n            try:\n                os.remove(full_path)\n            except OSError:\n                pass\n            return False\n        else:\n            logging.info(\"SUCCESS\\n\")\n            return True\n", "path": "scripts/lib/CIME/Servers/wget.py"}]}