For http/https URIs we need to preserve the query part as it may be
important to refer to the image.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
return -1;
}
- /* handle socket stored as a query */
- if (uri->query)
- src->hosts->socket = g_strdup(STRSKIP(uri->query, "socket="));
+ if (uri->query) {
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTP ||
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_HTTPS) {
+ src->query = g_strdup(uri->query);
+ } else {
+ /* handle socket stored as a query */
+ if (STRPREFIX(uri->query, "socket="))
+ src->hosts->socket = g_strdup(STRSKIP(uri->query, "socket="));
+ }
+ }
/* uri->path is NULL if the URI does not contain slash after host:
* transport://host:port */
"\"file.url\": \"https://host/folder/esx6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=data&dsName=esx6.5-matrix\","
"\"file.timeout\": 2000"
"}",
- "<source protocol='https' name='folder/esx6.5-rhel7.7-x86_64/esx6.5-rhel7.7-x86_64-flat.vmdk'>\n"
+ "<source protocol='https' name='folder/esx6.5-rhel7.7-x86_64/esx6.5-rhel7.7-x86_64-flat.vmdk' query='dcPath=data&dsName=esx6.5-matrix'>\n"
" <host name='host' port='443'/>\n"
" <ssl verify='no'/>\n"
" <cookies>\n"
"\"file.url\": \"https://host/folder/esx6.5-rhel7.7-x86%5f64/esx6.5-rhel7.7-x86%5f64-flat.vmdk?dcPath=data&dsName=esx6.5-matrix\","
"\"file.timeout\": 2000"
"}",
- "<source protocol='https' name='folder/esx6.5-rhel7.7-x86_64/esx6.5-rhel7.7-x86_64-flat.vmdk'>\n"
+ "<source protocol='https' name='folder/esx6.5-rhel7.7-x86_64/esx6.5-rhel7.7-x86_64-flat.vmdk' query='dcPath=data&dsName=esx6.5-matrix'>\n"
" <host name='host' port='443'/>\n"
" <ssl verify='no'/>\n"
" <cookies>\n"