From graham.dumpleton at gmail.com Fri Aug 10 05:16:24 2012 From: graham.dumpleton at gmail.com (Graham Dumpleton) Date: Fri, 10 Aug 2012 13:16:24 +1000 Subject: [Web-SIG] [modwsgi] Hop-by-hop headers In-Reply-To: <40C26A9E-29DD-47A0-9D29-DD29F802D2FB@flownet.com> References: <19278098.917.1317569747456.JavaMail.geo-discussion-forums@vbbek10> <89D09D8F-5AE3-4000-8B89-E2295470A1F6@flownet.com> <7D8EF730-0289-4BF7-8A7F-0051B3558424@flownet.com> <24523226.1345.1317990372719.JavaMail.geo-discussion-forums@yqjw35> <3777347.295.1318000427693.JavaMail.geo-discussion-forums@yqjw35> <6754747.1801.1318007813625.JavaMail.geo-discussion-forums@yqnv12> <110C793B-18E1-45BD-8D15-D8BC60C580DD@flownet.com> <122C8DCB-F1D6-488E-8131-912171DA6B1B@flownet.com> <53128FD7-681C-4A71-BCEA-D61BA4B8686D@flownet.com> <40C26A9E-29DD-47A0-9D29-DD29F802D2FB@flownet.com> Message-ID: Probably better off asking on the Python WEB-SIG. I have cc'd this there. http://www.python.org/community/sigs/current/web-sig/ Someone has probably felt that wsgiref implementation should somehow be checking for things which aren't notionally allowed but which go beyond just API usage checks. Checking for hop by hop headers should possibly have been the job of the wsgiref.validator and not the server in wsgiref. I know of no other server which will outright error when a hop by hop header is returned by an application, and as you note, there are sometimes where it is useful to pass back Connection to ensure that the web server/client drops the current connection and doesn't try and maintain a keep alive connection. Graham On 10 August 2012 02:43, Ron Garret wrote: > I'm not sure this is the right place to ask this question because it's not really about modwsgi but this is the best place I know to find expertise about WSGI in general. > > Yesterday I fired up some old code using the wsgiref server and got the following error: > > "Hop-by-hop headers not allowed" > > This turned out to be caused by my code including a "Connection: close" header in order to work around an old Safari bug. Trick is, the last time I ran this code under wsgiref it worked, and it hasn't changed. And when I run it under modwsgi it works. > > So my question is: does anyone here know why wsgiref doesn't allow connection headers? And did this change recently? Looking at the wsgiref code it seems to reject Connection headers at least as far back as Python 2.6. My code is old, but it's not that old (less than two years). I'm pretty sure it has run successfully under Python2.6 if not 2.7. It contains WITH statements, so the last time I ran it could not have been under anything earlier than 2.6. > > I'm baffled. Can anyone here shed any light on this? > > Thanks, > rg > > -- > You received this message because you are subscribed to the Google Groups "modwsgi" group. > To post to this group, send email to modwsgi at googlegroups.com. > To unsubscribe from this group, send email to modwsgi+unsubscribe at googlegroups.com. > For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en. >