受病毒感染的资源的 HTTP 状态代码
HTTP status code for a resource infected by virus
我正在开发一个用作 Http-Proxy 的应用程序,用于提供来自外部资源的文件。它实际上从外部资源下载文件,检查 病毒 ,如果文件未被感染,return 将文件发送到客户端。
我的问题是,万一文件被感染,我的服务应该return什么 HTTP 状态代码?我认为任何类型的 4xx 错误代码都不适合这种情况,因为此 class 代码用于客户端错误。
502 (Bad Gateway) 错误更合适吗?
有没有涵盖这种情况的标准?
Http 响应代码仅用于处理 http 特定条件,因此我认为没有这样的正确答案。但有些可能性...
204 - "The server successfully processed the request and is not returning any content"
403 - "The request was valid, but the server is refusing action"
我认为你是对的 maestromarko : 502 Bad Gateway。阅读 the specifications here:
The 502 (Bad Gateway) status code indicates that the server, while
acting as a gateway or proxy, received an invalid response from an
inbound server it accessed while attempting to fulfill the request.
您的代理充当网关,他收到了它认为无效的内容,因为其中有病毒。
这不是4xx class错误,因为无论客户端在请求中如何更改,结果仍然是错误。
另请参阅此 decision diagram
我正在开发一个用作 Http-Proxy 的应用程序,用于提供来自外部资源的文件。它实际上从外部资源下载文件,检查 病毒 ,如果文件未被感染,return 将文件发送到客户端。
我的问题是,万一文件被感染,我的服务应该return什么 HTTP 状态代码?我认为任何类型的 4xx 错误代码都不适合这种情况,因为此 class 代码用于客户端错误。
502 (Bad Gateway) 错误更合适吗? 有没有涵盖这种情况的标准?
Http 响应代码仅用于处理 http 特定条件,因此我认为没有这样的正确答案。但有些可能性...
204 - "The server successfully processed the request and is not returning any content"
403 - "The request was valid, but the server is refusing action"
我认为你是对的 maestromarko : 502 Bad Gateway。阅读 the specifications here:
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
您的代理充当网关,他收到了它认为无效的内容,因为其中有病毒。
这不是4xx class错误,因为无论客户端在请求中如何更改,结果仍然是错误。
另请参阅此 decision diagram