prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Ability to not send specific headers in HTTP requests
  Some web servers behave differently when they are receive or don't receive specific headers.
  
  For example FeedBurner (http://feeds.feedburner.com/someblog) sends out XML RSS feeds **only is you do not set the "Referer" header.**
  
  The idea would be to use the `headers` dict with some keys with a `None` value, and skip these headers when sending the HTTP request.
  
  Currently, for the "Referer" example:
  - `headers={"Referer": None}` sends "Referer: None"
  - `headers={"Referer": ""}` sends "Referer: " (which works for the FeedBurner case, but is not satisfactory)
  - disable `RefererMiddleware` but that feels a bit heavy
  
  (for this FeedBurner thing, apparently adding `?format=xml` also does the trick)
  
  
  </issue>
  <code>
  [start of scrapy/http/headers.py]
  1 from w3lib.http import headers_dict_to_raw
  2 from scrapy.utils.datatypes import CaselessDict
  3 
  4 
  5 class Headers(CaselessDict):
  6     """Case insensitive http headers dictionary"""
  7 
  8     def __init__(self, seq=None, encoding='utf-8'):
  9         self.encoding = encoding
  10         super(Headers, self).__init__(seq)
  11 
  12     def normkey(self, key):
  13         """Headers must not be unicode"""
  14         if isinstance(key, unicode):
  15             return key.title().encode(self.encoding)
  16         return key.title()
  17 
  18     def normvalue(self, value):
  19         """Headers must not be unicode"""
  20         if not hasattr(value, '__iter__'):
  21             value = [value]
  22         return [x.encode(self.encoding) if isinstance(x, unicode) else x \
  23             for x in value]
  24 
  25     def __getitem__(self, key):
  26         try:
  27             return super(Headers, self).__getitem__(key)[-1]
  28         except IndexError:
  29             return None
  30 
  31     def get(self, key, def_val=None):
  32         try:
  33             return super(Headers, self).get(key, def_val)[-1]
  34         except IndexError:
  35             return None
  36 
  37     def getlist(self, key, def_val=None):
  38         try:
  39             return super(Headers, self).__getitem__(key)
  40         except KeyError:
  41             if def_val is not None:
  42                 return self.normvalue(def_val)
  43             return []
  44 
  45     def setlist(self, key, list_):
  46         self[key] = list_
  47 
  48     def setlistdefault(self, key, default_list=()):
  49         return self.setdefault(key, default_list)
  50 
  51     def appendlist(self, key, value):
  52         lst = self.getlist(key)
  53         lst.extend(self.normvalue(value))
  54         self[key] = lst
  55 
  56     def items(self):
  57         return list(self.iteritems())
  58 
  59     def iteritems(self):
  60         return ((k, self.getlist(k)) for k in self.keys())
  61 
  62     def values(self):
  63         return [self[k] for k in self.keys()]
  64 
  65     def to_string(self):
  66         return headers_dict_to_raw(self)
  67 
  68     def __copy__(self):
  69         return self.__class__(self)
  70     copy = __copy__
  71 
  72 
  73
  [end of scrapy/http/headers.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/scrapy/http/headers.py b/scrapy/http/headers.py
  --- a/scrapy/http/headers.py
  +++ b/scrapy/http/headers.py
  @@ -17,7 +17,9 @@
   
       def normvalue(self, value):
           """Headers must not be unicode"""
  -        if not hasattr(value, '__iter__'):
  +        if value is None:
  +            value = []
  +        elif not hasattr(value, '__iter__'):
               value = [value]
           return [x.encode(self.encoding) if isinstance(x, unicode) else x \
               for x in value]
  
verification_info: {"golden_diff": "diff --git a/scrapy/http/headers.py b/scrapy/http/headers.py\n--- a/scrapy/http/headers.py\n+++ b/scrapy/http/headers.py\n@@ -17,7 +17,9 @@\n \n     def normvalue(self, value):\n         \"\"\"Headers must not be unicode\"\"\"\n-        if not hasattr(value, '__iter__'):\n+        if value is None:\n+            value = []\n+        elif not hasattr(value, '__iter__'):\n             value = [value]\n         return [x.encode(self.encoding) if isinstance(x, unicode) else x \\\n             for x in value]\n", "issue": "Ability to not send specific headers in HTTP requests\nSome web servers behave differently when they are receive or don't receive specific headers.\n\nFor example FeedBurner (http://feeds.feedburner.com/someblog) sends out XML RSS feeds **only is you do not set the \"Referer\" header.**\n\nThe idea would be to use the `headers` dict with some keys with a `None` value, and skip these headers when sending the HTTP request.\n\nCurrently, for the \"Referer\" example:\n- `headers={\"Referer\": None}` sends \"Referer: None\"\n- `headers={\"Referer\": \"\"}` sends \"Referer: \" (which works for the FeedBurner case, but is not satisfactory)\n- disable `RefererMiddleware` but that feels a bit heavy\n\n(for this FeedBurner thing, apparently adding `?format=xml` also does the trick)\n\n", "before_files": [{"content": "from w3lib.http import headers_dict_to_raw\nfrom scrapy.utils.datatypes import CaselessDict\n\n\nclass Headers(CaselessDict):\n    \"\"\"Case insensitive http headers dictionary\"\"\"\n\n    def __init__(self, seq=None, encoding='utf-8'):\n        self.encoding = encoding\n        super(Headers, self).__init__(seq)\n\n    def normkey(self, key):\n        \"\"\"Headers must not be unicode\"\"\"\n        if isinstance(key, unicode):\n            return key.title().encode(self.encoding)\n        return key.title()\n\n    def normvalue(self, value):\n        \"\"\"Headers must not be unicode\"\"\"\n        if not hasattr(value, '__iter__'):\n            value = [value]\n        return [x.encode(self.encoding) if isinstance(x, unicode) else x \\\n            for x in value]\n\n    def __getitem__(self, key):\n        try:\n            return super(Headers, self).__getitem__(key)[-1]\n        except IndexError:\n            return None\n\n    def get(self, key, def_val=None):\n        try:\n            return super(Headers, self).get(key, def_val)[-1]\n        except IndexError:\n            return None\n\n    def getlist(self, key, def_val=None):\n        try:\n            return super(Headers, self).__getitem__(key)\n        except KeyError:\n            if def_val is not None:\n                return self.normvalue(def_val)\n            return []\n\n    def setlist(self, key, list_):\n        self[key] = list_\n\n    def setlistdefault(self, key, default_list=()):\n        return self.setdefault(key, default_list)\n\n    def appendlist(self, key, value):\n        lst = self.getlist(key)\n        lst.extend(self.normvalue(value))\n        self[key] = lst\n\n    def items(self):\n        return list(self.iteritems())\n\n    def iteritems(self):\n        return ((k, self.getlist(k)) for k in self.keys())\n\n    def values(self):\n        return [self[k] for k in self.keys()]\n\n    def to_string(self):\n        return headers_dict_to_raw(self)\n\n    def __copy__(self):\n        return self.__class__(self)\n    copy = __copy__\n\n\n", "path": "scrapy/http/headers.py"}]}