Opened 11 years ago

Closed 11 years ago

#197 closed protocol enhancement (fixed)

Upgrade to RFC5234 ABNF (lose LWS issue)

Reported by: zach@… Owned by: zach@…
Priority: trivial Milestone:
Component: link-format Version:
Severity: - Keywords:
Cc:

Description

Julian Reschke and Jari Arkko suggested that we fix the ABNF, which is currently inheriting old RFC2616 ABNF.

This ticket is to upgrade to RFC5234 by repeating the ABNF from RFC5988 in the correct RFC5234 form, at the same time thus losing the problem of implied linear white space.

Change History (3)

comment:1 Changed 11 years ago by zach@…

  • Status changed from new to assigned

Proposed new ABNF upgraded to RFC5234. Note that this also takes care of Ticket #199, but means that we can't fix Ticket #198 as we are now doing relation type style values for if= and rt= due to the registries.

Running this through ABNF validation (http://www.apps.ietf.org/content/chris-newmans-abnf-validator) results in:

undefined rule: ext-value
undefined rule: quoted-string
undefined rule: subtype-name
undefined rule: LOALPHA
undefined rule: URI
undefined rule: URI-Reference
undefined rule: parmname
undefined rule: Language-Tag
unreferenced rule: Link
undefined rule: type-name
undefined rule: MediaDesc
ABNF validation (version 1.0) completed

Not sure how many of those undefined rules we are already bringing in through references, or should some of these be explicitly added to this definition? Any suggestions on improved ABNF are welcome.

  Link           = "<" URI-Reference ">" *( ";" link-param )
  link-param     = ( ( "rel" "=" relation-types )
                 / ( "anchor" "=" <"> URI-Reference <"> )
                 / ( "rev" "=" relation-types )
                 / ( "hreflang" "=" Language-Tag )
                 / ( "media" "=" ( MediaDesc / ( <"> MediaDesc <"> ) ) )
                 / ( "title" "=" quoted-string )
                 / ( "title*" "=" ext-value )
                 / ( "type" "=" ( media-type / quoted-mt ) )
                 / ( "rt" "=" relation-types )
                 / ( "if" "=" relation-types )
                 / ( "sz" "=" cardinal )
                 / ( link-extension ) )
  link-extension = ( parmname [ "=" ( ptoken / quoted-string ) ] )
                 / ( ext-name-star "=" ext-value )
  ext-name-star  = parmname "*" ; reserved for RFC2231-profiled
                                ; extensions.  Whitespace NOT
                                ; allowed in between.
  ptoken         = 1*ptokenchar
  ptokenchar     = "!" / "#" / "$" / "%" / "&" / "'" / "("
                 / ")" / "*" / "+" / "-" / "." / "/" / DIGIT
                 / ":" / "<" / "=" / ">" / "?" / "@" / ALPHA
                 / "[" / "]" / "^" / "_" / "`" / "{" / "|"
                 / "}" / "~"
  media-type     = type-name "/" subtype-name
  quoted-mt      = <"> media-type <">
  relation-types = relation-type
                 / <"> relation-type *( 1*SP relation-type ) <">
  relation-type  = reg-rel-type / ext-rel-type
  reg-rel-type   = LOALPHA *( LOALPHA / DIGIT / "." / "-" )
  ext-rel-type   = URI
  cardinal       = "0" / %x31-39 *DIGIT 

comment:2 Changed 11 years ago by zach@…

And after some more improvements and integrating the rest of the review comments we now have the following ABNF that passes validation:

  Link            = link-value-list
  link-value-list = [ link-value *[ "," link-value ]]
  link-value     = "<" URI-Reference ">" *( ";" link-param )
  link-param     = ( ( "rel" "=" relation-types )
                 / ( "anchor" "=" <"> URI-Reference <"> )
                 / ( "rev" "=" relation-types )
                 / ( "hreflang" "=" Language-Tag )
                 / ( "media" "=" ( MediaDesc / ( <"> MediaDesc <"> ) ) )
                 / ( "title" "=" quoted-string )
                 / ( "title*" "=" ext-value )
                 / ( "type" "=" ( media-type / quoted-mt ) )
                 / ( "rt" "=" relation-types )
                 / ( "if" "=" relation-types )
                 / ( "sz" "=" cardinal )
                 / ( link-extension ) )
  link-extension = ( parmname [ "=" ( ptoken / quoted-string ) ] )
                 / ( ext-name-star "=" ext-value )
  ext-name-star  = parmname "*" ; reserved for RFC2231-profiled
                                ; extensions.  Whitespace NOT
                                ; allowed in between.
  ptoken         = 1*ptokenchar
  ptokenchar     = "!" / "#" / "$" / "%" / "&" / "'" / "("
                 / ")" / "*" / "+" / "-" / "." / "/" / DIGIT
                 / ":" / "<" / "=" / ">" / "?" / "@" / ALPHA
                 / "[" / "]" / "^" / "_" / "`" / "{" / "|"
                 / "}" / "~"
  media-type     = type-name "/" subtype-name
  quoted-mt      = <"> media-type <">
  relation-types = relation-type
                 / <"> relation-type *( 1*SP relation-type ) <">
  relation-type  = reg-rel-type / ext-rel-type
  reg-rel-type   = LOALPHA *( LOALPHA / DIGIT / "." / "-" )
  ext-rel-type   = URI
  cardinal       = "0" / ( %x31-39 *DIGIT )
  LOALPHA        = <defined in RFC2616>
  quoted-string  = <defined in RFC2616>
  URI            = <defined in RFC3986>
  URI-Reference  = <defined in RFC3986>
  type-name      = <defined in RFC4288>
  subtype-name   = <defined in RFC4288>
  MediaDesc      = <defined in W3C.REC-html401-19991224>
  Language-Tag   = <defined in RFC5646>
  ext-value      = <defined in RFC5987>
  parmname       = <defined in RFC5987>

comment:3 Changed 11 years ago by zach@…

  • Resolution set to fixed
  • Status changed from assigned to closed

And with a final fix for <"> -> DQUOTE:

    Link            = link-value-list
    link-value-list = [ link-value *[ "," link-value ]]
    link-value     = "<" URI-Reference ">" *( ";" link-param )
    link-param     = ( ( "rel" "=" relation-types )
                   / ( "anchor" "=" DQUOTE URI-Reference DQUOTE )
                   / ( "rev" "=" relation-types )
                   / ( "hreflang" "=" Language-Tag )
                   / ( "media" "=" ( MediaDesc
                          / ( DQUOTE MediaDesc DQUOTE ) ) )
                   / ( "title" "=" quoted-string )
                   / ( "title*" "=" ext-value )
                   / ( "type" "=" ( media-type / quoted-mt ) )
                   / ( "rt" "=" relation-types )
                   / ( "if" "=" relation-types )
                   / ( "sz" "=" cardinal )
                   / ( link-extension ) )
    link-extension = ( parmname [ "=" ( ptoken / quoted-string ) ] )
                   / ( ext-name-star "=" ext-value )
    ext-name-star  = parmname "*" ; reserved for RFC2231-profiled
                                  ; extensions.  Whitespace NOT
                                  ; allowed in between.
    ptoken         = 1*ptokenchar
    ptokenchar     = "!" / "#" / "$" / "%" / "&" / "'" / "("
                   / ")" / "*" / "+" / "-" / "." / "/" / DIGIT
                   / ":" / "<" / "=" / ">" / "?" / "@" / ALPHA
                   / "[" / "]" / "^" / "_" / "`" / "{" / "|"
                   / "}" / "~"
    media-type     = type-name "/" subtype-name
    quoted-mt      = DQUOTE media-type DQUOTE
    relation-types = relation-type
                   / DQUOTE relation-type *( 1*SP relation-type ) DQUOTE
    relation-type  = reg-rel-type / ext-rel-type
    reg-rel-type   = LOALPHA *( LOALPHA / DIGIT / "." / "-" )
    ext-rel-type   = URI
    cardinal       = "0" / ( %x31-39 *DIGIT )
    LOALPHA        = <defined in RFC2616>
    quoted-string  = <defined in RFC2616>
    URI            = <defined in RFC3986>
    URI-Reference  = <defined in RFC3986>
    type-name      = <defined in RFC4288>
    subtype-name   = <defined in RFC4288>
    MediaDesc      = <defined in W3C.REC-html401-19991224>
    Language-Tag   = <defined in RFC5646>
    ext-value      = <defined in RFC5987>
    parmname       = <defined in RFC5987>
Note: See TracTickets for help on using tickets.