GithubHelp home page GithubHelp logo

Comments (16)

annevk avatar annevk commented on May 21, 2024 1

Fair, though I'm not sure the added complexity is worth it just for that. The client is much more informed about whether it wants to initiate a large transfer or not. Also, with H2 and also with early responses you can somewhat mitigate the "damage". And with streaming uploads that are coming soon you should have all the control you need.

from fetch.

fuweichin avatar fuweichin commented on May 21, 2024 1

Inspired by Server-sent Events, I'm trying to implement Client-sent Events based on fetch upload streaming, while Fetch API supports neither Expect: 100-continue request header nor 100 Continue response status.

So I quit for now, either be patient or forget it.

from fetch.

annevk avatar annevk commented on May 21, 2024

@tyoshino @mnot @wanderview @nikhilm do we still want this given the conclusion in #42?

from fetch.

annevk avatar annevk commented on May 21, 2024

Also, @mnot, it does not seem like this header guarantees there will be no redirects.

from fetch.

mnot avatar mnot commented on May 21, 2024

No, it doesn't.

Expect/Continue is a mechanism for avoiding unnecessary transfer of the request body; it won't help you avoid buffering it.

I think what you want to do is assure that developers can use expect/continue. It might be useful to have fetch do it natively too, but I think it's a very implementation-specific decision.

Question: How does Fetch handle these sorts of genuinely optional, implementation-specific behaviours? In other places I see hand-waving about "do whatever HTTP stuff you want to do", but here it's pretty intrusive into the request handling model.

I suppose you might do that by putting a note in to the effect "You can make an implementation choice to support Expect/Continue HERE, but we leave the details as an exercise for the reader."

from fetch.

annevk avatar annevk commented on May 21, 2024

Ideally, if it's not specified, it's not allowed. But there's still quite a bit of handwaving the lower on the stack you go. Servers seem to rely on clients behaving in a certain way. I'm sure they're not going to be happy if we start sending them these headers without optin.

from fetch.

mnot avatar mnot commented on May 21, 2024

Servers already get Expect on requests with bodies, and have to deal with it. Really, Expect itself is a form of opt-in (for the request).

from fetch.

 avatar commented on May 21, 2024

Even without the teeing optimization, supporting Expect: 100-continue could be useful for large requests, in particular file uploads. The server may be able to respond immediately with an error (like a 401 or 403), meaning that clients for whom network usage is important (mobile in particular) can avoid wasting network on a request whose body will be ignored.

from fetch.

annevk avatar annevk commented on May 21, 2024

@mnot Expect is a forbidden header name at the moment. But even if we lift that, we can only handle a single response. I'm not sure how we'd adjust the API signature for a stream(?) of responses.

from fetch.

 avatar commented on May 21, 2024

Could Fetch handle the 100-continue transparently? Or would that just lead to requests not to and let the client handle it?

from fetch.

annevk avatar annevk commented on May 21, 2024

@scshunt we could let the client handle them and let the client handle when to transmit the request body (if the 100 response never shows). I thought we maybe wanted to expose them. Letting the client handle them certainly makes things easier.

from fetch.

mnot avatar mnot commented on May 21, 2024

I think that's what you'd want to do.

Note that Expect/Continue has lots of problems; defining its behaviour in fetch might help some of them, if it's done carefully.

from fetch.

annevk avatar annevk commented on May 21, 2024

First step here is probably fixing #366.

from fetch.

annevk avatar annevk commented on May 21, 2024

Given the discussion in yutakahirano/fetch-with-streams#66 I'm closing this. There's no real benefit in Expect if it is only for 100 and that status does not give us the guarantees we are looking for.

Note that #366 clarified that most 1xx (apart from 101) are to be ignored by the client.

from fetch.

mnot avatar mnot commented on May 21, 2024

As @scshunt said, there's still benefit for avoiding large transfers. Not that I'm strongly arguing for it, just noting that the issue discussed over there is orthogonal to the one discussed here.

from fetch.

covener avatar covener commented on May 21, 2024

I think one benefit not mentioned here is that a a POST w/ Expect: 100-continue that runs into a HTP/1.1 keepalive closure race can be detected and safely retried.

from fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.