← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/allow-header-syntax into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/allow-header-syntax into lp:launchpad.

Commit message:
Use correct method separator in Allow headers.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1717682 in Launchpad itself: "OPTIONS http request gives spaces instead of commas in "Allow" header"
  https://bugs.launchpad.net/launchpad/+bug/1717682

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/allow-header-syntax/+merge/330885

RFC 2616 2.1 / 14.7 defines the syntax as:

   #rule
      A construct "#" is defined, similar to "*", for defining lists of
      elements. The full form is "<n>#<m>element" indicating at least
      <n> and at most <m> elements, each separated by one or more commas
      (",") and OPTIONAL linear white space (LWS).

          Allow   = "Allow" ":" #Method
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/allow-header-syntax into lp:launchpad.
=== modified file 'lib/lp/services/webapp/doc/webapp-publication.txt'
--- lib/lp/services/webapp/doc/webapp-publication.txt	2017-01-13 13:37:12 +0000
+++ lib/lp/services/webapp/doc/webapp-publication.txt	2017-09-16 14:00:56 +0000
@@ -333,7 +333,7 @@
     >>> print_request_and_publication('launchpad.dev', method='DELETE')
     ProtocolErrorRequest
     ProtocolErrorPublication: status=405
-      Allow: GET HEAD POST
+      Allow: GET, HEAD, POST
 
     >>> print_request_and_publication('api.launchpad.dev')
     WebServiceClientRequest

=== modified file 'lib/lp/services/webapp/servers.py'
--- lib/lp/services/webapp/servers.py	2016-09-14 11:13:06 +0000
+++ lib/lp/services/webapp/servers.py	2017-09-16 14:00:56 +0000
@@ -397,7 +397,7 @@
         else:
             request_factory = ProtocolErrorRequest
             publication_factory = ProtocolErrorPublicationFactory(
-                405, headers={'Allow': " ".join(self.methods)})
+                405, headers={'Allow': ", ".join(self.methods)})
             factories = (request_factory, publication_factory)
 
         return factories


Follow ups