* 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>
+#include "strsafe.h"
#define URI_DISPLAY_NO_ABSOLUTE_URI 0x1
#define URI_DISPLAY_NO_DEFAULT_PORT_AUTH 0x2
#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 {
return c == '/' || c == '\\';
}
+static inline BOOL is_ascii(WCHAR c)
+{
+ return c < 0x80;
+}
+
static BOOL is_default_port(URL_SCHEME scheme, DWORD port) {
DWORD i;
continue;
}
}
- } else if(!is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') {
+ } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') {
/* Only percent encode forbidden characters if the NO_ENCODE_FORBIDDEN_CHARACTERS flag
* is NOT set.
*/
continue;
}
}
- } else if(!is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') {
+ } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') {
/* Only percent encode forbidden characters if the NO_ENCODE_FORBIDDEN_CHARACTERS flag
* is NOT set.
*/
if(!computeOnly)
uri->canon_uri[uri->canon_len] = *ptr;
++uri->canon_len;
- } else if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) &&
+ } else if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) && is_ascii(*ptr) &&
!is_unreserved(*ptr) && !is_reserved(*ptr) && known_scheme) {
if(!computeOnly) {
pct_encode_val(*ptr, uri->canon_uri+uri->canon_len);
len++;
do_default_action = FALSE;
}
- } else if(known_scheme && !is_res && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
+ } else if(known_scheme && !is_res && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) || is_file)) {
if(!is_file || !(flags & Uri_CREATE_FILE_USE_DOS_PATH)) {
/* Escape the forbidden character. */
}
} else if(is_mk && *ptr == ':' && ptr + 1 < data->path + data->path_len && *(ptr + 1) == ':') {
flags &= ~Uri_CREATE_FILE_USE_DOS_PATH;
- } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
+ } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS)) {
if(!(is_file && (flags & Uri_CREATE_FILE_USE_DOS_PATH))) {
if(!computeOnly)
continue;
}
}
- } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr)) {
+ } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr)) {
if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) &&
!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO)) {
if(!computeOnly)
continue;
}
}
- } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr)) {
+ } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr)) {
if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) &&
!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO)) {
if(!computeOnly)
len += 3;
do_default_action = FALSE;
}
- } else if(!is_reserved(*ptr) && !is_unreserved(*ptr)) {
+ } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr)) {
if(flags & URL_ESCAPE_UNSAFE) {
if(len + 3 < output_len)
pct_encode_val(*ptr, output+len);