This prevents a critical warning and other misbehaviour in the
simple-httpd test, when using requests like "GET http: HTTP/1.0".
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=667637
Bug-NB: NB#294977
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Dan Winship <danw@gnome.org>
uri = NULL;
g_free (req_path);
- if (!uri)
+
+ if (!SOUP_URI_VALID_FOR_HTTP (uri)) {
+ /* certainly not "a valid host on the server" (RFC2616 5.2.3)
+ * SOUP_URI_VALID_FOR_HTTP also guards against uri == NULL
+ */
+ if (uri)
+ soup_uri_free (uri);
return SOUP_STATUS_BAD_REQUEST;
+ }
+
soup_message_set_uri (msg, uri);
soup_uri_free (uri);