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

KEEP_ALIVE doesn't work from the 21.3 sanic version #2984

Open
1 task done
ivancallefon opened this issue Jul 10, 2024 · 1 comment
Open
1 task done

KEEP_ALIVE doesn't work from the 21.3 sanic version #2984

ivancallefon opened this issue Jul 10, 2024 · 1 comment
Labels

Comments

@ivancallefon
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When you put in the sanic config keep_alive to false, it doesn't work you can see in all responses "Connection": "keep-alive".

I tryed with version 20.12.7 and sanic works correctly but in the version 21.3.0 it doesn't works

Code snippet

import asyncio


import uvloop
from sanic import Sanic
from sanic.response import text

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.get_event_loop()
app = Sanic('appname')


@app.get('/status')
async def status_handler(request):
    return text("", status=200)


def main():
    app.config.KEEP_ALIVE = False
    server = app.run(host='0.0.0.0', port=8000)
    asyncio.run(server, loop=loop)


if __name__ == '__main__':
    main()

Expected Behavior

I expect that the header "connection" of the response should be close if you put the config of KEEP_ALIVE=false

How do you run Sanic?

As a script (app.run or Sanic.serve)

Operating System

Linux

Sanic Version

=21.3.0

Additional context

No response

@cnicodeme
Copy link
Contributor

I can confirm this, which creates odd behavior with Brave browser and Websockets. Refreshing the page multiple times ends by the page being stuck at loading. I'll try to create a reproducible bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants