| 1 | /* |
| 2 | * uriparser - RFC 3986 URI parsing library |
| 3 | * |
| 4 | * Copyright (C) 2007, Weijia Song <[email protected]> |
| 5 | * Copyright (C) 2007, Sebastian Pipping <[email protected]> |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * |
| 12 | * 1. Redistributions of source code must retain the above |
| 13 | * copyright notice, this list of conditions and the following |
| 14 | * disclaimer. |
| 15 | * |
| 16 | * 2. Redistributions in binary form must reproduce the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer in the documentation and/or other materials |
| 19 | * provided with the distribution. |
| 20 | * |
| 21 | * 3. Neither the name of the copyright holder nor the names of |
| 22 | * its contributors may be used to endorse or promote products |
| 23 | * derived from this software without specific prior written |
| 24 | * permission. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 29 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
| 30 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 31 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 32 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 35 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 37 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | */ |
| 39 | |
| 40 | #ifndef URI_DOXYGEN |
| 41 | # include "UriNormalizeBase.h" |
| 42 | #endif |
| 43 | |
| 44 | UriBool uriIsUnreserved(int code) { |
| 45 | switch (code) { |
| 46 | case L'a': /* ALPHA */ |
| 47 | case L'A': |
| 48 | case L'b': |
| 49 | case L'B': |
| 50 | case L'c': |
| 51 | case L'C': |
| 52 | case L'd': |
| 53 | case L'D': |
| 54 | case L'e': |
| 55 | case L'E': |
| 56 | case L'f': |
| 57 | case L'F': |
| 58 | case L'g': |
| 59 | case L'G': |
| 60 | case L'h': |
| 61 | case L'H': |
| 62 | case L'i': |
| 63 | case L'I': |
| 64 | case L'j': |
| 65 | case L'J': |
| 66 | case L'k': |
| 67 | case L'K': |
| 68 | case L'l': |
| 69 | case L'L': |
| 70 | case L'm': |
| 71 | case L'M': |
| 72 | case L'n': |
| 73 | case L'N': |
| 74 | case L'o': |
| 75 | case L'O': |
| 76 | case L'p': |
| 77 | case L'P': |
| 78 | case L'q': |
| 79 | case L'Q': |
| 80 | case L'r': |
| 81 | case L'R': |
| 82 | case L's': |
| 83 | case L'S': |
| 84 | case L't': |
| 85 | case L'T': |
| 86 | case L'u': |
| 87 | case L'U': |
| 88 | case L'v': |
| 89 | case L'V': |
| 90 | case L'w': |
| 91 | case L'W': |
| 92 | case L'x': |
| 93 | case L'X': |
| 94 | case L'y': |
| 95 | case L'Y': |
| 96 | case L'z': |
| 97 | case L'Z': |
| 98 | case L'0': /* DIGIT */ |
| 99 | case L'1': |
| 100 | case L'2': |
| 101 | case L'3': |
| 102 | case L'4': |
| 103 | case L'5': |
| 104 | case L'6': |
| 105 | case L'7': |
| 106 | case L'8': |
| 107 | case L'9': |
| 108 | case L'-': /* "-" / "." / "_" / "~" */ |
| 109 | case L'.': |
| 110 | case L'_': |
| 111 | case L'~': |
| 112 | return URI_TRUE; |
| 113 | |
| 114 | default: |
| 115 | return URI_FALSE; |
| 116 | } |
| 117 | } |