* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-//#include <limits.h>
-
#include "urlmon_main.h"
-#include <wine/debug.h>
-
-#define NO_SHLWAPI_REG
-#include <shlwapi.h>
#include <strsafe.h>
#define COMBINE_URI_FORCE_FLAG_USE 0x1
-WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
-
static const IID IID_IUriObj = {0x4b364760,0x9f51,0x11df,{0x98,0x1c,0x08,0x00,0x20,0x0c,0x9a,0x66}};
typedef struct {
else if(is_hierarchical_scheme(data->scheme_type) && (*ptr)[0] == '\\' && (*ptr)[1] == '\\') {
*ptr += 2;
return TRUE;
- } else if(check_hierarchical(ptr))
+ } else if(data->scheme_type != URL_SCHEME_MAILTO && check_hierarchical(ptr))
return TRUE;
*ptr = start;
DWORD i;
/* If the sec_last_tld is 3 characters long it HAS to be on the list of
* recognized to still be considered part of the TLD name, otherwise
- * its considered the domain name.
+ * it's considered the domain name.
* Ex: www.google.com.uk -> google.com.uk as the domain name.
* www.google.foo.uk -> foo.uk as the domain name.
*/
/* An IPv6 address can have no more than 8 h16 components. */
if(ip.h16_count >= 8) {
*ptr = start;
- TRACE("(%p %p %x): Not a IPv6 address, to many h16 components.\n",
+ TRACE("(%p %p %x): Not a IPv6 address, too many h16 components.\n",
ptr, data, flags);
return FALSE;
}
return TRUE;
}
-/* Parses the path of an opaque URI (much less strict then the parser
+/* Parses the path of an opaque URI (much less strict than the parser
* for a hierarchical URI).
*
* NOTE:
static BOOL parse_path_opaque(const WCHAR **ptr, parse_data *data, DWORD flags) {
const BOOL known_scheme = data->scheme_type != URL_SCHEME_UNKNOWN;
const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
+ const BOOL is_mailto = data->scheme_type == URL_SCHEME_MAILTO;
- data->path = *ptr;
+ if (is_mailto && (*ptr)[0] == '/' && (*ptr)[1] == '/')
+ {
+ if ((*ptr)[2]) data->path = *ptr + 2;
+ else data->path = NULL;
+ }
+ else
+ data->path = *ptr;
while(!is_path_delim(**ptr)) {
if(**ptr == '%' && known_scheme) {
++(*ptr);
}
- data->path_len = *ptr - data->path;
+ if (data->path) data->path_len = *ptr - data->path;
TRACE("(%p %p %x): Parsed opaque URI path %s len=%d\n", ptr, data, flags,
debugstr_wn(data->path, data->path_len), data->path_len);
return TRUE;
return E_POINTER;
if(uriProp > Uri_PROPERTY_STRING_LAST) {
- /* Windows allocates an empty BSTR for invalid Uri_PROPERTY's. */
- *pbstrProperty = SysAllocStringLen(NULL, 0);
- if(!(*pbstrProperty))
- return E_OUTOFMEMORY;
-
/* It only returns S_FALSE for the ZONE property... */
- if(uriProp == Uri_PROPERTY_ZONE)
+ if(uriProp == Uri_PROPERTY_ZONE) {
+ *pbstrProperty = SysAllocStringLen(NULL, 0);
+ if(!(*pbstrProperty))
+ return E_OUTOFMEMORY;
return S_FALSE;
- else
- return S_OK;
+ }
+
+ *pbstrProperty = NULL;
+ return E_INVALIDARG;
}
/* Don't have support for flags yet. */
Uri *uri;
if((uri = get_uri_obj(pIUri))) {
- /* Only reset the builder if it's Uri isn't the same as
+ /* Only reset the builder if its Uri isn't the same as
* the Uri passed to the function.
*/
if(This->uri != uri) {
return E_NOTIMPL;
}
} else if(This->uri)
- /* Only reset the builder if it's Uri isn't NULL. */
+ /* Only reset the builder if its Uri isn't NULL. */
reset_builder(This);
return S_OK;
return E_OUTOFMEMORY;
}
- parse_uri(&data, 0);
+ parse_uri(&data, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME);
hr = Uri_Construct(NULL, (void**)&ret);
if(FAILED(hr)) {
data.path_len = proc_uri->path_len;
} else if(!data.is_opaque) {
/* Just set the path as a '/' if the base didn't have
- * one and if it's an hierarchical URI.
+ * one and if it's a hierarchical URI.
*/
static const WCHAR slashW[] = {'/',0};
data.path = slashW;
}
}
- hr = CreateUri(pwzRelativeUrl, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
+ hr = CreateUri(pwzRelativeUrl, Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, &relative);
if(FAILED(hr)) {
*ppCombinedUri = NULL;
return hr;