handle broken headers
This commit is contained in:
parent
94ca01a041
commit
8212c28ac7
1 changed files with 9 additions and 1 deletions
10
ox/cache.py
10
ox/cache.py
|
@ -231,7 +231,15 @@ class SQLiteCache(Cache):
|
|||
else:
|
||||
compressed = 0
|
||||
data = sqlite3.Binary(data)
|
||||
t = (url_hash, domain, url, post_data, json.dumps(headers), created,
|
||||
|
||||
#fixme: this looks wrong
|
||||
try:
|
||||
_headers = json.dumps(headers)
|
||||
except:
|
||||
for h in headers:
|
||||
headers[h] = headers[h].decode(detect_encoding(headers[h]))
|
||||
_headers = json.dumps(headers)
|
||||
t = (url_hash, domain, url, post_data, _headers, created,
|
||||
data, only_headers, compressed)
|
||||
c.execute(u"""INSERT OR REPLACE INTO cache values (?, ?, ?, ?, ?, ?, ?, ?, ?)""", t)
|
||||
|
||||
|
|
Loading…
Reference in a new issue