Skip to content

Instantly share code, notes, and snippets.

@mnot
Last active May 18, 2017 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnot/2fb569e7303dbcdde8b27cb7a404a648 to your computer and use it in GitHub Desktop.
Save mnot/2fb569e7303dbcdde8b27cb7a404a648 to your computer and use it in GitHub Desktop.
Pseudocode for parsing Link headers
@reschke
Copy link

reschke commented May 17, 2017

I think this goes into the right direction; it's mostly a parser based on a relaxed ABNF transformed to prose (which makes me wonder whether there's a tool to be written here :-).

Other comments:

  1. "... If it is not present, context_string is the identity of the representation carrying the Link header ..." - similar prose is elsewhere in the spec - what is "the identity of a representation"?????
  2. "Consume the contents up to but not including the first DQUOTE character that is not preceded by a "" character" - I assume there's a backslash missing here. That said: doesn't work, because it would fail for an input such as: "\\" - here, the DQUOTE is preceded by backslash, but it's not part of the quoted-pair.

@mnot
Copy link
Author

mnot commented May 18, 2017

@reschke -

  1. Did you read the linked text? Would it be better if s/identity/URL/?

  2. Will fix.

@mnot
Copy link
Author

mnot commented May 18, 2017

OK, have another look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment