<br><br><div class="gmail_quote">On Tue, Jan 3, 2012 at 5:52 PM, Alon Levy <span dir="ltr">&lt;<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">With this patch if you use:<br>
 spice://&lt;host&gt;:&lt;port&gt;<br>
<br>
You will get a warning (g_warning) and it will be treated the same as<br>
 spice://&lt;host&gt;?port=&lt;port&gt;<br></div></blockquote><div><br></div><div>If we introduce this on purpose, we really shouldn&#39;t warn about it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
</div>You will also get a warning for the following double port definition:<br>
 spice://&lt;host&gt;:&lt;port&gt;?port=&lt;port&gt;<br>
---<br>
 gtk/spice-session.c |   18 ++++++++++++++++--<br>
 1 files changed, 16 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/gtk/spice-session.c b/gtk/spice-session.c<br>
index b640e06..9ac543d 100644<br>
--- a/gtk/spice-session.c<br>
+++ b/gtk/spice-session.c<br>
@@ -266,8 +266,22 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri)<br>
<div class="im">         if (uri[pos] == 0) {<br>
             break;<br>
         }<br>
-        if (sscanf(uri + pos, &quot;%31[-a-zA-Z0-9]=%127[^;&amp;]%n&quot;, key, value, &amp;len) != 2)<br>
-            goto fail;<br>
+        if (uri[pos] == &#39;:&#39;) {<br>
+            g_warning(&quot;usage of colon in spice URI parsing. Treating as a port (?port=)&quot;);<br></div></blockquote><div><br></div><div>if you&#39;d like to keep it, you could turn it into a SPICE_DEBUG?</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
+            if (punctuation++) {<br>
+                g_warning(&quot;colon seen after a previous punctuation (?;&amp;:)&quot;);<br>
+                goto fail;<br>
+            }<br>
+            pos++;<br>
</div>+            if (sscanf(uri + pos, &quot;%127[0-9]%n&quot;, value, &amp;len) != 1)<br></blockquote><div><br></div><div>I guess %5 would be enough.. even if we are far from building the perfect uri parser ;)</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im HOEnZb">+                goto fail;<br>
+            port = g_strdup(value);<br>
+            pos += len;<br>
+            continue;<br>
+        } else {<br>
+            if (sscanf(uri + pos, &quot;%31[-a-zA-Z0-9]=%127[^;&amp;]%n&quot;, key, value, &amp;len) != 2)<br>
+                goto fail;<br>
+        }<br>
         pos += len;<br>
</div><div class="im HOEnZb">         target_key = NULL;<br>
         if (g_str_equal(key, &quot;port&quot;)) {<br>
</div><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>ack otherwise </div></div>-- <br>Marc-André Lureau<br>