Chapters: 

The tracker hang spot:

return render_template("upload.html", group=group, files=names)

Right now Flask builds the whole upload.html and only then flushes. On a tiny 2005 firewall that delay is enough to make the browser think the connection is toast.

🔧 Minimal adjustment (test mode)

Yes, you can “tack on” Response to your existing imports. You already have:

from flask import request, redirect, jsonify, render_template, \
                  send_from_directory, abort, send_file, make_response

👉 Add Response to the list:

from flask import request, redirect, jsonify, render_template, \
                  send_from_directory, abort, send_file, make_response, Response

Then change your return line to stream:

return Response(
    render_template("upload.html", group=group, files=names),
    mimetype="text/html")

🔍 Why this helps

  • Old way: browser waits until template fully rendered before anything comes back.
  • New way: Flask hands the rendered template to Response, which can start flushing headers/body right away.
  • That tiny difference is often enough to keep old gear happy → browser stops spinning.

⏱ How to test

  1. Make that one-line change.
  2. Restart TD (systemctl restart transferdepot or however you run it).
  3. Upload a small file in the browser.
    • If the spinner finally closes → bingo, response path fixed.
    • If not, we’ll escalate to stream_with_context (chunked streaming), but this quick Response wrapper is the safe first step.