> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.openstack.swift.utils;
> +
> +import org.testng.annotations.Test;
> +
> +import static org.testng.Assert.assertEquals;
> +
> +/**
> + * @author Francis Devereux
> + */
> +@Test(groups = "unit")
> +public class ETagUtilsTest {
> +   @Test
> +   public void testNoExceptionUnquotingSingleDQuote() {

Something to note here is that this is not a general purpose eTag parser. 
According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 (see 
also http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19) eTags can 
be any quoted string, but this can't handle anything except (possibly quoted) 
hex strings. The justification for that is that 
http://docs.openstack.org/trunk/openstack-object-storage/admin/content/additional-notes-on-large-objects.html
 says that the eTag for an openstack object is an MD5 sum (which is a hex 
string).

I will rename things and add comments to make it clearer that this code is only 
for parsing openstack object eTags, not any HTTP eTag.

Given the above, do you think that this code should accept weak eTags? I don't 
think that a hash has the semantics of a weak etag - RF2616 says:

> A "weak entity tag," indicated by the "W/" prefix, MAY be shared by
> two entities of a resource only if the entities are equivalent and
> could be substituted for each other with no significant change in
> semantics. A weak entity tag can only be used for weak comparison.

...but if the MD5 hash of two entities match then they are the same, not just 
equivalent. Well, they might not be the same if there's a hash collision but in 
that case they probably aren't equivalent either.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/120/files#r5920176

Reply via email to