lluri_test.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:26k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /**
  2.  * @file   lluri_test.cpp
  3.  * @brief  LLURI unit tests
  4.  * @date   September 2006
  5.  *
  6.  * $LicenseInfo:firstyear=2006&license=viewergpl$
  7.  * 
  8.  * Copyright (c) 2006-2010, Linden Research, Inc.
  9.  * 
  10.  * Second Life Viewer Source Code
  11.  * The source code in this file ("Source Code") is provided by Linden Lab
  12.  * to you under the terms of the GNU General Public License, version 2.0
  13.  * ("GPL"), unless you have obtained a separate licensing agreement
  14.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  15.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17.  * 
  18.  * There are special exceptions to the terms and conditions of the GPL as
  19.  * it is applied to this Source Code. View the full text of the exception
  20.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  21.  * online at
  22.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23.  * 
  24.  * By copying, modifying or distributing this software, you acknowledge
  25.  * that you have read and understood your obligations described above,
  26.  * and agree to abide by those obligations.
  27.  * 
  28.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30.  * COMPLETENESS OR PERFORMANCE.
  31.  * $/LicenseInfo$
  32.  */
  33. #include "linden_common.h"
  34. #include "../llsd.h"
  35. #include "../lluri.h"
  36. #include "../test/lltut.h"
  37. namespace tut
  38. {
  39. struct URITestData {
  40. void checkParts(const LLURI& u,
  41. const char* expectedScheme,
  42. const char* expectedOpaque,
  43. const char* expectedAuthority,
  44. const char* expectedPath,
  45. const char* expectedQuery = "")
  46. {
  47. ensure_equals("scheme", u.scheme(), expectedScheme);
  48. ensure_equals("opaque", u.opaque(), expectedOpaque);
  49. ensure_equals("authority", u.authority(), expectedAuthority);
  50. ensure_equals("path", u.path(), expectedPath);
  51. ensure_equals("query", u.query(), expectedQuery);
  52. }
  53. void escapeRoundTrip(const std::string& uri_raw_1)
  54. {
  55. std::string uri_esc_1(LLURI::escape(uri_raw_1));
  56. std::string uri_raw_2(LLURI::unescape(uri_esc_1));
  57. ensure_equals("escape/unescape raw", uri_raw_2, uri_raw_1);
  58. std::string uri_esc_2(LLURI::escape(uri_raw_2));
  59. ensure_equals("escape/unescape escaped", uri_esc_2, uri_esc_1);
  60. }
  61. };
  62. typedef test_group<URITestData> URITestGroup;
  63. typedef URITestGroup::object URITestObject;
  64. URITestGroup uriTestGroup("LLURI");
  65. template<> template<>
  66. void URITestObject::test<1>()
  67. {
  68. LLURI u("http://abc.com/def/ghi?x=37&y=hello");
  69. ensure_equals("scheme", u.scheme(), "http");
  70. ensure_equals("authority", u.authority(), "abc.com");
  71. ensure_equals("path", u.path(), "/def/ghi");
  72. ensure_equals("query", u.query(), "x=37&y=hello");
  73. ensure_equals("host name", u.hostName(), "abc.com");
  74. ensure_equals("host port", u.hostPort(), 80);
  75. LLSD query = u.queryMap();
  76. ensure_equals("query x", query["x"].asInteger(), 37);
  77. ensure_equals("query y", query["y"].asString(), "hello");
  78. query = LLURI::queryMap("x=22.23&y=https://lindenlab.com/");
  79. ensure_equals("query x", query["x"].asReal(), 22.23);
  80. ensure_equals("query y", query["y"].asURI().asString(), "https://lindenlab.com/");
  81. }
  82. template<> template<>
  83. void URITestObject::test<2>()
  84. {
  85. // empty string
  86. checkParts(LLURI(""), "", "", "", "");
  87. }
  88. template<> template<>
  89. void URITestObject::test<3>()
  90. {
  91. // no scheme
  92. checkParts(LLURI("foo"), "", "foo", "", "");
  93. checkParts(LLURI("foo%3A"), "", "foo:", "", "");
  94. }
  95. template<> template<>
  96. void URITestObject::test<4>()
  97. {
  98. // scheme w/o paths
  99. checkParts(LLURI("mailto:zero@ll.com"),
  100. "mailto", "zero@ll.com", "", "");
  101. checkParts(LLURI("silly://abc/def?foo"),
  102. "silly", "//abc/def?foo", "", "");
  103. }
  104. template<> template<>
  105. void URITestObject::test<5>()
  106. {
  107. // authority section
  108. checkParts(LLURI("http:///"),
  109. "http", "///", "", "/");
  110. checkParts(LLURI("http://abc"),
  111. "http", "//abc", "abc", "");
  112. checkParts(LLURI("http://a%2Fb/cd"),
  113. "http", "//a/b/cd", "a/b", "/cd");
  114. checkParts(LLURI("http://host?"),
  115. "http", "//host?", "host", "");
  116. }
  117. template<> template<>
  118. void URITestObject::test<6>()
  119. {
  120. // path section
  121. checkParts(LLURI("http://host/a/b/"),
  122. "http", "//host/a/b/", "host", "/a/b/");
  123. checkParts(LLURI("http://host/a%3Fb/"),
  124. "http", "//host/a?b/", "host", "/a?b/");
  125. checkParts(LLURI("http://host/a:b/"),
  126. "http", "//host/a:b/", "host", "/a:b/");
  127. }
  128. template<> template<>
  129. void URITestObject::test<7>()
  130. {
  131. // query string
  132. checkParts(LLURI("http://host/?"),
  133. "http", "//host/?", "host", "/", "");
  134. checkParts(LLURI("http://host/?x"),
  135. "http", "//host/?x", "host", "/", "x");
  136. checkParts(LLURI("http://host/??"),
  137. "http", "//host/??", "host", "/", "?");
  138. checkParts(LLURI("http://host/?%3F"),
  139. "http", "//host/??", "host", "/", "?");
  140. }
  141. template<> template<>
  142. void URITestObject::test<8>()
  143. {
  144. LLSD path;
  145. path.append("x");
  146. path.append("123");
  147. checkParts(LLURI::buildHTTP("host", path),
  148. "http", "//host/x/123", "host", "/x/123");
  149. LLSD query;
  150. query["123"] = "12";
  151. query["abcd"] = "abc";
  152. checkParts(LLURI::buildHTTP("host", path, query),
  153. "http", "//host/x/123?123=12&abcd=abc",
  154. "host", "/x/123", "123=12&abcd=abc");
  155. }
  156. template<> template<>
  157. void URITestObject::test<9>()
  158. {
  159. // test unescaped path components
  160. LLSD path;
  161. path.append("x@*//*$&^");
  162. path.append("123");
  163. checkParts(LLURI::buildHTTP("host", path),
  164. "http", "//host/x@*//*$&^/123", "host", "/x@*//*$&^/123");
  165. }
  166. template<> template<>
  167. void URITestObject::test<10>()
  168. {
  169. // test unescaped query components
  170. LLSD path;
  171. path.append("x");
  172. path.append("123");
  173. LLSD query;
  174. query["123"] = "?&*#//";
  175. query["**@&?//"] = "abc";
  176. checkParts(LLURI::buildHTTP("host", path, query),
  177. "http", "//host/x/123?**@&?//=abc&123=?&*#//",
  178. "host", "/x/123", "**@&?//=abc&123=?&*#//");
  179. }
  180. template<> template<>
  181. void URITestObject::test<11>()
  182. {
  183. // test unescaped host components
  184. LLSD path;
  185. path.append("x");
  186. path.append("123");
  187. LLSD query;
  188. query["123"] = "12";
  189. query["abcd"] = "abc";
  190. checkParts(LLURI::buildHTTP("hi123*33--}{:portstuffs", path, query),
  191. "http", "//hi123*33--}{:portstuffs/x/123?123=12&abcd=abc",
  192. "hi123*33--}{:portstuffs", "/x/123", "123=12&abcd=abc");
  193. }
  194. template<> template<>
  195. void URITestObject::test<12>()
  196. {
  197. // test funky host_port values that are actually prefixes
  198. checkParts(LLURI::buildHTTP("http://example.com:8080", LLSD()),
  199. "http", "//example.com:8080",
  200. "example.com:8080", "");
  201. checkParts(LLURI::buildHTTP("http://example.com:8080/", LLSD()),
  202. "http", "//example.com:8080/",
  203. "example.com:8080", "/");
  204. checkParts(LLURI::buildHTTP("http://example.com:8080/a/b", LLSD()),
  205. "http", "//example.com:8080/a/b",
  206. "example.com:8080", "/a/b");
  207. }
  208. template<> template<>
  209. void URITestObject::test<13>()
  210. {
  211. const std::string unreserved =   
  212. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
  213. "0123456789"
  214. "-._~";
  215. // test escape
  216. ensure_equals("escaping", LLURI::escape("abcdefg", "abcdef"), "abcdef%67");
  217. ensure_equals("escaping", LLURI::escape("|/&\+-_!@", ""), "%7C%2F%26%5C%2B%2D%5F%21%40");
  218. ensure_equals("escaping as query variable", 
  219.   LLURI::escape("http://10.0.1.4:12032/agent/god/agent-id/map/layer/?resume=http://station3.ll.com:12032/agent/203ad6df-b522-491d-ba48-4e24eb57aeff/send-postcard", unreserved + ":@!$'()*+,="), 
  220.   "http:%2F%2F10.0.1.4:12032%2Fagent%2Fgod%2Fagent-id%2Fmap%2Flayer%2F%3Fresume=http:%2F%2Fstation3.ll.com:12032%2Fagent%2F203ad6df-b522-491d-ba48-4e24eb57aeff%2Fsend-postcard");
  221. // French cedilla (C with squiggle, like in the word Francais) is UTF-8 C3 A7
  222. #if LL_WINDOWS
  223. #pragma warning(disable: 4309)
  224. #endif
  225. std::string cedilla;
  226. cedilla.push_back( (char)0xC3 );
  227. cedilla.push_back( (char)0xA7 );
  228. ensure_equals("escape UTF8", LLURI::escape( cedilla, unreserved), "%C3%A7");
  229. }
  230. template<> template<>
  231. void URITestObject::test<14>()
  232. {
  233. // make sure escape and unescape of empty strings return empty
  234. // strings.
  235. std::string uri_esc(LLURI::escape(""));
  236. ensure("escape string empty", uri_esc.empty());
  237. std::string uri_raw(LLURI::unescape(""));
  238. ensure("unescape string empty", uri_raw.empty());
  239. }
  240. template<> template<>
  241. void URITestObject::test<15>()
  242. {
  243. // do some round-trip tests
  244. escapeRoundTrip("http://secondlife.com");
  245. escapeRoundTrip("http://secondlife.com/url with spaces");
  246. escapeRoundTrip("http://bad[domain]name.com/");
  247. escapeRoundTrip("ftp://bill.gates@ms/micro$oft.com/c:\autoexec.bat");
  248. escapeRoundTrip("");
  249. }
  250. template<> template<>
  251. void URITestObject::test<16>()
  252. {
  253. // Test the default escaping
  254. // yes -- this mangles the url. This is expected behavior
  255. std::string simple("http://secondlife.com");
  256. ensure_equals(
  257. "simple http",
  258. LLURI::escape(simple),
  259. "http%3A%2F%2Fsecondlife.com");
  260. ensure_equals(
  261. "needs escape",
  262. LLURI::escape("http://get.secondlife.com/windows viewer"),
  263. "http%3A%2F%2Fget.secondlife.com%2Fwindows%20viewer");
  264. }
  265. template<> template<>
  266. void URITestObject::test<17>()
  267. {
  268. // do some round-trip tests with very long strings.
  269. escapeRoundTrip("Welcome to Second Life.We hope you'll have a richly rewarding experience, filled with creativity, self expression and fun.The goals of the Community Standards are simple: treat each other with respect and without harassment, adhere to local standards as indicated by simulator ratings, and refrain from any hate activity which slurs a real-world individual or real-world community. Behavioral Guidelines - The Big Six");
  270. escapeRoundTrip(
  271. "'asset_data':b(12100){'task_id':ucc706f2d-0b68-68f8-11a4-f1043ff35ca0}n{ntnametObject|ntpermissions 0nt{nttbase_maskt7fffffffnttowner_maskt7fffffffnttgroup_maskt00000000ntteveryone_maskt00000000nttnext_owner_maskt7fffffffnttcreator_idt13fd9595-a47b-4d64-a5fb-6da645f038e0nttowner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttlast_owner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttgroup_idt00000000-0000-0000-0000-000000000000nt}ntlocal_idt217444921nttotal_crct323nttypet2nttask_validt2nttravel_accesst13ntdisplayoptst2ntdisplaytypetvntpost-0.368634403t0.00781063363t-0.569040775ntoldpost150.117996t25.8658009t8.19664001ntrotationt-0.06293071806430816650390625t-0.6995697021484375t-0.7002241611480712890625t0.1277817934751510620117188ntchildpost-0.00499999989t-0.0359999985t0.307999998ntchildrott-0.515492737293243408203125t-0.46601200103759765625t0.529055416584014892578125t0.4870323240756988525390625ntscale"
  272. "t0.074629t0.289956t0.01ntsit_offsett0t0t0ntcamera_eye_offsett0t0t0ntcamera_at_offsett0t0t0ntsit_quatt0t0t0t1ntsit_hintt0ntstatet160ntmaterialt3ntsoundidt00000000-0000-0000-0000-000000000000ntsoundgaint0ntsoundradiust0ntsoundflagst0nttextcolort0 0 0 1ntselectedt0ntselectort00000000-0000-0000-0000-000000000000ntusephysicst0ntrotate_xt1ntrotate_yt1ntrotate_zt1ntphantomt0ntremote_script_access_pint0ntvolume_detectt0ntblock_grabst0ntdie_at_edget0ntreturn_at_edget0nttemporaryt0ntsandboxt0ntsandboxhomet0t0t0ntshape 0nt{nttpath 0ntt{ntttcurvet16ntttbegint0ntttendt1ntttscale_xt1ntttscale_yt1ntttshear_xt0ntttshear_yt0nttttwistt0nttttwist_begint0ntttradius_offsett0nttttaper_xt0nttttaper_yt0ntttrevolutionst1ntttskewt0ntt}nttprofile 0ntt{ntttcurvet1ntttbegint0ntttendt1nttthollowt0ntt}nt}ntf"
  273. "acest6nt{nttimageidtddde1ffc-678b-3cda-1748-513086bdf01bnttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204"
  274. "nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtddde1ffc-678b-3cda-1748-513086bdf01bnttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett-1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}ntps_next_crct1ntgpw_biast1ntipt0ntcompletetTRUEntdelayt50000ntnextstartt0ntbirthtimet1061088050622956ntreztimet1094866329019785ntparceltimet1133568981980596nttax_ratet1.00084ntscratchpadt0nt{ntnt}ntsale_infot0nt{nttsale_typetnotnttsale_pricet10nt}ntcorrect_family_idt00000000-0000-0000-0000-000000000000nthas_rezzedt0ntpre_link_base_maskt7fffffffntlinked tchildntdefault_pay_pricet-2t1t5t10t20n}n{'task_id':u61fa7364-e151-0597-774c-523312dae31b}n{ntnametObject|ntpermissions 0nt{nttbase_maskt7fffff"
  275. "ffnttowner_maskt7fffffffnttgroup_maskt00000000ntteveryone_maskt00000000nttnext_owner_maskt7fffffffnttcreator_idt13fd9595-a47b-4d64-a5fb-6da645f038e0nttowner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttlast_owner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttgroup_idt00000000-0000-0000-0000-000000000000nt}ntlocal_idt217444922nttotal_crct324nttypet2nttask_validt2nttravel_accesst13ntdisplayoptst2ntdisplaytypetvntpost-0.367110789t0.00780026987t-0.566269755ntoldpost150.115005t25.8479004t8.18669987ntrotationt0.47332942485809326171875t-0.380102097988128662109375t-0.5734078884124755859375t0.550168216228485107421875ntchildpost-0.00499999989t-0.0370000005t0.305000007ntchildrott-0.736649334430694580078125t-0.03042060509324073791503906t-0.02784589119255542755126953t0.67501628398895263671875ntscalet0.074629t0.289956t0.01ntsit_offsett0t0t0ntcamera_eye_offsett0t0t0ntcamera_at_offsett0t0t0ntsit_quatt0t"
  276. "0t0t1ntsit_hintt0ntstatet160ntmaterialt3ntsoundidt00000000-0000-0000-0000-000000000000ntsoundgaint0ntsoundradiust0ntsoundflagst0nttextcolort0 0 0 1ntselectedt0ntselectort00000000-0000-0000-0000-000000000000ntusephysicst0ntrotate_xt1ntrotate_yt1ntrotate_zt1ntphantomt0ntremote_script_access_pint0ntvolume_detectt0ntblock_grabst0ntdie_at_edget0ntreturn_at_edget0nttemporaryt0ntsandboxt0ntsandboxhomet0t0t0ntshape 0nt{nttpath 0ntt{ntttcurvet16ntttbegint0ntttendt1ntttscale_xt1ntttscale_yt1ntttshear_xt0ntttshear_yt0nttttwistt0nttttwist_begint0ntttradius_offsett0nttttaper_xt0nttttaper_yt0ntttrevolutionst1ntttskewt0ntt}nttprofile 0ntt{ntttcurvet1ntttbegint0ntttendt1nttthollowt0ntt}nt}ntfacest6nt{nttimageidtddde1ffc-678b-3cda-1748-513086bdf01bnttcolorst0.937255 0.796078 0.494118 1nttscalest1nt"
  277. "tscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtf54a0c32-3cd1-d49a-5b4f-7b792bebc204nttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett1nttoffsetst0nttoffsettt0nttimagerott0nt"
  278. "tbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidtddde1ffc-678b-3cda-1748-513086bdf01bnttcolorst0.937255 0.796078 0.494118 1nttscalest1nttscalett-1nttoffsetst0nttoffsettt0nttimagerott0nttbumpt0nttfullbrightt0nttmedia_flagst0nt}ntps_next_crct1ntgpw_biast1ntipt0ntcompletetTRUEntdelayt50000ntnextstartt0ntbirthtimet1061087839248891ntreztimet1094866329020800ntparceltimet1133568981981983nttax_ratet1.00084ntscratchpadt0nt{ntnt}ntsale_infot0nt{nttsale_typetnotnttsale_pricet10nt}ntcorrect_family_idt00000000-0000-0000-0000-000000000000nthas_rezzedt0ntpre_link_base_maskt7fffffffntlinked tchildntdefault_pay_pricet-2t1t5t10t20n}n{'task_id':ub8d68643-7dd8-57af-0d24-8790032aed0c}n{ntnametObject|ntpermissions 0nt{nttbase_maskt7fffffffnttowner_maskt7fffffffnttgroup_maskt00000000ntteveryone_maskt00000000nttnext_owner_maskt7fffffffnttcreat"
  279. "or_idt13fd9595-a47b-4d64-a5fb-6da645f038e0nttowner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttlast_owner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttgroup_idt00000000-0000-0000-0000-000000000000nt}ntlocal_idt217444923nttotal_crct235nttypet2nttask_validt2nttravel_accesst13ntdisplayoptst2ntdisplaytypetvntpost-0.120029509t-0.00284469454t-0.0302077383ntoldpost150.710999t25.8584995t8.19172001ntrotationt0.145459949970245361328125t-0.1646589934825897216796875t0.659558117389678955078125t-0.718826770782470703125ntchildpost0t-0.182999998t-0.26699999ntchildrott0.991444766521453857421875t3.271923924330621957778931e-05t-0.0002416197530692443251609802t0.1305266767740249633789062ntscalet0.0382982t0.205957t0.368276ntsit_offsett0t0t0ntcamera_eye_offsett0t0t0ntcamera_at_offsett0t0t0ntsit_quatt0t0t0t1ntsit_hintt0ntstatet160ntmaterialt3ntsoundidt00000000-0000-0000-0000-000000000000ntsoundgaint0ntsoundra"
  280. "diust0ntsoundflagst0nttextcolort0 0 0 1ntselectedt0ntselectort00000000-0000-0000-0000-000000000000ntusephysicst0ntrotate_xt1ntrotate_yt1ntrotate_zt1ntphantomt0ntremote_script_access_pint0ntvolume_detectt0ntblock_grabst0ntdie_at_edget0ntreturn_at_edget0nttemporaryt0ntsandboxt0ntsandboxhomet0t0t0ntshape 0nt{nttpath 0ntt{ntttcurvet32ntttbegint0.3ntttendt0.65ntttscale_xt1ntttscale_yt0.05ntttshear_xt0ntttshear_yt0nttttwistt0nttttwist_begint0ntttradius_offsett0nttttaper_xt0nttttaper_yt0ntttrevolutionst1ntttskewt0ntt}nttprofile 0ntt{ntttcurvet0ntttbegint0ntttendt1nttthollowt0ntt}nt}ntfacest3nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1.57084nttbumpt0nttfullbrightt0nttmedia_flagst0"
  281. "nt}nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1.57084nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1.57084nttbumpt0nttfullbrightt0nttmedia_flagst0nt}ntps_next_crct1ntgpw_biast1ntipt0ntcompletetTRUEntdelayt50000ntnextstartt0ntbirthtimet1061087534454174ntreztimet1094866329021741ntparceltimet1133568981982889nttax_ratet1.00326ntscratchpadt0nt{ntnt}ntsale_infot0nt{nttsale_typetnotnttsale_pricet10nt}ntcorrect_family_idt00000000-0000-0000-0000-000000000000nthas_rezzedt0ntpre_link_base_maskt7fffffffntlinked tchildntdefault_pay_pricet-2t1t5t10t20n}n{'task_id':ue4b19200-9d33-962f-c8c5-6f"
  282. "25be3a3fd0}n{ntnametApotheosis_Immolaine_tail|ntpermissions 0nt{nttbase_maskt7fffffffnttowner_maskt7fffffffnttgroup_maskt00000000ntteveryone_maskt00000000nttnext_owner_maskt7fffffffnttcreator_idt13fd9595-a47b-4d64-a5fb-6da645f038e0nttowner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttlast_owner_idt3c115e51-04f4-523c-9fa6-98aff1034730nttgroup_idt00000000-0000-0000-0000-000000000000nt}ntlocal_idt217444924nttotal_crct675nttypet1nttask_validt2nttravel_accesst13ntdisplayoptst2ntdisplaytypetvntpost-0.34780401t-0.00968400016t-0.260098994ntoldpost0t0t0ntrotationt0.73164522647857666015625t-0.67541944980621337890625t-0.07733880728483200073242188t0.05022468417882919311523438ntvelocityt0t0t0ntangvelt0t0t0ntscalet0.0382982t0.32228t0.383834ntsit_offsett0t0t0ntcamera_eye_offsett0t0t0ntcamera_at_offsett0t0t0ntsit_quatt0t0t0t1ntsit_hintt0ntstatet160ntmaterialt3ntsoundidt00000"
  283. "000-0000-0000-0000-000000000000ntsoundgaint0ntsoundradiust0ntsoundflagst0nttextcolort0 0 0 1ntselectedt0ntselectort00000000-0000-0000-0000-000000000000ntusephysicst0ntrotate_xt1ntrotate_yt1ntrotate_zt1ntphantomt0ntremote_script_access_pint0ntvolume_detectt0ntblock_grabst0ntdie_at_edget0ntreturn_at_edget0nttemporaryt0ntsandboxt0ntsandboxhomet0t0t0ntshape 0nt{nttpath 0ntt{ntttcurvet32ntttbegint0.3ntttendt0.65ntttscale_xt1ntttscale_yt0.05ntttshear_xt0ntttshear_yt0nttttwistt0nttttwist_begint0ntttradius_offsett0nttttaper_xt0nttttaper_yt0ntttrevolutionst1ntttskewt0ntt}nttprofile 0ntt{ntttcurvet0ntttbegint0ntttendt1nttthollowt0ntt}nt}ntfacest3nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1"
  284. ".57084nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1.57084nttbumpt0nttfullbrightt0nttmedia_flagst0nt}nt{nttimageidte7150bed-3e3e-c698-eb15-d17b178148afnttcolorst0.843137 0.156863 0.156863 1nttscalest15nttscalett1nttoffsetst0nttoffsettt0nttimagerott-1.57084nttbumpt0nttfullbrightt0nttmedia_flagst0nt}ntps_next_crct1ntgpw_biast1ntipt0ntcompletetTRUEntdelayt50000ntnextstartt0ntbirthtimet1061087463950186ntreztimet1094866329022555ntparceltimet1133568981984359ntdescriptiont(No Description)|nttax_ratet1.01736ntnamevaluetAttachPt U32 RW S 10ntnamevaluetAttachmentOrientation VEC3 RW DS -3.110088, -0.182018, 1.493795ntnamevaluetAttachmentOffset VEC3 RW DS -0.347804, -0.009684, -0.260099ntnamevaluetAttachItemI"
  285. "D STRING RW SV 20f36c3a-b44b-9bc7-87f3-018bfdfc8cdantscratchpadt0nt{ntnt}ntsale_infot0nt{nttsale_typetnotnttsale_pricet10nt}ntorig_asset_idt8747acbc-d391-1e59-69f1-41d06830e6c0ntorig_item_idt20f36c3a-b44b-9bc7-87f3-018bfdfc8cdantfrom_task_idt3c115e51-04f4-523c-9fa6-98aff1034730ntcorrect_family_idt00000000-0000-0000-0000-000000000000nthas_rezzedt0ntpre_link_base_maskt7fffffffntlinked tlinkedntdefault_pay_pricet-2t1t5t10t20n}n");
  286. }
  287.  
  288. template<> template<>
  289. void URITestObject::test<18>()
  290. {
  291. LLURI u("secondlife:///app/login?first_name=Testert4&last_name=Tester&web_login_key=test");
  292. // if secondlife is the scheme, LLURI should parse /app/login as path, with no authority 
  293. ensure_equals("scheme", u.scheme(), "secondlife");
  294. ensure_equals("authority", u.authority(), "");
  295. ensure_equals("path", u.path(), "/app/login");
  296. ensure_equals("pathmap", u.pathArray()[0].asString(), "app");
  297. ensure_equals("pathmap", u.pathArray()[1].asString(), "login");
  298. ensure_equals("query", u.query(), "first_name=Testert4&last_name=Tester&web_login_key=test");
  299. ensure_equals("query map element", u.queryMap()["last_name"].asString(), "Tester");
  300. u = LLURI("secondlife://Da Boom/128/128/128");
  301. // if secondlife is the scheme, LLURI should parse /128/128/128 as path, with Da Boom as authority
  302. ensure_equals("scheme", u.scheme(), "secondlife");
  303. ensure_equals("authority", u.authority(), "Da Boom");
  304. ensure_equals("path", u.path(), "/128/128/128");
  305. ensure_equals("pathmap", u.pathArray()[0].asString(), "128");
  306. ensure_equals("pathmap", u.pathArray()[1].asString(), "128");
  307. ensure_equals("pathmap", u.pathArray()[2].asString(), "128");
  308. ensure_equals("query", u.query(), "");
  309. }
  310. template<> template<>
  311. void URITestObject::test<19>()
  312. {
  313. // Parse about: schemes
  314. LLURI u("about:blank?redirect-http-hack=secondlife%3A%2F%2F%2Fapp%2Flogin%3Ffirst_name%3DCallum%26last_name%3DLinden%26location%3Dspecify%26grid%3Dvaak%26region%3D%2FMorris%2F128%2F128%26web_login_key%3Defaa4795-c2aa-4c58-8966-763c27931e78");
  315. ensure_equals("scheme", u.scheme(), "about");
  316. ensure_equals("authority", u.authority(), "");
  317. ensure_equals("path", u.path(), "blank");
  318. ensure_equals("pathmap", u.pathArray()[0].asString(), "blank");
  319. ensure_equals("query", u.query(), "redirect-http-hack=secondlife:///app/login?first_name=Callum&last_name=Linden&location=specify&grid=vaak&region=/Morris/128/128&web_login_key=efaa4795-c2aa-4c58-8966-763c27931e78");
  320. ensure_equals("query map element", u.queryMap()["redirect-http-hack"].asString(), "secondlife:///app/login?first_name=Callum&last_name=Linden&location=specify&grid=vaak&region=/Morris/128/128&web_login_key=efaa4795-c2aa-4c58-8966-763c27931e78");
  321. }
  322. }