prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  reset.css doesn't load sometimes
  @clone1018 saw this when we first started caching static assets. It's why I turned off static caching initially. Now static caching is back with #1245 and indeed we're seeing this again. :(
  
  ![2013-08-06_11-47-55](https://f.cloud.github.com/assets/134455/931202/acae7e70-0026-11e3-8624-91825c6e8726.png)
  
  
  </issue>
  <code>
  [start of gittip/cache_static.py]
  1 """
  2 Handles caching of static resources.
  3 """
  4 import os
  5 from calendar import timegm
  6 from email.utils import parsedate
  7 from wsgiref.handlers import format_date_time
  8 
  9 from aspen import Response
  10 
  11 
  12 def version_is_available(request):
  13     """Return a boolean, whether we have the version they asked for.
  14     """
  15     path = request.line.uri.path
  16     version = request.website.version
  17     return path['version'] == version if 'version' in path else True
  18 
  19 
  20 def version_is_dash(request):
  21     """Return a boolean, whether the version they asked for is -.
  22     """
  23     return request.line.uri.path.get('version') == '-'
  24 
  25 
  26 def get_last_modified(fs_path):
  27     """Get the last modified time, as int, of the file pointed to by fs_path.
  28     """
  29     return int(os.path.getctime(fs_path))
  30 
  31 
  32 def inbound(request):
  33     """Try to serve a 304 for resources under assets/.
  34     """
  35     uri = request.line.uri
  36 
  37     if not uri.startswith('/assets/'):
  38 
  39         # Only apply to the assets/ directory.
  40 
  41         return request
  42 
  43     if version_is_dash(request):
  44 
  45         # Special-case a version of '-' to never 304/404 here.
  46 
  47         return request
  48 
  49     if not version_is_available(request):
  50 
  51         # Don't serve one version of a file as if it were another.
  52 
  53         raise Response(404)
  54 
  55     ims = request.headers.get('If-Modified-Since')
  56     if not ims:
  57 
  58         # This client doesn't care about when the file was modified.
  59 
  60         return request
  61 
  62     if request.fs.endswith('.spt'):
  63 
  64         # This is a requests for a dynamic resource. Perhaps in the future
  65         # we'll delegate to such resources to compute a sensible Last-Modified
  66         # or E-Tag, but for now we punt. This is okay, because we expect to
  67         # put our dynamic assets behind a CDN in production.
  68 
  69         return request
  70 
  71 
  72     try:
  73         ims = timegm(parsedate(ims))
  74     except:
  75 
  76         # Malformed If-Modified-Since header. Proceed with the request.
  77 
  78         return request
  79 
  80     last_modified = get_last_modified(request.fs)
  81     if ims < last_modified:
  82 
  83         # The file has been modified since. Serve the whole thing.
  84 
  85         return request
  86 
  87 
  88     # Huzzah!
  89     # =======
  90     # We can serve a 304! :D
  91 
  92     response = Response(304)
  93     response.headers['Last-Modified'] = format_date_time(last_modified)
  94     response.headers['Cache-Control'] = 'no-cache'
  95     raise response
  96 
  97 
  98 def outbound(response):
  99     """Set caching headers for resources under assets/.
  100     """
  101     request = response.request
  102     website = request.website
  103     uri = request.line.uri
  104 
  105     version = website.version
  106     response.headers['X-Gittip-Version'] = version
  107 
  108     if not uri.startswith('/assets/'):
  109         return response
  110 
  111     response.headers.cookie.clear()
  112 
  113     if response.code == 304:
  114         return response
  115 
  116     if website.cache_static:
  117 
  118         # https://developers.google.com/speed/docs/best-practices/caching
  119         response.headers['Cache-Control'] = 'public'
  120         response.headers['Vary'] = 'accept-encoding'
  121 
  122         if 'version' in uri.path:
  123             # This specific asset is versioned, so it's fine to cache it.
  124             response.headers['Expires'] = 'Sun, 17 Jan 2038 19:14:07 GMT'
  125         else:
  126             # Asset is not versioned. Don't cache it, but set Last-Modified.
  127             last_modified = get_last_modified(request.fs)
  128             response.headers['Last-Modified'] = format_date_time(last_modified)
  129
  [end of gittip/cache_static.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/gittip/cache_static.py b/gittip/cache_static.py
  --- a/gittip/cache_static.py
  +++ b/gittip/cache_static.py
  @@ -111,6 +111,10 @@
       response.headers.cookie.clear()
   
       if response.code == 304:
  +
  +        # https://github.com/gittip/www.gittip.com/issues/1308
  +        del response.headers['Content-Type']
  +
           return response
   
       if website.cache_static:
  
verification_info: {"golden_diff": "diff --git a/gittip/cache_static.py b/gittip/cache_static.py\n--- a/gittip/cache_static.py\n+++ b/gittip/cache_static.py\n@@ -111,6 +111,10 @@\n     response.headers.cookie.clear()\n \n     if response.code == 304:\n+\n+        # https://github.com/gittip/www.gittip.com/issues/1308\n+        del response.headers['Content-Type']\n+\n         return response\n \n     if website.cache_static:\n", "issue": "reset.css doesn't load sometimes\n@clone1018 saw this when we first started caching static assets. It's why I turned off static caching initially. Now static caching is back with #1245 and indeed we're seeing this again. :(\n\n![2013-08-06_11-47-55](https://f.cloud.github.com/assets/134455/931202/acae7e70-0026-11e3-8624-91825c6e8726.png)\n\n", "before_files": [{"content": "\"\"\"\nHandles caching of static resources.\n\"\"\"\nimport os\nfrom calendar import timegm\nfrom email.utils import parsedate\nfrom wsgiref.handlers import format_date_time\n\nfrom aspen import Response\n\n\ndef version_is_available(request):\n    \"\"\"Return a boolean, whether we have the version they asked for.\n    \"\"\"\n    path = request.line.uri.path\n    version = request.website.version\n    return path['version'] == version if 'version' in path else True\n\n\ndef version_is_dash(request):\n    \"\"\"Return a boolean, whether the version they asked for is -.\n    \"\"\"\n    return request.line.uri.path.get('version') == '-'\n\n\ndef get_last_modified(fs_path):\n    \"\"\"Get the last modified time, as int, of the file pointed to by fs_path.\n    \"\"\"\n    return int(os.path.getctime(fs_path))\n\n\ndef inbound(request):\n    \"\"\"Try to serve a 304 for resources under assets/.\n    \"\"\"\n    uri = request.line.uri\n\n    if not uri.startswith('/assets/'):\n\n        # Only apply to the assets/ directory.\n\n        return request\n\n    if version_is_dash(request):\n\n        # Special-case a version of '-' to never 304/404 here.\n\n        return request\n\n    if not version_is_available(request):\n\n        # Don't serve one version of a file as if it were another.\n\n        raise Response(404)\n\n    ims = request.headers.get('If-Modified-Since')\n    if not ims:\n\n        # This client doesn't care about when the file was modified.\n\n        return request\n\n    if request.fs.endswith('.spt'):\n\n        # This is a requests for a dynamic resource. Perhaps in the future\n        # we'll delegate to such resources to compute a sensible Last-Modified\n        # or E-Tag, but for now we punt. This is okay, because we expect to\n        # put our dynamic assets behind a CDN in production.\n\n        return request\n\n\n    try:\n        ims = timegm(parsedate(ims))\n    except:\n\n        # Malformed If-Modified-Since header. Proceed with the request.\n\n        return request\n\n    last_modified = get_last_modified(request.fs)\n    if ims < last_modified:\n\n        # The file has been modified since. Serve the whole thing.\n\n        return request\n\n\n    # Huzzah!\n    # =======\n    # We can serve a 304! :D\n\n    response = Response(304)\n    response.headers['Last-Modified'] = format_date_time(last_modified)\n    response.headers['Cache-Control'] = 'no-cache'\n    raise response\n\n\ndef outbound(response):\n    \"\"\"Set caching headers for resources under assets/.\n    \"\"\"\n    request = response.request\n    website = request.website\n    uri = request.line.uri\n\n    version = website.version\n    response.headers['X-Gittip-Version'] = version\n\n    if not uri.startswith('/assets/'):\n        return response\n\n    response.headers.cookie.clear()\n\n    if response.code == 304:\n        return response\n\n    if website.cache_static:\n\n        # https://developers.google.com/speed/docs/best-practices/caching\n        response.headers['Cache-Control'] = 'public'\n        response.headers['Vary'] = 'accept-encoding'\n\n        if 'version' in uri.path:\n            # This specific asset is versioned, so it's fine to cache it.\n            response.headers['Expires'] = 'Sun, 17 Jan 2038 19:14:07 GMT'\n        else:\n            # Asset is not versioned. Don't cache it, but set Last-Modified.\n            last_modified = get_last_modified(request.fs)\n            response.headers['Last-Modified'] = format_date_time(last_modified)\n", "path": "gittip/cache_static.py"}]}