0

According to rfc2616 in the section 3.11 the format of entity tag is the following:

entity-tag = [ weak ] opaque-tag

weak = "W/"

opaque-tag = quoted-string

And in the examples given for the condition "If-match" in section 14.24 in rfc2616 are the following:

If-Match: "xyzzy"

If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"

If-Match: *

I'm doing a project in c, where I'll parse the http requests from different clients. The web server is also written c, and from the webserver I can get the request headers and values as const char*and I parse them. But my confusion is that where the value in the header "If-match" will be similar to "xyzzy, r2d2xxxx ,c3piozzzz" or will it be similar to ""xyzzy", "r2d2xxxx", "c3piozzzz""? Do you know which one is right? And will there surely be space between each etags in the If-Match header value if it has a list of entities? I mean will the format be the following type?

If-Match: "one-entity-tag",[space]"second-entity-tag",[space]"third-entity-tag"

There is no description of the format of the If-Match header value if it has a list of etags. rfc2616 only gives an example(which I showed above) of it. Is that example reliable?

1 Answer 1

1

You can trust the spec and the examples: the double quote is really part of the ETag.

Sign up to request clarification or add additional context in comments.

4 Comments

What about the format of the list of etags in the etag header value? There's no description on whether or not there will be space between two etags. But the example shows there are spaces between etags, is that example reliable?
No, it's just an example. Whitespace is optional (you can't solely rely on looking at examples if you want to understand the specification).
But there's didn't specified anything about how the list of the etags will the be written in the If-Match or If-None-Match header in rfc2616. I mean it's not specified whether it will be like If-Match: "xyzzy",[SP]"r2d2xxxx",[SP]"c3piozzzz" or like If-Match: "xyzzy","r2d2xxxx","c3piozzzz" An example is given similar to the former one. How do I decide which one is correct or do I have to prepare for both type? Thanks for your precious time :).
Yes, it is. The ABNF uses the list constructor ("#"), which is defined in greenbytes.de/tech/webdav/rfc2616.html#rfc.section.2.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.