Why does my website just keep on loading and loading and loading when it has to return the content sent from the server's response?

if environ["PATH_INFO"] == "/signup":
        info = pformat(environ["wsgi.input"].read(int(environ["CONTENT_LENGTH"])))
        print(info)
        binfo = environ["wsgi.input"].read(int(environ["CONTENT_LENGTH"]))
        start_response("200 OK", [("Content-Type", "application/octet-stream")])
        return[environ["wsgi.input"].read(int(environ["CONTENT_LENGTH"]))]

okay so this code is meant to read the input from an html form, and send it to the signup page so you can see what was entered. now, nobody is using this but me so ik it’s insecure i just wanted to see something

basically, the issue is in the last line, the return line. for some reason, when i put this line in it keeps loading?? this is not the case when i put info.encode(“UTF-8”). i’m not sure why? i get no errors as well, it just…loads instead! and the return type for the thing inside the brackets is bytes so i’m not sure where the issue is here

if anyone could kindly let me know, that would be nice

thanks!

Do you intend to be returning bytes, here? Right now, you’re returning a list of bytes. [b""] is not the same thing as b"". If you remove the square brackets around your return value, do you get the behavior you expect?

Otherwise, you might need to provide more details.

I don’t think you’re allowed to read from wsgi.input multiple times like you’re doing here.

No you’re actually supposed to return a list of bytes im p sure

Look at the module source code, there are a few examples.

Yh i think that is the case there is nothing left to read after the first line with wsgi.input