gpt4 book ai didi

heroku - Heroku 上的 Rust HTTP 服务器生成错误 H18 — 服务器请求中断

转载 作者:行者123 更新时间:2023-11-29 08:07:48 28 4
gpt4 key购买 nike

问题

我正在尝试在 Heroku 上托管一个用 Rust 编写的简单 HTTP 服务器。

我没有使用外部 HTTP 库,因为这是一个大学学习项目,所以我通过 TcpStream 管理所有内容。

服务器在本地按预期工作。

我一直在 Heroku 日志中看到 H18(服务器请求中断)错误,并且 Heroku 上正在运行的实例不提供任何文件。具体来说,会发生以下类型的错误:

2017-03-12T14:11:53.952084+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/" host=regans-rust-project.herokuapp.com request_id=fe50b113-8091-4129-99f5-632c9536bb8e fwd="154.126.208.8" dyno=web.1 connect=0ms service=2ms status=503 bytes=581 protocol=https

2017-03-12T14:11:54.459277+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/favicon.ico" host=regans-rust-project.herokuapp.com request_id=cf6ad8a0-2780-4c07-843a-2b533df1c9aa fwd="154.126.208.8" dyno=web.1 connect=0ms service=1ms status=503 bytes=388 protocol=https

我尝试过的

  • 我已通过调用 Heroku 的 bash 实用程序确保静态资源位于目录中。我还从这里运行了可执行文件,服务器也在本地从 Heroku 实例工作。
  • 我已确保返回格式正确的 HTTP 响应(我有状态代码、内容类型、连接类型、内容长度)。

我的代码

可以看我的代码here .

我正在使用以下 buildpack

还有什么我应该附加到我的回复中以“完成”它们吗?任何帮助将不胜感激:)

最佳答案

正如评论中所讨论的,问题是代码使用 \n 作为 HTTP 响应中的分隔符,而标准规定它应该是 \r\n

关于heroku - Heroku 上的 Rust HTTP 服务器生成错误 H18 — 服务器请求中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42748698/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com