어제 스터디하다가 궁금한 내용을 또 찾아봅니다.
결론은.. RFC문서에서 정해놓은 BNF 식에 맞춰 해당 content type이 미리 정의되어있습니다.
type := discrete-type / composite-type
discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token
composite-type := "message" / "multipart" / extension-token
extension-token := ietf-token / x-token
ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>
(ase insensitive하다는 걸 꼭 기억해주세요.)
Text/html은 여기에 나와있지 않지만, ietf-token에서 따라가다 보면 나옵니다. 이 글의 맨 마지막에 나옵니다.
참고로, 확장성을 위해서 ietf-token을 넣어둔것이죠. 그래서 content –type의 전체 리스트는 명확히 한정되어 있지 않습니다..
추적 내용
Html 4.0 스펙을 찾아가서 (http://www.w3.org/TR/html401/types.html#type-content-type) 보았습니다.
6.7 Content types (MIME types)
This type is represented in the DTD by %ContentType;. Content types are case-insensitive.
Examples of content types include "text/html", "image/png", "image/gif", "video/mpeg", "text/css", and "audio/basic". For the current list of registered MIME types, please consult [MIMETYPES].
Html 4.0 DTD 스펙에는 다음과 같이 content type을 정의하고 있습니다. (http://www.w3.org/TR/html401/sgml/dtd.html#ContentType)
<!ENTITY % ContentTypes "CDATA"
-- comma-separated list of media types, as per [RFC2045]
-->
"Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", N. Freed and N. Borenstein, November 1996. Note that this RFC obsoletes RFC1521, RFC1522, and RFC1590.
IETF 2045
http://www.ietf.org/rfc/rfc2045.txt
제목은 다음과 같습니다.
Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
5.1. Syntax of the Content-Type Header Field
In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:
content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.
type := discrete-type / composite-type
discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token
composite-type := "message" / "multipart" / extension-token
extension-token := ietf-token / x-token
ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>
x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>
subtype := extension-token / iana-token
iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>
parameter := attribute "=" value
attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.
value := token / quoted-string
token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>
tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "\" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values
여기서 파라미터는 ; charset=us-ascii 이런거 되겠지요..
Extended-token으로 정의되어 있는 부분은 다음과 설명이 되어 있습니다. X-application-type 이런거 그 예가 되겠지요..iana는 RFC2048을 참조하라고 되어 있네요.
(1) Private values (starting with "X-") may be defined
bilaterally between two cooperating agents without
outside registration or standardization. Such values
cannot be registered or standardized.
(2) New standard values should be registered with IANA as
described in RFC 2048.
재미있는 것은 위의 스펙에서는 왜 text/html이 보이지 않는 걸까요?
이건 따로 스펙이 있습니다. (http://www.ietf.org/rfc/rfc2854.txt)
제목 : The'text/html' Media Type
MIME media type name: text
MIME subtype name: html
위의 ietf-token 토큰이 여기에 해당되지요..
Html의 content type 전체 리스트는 구하기 힘들지만, 대충은 알아볼 수 있을 것이라 생각됩니다..
'web' 카테고리의 다른 글
multi-part/form-data (0) | 2007.08.23 |
---|---|
html 4.0의 select-optgroup (0) | 2007.08.23 |
HTTP post 길이 제한??? (있다, 없다) (0) | 2007.08.23 |
session clustering (0) | 2007.08.22 |
쿠키 제한 값? size and length of cookie limit (0) | 2007.08.22 |