<br><br><div class="gmail_quote">On Tue, Jan 3, 2012 at 5:52 PM, Alon Levy <span dir="ltr"><<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>></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://<host>:<port><br>
<br>
You will get a warning (g_warning) and it will be treated the same as<br>
spice://<host>?port=<port><br></div></blockquote><div><br></div><div>If we introduce this on purpose, we really shouldn'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://<host>:<port>?port=<port><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, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2)<br>
- goto fail;<br>
+ if (uri[pos] == ':') {<br>
+ g_warning("usage of colon in spice URI parsing. Treating as a port (?port=)");<br></div></blockquote><div><br></div><div>if you'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("colon seen after a previous punctuation (?;&:)");<br>
+ goto fail;<br>
+ }<br>
+ pos++;<br>
</div>+ if (sscanf(uri + pos, "%127[0-9]%n", value, &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, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2)<br>
+ goto fail;<br>
+ }<br>
pos += len;<br>
</div><div class="im HOEnZb"> target_key = NULL;<br>
if (g_str_equal(key, "port")) {<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>