[Python] Bad request version/syntax/type when executing POST request to flask

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    Good Morning,

    I'm trying to set up a local flask app running for testing some python code, i used to do it the same way a lot (with the same python script) without any issues, but now i'm getting random 'bad request version/type/syntax" errors and a lot of random bytes text errors.

    To set the app running, i'm doing the standard:

    export FLASK_APP=<name_here>
    export FLASK_ENV=development


    And then i do:

    flask run


    Then, after sending any POST request to it, i'm getting a random error like this:

    127.0.0.1 - - [24/Mar/2025 08:54:18] code 400, message Bad request version ('\x02³áWüçð\x18åÙíäï\x81¡P')
    127.0.0.1 - - [24/Mar/2025 08:54:18] "\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03]|Û\x9c¦Û\x1bNn¡B\x08¥æ<úä´q\x87\x08\x09ÕýQân\x8bÅã¼t \x02³áWüçð\x18åÙíäï\x81¡P" 400 -
    127.0.0.1 - - [24/Mar/2025 08:54:25] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03²2/ýP\x84#')
    127.0.0.1 - - [24/Mar/2025 08:54:25] "\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03²2/ýP\x84#\x0c\x0d2»®\x86\x8a\x91È¢"Ù\x1a~\x13%d\x17#D" 400 -
    127.0.0.1 - - [24/Mar/2025 08:54:26] code 400, message Bad request version ('À\x13À')
    127.0.0.1 - - [24/Mar/2025 08:54:26] "\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03bzqJ%\x0bÞ\x90¯_¨Ò\x81N\x1cS?¦O×\x84qlX"`J¦sBBK \x16ºç$ò:\x87\x9d¹\x93\x0ery_~'\x12\x0b+\x1fë_n83&a©ÁL\x97Ö\x00$\x13\x01\x13\x02\x13\x03À/À+À0À,À'̨̩À\x09À\x13À" 400 -
    127.0.0.1 - - [24/Mar/2025 08:54:27] code 400, message Bad request syntax ('\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03AÂ:ÿ\x91+*ò>~ir{ÿô5}@êë¸o¼')
    127.0.0.1 - - [24/Mar/2025 08:54:27] "\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03AÂ:ÿ\x91+*ò>~ir{ÿô5}@êë¸o¼" 400 -
    127.0.0.1 - - [24/Mar/2025 08:54:41] code 400, message Bad request version ('À\x13À')
    127.0.0.1 - - [24/Mar/2025 08:54:41] "\x16\x03\x01\x00á\x01\x00\x00Ý\x03\x03^¨l᥻ê!\x1ab\x92*\x85\x99ÄaðÁ\x82\x88êÒ£eC\x90\x85Ó\x92oÍþ Á<|3KMÍù~:ì\x0f-Öâ~E>o\x87O1ßÛ±èµë}Ò\x17r\x00$\x13\x01\x13\x02\x13\x03À/À+À0À,À'̨̩À\x09À\x13À" 400 -


    My guess is something must have changed in the flask library, because, as i said, i used to test the same python app like 2 years ago using that syntax and everything worked flawless.

    Any idea what could it be?

    Thanks in advance!

    Continue reading...

Compartilhe esta Página