IOError:[Errno 104]由对等方重置连接

时间:2015-12-13 11:40:43

标签: python flask

我正在发送一个包含以下路线的文件

public class ChatController : Controller
    {
        public ChatController()
        {
            ChatEngine.Instance.OnMessageReceived = MessageReceived;
        }

        /// <summary>
        /// Handler on message received
        /// </summary>
        /// <param name="e"></param>
        private void MessageReceived(S22.Xmpp.Im.MessageEventArgs e)
        {
            // we can do only server side updates, but can't to manipulate View here
            RedirectToAction("Index", "Home");  // this doesn't work
        }

它适用于大多数桌面浏览器和某些移动浏览器。但是在其他方面却没有,我得到了这个错误

@app.route('/file/')
@db_session
def file():
    filename = request.args.get('filename')
    response = make_response(filename)
    response.headers['Content-Type'] = 'video/mp3'
    response.headers["Content-Disposition"] = 'attachment; filename=%s' % filename
    response.headers['Content-Length'] = os.path.getsize(filename)
    response.headers["X-Accel-Redirect"] = '%s' % filename
    return send_file(
                 filename,
                 mimetype="audio/mp3",
                 as_attachment=True,
                 attachment_filename="%s" % filename)

我已经尝试随机输入time.sleep(1)以尝试帮助。

0 个答案:

没有答案