mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Massenzio" <ma...@mesosphere.io>
Subject Re: Review Request 36450: Introduced Address and URL protobufs.
Date Fri, 17 Jul 2015 06:44:36 GMT


> On July 15, 2015, 7:08 p.m., Vinod Kone wrote:
> > src/common/type_utils.cpp, line 131
> > <https://reviews.apache.org/r/36450/diff/2/?file=1011909#file1011909line131>
> >
> >     Is the order of query parameters important? Aren't these URLs equivalent?
> >     
> >     http://a.b.c/?k1=a&k2=b
> >     
> >     http://a.b.c/?k2=b&k1=a
> 
> Ben Mahler wrote:
>     Java's URI class considers ordering as important:
>     
>     http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/URI.java#URI.equals%28java.lang.Object%29
>     
>     I'd also like to keep it simple for now, you'll notice that they consider percent
encoding to be case-insensitive (e.g. %2C == %2c), but I'd hope we can just avoid this for
now:
>     
>     http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/URI.java#URI.equal%28java.lang.String%2Cjava.lang.String%29
>     
>     Ideally, we'd have a URI / URL class in stout, where we can have a comprehensive
equality operator.
> 
> Anand Mazumdar wrote:
>     +1 
>     
>     There is already a URL struct that exists in libprocess that we might consider enriching
upon later and also move it to stout.
> 
> Ben Mahler wrote:
>     I'll add a TODO related to this.

Interestingly enough, the original [RFC 3986](https://tools.ietf.org/html/rfc3986)  (also
mentioned [here](https://en.wikipedia.org/wiki/URL_normalization)) does not specify anything,
leaving the matter to

>determination of equivalence or difference of URIs is based on string
   comparison, perhaps augmented by reference to additional rules
   provided by URI scheme definitions.
   
> (Sec. 6.1 Equivalence)

And the HTTP scheme, does not further clarify the matter; however, the only real difference
seem to pertain to repeated query parameters, where the order *may* matter.

For my own curiosity, as the references were to Open JDK 6, I tried it also with the Oracle
JDK 8 and they still made a string-wise comparison: 
```
URI uri = new URI("http://a.b.com?a=foo&b=bar");
URI another = new URI("http://a.b.com?b=bar&a=foo");
System.out.println(String.format("%s %s equal to %s",
    uri,
    uri.equals(another) ? "is" : "is not",
    another));
```
yields:
```
http://a.b.com?a=foo&b=bar is not equal to http://a.b.com?b=bar&a=foo
```

I'm just noting this, because if we do decide (as it would seem reasonable and de facto adopted)
to consider two URIs equivalent (regardless of the query params ordering) this should probably
be noted in the equality operator documentation (to avoid someone tripping unwittingly on
it).

Please be aware that URI is **different** from URL (the latter is a subset of the former).


- Marco


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36450/#review91795
-----------------------------------------------------------


On July 17, 2015, 1:36 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36450/
> -----------------------------------------------------------
> 
> (Updated July 17, 2015, 1:36 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3012
>     https://issues.apache.org/jira/browse/MESOS-3012
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> To make the API more consistent, we'd like to have a single way to express a network
address.
> Also would like a way to express an HTTP address (a URL), which may include a path prefix.
> 
> This also enables the message passing optimization in the scheduler driver when receiving
events, per MESOS-3012.
> 
> 
> Diffs
> -----
> 
>   include/mesos/mesos.proto d2f482668e671b30f2586f6aae9c20132ab4d1e4 
>   include/mesos/type_utils.hpp eb7fe2562cfcff52288d1c216425068d1ba551c0 
>   src/common/type_utils.cpp 2ad5b4cbe324c83e81fd7df7430652f5c0a4e30f 
>   src/master/master.cpp 082758ef54597ad32cf0d025c147f0f44dd11961 
>   src/tests/master_tests.cpp 767c86cbde31eeb49d110d04bfb5a3eb5d469afc 
> 
> Diff: https://reviews.apache.org/r/36450/diff/
> 
> 
> Testing
> -------
> 
> Modified the simplest test I could find for offers.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message