Giter Club home page Giter Club logo

Comments (4)

Dreamsorcerer avatar Dreamsorcerer commented on September 25, 2024 1

As we use llhttp, if you convince Node.js to change behaviour, then we'll update the Python parser to match. But, it'd be weird to have different behaviour depending on the parser used.

Given that the client in this case has violated the HTTP protocol, I don't think it really matters whether the behaviour is intuitive or not, it should never be encountered by an HTTP client.

from aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on September 25, 2024

That error is from the Python parser. With llhttp, you get the more accurate: Data after Connection: close:.

from aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on September 25, 2024

A client that sends a "close" connection option MUST NOT send further requests on that connection (after the one containing the "close")
https://www.rfc-editor.org/rfc/rfc9112#section-9.6-5

For the server, it merely says that it should not process further requests. It does not say it should process the previous request. So, I think tweaking the Python parser to match the llhttp error is fine.

from aiohttp.

kenballus avatar kenballus commented on September 25, 2024

For the server, it merely says that it should not process further requests. It does not say it should process the previous request.

I suppose this might be technically allowable, but it's pretty unintuitive in my opinion. I would assume that data received after a connection has been declared closed should not invalidate previous valid messages sent on that connection.

I've since tested this on many more HTTP implementations.

These ones reject the second request without responding to the first:

  • Hypercorn
  • Node.js

These ones respond to the first request and ignore the second because the connection is closed:
(Mongoose and Uvicorn have changed sides on this because of reports that I submitted, so feel free to ignore those two)

  • Apache httpd
  • Cheroot
  • cpp-httplib
  • Dart stdlib
  • FastHTTP
  • Eclipse GlassFish
  • Go net/http
  • Gunicorn
  • H2O
  • HAProxy
  • Hyper
  • Microsoft IIS
  • JetBrains Ktor
  • Eclipse Jetty
  • Libevent
  • Libmicrohttpd
  • Libsoup
  • Lighttpd
  • Mongoose
  • Netty
  • Nginx
  • OpenBSD httpd
  • OpenLiteSpeed
  • Phusion Passenger
  • PHP stdlib
  • protocol-http1
  • Puma
  • Apple ServiceTalk
  • Apache Tomcat
  • Tornado
  • Twisted
  • OpenWrt uhttpd
  • Unicorn
  • Uvicorn
  • Waitress
  • WEBrick
  • Akamai GHost
  • Apache Traffic Server
  • AWS Application Load Balancer
  • AWS Classic Load Balancer
  • Cloudflare
  • Google Classic Application Load Balancer
  • Envoy
  • OpenBSD relayd
  • Pingora
  • Pound
  • Squid
  • Varnish

Given the behavior of other implementations, it's probably worth at least documenting that AIOHTTP handles things differently.

from aiohttp.

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.