📄 url.h
字号:
*/
BYTE *
URL_GetPath (URL *url);
/*
* Extract the path component of a URL.
* Returns FALSE in case of error, including that the URL is not valid.
* Sets the out-parameter to NULL if the URL does not have a path component.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BOOL
w_GetPath (const WCHAR* pchUrl, WCHAR **path);
BOOL
b_GetPath (const BYTE* pbUrl, BYTE **path);
/*
* Return the parameter component of a URL.
* Returns NULL in case of error, or if the URL does not have any parameters.
* NOTE: it is the responsibility of the caller to deallocate the string.
*/
BYTE *
URL_GetParameters (URL *url);
/*
* Extract the parameter component of a URL.
* Returns FALSE in case of error, including that the URL is not valid.
* Sets the out-parameter to NULL if the URL does not have any parameters.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BOOL
w_GetParameters (const WCHAR* pchUrl, WCHAR **param);
BOOL
b_GetParameters (const BYTE* pbUrl, BYTE **param);
/*
* Return the query part of a URL.
* Returns NULL in case of error, or if the URL does not have a query part.
* NOTE: it is the responsibility of the caller to deallocate the string.
*/
BYTE *
URL_GetQuery (URL *url);
/*
* Extract the query part of a URL.
* Returns FALSE in case of error, including that the URL is not valid.
* Sets the out-parameter to NULL if the URL does not have a query part.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BOOL
w_GetQuery (const WCHAR* pchUrl, WCHAR **query);
BOOL
b_GetQuery (const BYTE* pbUrl, BYTE **query);
void
URL_RemoveQuery (URL *url);
/*
* Return the fragment part of a URL.
* Returns NULL in case of error, or if the URL does not have a fragment part.
* NOTE: it is the responsibility of the caller to deallocate the string.
*/
BYTE *
URL_GetFragment (URL *url);
/*
* Extract the fragment part of a URL.
* Returns FALSE in case of error, including that the URL is not valid.
* Sets the out-parameter to NULL if the URL does not have a fragment part.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BOOL
w_GetFragment (const WCHAR* pchUrl, WCHAR **frag);
BOOL
b_GetFragment (const BYTE* pbUrl, BYTE **frag);
/************************************************************
* Other utility routines
************************************************************/
/*
* Return a copy of 'pchString' where each character belonging to the set of
* so called "special characters" or being in the range 0x80-0xff,
* has been replaced by a hexadecimal esacape sequence of the form "%xy".
* Returns NULL in case of error or if any character in the input
* has a character code > 0xff.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
WCHAR *
w_WMLS_EscapeString (const WCHAR* pchString);
/*
* Return a copy of 'pchString' where each character belonging to the set of
* so called "special characters" or being in the range 0x80-0xff,
* has been replaced by a hexadecimal esacape sequence of the form "%xy".
* Returns NULL in case of error or if any character in the input
* has a character code > 0xff.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
WCHAR *
w_EscapeString (const WCHAR* pchString);
BYTE *
b_EscapeString (const BYTE* pbString);
/*
* Return a copy of 'ws', where every 16-bit character has been
* replaced by two escape sequences of the form "%xy", representing
* the two bytes in the 16-bit character. The parts of each 16-bit
* character are read in big-endian order.
* Returns NULL in case of error.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
BYTE *
b_UnicodeEscape (WCHAR *ws);
/*
* Return a copy of 'pchString' where each character belonging to the set of
* so called "special characters" or being in the range 0x80-0xff,
* has been replaced by a hexadecimal esacape sequence of the form "%xy".
* Characters that are greater then 0xff are replaced with a blank character.
* Returns NULL in case of error.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
WCHAR *
w_wmlVariableEscape (const WCHAR* pchString);
/*
* Return a copy of 'pchString' where each hexadecimal escape sequence
* of the form "%xy" has been replaced with the character it represents.
* Returns NULL if the original string contains non-ASCII-characters.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
WCHAR *
w_WMLS_UnescapeString (const WCHAR* pchString);
/*
* Return a copy of 'pchString' where each hexadecimal escape sequence
* of the form "%xy" has been replaced with the character it represents.
* Returns NULL in case of error.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
WCHAR *
w_UnescapeString (const WCHAR* pchString);
BYTE *
b_UnescapeString (const BYTE* pbString);
/*
* Copy the string "src" to the string "dst", while replacing
* all escape sequences with the characters they represent.
* Works correctly even if called with the same argument for src and dst.
*/
VOID
UnescapeString (BYTE *dst, const BYTE *src);
/*
* Check if the given absolute URL has access rights,
* given 'domain' and 'path' as access control attributes.
*
* Assumes that all three strings are zero-terminated BYTE strings,
* and that 'abs_url' is a valid absolute URL.
* Returns FALSE if either 'abs_url' or 'domain' is NULL.
* If 'path' is NULL, the routine works as if it were the path "/".
*
* The check is performed by verifying that the domain attribute
* is a component-wise suffix of the domain part of the absolute URL,
* and that the path attribute is a component-wise prefix of
* the path part of the absolute URL. Comparisons of the paths
* are case-sensitive, but comparisons of the domain components are not.
* Handles escape sequences ("%xy") correctly.
*/
BOOL
URL_CheckAccess (BYTE *abs_url, BYTE *domain, BYTE *path);
/*
* Take an incomplete URL, like "www.abc.com", and turn it into
* a correct absolute URL using heuristic methods. This is not a
* well-defined process, rather it makes a guess as to what the user means.
* In the example above, the result would be "http://www.abc.com/".
* In case of failure, NULL is returned.
* NOTE: it is the caller's responsibility to deallocate the returned string.
*/
BYTE *
b_CompleteURLHeuristically (BYTE *bs);
/*
* Given two URLs, compute the minimum relative path, i.e., the shortest
* relative path that together with 'fromUrl' can be resolved to yield
* 'toUrl'. If 'includeFragment' is TRUE any fragment part in 'toUrl'
* is included in the result, otherwise it is dropped.
* Returns NULL in case of error.
* NOTE: it is the caller's responsibility to deallocate the returned string.
*/
BYTE *
b_MinRelativePath (BYTE *fromUrl, BYTE *toUrl, BOOL includeFragment);
/*
* Check that a URL is valid and has at least a scheme, host, and path
* component.
*/
BOOL
b_UrlIsCompleteValid (const BYTE* pbUrl);
/*
* Return a URL that is a copy of 'old_url', but with 'new_query'
* appended to the query part. If 'old_url' already has a query part,
* that old part will be separated from the new by a '&'-character.
* Returns NULL in case of error.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BYTE *
b_AppendToQuery (BYTE *old_url, BYTE *new_query);
/*
* Return the longest componentwise common prefix of two URL paths.
* Returns NULL in case of error.
* NOTE: it is the responsibility of the caller to deallocate
* the returned string.
*/
BYTE *
b_LongestCommonPrefix (BYTE *path1, BYTE *path2);
/*
* Check if the URL "path1" is a prefix of "path2".
* The prefix match is done according to the rules in section 7.4
* in "WAP Cache Operation Specification".
*/
BOOL
b_IsPrefix (BYTE *path1, BYTE *path2);
/*
* Return a copy of 'pbString' where each blank character
* has been replaced by a hexadecimal esacape sequence of the form "%xy".
* Returns NULL in case of error.
* NOTE: it is the callers responsibility to deallocate the returned string.
*/
BYTE*
b_EscapeBlanks (const BYTE* pbString);
BYTE* EscapeALLString (const BYTE* pbString, UINT16 iLen);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -