Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide opt-in to avoid request body duplication #533

Closed
jakearchibald opened this issue Oct 24, 2014 · 14 comments
Closed

Provide opt-in to avoid request body duplication #533

jakearchibald opened this issue Oct 24, 2014 · 14 comments

Comments

@jakearchibald
Copy link
Contributor

Once streams land, we want support in fetch. This issues tracks that and is a home for considerations.

@jakearchibald
Copy link
Contributor Author

From @annevk in #whatwg:

If a redirect is hit, the request gets replayed to the new URL, this means that the request body gets buffered whether it needs to be or not. This may be undesirable/unworkable for large uploads, we may want to consider an option to fail-on-redirect, or prevent-buffering.

@tyoshino
Copy link
Contributor

So, if we want to retry on such a failure on fetch() with fail-on-redirect: true, we need to build another Request object manually? fetch() sets used flag of the given Request.

@annevk
Copy link
Member

annevk commented Oct 28, 2014

@tyoshino I don't really see another way of preventing the duplication. You? Files will become very large going forward, or are we not concerned about that?

@tyoshino
Copy link
Contributor

@annevk I'm not objecting to the idea. It makes sense. Just trying to understand manual retry story.

@annevk
Copy link
Member

annevk commented Oct 29, 2014

The idea would be that before you do something like this you ensure it's going to work. So network is up, you know the URL will not redirect, and then you start transferring this huge stream of data. If it does go wrong, it probably depends a bit on where the data came from originally how you want to recover.

@tyoshino
Copy link
Contributor

@annevk OK. Thanks.

@tyoshino
Copy link
Contributor

/cc @yutakahirano

@annevk
Copy link
Member

annevk commented Apr 5, 2015

So when I added redirect = "error" I forgot about this optimization.

The other avenue for a repeated request is HTTP authentication. Now normal HTTP authentication is not a problem as that is disabled in fetch() (you need to handle that yourself, building Authorization headers etc.). However, there is also HTTP proxy authentication. Opting out of that might be tricky or not desired. So I'd still need some input from network experts whether we can make the optimization and how that would affect HTTP proxy authentication.

@annevk
Copy link
Member

annevk commented Apr 5, 2015

(It might be better to move this issue to https://github.com/whatwg/fetch at this point... I'd like to stop using this repository for Fetch issues.)

@annevk annevk changed the title Add support for streams Provide opt-in to avoid request body duplication Apr 5, 2015
@tyoshino
Copy link
Contributor

tyoshino commented Apr 6, 2015

On network with small RTT, it might be ok to:

  • ask users who want to do streaming to return a response header asap
  • have UAs refrain from forgetting sent data until it receives a response header

Can we use 100 continue or something to carry this kind of signal (It seems the final HTTP2 spec allows 100 continue)?

For large RTT network, it would be big loss if we don't start sending data until we receive a response (we shouldn't assume the underlying connection is TCP. Now we have HTTP2, etc.).

@annevk
Copy link
Member

annevk commented Apr 6, 2015

So that would be a protocol addition to enable something similar to this with the server controlling behavior. That might be good to support in due course and probably warrants a distinct ticket (against whatwg/fetch) and coordination with @mnot and cohorts.

However, my open question is about letting the client decide. That is, what should do about the situation where apart from proxy authentication we know no teeing would be needed?

@mnot
Copy link
Member

mnot commented Apr 7, 2015

It sounds like you're talking about expect/continue:
http://httpwg.github.io/specs/rfc7231.html#header.expect

@annevk
Copy link
Member

annevk commented Apr 7, 2015

Thanks! Indeed that seems sufficient for a negotiated version of this with some kind of opt-in flag passed to fetch(). I'd still be interested in hearing if we can avoid or fail on HTTP proxy authentication (407) so we can have a client-driven solution as well.

@annevk
Copy link
Member

annevk commented Apr 7, 2015

Opened two issues. One for the protocol-based version and one for the client decides version:

Closing this one. Other Fetch stream concerns are tracked by this repository by the way:

@annevk annevk closed this as completed Apr 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants