diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-05-31 14:34:09 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-05-31 14:36:17 +1200 |
commit | 9ea68ebd284ce13d765519a20dd7cfe998c0ae1c (patch) | |
tree | 635b4ef4be9203b61f932efb166ccda4bd03a140 /netlib/multidict.py | |
parent | d98582664d8f234fe6a2c805f02d47686243379f (diff) | |
download | mitmproxy-9ea68ebd284ce13d765519a20dd7cfe998c0ae1c.tar.gz mitmproxy-9ea68ebd284ce13d765519a20dd7cfe998c0ae1c.tar.bz2 mitmproxy-9ea68ebd284ce13d765519a20dd7cfe998c0ae1c.zip |
Improve handling of pseudo-headers
- The canonical source for :method, :scheme and :path are the .method, .scheme
and .path attributes on the request object.
- These pseudo-headers are stripped after reading the request, and re-inserted
just before sending.
- The :authority header remains, and should be handled analagously to the Host
header in HTTP1 with respect to display and user interaction.
Diffstat (limited to 'netlib/multidict.py')
-rw-r--r-- | netlib/multidict.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/netlib/multidict.py b/netlib/multidict.py index 98fde7e3..f8876cbd 100644 --- a/netlib/multidict.py +++ b/netlib/multidict.py @@ -171,6 +171,14 @@ class _MultiDict(MutableMapping, Serializable): else: return super(_MultiDict, self).items() + def clear(self, key): + """ + Removes all items with the specified key, and does not raise an + exception if the key does not exist. + """ + if key in self: + del self[key] + def to_dict(self): """ Get the MultiDict as a plain Python dict. |