1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | #ifndef URLENCODE_H
|
---|
5 | #define URLENCODE_H
|
---|
6 |
|
---|
7 | #include "azure_c_shared_utility/strings.h"
|
---|
8 |
|
---|
9 | #include "azure_c_shared_utility/umock_c_prod.h"
|
---|
10 |
|
---|
11 | #ifdef __cplusplus
|
---|
12 | extern "C" {
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | /* @brief URL Encode (aka percent encode) a string.
|
---|
16 | * Please note that while the URL encoder accepts the full range of 8-bit extended ASCII,
|
---|
17 | * it has unpredictable behavior beyond the 7-bit ASCII standard. This function does NOT
|
---|
18 | * guarantee correctness of output for characters outside this range.
|
---|
19 | *
|
---|
20 | * @param URL Encode can be done on a const char* or a STRING_HANDLE, use the appropriate
|
---|
21 | * function depending on input type, they both behave the same way.
|
---|
22 | *
|
---|
23 | * @return Returns a STRING_HANDLE with the encoded string, or NULL on failure.
|
---|
24 | */
|
---|
25 | MOCKABLE_FUNCTION(, STRING_HANDLE, URL_Encode, STRING_HANDLE, input);
|
---|
26 | MOCKABLE_FUNCTION(, STRING_HANDLE, URL_EncodeString, const char*, textEncode);
|
---|
27 |
|
---|
28 | /* @brief URL Decode (aka percent decode) a string.
|
---|
29 | * Please note that the URL decoder only supports decoding characters that fall within the
|
---|
30 | * 7-bit ASCII range. It does NOT support 8-bit extended ASCII, and will fail if you try.
|
---|
31 | *
|
---|
32 | * @param URL Decode can be done on a const char* or a STRING_HANDLE, use the appropriate
|
---|
33 | * function depending on input type, they both behave the same way.
|
---|
34 | *
|
---|
35 | * @return Returns a STRING_HANDLE with the decoded string, or NULL on failure.
|
---|
36 | */
|
---|
37 | MOCKABLE_FUNCTION(, STRING_HANDLE, URL_Decode, STRING_HANDLE, input);
|
---|
38 | MOCKABLE_FUNCTION(, STRING_HANDLE, URL_DecodeString, const char*, textDecode);
|
---|
39 |
|
---|
40 | #ifdef __cplusplus
|
---|
41 | }
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #endif /* URLENCODE_H */
|
---|
45 |
|
---|