title: URI encoding in C++ REST SDK ("Casablanca")
body: <p>I'm using the http listener of the <a href="https://github.com/Microsoft/cpprestsdk" rel="nofollow">C++ REST SDK</a> 2.8 and noticed the following. If I send the following URL to this listener:</p>
  
  <pre><code>http://my_server/my%2fpath?key=xxx%26yyy%3Dzzz
  </code></pre>
  
  <p>and I do:</p>
  
  <pre><code>auto uri = request.relative_uri();
  auto v_path_components = web::uri::split_path(web::uri::decode(uri.path()));
  auto m_query_components = web::uri::split_query(web::uri::decode(uri.query()));
  </code></pre>
  
  <p>then I find that <strong>v_path_components</strong> contains 2 elements ["my", "path"], and <strong>m_query_components</strong> contains 2 pairs [("key","xxx"), ("yyy","zzz")].</p>
  
  <p>What I want and would have expected is <strong>v_path_components</strong> to contain 1 element ["my/path"], and <strong>m_query_components</strong> to contain 1 pair [("key","xxx&amp;yyy=zzz")].</p>
  
  <p>In order for the latter to achieve, <strong>relative_uri</strong> shouldn't decode/encode the uri, as that looses information. In addition, <strong>web::uri::decode()</strong> should be executed on the split results rather than before splitting. But, as the REST SDK itself as well as many samples shipped with it uses this in the above way, it leads me to believe that I might be wrong.</p>
  
  <p>Could anyone confirm my findings or explain why I'm on the wrong track?</p>