diff options
author | 2014-04-21 19:26:53 +0200 | |
---|---|---|
committer | 2014-04-21 19:26:53 +0200 | |
commit | db52fa001a481ab97100172bb9905fc144c8752d (patch) | |
tree | a0f9be62360ff7693c6478015a15f85bc9eb2462 /pyload/network | |
parent | Moving new plugins from module to pyload (diff) | |
download | pyload-db52fa001a481ab97100172bb9905fc144c8752d.tar.xz |
updated bottle, fixed a header and referer bug
Diffstat (limited to 'pyload/network')
-rw-r--r-- | pyload/network/HeaderDict.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pyload/network/HeaderDict.py b/pyload/network/HeaderDict.py new file mode 100644 index 000000000..d2041be15 --- /dev/null +++ b/pyload/network/HeaderDict.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from bottle import HeaderDict as BottleHeaderDict + + +class HeaderDict(BottleHeaderDict): + """ Multidict for header values """ + + def to_headerlist(self): + """ Converts all entries to header list usable by curl """ + header = [] + for key in self.iterkeys(): + fields = ",".join(self.getall(key)) + + if fields: + header.append("%s: %s" % (key, fields)) + else: + # curl will remove this header + header.append("%s:" % key) + + return header + |