Giter Site home page Giter Site logo

Comments (6)

m0rt3nlund avatar m0rt3nlund commented on September 28, 2024 1

Thank you very much for a prompt and good answer! This project is great!

I of course should have returned the new conn, now everything works as expected!

My thought was that since the docs says that the body is read out of the socket I did not think there was anything in the conn that was updated and then did not even think that the new conn was needed.. Silly me..

But then I know a bunch more about the inner workings of both Plug and Bandit

Thanks!

from bandit.

m0rt3nlund avatar m0rt3nlund commented on September 28, 2024

image

from bandit.

mtrudel avatar mtrudel commented on September 28, 2024

Are you 100% certain you're not rebinding conn on every call into Plug.Conn functions? This looks exactly like that's the case

from bandit.

mtrudel avatar mtrudel commented on September 28, 2024

Here's your problem:

https://github.com/m0rt3nlund/bandit_test/blob/main/lib/teste_web/controllers/page_controller.ex#L38

You need to rebind conn on every call - Bandit keeps important things in there

from bandit.

mtrudel avatar mtrudel commented on September 28, 2024

Cowboy gets away with this in some cases because they smear connection state across a few processes so you won't always see this (but you will sometimes; it depends on where you're not rebinding). Bandit is very much intentionally a single-process-per-connection design, so we're more sensitive to rebinding.

Regardless, the Plug contract is clear on this; you need to track and rebind returned conn values for correctness.

from bandit.

mtrudel avatar mtrudel commented on September 28, 2024

Closing for hygiene. Thanks for the report!

from bandit.

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.