From 821dfe09d15c70dbcf76b2a9fd0d99207c273fb9 Mon Sep 17 00:00:00 2001 From: Martin Moss Date: Tue, 5 Jan 2016 15:25:36 +0000 Subject: [PATCH 1/2] Fix error for Headers of format 'Connection' This fixes the "AssertionError: Hop-by-hop headers not allowed" error --- django_seo_js/backends/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_seo_js/backends/base.py b/django_seo_js/backends/base.py index 186a814..8aa2d5f 100644 --- a/django_seo_js/backends/base.py +++ b/django_seo_js/backends/base.py @@ -63,7 +63,7 @@ def __init__(self, *args, **kwargs): def build_django_response_from_requests_response(self, response): r = HttpResponse(response.content) for k, v in response.headers.items(): - if k not in IGNORED_HEADERS: + if k.lower() not in IGNORED_HEADERS: r[k] = v r['content-length'] = len(response.content) r.status_code = response.status_code From 6705f8bde5804902e80016eabea43f19dcfc8e02 Mon Sep 17 00:00:00 2001 From: Martin Moss Date: Thu, 27 Apr 2017 13:05:18 +0100 Subject: [PATCH 2/2] Fix recache url mechanism --- django_seo_js/backends/prerender.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django_seo_js/backends/prerender.py b/django_seo_js/backends/prerender.py index 8d6ec9d..7159cb1 100644 --- a/django_seo_js/backends/prerender.py +++ b/django_seo_js/backends/prerender.py @@ -1,5 +1,6 @@ from django_seo_js import settings from base import SEOBackendBase, RequestsBasedBackend +import json class PrerenderIO(SEOBackendBase, RequestsBasedBackend): @@ -55,7 +56,7 @@ def update_url(self, url=None, regex=None): if regex: data["regex"] = regex - r = self.session.post(self.RECACHE_URL, headers=headers, data=data) + r = self.session.post(self.RECACHE_URL, headers=headers, data=json.dumps(data)) return r.status_code < 500