Should wsgi send "connection: close" header on 501 error?

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi all:

I am doing some more work with testing roundup by running it as a wsgi
server during a pytest run.

If somebody tries to make an OPTIONS request to the root of the
tracker a 501 - "not implemented" error is returned. (Note OPTIONS are
supported for the /rest/... endpoints which work as expected.)

One of the headers that is returned as part of the 501 error is:

 Connection: close

The wsgi library (/usr/lib/python3.6/wsgiref/handlers.py) fails an
assert inside an if __debug__: clause:

   assert not is_hop_by_hop(name),"Hop-by-hop headers not allowed"
 
So a couple of questions:

  1) should we be returning a "Connection" header at all?

  2) if we use an optimized build, __debug__ will be false. So I claim
     the validity of this assert is questionable.  Why isn't this
     raising an exception if it is important enough to stop
     processing?

My guess is that we should not return a Connection header. It looks
like only the roundup/cgi/wsgi_handler.py references a Connection
header.

Does anybody know of a reason not to delete the header inside the wsgi
handler?

Thanks.
 
--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.