Ticket #117 (closed task: fixed)

Opened 6 years ago

Last modified 3 years ago

paste.httpexceptions always displays plaintext exceptions in Safari

Reported by: http://alastair.houghton.myopenid.com/ Owned by: ianb
Priority: high Milestone: 1.4.1
Component: wareweb Version: 0.3
Severity: blocker Keywords:
Cc:

Description

Safari doesn't explicitly list text/html in its http-accept header; instead, it just specifies */*. As a result, the existing behaviour of httpexceptions.py is flawed in that it will only ever display plaintext responses in Safari (along with any other client that exhibits this behaviour).

Here's a patch to fix it:

Index: httpexceptions.py
===================================================================
--- httpexceptions.py   (revision 5118)
+++ httpexceptions.py   (working copy)
@@ -228,7 +228,8 @@
             headers = list(self.headers)
         else:
             headers = []
-        if 'html' in environ.get('HTTP_ACCEPT',''):
+        accepts = environ.get('HTTP_ACCEPT','')
+        if 'html' in accepts or '*/*' in accepts:
             replace_header(headers, 'content-type', 'text/html')
             content = self.html(environ)
         else:

Change History

Changed 6 years ago by kkkkoaaa

  • milestone set to 0.4

Keep a good job up!  http://quick-adult-links.com

Changed 6 years ago by bbangert

  • status changed from new to closed
  • resolution set to fixed

I fixed this earlier today without realizing it was already in here...

Changed 6 years ago by anonymous

  • severity changed from normal to blocker
  • component changed from exceptions to wareweb
  • priority changed from normal to high
  • version changed from svn-trunk to 0.3
  • milestone changed from 0.4 to 0.9
  • type set to task

Changed 6 years ago by anonymous

Great resource. Really helpful for understand odbc things.

Thanks.

my email:googlefans@163.com

=============Some my site====================

1. wow gold

2. world of warcraft gold

3. wow gold

Changed 5 years ago by anonymous

  • milestone 0.9 deleted

Milestone 0.9 deleted

Note: See TracTickets for help on using tickets.