httpプロトコルを学びながら、Pythonでhttpサーバーを作成します。問題が発生しました。コンテンツを複数のパケットでブラウザに送信したい。私はこれを試しました:
conn.send("HTTP/1.0 200 OK")
conn.send("\r\n")
conn.send("Content-Type: application/force-download")
conn.send("\r\n")
conn.send("Content-Disposition: attachment; filename=file.txt")
conn.send("\r\n")
conn.send("Content-length: "+str(file_length))
conn.send("\r\n\r\n")
c = 0
while download_data[c]:
conn.send(download_data[c])
しかし、それは機能しません。ブラウザは最初のパケットのみを受信します。アドバイスをありがとう。