summaryrefslogtreecommitdiff
path: root/utils/idna.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/idna.c')
-rw-r--r--utils/idna.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/utils/idna.c b/utils/idna.c
index 34cc40f83..572882ecb 100644
--- a/utils/idna.c
+++ b/utils/idna.c
@@ -63,17 +63,17 @@ static nserror punycode_status_to_nserror(enum punycode_status status)
break;
case punycode_bad_input:
- LOG("Bad input");
+ NSLOG(netsurf, INFO, "Bad input");
ret = NSERROR_BAD_ENCODING;
break;
case punycode_big_output:
- LOG("Output too big");
+ NSLOG(netsurf, INFO, "Output too big");
ret = NSERROR_BAD_SIZE;
break;
case punycode_overflow:
- LOG("Overflow");
+ NSLOG(netsurf, INFO, "Overflow");
ret = NSERROR_NOSPACE;
break;
@@ -437,7 +437,8 @@ static bool idna__is_valid(int32_t *label, size_t len)
/* 2. Check characters 3 and 4 are not '--'. */
if ((label[2] == 0x002d) && (label[3] == 0x002d)) {
- LOG("Check failed: characters 2 and 3 are '--'");
+ NSLOG(netsurf, INFO,
+ "Check failed: characters 2 and 3 are '--'");
return false;
}
@@ -447,7 +448,8 @@ static bool idna__is_valid(int32_t *label, size_t len)
if ((unicode_props->category == UTF8PROC_CATEGORY_MN) ||
(unicode_props->category == UTF8PROC_CATEGORY_MC) ||
(unicode_props->category == UTF8PROC_CATEGORY_ME)) {
- LOG("Check failed: character 0 is a combining mark");
+ NSLOG(netsurf, INFO,
+ "Check failed: character 0 is a combining mark");
return false;
}
@@ -456,14 +458,20 @@ static bool idna__is_valid(int32_t *label, size_t len)
/* 4. Check characters not DISALLOWED by RFC5892 */
if (idna_prop == IDNA_P_DISALLOWED) {
- LOG("Check failed: character %" PRIsizet " (%x) is DISALLOWED", i, label[i]);
+ NSLOG(netsurf, INFO,
+ "Check failed: character %"PRIsizet" (%x) is DISALLOWED",
+ i,
+ label[i]);
return false;
}
/* 5. Check CONTEXTJ characters conform to defined rules */
if (idna_prop == IDNA_P_CONTEXTJ) {
if (idna__contextj_rule(label, i, len) == false) {
- LOG("Check failed: character %" PRIsizet " (%x) does not conform to CONTEXTJ rule", i, label[i]);
+ NSLOG(netsurf, INFO,
+ "Check failed: character %"PRIsizet" (%x) does not conform to CONTEXTJ rule",
+ i,
+ label[i]);
return false;
}
}
@@ -472,14 +480,20 @@ static bool idna__is_valid(int32_t *label, size_t len)
/** \todo optionally we can check conformance to this rule */
if (idna_prop == IDNA_P_CONTEXTO) {
if (idna__contexto_rule(label[i]) == false) {
- LOG("Check failed: character %" PRIsizet " (%x) has no CONTEXTO rule defined", i, label[i]);
+ NSLOG(netsurf, INFO,
+ "Check failed: character %"PRIsizet" (%x) has no CONTEXTO rule defined",
+ i,
+ label[i]);
return false;
}
}
/* 7. Check characters are not UNASSIGNED */
if (idna_prop == IDNA_P_UNASSIGNED) {
- LOG("Check failed: character %" PRIsizet " (%x) is UNASSIGNED", i, label[i]);
+ NSLOG(netsurf, INFO,
+ "Check failed: character %"PRIsizet" (%x) is UNASSIGNED",
+ i,
+ label[i]);
return false;
}
@@ -588,7 +602,8 @@ static bool idna__verify(const char *label, size_t len)
return true;
}
- LOG("Re-encoded ACE label %s does not match input", ace);
+ NSLOG(netsurf, INFO, "Re-encoded ACE label %s does not match input",
+ ace);
free(ace);
return false;
@@ -641,7 +656,8 @@ idna_encode(const char *host, size_t len, char **ace_host, size_t *ace_len)
/* This is already a DNS-valid ASCII string */
if ((idna__is_ace(host, label_len) == true) &&
(idna__verify(host, label_len) == false)) {
- LOG("Cannot verify ACE label %s", host);
+ NSLOG(netsurf, INFO,
+ "Cannot verify ACE label %s", host);
return NSERROR_BAD_URL;
}
strncpy(fqdn_p, host, label_len);