mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
Handling unreadable POST for push feeds and their fat pings.
This commit is contained in:
parent
77ad32dfcb
commit
5bf0b26a17
1 changed files with 6 additions and 2 deletions
|
@ -5,6 +5,7 @@ import random
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
|
from django.http.request import UnreadablePostError
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from apps.push.models import PushSubscription
|
from apps.push.models import PushSubscription
|
||||||
|
@ -52,8 +53,11 @@ def push_callback(request, push_id):
|
||||||
# XXX TODO: Optimize this by removing feedparser. It just needs to find out
|
# XXX TODO: Optimize this by removing feedparser. It just needs to find out
|
||||||
# the hub_url or topic has changed. ElementTree could do it.
|
# the hub_url or topic has changed. ElementTree could do it.
|
||||||
if random.random() < 0.1:
|
if random.random() < 0.1:
|
||||||
parsed = feedparser.parse(request.body)
|
try:
|
||||||
subscription.check_urls_against_pushed_data(parsed)
|
parsed = feedparser.parse(request.body)
|
||||||
|
subscription.check_urls_against_pushed_data(parsed)
|
||||||
|
except UnreadablePostError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Don't give fat ping, just fetch.
|
# Don't give fat ping, just fetch.
|
||||||
# subscription.feed.queue_pushed_feed_xml(request.body)
|
# subscription.feed.queue_pushed_feed_xml(request.body)
|
||||||
|
|
Loading…
Add table
Reference in a new issue