diff options
Diffstat (limited to 'pyload/network/HeaderDict.py')
-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 + |