Add Api for HTTP/2 PushPromise #371

Open
benaadams opened this Issue Aug 15, 2015 · 5 comments

Projects

None yet

4 participants

@benaadams
Contributor

Implement the PushPromise api as virtual NoOp in the abstract class HttpResponse.

Background

This API is to support applications sending push promises to HTTP 2.0 clients.

Current .NET v4.6 Api

public void PushPromise( string path )

public void PushPromise(
    string path,
    string method,
    NameValueCollection headers
)

Parameters
path Type: System.String
The URL of the push request. It should be the virtual path of the relative resource that the server wants to push to the client.

method Type: System.String
Http request method that would be used by the push request.

headers Type: System.Collections.Specialized.NameValueCollection
Http request header that would be used by the push request.

Suggested addition to Microsoft.AspNet.Http.Abstractions/HttpResponse.cs

Remarks
PushPromise is non-deterministic and applications shouldn't have logic that depends on it. Its only purpose is performance advantage in some cases. There are many conditions (protocol and implementation) that may cause to ignore the push requests completely. The expectation is based on fire-and-forget.

Rationale

Its out-of-band data like headers and cookies and is part of the response so should live at the HttpResponse level.

It is a core feature of http/2 rather than a extended addition that might be HttpContext related.

Its now standardised and implemented in all browsers - so is something I assume will be implemented in ASP.NET 5.

It already comes with two huge caveats:

  • applications shouldn't have logic that depends on it
  • There are many conditions (protocol and implementation) that may cause to ignore the push requests completely.

Which means it doesn't actually have to do anything at this time.

Suggested Api

public virtual void PushPromise(string path);
public virtual void PushPromise(string path, string method, IHeaderDictionary headers);
@benaadams
Contributor

Additional protocol activation background

  • Currently use of http/2 in browsers requires https as none of them have implemented it over http.
  • At one point the spec in draft also required ssl/tls; but due to pushback the final spec no longer requires it.
  • There doesn't seem to be a huge appetite from browser vendors to implement http/2 over http
  • When websockets was implemented there was a lot of trouble with proxies etc going over http; so to ensure maximum support, generally https has to be used.

In light of this it looks like http/2 is a defacto https only protocol; so PushPromise will only need to work over https and http/2 at this time.

@muratg muratg added this to the Backlog milestone Nov 19, 2015
@muratg
Member
muratg commented Nov 19, 2015

As per previous discussion, we'll look into HTTP/2 after RTM.

@Tratcher
Member

Related API questions:

  • How do we surface to the app that this is an HTTP/2 request and that PushPromise will do something? HTTP/1.1 and HTTP/2 can be hosted on the same port (using TLS & ALPN).
  • Do we also surface request priority and other new fields?
@rh78
rh78 commented Dec 15, 2016

Supporting this!!!

@muratg muratg removed this from the Backlog milestone Dec 15, 2016
@muratg
Member
muratg commented Jan 11, 2017

Backlogging this one. cc @DamianEdwards

@muratg muratg added this to the Backlog milestone Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment