mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-04 02:04:48 +03:00
nsurl: Add variant of nsurl_access for logging.
This commit is contained in:
parent
bc280f0e3f
commit
add6dcc015
@ -180,6 +180,24 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part);
|
||||
const char *nsurl_access(const nsurl *url);
|
||||
|
||||
|
||||
/**
|
||||
* Variant of \ref nsurl_access for logging.
|
||||
*
|
||||
* \param url NetSurf URL to retrieve a string pointer for.
|
||||
* \return the required string
|
||||
*
|
||||
* This will not necessarily return the actual nsurl's URL, but something
|
||||
* that is suitable for recording to logs. E.g. URLs with the `data` scheme
|
||||
* will return a simple place holder, to avoid repeatedly dumping loads of data.
|
||||
*
|
||||
* The returned string is owned by the NetSurf URL object. It will die
|
||||
* with the NetSurf URL object. Keep a reference to the URL if you need it.
|
||||
*
|
||||
* The returned string has a trailing '\0'.
|
||||
*/
|
||||
const char *nsurl_access_log(const nsurl *url);
|
||||
|
||||
|
||||
/**
|
||||
* Get a UTF-8 string (for human readable IDNs) from a NetSurf URL object
|
||||
*
|
||||
|
@ -315,6 +315,19 @@ const char *nsurl_access(const nsurl *url)
|
||||
}
|
||||
|
||||
|
||||
/* exported interface, documented in nsurl.h */
|
||||
const char *nsurl_access_log(const nsurl *url)
|
||||
{
|
||||
assert(url != NULL);
|
||||
|
||||
if (url->components.scheme_type == NSURL_SCHEME_DATA) {
|
||||
return "[data url]";
|
||||
}
|
||||
|
||||
return url->string;
|
||||
}
|
||||
|
||||
|
||||
/* exported interface, documented in nsurl.h */
|
||||
nserror nsurl_get_utf8(const nsurl *url, char **url_s, size_t *url_l)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user