Re: Inviting feedback on my proposed "ASGI" spec
Collin Anderson <[email protected]> Fri, 11 Mar 2016 10:45:05 -0500
| Newsgroups | gmane.comp.python.web |
|---|---|
| Message-ID | <CAFO84S6wyOLdGM+1sBLdjko8B86BkuL0zbMyF1eoZHQjkPPK_Q@mail.gmail.com> |
--===============5878227928301356368== Content-Type: multipart/alternative; boundary=001a113ceae6ca4e8e052dc7d179 --001a113ceae6ca4e8e052dc7d179 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Just a thought from a non-wsgi developer: I think it might be smart to follow http2 when in doubt on a question: - http2 preserves header order and allows duplicates in both directions. A list of tuples seems to be the best data structure IMHO. - http2 ignores reason phrases, which makes me think discarding it wouldn't be a problem for the new standard. On Fri, Mar 11, 2016 at 5:28 AM, Cory Benfield <[email protected]> wrote: > > > On 10 Mar 2016, at 18:36, Andrew Godwin <[email protected]> wrote: > > > > > > Second, if it were me I=E2=80=99d remove the `status_text` field on the > `Response` object. Custom status text is a terrible misfeature (especiall= y > as HTTP/2 doesn=E2=80=99t support it), and in 99% of cases you=E2=80=99re= just wasting data > by repeatedly sending the default phrase that the server already knows. > > > > Well, it IS optional; you only need to send it if you're changing it > from the default or providing an unusual new value (e.g. 418). We could > change the spec to say servers don't have to abide by it, too. I have don= e > a project in the past with custom reason phrases, that's all :) > > You monster! ;) > > For what it=E2=80=99s worth, I object to the use of reason phrases becaus= e, as > with all things in HTTP, they were far-too-broadly specified. The rules f= or > parsing the reason phrase are super broad (the reason phrase allows \t, > space, and then all bytes from 0x21 to 0xFF *excluding* 0x7F (ASCII DEL). > This means that it=E2=80=99s sometimes possible to encode a reason phrase > containing non-ASCII/non-Latin-1 codepoints in UTF-8 (I=E2=80=99ve seen t= his > happen), and then everything gets really terrible really fast. > > IMO, I think almost nothing would be lost by just quietly removing it fro= m > the specification. The only loss is in setting =E2=80=9Cunusual=E2=80=9D = values, and FWIW I > think that=E2=80=99s *also* unwise: if it can=E2=80=99t be found here[0] = then the unusual > status code is nothing but vanity, because it=E2=80=99s no more precise t= han the > X00 version that already exists (no user agent can take action on it). > > Again, just my 2=C2=A2. > > Cory > > > [0]: > https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtm= l > > _______________________________________________ > Web-SIG mailing list > [email protected] > Web SIG: http://www.python.org/sigs/web-sig > Unsubscribe: > https://mail.python.org/mailman/options/web-sig/cmawebsite%40gmail.com > > --001a113ceae6ca4e8e052dc7d179 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Just a thought from a non-wsgi developer: I think it might= be smart to follow http2 when in doubt on a question:<div><br></div><div>-= http2 preserves header order and allows duplicates in both directions. A l= ist of tuples seems to be the best data structure IMHO.</div><div><br></div= ><div>- http2 ignores reason phrases, which makes me think discarding it wo= uldn't be a problem for the new standard.</div></div><div class=3D"gmai= l_extra"><br><div class=3D"gmail_quote">On Fri, Mar 11, 2016 at 5:28 AM, Co= ry Benfield <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" targ= et=3D"_blank">[email protected]</a>></span> wrote:<br><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"><span class=3D""><br> > On 10 Mar 2016, at 18:36, Andrew Godwin <<a href=3D"mailto:andrew@a= eracode.org">[email protected]</a>> wrote:<br> ><br> ><br> > Second, if it were me I=E2=80=99d remove the `status_text` field on th= e `Response` object. Custom status text is a terrible misfeature (especiall= y as HTTP/2 doesn=E2=80=99t support it), and in 99% of cases you=E2=80=99re= just wasting data by repeatedly sending the default phrase that the server= already knows.<br> ><br> > Well, it IS optional; you only need to send it if you're changing = it from the default or providing an unusual new value (e.g. 418). We could = change the spec to say servers don't have to abide by it, too. I have d= one a project in the past with custom reason phrases, that's all :)<br> <br> </span>You monster! ;)<br> <br> For what it=E2=80=99s worth, I object to the use of reason phrases because,= as with all things in HTTP, they were far-too-broadly specified. The rules= for parsing the reason phrase are super broad (the reason phrase allows \t= , space, and then all bytes from 0x21 to 0xFF *excluding* 0x7F (ASCII DEL).= This means that it=E2=80=99s sometimes possible to encode a reason phrase = containing non-ASCII/non-Latin-1 codepoints in UTF-8 (I=E2=80=99ve seen thi= s happen), and then everything gets really terrible really fast.<br> <br> IMO, I think almost nothing would be lost by just quietly removing it from = the specification. The only loss is in setting =E2=80=9Cunusual=E2=80=9D va= lues, and FWIW I think that=E2=80=99s *also* unwise: if it can=E2=80=99t be= found here[0] then the unusual status code is nothing but vanity, because = it=E2=80=99s no more precise than the X00 version that already exists (no u= ser agent can take action on it).<br> <br> Again, just my 2=C2=A2.<br> <br> Cory<br> <br> <br> [0]: <a href=3D"https://www.iana.org/assignments/http-status-codes/http-sta= tus-codes.xhtml" rel=3D"noreferrer" target=3D"_blank">https://www.iana.org/= assignments/http-status-codes/http-status-codes.xhtml</a><br> <br>_______________________________________________<br> Web-SIG mailing list<br> <a href=3D"mailto:[email protected]">[email protected]</a><br> Web SIG: <a href=3D"http://www.python.org/sigs/web-sig" rel=3D"noreferrer" = target=3D"_blank">http://www.python.org/sigs/web-sig</a><br> Unsubscribe: <a href=3D"https://mail.python.org/mailman/options/web-sig/cma= website%40gmail.com" rel=3D"noreferrer" target=3D"_blank">https://mail.pyth= on.org/mailman/options/web-sig/cmawebsite%40gmail.com</a><br> <br></blockquote></div><br></div> --001a113ceae6ca4e8e052dc7d179-- --===============5878227928301356368== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Web-SIG mailing list [email protected] Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: https://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org --===============5878227928301356368==--