Doubtful sentence in 9.2.3.4 of the latest OPC draft

MURATA Makoto eb2m-mrt at asahi-net.or.jp
Thu Sep 13 15:50:08 CEST 2018


Here is the doubtful sentence in 9.2.3.4 of the current
OPC draft:


The comparison might be case-sensitive and
include every character regardless of the role
it plays in the content-type grammar of RFC
7231, or it might follow the grammar of RFC
7231.

1) sensitive or insensitive?

I find that media types in .Net are case insensitive.
I executed the following F# code and the result is
"case insensitive".

    let mt1 =
        System.Nt.Mime.ContentType("application/xml")
    let mt2 =
        System.Net.Mime.ContentType("Application/Xml")

    if mt1 = mt2 then
        printfn "case insensitive"
    else printfn "case senstive"


How harmful if an OPC implementation does not handle content types in
a case-sensitive manner?  If programmers specify "Application/Xml" and
an OPC package has the following Override element, programmers
will get an unexpected result.

   <Override PartName="/a.xml" ContentType="application/xml" />

But do such an OPC implementation create problematic OPC packages?
Suppose that an OPC package aleady contains:

   <Default Extension="xml" ContentType="application/xml" />

If a programmer would like to add another part /a.xml of
"Application/Xml", a package will have

   <Override PartName="/a.xml" ContentType="Application/Xml" />

Although this Override element is unnecessary, it is not extremely
harmful.  Correct OPC implementations will have no problems even
if they encounter such unnecessary Override elements.

I propose to disallow case-sensitive comparison of media types
but add a note.

Note: The previous edition of this document did not disallow
case-sensitive comparison.

2) the content-type grammar of RFC 7231

I am puzzled by the doubtful sentence quoted above.
First, the synax in RFC 7231 is shown below:

Syntax:

     media-type = type "/" subtype *( OWS ";" OWS parameter )
     type       = token
     subtype    = token
     parameter  = token "=" ( token / quoted-string )

Examples:

     text/html;charset=utf-8
     text/html;charset=UTF-8
     Text/HTML;Charset="utf-8"
     text/html; charset="utf-8"

What does the sentence mean?

Regards,
Makoto


This message has been scanned for malware by Forcepoint. www.forcepoint.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.vse.cz/pipermail/sc34wg4/attachments/20180913/6ce11ef2/attachment.html>


More information about the sc34wg4 mailing list