| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#include <uriparser/UriDefsConfig.h> |
| 42 |
#if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) |
| 43 |
|
| 44 |
# ifdef URI_ENABLE_ANSI |
| 45 |
# define URI_PASS_ANSI 1 |
| 46 |
# include "UriCompare.c" |
| 47 |
# undef URI_PASS_ANSI |
| 48 |
# endif |
| 49 |
# ifdef URI_ENABLE_UNICODE |
| 50 |
# define URI_PASS_UNICODE 1 |
| 51 |
# include "UriCompare.c" |
| 52 |
# undef URI_PASS_UNICODE |
| 53 |
# endif |
| 54 |
#else |
| 55 |
# ifdef URI_PASS_ANSI |
| 56 |
# include <uriparser/UriDefsAnsi.h> |
| 57 |
# else |
| 58 |
# include <uriparser/UriDefsUnicode.h> |
| 59 |
# include <wchar.h> |
| 60 |
# endif |
| 61 |
|
| 62 |
# ifndef URI_DOXYGEN |
| 63 |
# include <uriparser/Uri.h> |
| 64 |
# include <uriparser/UriIp4.h> |
| 65 |
# include "UriCommon.h" |
| 66 |
# endif |
| 67 |
|
| 68 |
UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) * b) { |
| 69 |
|
| 70 |
if ((a == NULL) || (b == NULL)) { |
| 71 |
return ((a == NULL) && (b == NULL)) ? URI_TRUE : URI_FALSE; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
if (URI_FUNC(CompareRange)(&(a->scheme), &(b->scheme))) { |
| 76 |
return URI_FALSE; |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
if ((a->scheme.first == NULL) && (a->absolutePath != b->absolutePath)) { |
| 81 |
return URI_FALSE; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
if (URI_FUNC(CompareRange)(&(a->userInfo), &(b->userInfo))) { |
| 86 |
return URI_FALSE; |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
if (((a->hostData.ip4 == NULL) != (b->hostData.ip4 == NULL)) |
| 91 |
|| ((a->hostData.ip6 == NULL) != (b->hostData.ip6 == NULL)) |
| 92 |
|| ((a->hostData.ipFuture.first == NULL) |
| 93 |
!= (b->hostData.ipFuture.first == NULL))) { |
| 94 |
return URI_FALSE; |
| 95 |
} |
| 96 |
|
| 97 |
if (a->hostData.ip4 != NULL) { |
| 98 |
if (memcmp(a->hostData.ip4->data, b->hostData.ip4->data, 4)) { |
| 99 |
return URI_FALSE; |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
if (a->hostData.ip6 != NULL) { |
| 104 |
if (memcmp(a->hostData.ip6->data, b->hostData.ip6->data, 16)) { |
| 105 |
return URI_FALSE; |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
if (a->hostData.ipFuture.first != NULL) { |
| 110 |
if (URI_FUNC(CompareRange)(&(a->hostData.ipFuture), &(b->hostData.ipFuture))) { |
| 111 |
return URI_FALSE; |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
if ((a->hostData.ip4 == NULL) && (a->hostData.ip6 == NULL) |
| 116 |
&& (a->hostData.ipFuture.first == NULL)) { |
| 117 |
if (URI_FUNC(CompareRange)(&(a->hostText), &(b->hostText))) { |
| 118 |
return URI_FALSE; |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
if (URI_FUNC(CompareRange)(&(a->portText), &(b->portText))) { |
| 124 |
return URI_FALSE; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
if ((a->pathHead == NULL) != (b->pathHead == NULL)) { |
| 129 |
return URI_FALSE; |
| 130 |
} |
| 131 |
|
| 132 |
if (a->pathHead != NULL) { |
| 133 |
URI_TYPE(PathSegment) * walkA = a->pathHead; |
| 134 |
URI_TYPE(PathSegment) * walkB = b->pathHead; |
| 135 |
do { |
| 136 |
if (URI_FUNC(CompareRange)(&(walkA->text), &(walkB->text))) { |
| 137 |
return URI_FALSE; |
| 138 |
} |
| 139 |
if ((walkA->next == NULL) != (walkB->next == NULL)) { |
| 140 |
return URI_FALSE; |
| 141 |
} |
| 142 |
walkA = walkA->next; |
| 143 |
walkB = walkB->next; |
| 144 |
} while (walkA != NULL); |
| 145 |
} |
| 146 |
|
| 147 |
|
| 148 |
if (URI_FUNC(CompareRange)(&(a->query), &(b->query))) { |
| 149 |
return URI_FALSE; |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
if (URI_FUNC(CompareRange)(&(a->fragment), &(b->fragment))) { |
| 154 |
return URI_FALSE; |
| 155 |
} |
| 156 |
|
| 157 |
return URI_TRUE; |
| 158 |
} |
| 159 |
|
| 160 |
#endif |