Re: WSGI 2.0 Round 2: requirements and call for interest
Graham Dumpleton <[email protected]> Wed, 6 Jan 2016 20:48:01 +1100
| Newsgroups | gmane.comp.python.web |
|---|---|
| Message-ID | <[email protected]> |
--===============8317722311325409741== Content-Type: multipart/alternative; boundary="Apple-Mail=_A775F880-A9D1-407D-A333-E3925C5B071A" --Apple-Mail=_A775F880-A9D1-407D-A333-E3925C5B071A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 5 Jan 2016, at 10:31 PM, Graham Dumpleton = <[email protected]> wrote: >=20 >>> For example, mod_wsgi already supports HTTP/2 by virtue of the fact = that the mod_h2 module in Apache exists. The existing internal APIs of = Apache and how mod_wsgi uses those means that HTTP/2 bridges into the = WSGI world with no code changes to mod_wsgi. >>=20 >> Agreed. If all we want is to keep the request/response cycle intact, = then WSGI supports H2 already. One possibility that has already been = suggested here would be to define a HTTP/2 extension to WSGI, advertised = in the environ dict, that allows the application to signal pushes to the = server. This would be a fairly simple extension to write and implement. >=20 > Sorry to be cynical. Many people have said that changes in the past = related to WSGI will 'be a fairly simple extension to write and = implement=E2=80=99. Dig deeper and it never turns out to be the case. = :-) >=20 > Such an extension presumes you actually have a tightly integrated = HTTP/2 server which itself which can maintain a map of resources to push = when getting certain requests and also maintain what may have already = been sent for a session. Even getting to that point is going to be non = trivial, even if an extension may be simple for somehow notifying what = the additional resources to supply should be. >=20 > Right now I would say that with mod_h2 in Apache in would be plain = impossible as it doesn=E2=80=99t I believe even support the idea of = pushing resources at this point. Even then it would most likely be a = huge undertaking to get it to work for mod_wsgi daemon mode as the web = application runs in a separate process to where HTTP/2 is handled. >=20 > If you believe though it is as simple as an extra item in the environ = dictionary, then it can be handled as a separate extension specification = per the URL above. A side discussion on Twitter has noted that this exists: https://w3c.github.io/preload/ <https://w3c.github.io/preload/> This is already implemented by mod_h2, nghttp2 and H20 at least. This is not my area so I don=E2=80=99t know for sure whether this fits = the bill as to what is being described as =E2=80=98pushing=E2=80=99. If as I understand it, this allows a WSGI application to return a Link = header and mod_h2 in Apache then uses HTTP/2 push to deliver up those = resources straight away. If I am misunderstanding this, please let me know. The only problem I do see with this right now if it does what is = required, is that in mod_wsgi daemon mode, except for select headers = such as Set-Cookie and WWW-Authenticate, response headers of the same = name will be joined together. What I don=E2=80=99t know is if = mod_h2/nghttp2 will handle where the value of a Link header is joined. = It is probably going to be safer if I modify mod_wsgi and add Link to = the white list of headers which aren=E2=80=99t joined together. If this does solve the push issue, what is there in HTTP/2 then that one = couldn=E2=80=99t do via the existing WSGI interface? Graham --Apple-Mail=_A775F880-A9D1-407D-A333-E3925C5B071A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D""><br class=3D""><div><blockquote type=3D"cite" class=3D""><div = class=3D"">On 5 Jan 2016, at 10:31 PM, Graham Dumpleton <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div class=3D"" = style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; = -webkit-line-break: after-white-space;"><div class=3D""><blockquote = type=3D"cite" class=3D"" style=3D"font-family: Helvetica; font-size: = 16px; font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; orphans: auto; text-align: start; text-indent: = 0px; text-transform: none; white-space: normal; widows: auto; = word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=3D""><div = class=3D"" style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; = -webkit-line-break: after-white-space;"><div class=3D""><blockquote = type=3D"cite" class=3D""><div class=3D""><div class=3D"" = style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; = -webkit-line-break: after-white-space;"><div class=3D""><div = class=3D"">For example, mod_wsgi already supports HTTP/2 by virtue of = the fact that the mod_h2 module in Apache exists. The existing internal = APIs of Apache and how mod_wsgi uses those means that HTTP/2 bridges = into the WSGI world with no code changes to = mod_wsgi.</div></div></div></div></blockquote><div class=3D""><br = class=3D""></div><div class=3D"">Agreed. If all we want is to keep the = request/response cycle intact, then WSGI supports H2 already. One = possibility that has already been suggested here would be to define a = HTTP/2 extension to WSGI, advertised in the environ dict, that allows = the application to signal pushes to the server. This would be a fairly = simple extension to write and = implement.</div></div></div></div></blockquote><div style=3D"font-family: = Helvetica; font-size: 16px; font-style: normal; font-variant: normal; = font-weight: normal; letter-spacing: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" = class=3D""><br class=3D""></div><div style=3D"font-family: Helvetica; = font-size: 16px; font-style: normal; font-variant: normal; font-weight: = normal; letter-spacing: normal; orphans: auto; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; widows: = auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D"">Sorry= to be cynical. Many people have said that changes in the past related = to WSGI will 'be a fairly simple extension to write and implement=E2=80=99= . Dig deeper and it never turns out to be the case. :-)</div><div = style=3D"font-family: Helvetica; font-size: 16px; font-style: normal; = font-variant: normal; font-weight: normal; letter-spacing: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-stroke-width: 0px;" class=3D""><br class=3D""></div><div = style=3D"font-family: Helvetica; font-size: 16px; font-style: normal; = font-variant: normal; font-weight: normal; letter-spacing: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-stroke-width: 0px;" class=3D"">Such an extension presumes = you actually have a tightly integrated HTTP/2 server which itself which = can maintain a map of resources to push when getting certain requests = and also maintain what may have already been sent for a session. Even = getting to that point is going to be non trivial, even if an extension = may be simple for somehow notifying what the additional resources to = supply should be.</div><div style=3D"font-family: Helvetica; font-size: = 16px; font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; orphans: auto; text-align: start; text-indent: = 0px; text-transform: none; white-space: normal; widows: auto; = word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><br = class=3D""></div><div style=3D"font-family: Helvetica; font-size: 16px; = font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; orphans: auto; text-align: start; text-indent: = 0px; text-transform: none; white-space: normal; widows: auto; = word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D"">Right now = I would say that with mod_h2 in Apache in would be plain impossible as = it doesn=E2=80=99t I believe even support the idea of pushing resources = at this point. Even then it would most likely be a huge undertaking to = get it to work for mod_wsgi daemon mode as the web application runs in a = separate process to where HTTP/2 is handled.</div><div = style=3D"font-family: Helvetica; font-size: 16px; font-style: normal; = font-variant: normal; font-weight: normal; letter-spacing: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-stroke-width: 0px;" class=3D""><br class=3D""></div><div = style=3D"font-family: Helvetica; font-size: 16px; font-style: normal; = font-variant: normal; font-weight: normal; letter-spacing: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-stroke-width: 0px;" class=3D"">If you believe though it is = as simple as an extra item in the environ dictionary, then it can be = handled as a separate extension specification per the URL = above.</div></div></div></div></blockquote></div><br class=3D""><div = class=3D"">A side discussion on Twitter has noted that this = exists:</div><div class=3D""><br class=3D""></div><div class=3D""><a = href=3D"https://w3c.github.io/preload/" = class=3D"">https://w3c.github.io/preload/</a></div><div class=3D""><br = class=3D""></div><div class=3D"">This is already implemented by mod_h2, = nghttp2 and H20 at least.</div><div class=3D""><br class=3D""></div><div = class=3D"">This is not my area so I don=E2=80=99t know for sure whether = this fits the bill as to what is being described as = =E2=80=98pushing=E2=80=99.</div><div class=3D""><br class=3D""></div><div = class=3D"">If as I understand it, this allows a WSGI application to = return a Link header and mod_h2 in Apache then uses HTTP/2 push to = deliver up those resources straight away.</div><div class=3D""><br = class=3D""></div><div class=3D"">If I am misunderstanding this, please = let me know.</div><div class=3D""><br class=3D""></div><div class=3D"">The= only problem I do see with this right now if it does what is required, = is that in mod_wsgi daemon mode, except for select headers such as = Set-Cookie and WWW-Authenticate, response headers of the same name will = be joined together. What I don=E2=80=99t know is if mod_h2/nghttp2 will = handle where the value of a Link header is joined. It is probably going = to be safer if I modify mod_wsgi and add Link to the white list of = headers which aren=E2=80=99t joined together.</div><div class=3D""><br = class=3D""></div><div class=3D"">If this does solve the push issue, what = is there in HTTP/2 then that one couldn=E2=80=99t do via the existing = WSGI interface?</div><div class=3D""><br class=3D""></div><div = class=3D"">Graham</div><div class=3D""><br class=3D""></div><div = class=3D""><br class=3D""></div></body></html>= --Apple-Mail=_A775F880-A9D1-407D-A333-E3925C5B071A-- --===============8317722311325409741== 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 --===============8317722311325409741==--