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