缺少MIME类型时返回什么

缺少MIME类型时返回什么

本文介绍了缺少MIME类型时返回什么(如果有)http状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果Web服务器没有为客户端尝试下载的文件添加MIME类型,将返回什么(如果有)http状态代码?

If a web server doesn't have a MIME type added for a file that a client tries to download, what (if any) http status code would be returned?

这表明它可能是415,虽然答案不明确:

It suggests here it could be 415, although the answer isn't definite:

推荐答案

如果您的问题是请求的正确状态代码是什么,如果请求的主体是以服务器无法接受的媒体类型进行内容编码的,则答案是415不支持的媒体类型 。

The answer is "415 Unsupported Media Type" if your question is "what is the correct status code for a request if its body is content-encoded in the media type the server cannot accept."

RFC 2616和draft-ietf-httpbis-p2-semantics-21.txt说:

RFC 2616 and draft-ietf-httpbis-p2-semantics-21.txt says:

但如果您的问题是如果服务器无法响应接受请求标头请求的媒体类型内容编码的实体主体,那么正确的状态代码是什么,答案是406不可接受

But If your question is "what is the correct status code if the server cannot respond with an entity body which is content-encoded in the media-type requested by Accept request header", the answer is "406 Not Acceptable"

RFC 2616说:

RFC 2616 says:

这篇关于缺少MIME类型时返回什么(如果有)http状态代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 04:50