-
Notifications
You must be signed in to change notification settings - Fork 3
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
ERR_TIMED_OUT on multi requests #7
Comments
The connection is weak causing more errors on both sides: server and client. |
Hi - the reason why this module is called "tiny" is because it avoids all the complexity of serving many connections in parallel, keeping long/slow connections open etc. My feeling would be to close this as WONTFIX, but I will leave it open for a while if anyone wants to contribute a small and easy fix if it exists, but this should definitely not become a reinvention of much bigger wheels :) Heavy duty is probably best achieved by using e.g. flask with gunicorn. |
I agree, feel free to close it as wontfix. I've done some projects with flask and gunicorn and I'm also thinking about these tools but I'd rather pip install something ready to use :) I cannot believe that such a tool that graciously handles many parallel requests without crashing does not exist in python - I'm talking about HTTPS + auth server. But I cannot find anything! Perhaps you came across such tools? |
All right, I've come up with the simplest file-sending server on flask + gunicorn. Posting it here for other users: import os
from flask import Flask, send_file
from flask_httpauth import HTTPBasicAuth
from werkzeug.security import generate_password_hash, check_password_hash
app = Flask(__name__)
auth = HTTPBasicAuth()
FIRMWARE_PATH = "firmware.bin"
users = {
os.environ['ENV_OTA_SERVER_USER']: generate_password_hash(os.environ['ENV_OTA_SERVER_PASS'])
}
@app.route(f'/{FIRMWARE_PATH}')
@auth.login_required
def download_firmware():
return send_file(FIRMWARE_PATH, as_attachment=False)
@auth.verify_password
def verify_password(username, password):
if username in users and \
check_password_hash(users.get(username), password):
return username
if __name__ == '__main__':
app.run(debug=False, port=8070, host="0.0.0.0") The script servers only one predefined file. And I'm launching it with gunicorn like so:
|
I'm using your tiny http server to serve firmware updates for my ESP32 boards.
I have ~10 such boards in total all requesting to download a file. HTTPS + auth mode. And as soon as they all start a request, the server is no longer reachable (even from my PC).
Also, I noticed that if any such request fails, the server is stalled and not recovered until reset.
Perhaps, threads + timeouts on error would help.
The text was updated successfully, but these errors were encountered: