FileWebRequestTest.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. //
  2. // FileWebRequestTest.cs - NUnit Test Cases for System.Net.FileWebRequest
  3. //
  4. // Authors:
  5. // Lawrence Pit ([email protected])
  6. // Martin Willemoes Hansen ([email protected])
  7. // Gert Driesen ([email protected])
  8. //
  9. // (C) 2003 Martin Willemoes Hansen
  10. //
  11. using System;
  12. using System.Collections;
  13. using System.IO;
  14. using System.Net;
  15. using System.Runtime.Serialization;
  16. using System.Runtime.Serialization.Formatters;
  17. using System.Runtime.Serialization.Formatters.Binary;
  18. using System.Security;
  19. using System.Security.Permissions;
  20. using NUnit.Framework;
  21. #if TARGET_JVM
  22. using System.Globalization;
  23. using System.Reflection;
  24. #endif
  25. namespace MonoTests.System.Net
  26. {
  27. [TestFixture]
  28. public class FileWebRequestTest
  29. {
  30. private string _tempDirectory;
  31. private string _tempFile;
  32. private Uri _tempFileUri;
  33. [SetUp]
  34. public void SetUp ()
  35. {
  36. _tempDirectory = Path.Combine (Path.GetTempPath (), "MonoTests.System.Net.FileWebRequestTest");
  37. _tempFile = Path.Combine (_tempDirectory, "FileWebRequestTest.tmp");
  38. if (!Directory.Exists (_tempDirectory)) {
  39. Directory.CreateDirectory (_tempDirectory);
  40. } else {
  41. // ensure no files are left over from previous runs
  42. string [] files = Directory.GetFiles (_tempDirectory, "*");
  43. foreach (string file in files)
  44. File.Delete (file);
  45. }
  46. _tempFileUri = GetTempFileUri ();
  47. }
  48. [TearDown]
  49. public void TearDown ()
  50. {
  51. if (Directory.Exists (_tempDirectory))
  52. Directory.Delete (_tempDirectory, true);
  53. }
  54. [Test]
  55. public void Async ()
  56. {
  57. WebResponse res = null;
  58. try {
  59. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  60. req.Method = "PUT";
  61. req.ContentLength = 1;
  62. req.ContentType = "image/png";
  63. req.Timeout = 2 * 1000;
  64. IAsyncResult async = req.BeginGetRequestStream (null, null);
  65. try {
  66. req.BeginGetRequestStream (null, null);
  67. Assert.Fail ("#1 should've failed");
  68. } catch (InvalidOperationException) {
  69. // Cannot re-call BeginGetRequestStream/BeginGetResponse while
  70. // a previous call is still in progress
  71. }
  72. try {
  73. req.GetRequestStream ();
  74. Assert.Fail ("#3 should've failed");
  75. } catch (InvalidOperationException) {
  76. // Cannot re-call BeginGetRequestStream/BeginGetResponse while
  77. // a previous call is still in progress
  78. }
  79. using (Stream wstream = req.EndGetRequestStream (async)) {
  80. Assert.IsFalse (wstream.CanRead, "#1r");
  81. Assert.IsTrue (wstream.CanWrite, "#1w");
  82. Assert.IsTrue (wstream.CanSeek, "#1s");
  83. wstream.WriteByte (72);
  84. wstream.WriteByte (101);
  85. wstream.WriteByte (108);
  86. wstream.WriteByte (108);
  87. wstream.WriteByte (111);
  88. wstream.Close ();
  89. }
  90. Assert.AreEqual (1, req.ContentLength, "#1cl");
  91. Assert.AreEqual ("image/png", req.ContentType, "#1ct");
  92. // stream written
  93. req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  94. res = req.GetResponse ();
  95. try {
  96. req.BeginGetRequestStream (null, null);
  97. Assert.Fail ("#20: should've failed");
  98. } catch (InvalidOperationException) {
  99. // Cannot send a content-body with this verb-type
  100. }
  101. try {
  102. req.Method = "PUT";
  103. req.BeginGetRequestStream (null, null);
  104. Assert.Fail ("#21: should've failed");
  105. } catch (InvalidOperationException) {
  106. // This operation cannot be perfomed after the request has been submitted.
  107. }
  108. req.GetResponse ();
  109. IAsyncResult async2 = req.BeginGetResponse (null, null);
  110. // this succeeds !!
  111. WebResponse res2 = req.EndGetResponse (async2);
  112. Assert.AreSame (res, res2, "#23");
  113. Assert.AreEqual (5, res.ContentLength, "#2 len");
  114. Assert.AreEqual ("application/octet-stream", res.ContentType, "#2 type");
  115. Assert.AreEqual ("file", res.ResponseUri.Scheme, "#2 scheme");
  116. Stream rstream = res.GetResponseStream ();
  117. Assert.IsTrue (rstream.CanRead, "#3r");
  118. Assert.IsFalse (rstream.CanWrite, "#3w");
  119. Assert.IsTrue (rstream.CanSeek, "#3s");
  120. Assert.AreEqual (72, rstream.ReadByte (), "#4a");
  121. Assert.AreEqual (101, rstream.ReadByte (), "#4b");
  122. Assert.AreEqual (108, rstream.ReadByte (), "#4c");
  123. Assert.AreEqual (108, rstream.ReadByte (), "#4d");
  124. Assert.AreEqual (111, rstream.ReadByte (), "#4e");
  125. rstream.Close ();
  126. try {
  127. long len = res.ContentLength;
  128. Assert.AreEqual ((long) 5, len, "#5");
  129. } catch (ObjectDisposedException) {
  130. Assert.Fail ("#disposed contentlength");
  131. }
  132. try {
  133. WebHeaderCollection w = res.Headers;
  134. } catch (ObjectDisposedException) {
  135. Assert.Fail ("#disposed headers");
  136. }
  137. try {
  138. res.Close ();
  139. } catch (ObjectDisposedException) {
  140. Assert.Fail ("#disposed close");
  141. }
  142. } finally {
  143. if (res != null)
  144. res.Close ();
  145. }
  146. }
  147. [Test]
  148. public void Async_GetResponse_Failure ()
  149. {
  150. if (!RunningOnUnix)
  151. Assert.Ignore ("bug #80700");
  152. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  153. req.Method = "PUT";
  154. req.ContentLength = 1;
  155. req.ContentType = "image/png";
  156. req.Timeout = 500;
  157. IAsyncResult async = req.BeginGetRequestStream (null, null);
  158. try {
  159. req.GetResponse ();
  160. Assert.Fail ("#1");
  161. } catch (WebException) {
  162. // The operation has timed out
  163. }
  164. try {
  165. req.BeginGetResponse (null, null);
  166. Assert.Fail ("#2");
  167. } catch (InvalidOperationException) {
  168. // Cannot re-call BeginGetRequestStream/BeginGetResponse while
  169. // a previous call is still in progress
  170. }
  171. using (Stream wstream = req.EndGetRequestStream (async)) {
  172. wstream.WriteByte (72);
  173. }
  174. // the temp file should not be in use
  175. Directory.Delete (_tempDirectory, true);
  176. }
  177. [Test]
  178. public void Sync ()
  179. {
  180. WebResponse res = null;
  181. try {
  182. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  183. req.ContentLength = 1;
  184. req.ContentType = "image/png";
  185. try {
  186. Stream stream = req.GetRequestStream ();
  187. Assert.Fail ("should throw exception");
  188. } catch (ProtocolViolationException) {
  189. }
  190. req.Method = "PUT";
  191. Stream wstream = req.GetRequestStream ();
  192. Assert.IsFalse (wstream.CanRead, "#1r");
  193. Assert.IsTrue (wstream.CanWrite, "#1w");
  194. Assert.IsTrue (wstream.CanSeek, "#1s");
  195. wstream.WriteByte (72);
  196. wstream.WriteByte (101);
  197. wstream.WriteByte (108);
  198. wstream.WriteByte (108);
  199. wstream.WriteByte (111);
  200. wstream.Close ();
  201. Assert.AreEqual (1, req.ContentLength, "#1cl");
  202. Assert.AreEqual ("image/png", req.ContentType, "#1ct");
  203. // stream written
  204. req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  205. res = req.GetResponse ();
  206. Assert.AreEqual ((long) 5, res.ContentLength, "#2 len");
  207. Assert.AreEqual ("application/octet-stream", res.ContentType, "#2 type");
  208. Assert.AreEqual ("file", res.ResponseUri.Scheme, "#2 scheme");
  209. Stream rstream = res.GetResponseStream ();
  210. Assert.IsTrue (rstream.CanRead, "#3r");
  211. Assert.IsFalse (rstream.CanWrite, "#3w");
  212. Assert.IsTrue (rstream.CanSeek, "#3s");
  213. Assert.AreEqual (72, rstream.ReadByte (), "#4a");
  214. Assert.AreEqual (101, rstream.ReadByte (), "#4b");
  215. Assert.AreEqual (108, rstream.ReadByte (), "#4c");
  216. Assert.AreEqual (108, rstream.ReadByte (), "#4d");
  217. Assert.AreEqual (111, rstream.ReadByte (), "#4e");
  218. rstream.Close ();
  219. try {
  220. long len = res.ContentLength;
  221. Assert.AreEqual ((long) 5, len, "#5");
  222. } catch (ObjectDisposedException) {
  223. Assert.Fail ("#disposed contentlength");
  224. }
  225. try {
  226. WebHeaderCollection w = res.Headers;
  227. } catch (ObjectDisposedException) {
  228. Assert.Fail ("#disposed headers");
  229. }
  230. try {
  231. res.Close ();
  232. } catch (ObjectDisposedException) {
  233. Assert.Fail ("#disposed close");
  234. }
  235. } finally {
  236. if (res != null)
  237. res.Close ();
  238. }
  239. }
  240. [Test]
  241. public void Sync_GetResponse_Failure ()
  242. {
  243. if (!RunningOnUnix)
  244. Assert.Ignore ("bug #80700");
  245. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  246. req.Method = "PUT";
  247. req.ContentLength = 1;
  248. req.ContentType = "image/png";
  249. req.Timeout = 500;
  250. using (Stream rs = req.GetRequestStream ()) {
  251. try {
  252. req.GetResponse ();
  253. Assert.Fail ("#1");
  254. } catch (WebException) {
  255. // The operation has timed out
  256. }
  257. try {
  258. req.BeginGetResponse (null, null);
  259. Assert.Fail ("#2");
  260. } catch (InvalidOperationException) {
  261. // Cannot re-call BeginGetRequestStream/BeginGetResponse while
  262. // a previous call is still in progress
  263. }
  264. }
  265. // the temp file should not be in use
  266. Directory.Delete (_tempDirectory, true);
  267. }
  268. [Test]
  269. public void ConnectionGroupName ()
  270. {
  271. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  272. Assert.IsNull (req.ConnectionGroupName, "#A");
  273. req.ConnectionGroupName = "whatever";
  274. Assert.IsNotNull (req.ConnectionGroupName, "#B1");
  275. Assert.AreEqual ("whatever", req.ConnectionGroupName, "#B2");
  276. req.ConnectionGroupName = string.Empty;
  277. Assert.IsNotNull (req.ConnectionGroupName, "#C1");
  278. Assert.AreEqual (string.Empty, req.ConnectionGroupName, "#C2");
  279. req.ConnectionGroupName = null;
  280. Assert.IsNull (req.ConnectionGroupName, "#D");
  281. }
  282. [Test]
  283. public void ContentLength ()
  284. {
  285. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  286. Assert.AreEqual (0, req.Headers.Count, "#A1");
  287. Assert.AreEqual (0, req.ContentLength, "#A2");
  288. req.ContentLength = 5;
  289. Assert.AreEqual (5, req.ContentLength, "#A3");
  290. Assert.AreEqual (0, req.Headers.Count, "#A4");
  291. req.Method = "PUT";
  292. using (Stream s = req.GetRequestStream ()) {
  293. s.WriteByte (5);
  294. Assert.AreEqual (5, req.ContentLength, "#B1");
  295. s.WriteByte (4);
  296. Assert.AreEqual (5, req.ContentLength, "#B2");
  297. s.Flush ();
  298. Assert.AreEqual (5, req.ContentLength, "#B3");
  299. }
  300. Assert.AreEqual (5, req.ContentLength, "#B4");
  301. }
  302. [Test]
  303. public void ContentLength_Negative ()
  304. {
  305. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  306. try {
  307. req.ContentLength = -1;
  308. Assert.Fail ("#1");
  309. } catch (ArgumentException ex) {
  310. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
  311. Assert.IsNotNull (ex.Message, "#3");
  312. #if NET_2_0
  313. Assert.IsFalse (ex.Message == "value", "#4");
  314. #else
  315. Assert.AreEqual ("value", ex.Message, "#4");
  316. #endif
  317. #if !TARGET_JVM
  318. #if NET_2_0
  319. Assert.IsNotNull (ex.ParamName, "#5");
  320. Assert.AreEqual ("value", ex.ParamName, "#6");
  321. #else
  322. Assert.IsNull (ex.ParamName, "#5");
  323. #endif
  324. #endif
  325. Assert.IsNull (ex.InnerException, "#7");
  326. }
  327. }
  328. [Test]
  329. public void ContentType ()
  330. {
  331. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  332. Assert.AreEqual (0, req.Headers.Count, "#A1");
  333. Assert.IsNull (req.ContentType, "#A2");
  334. req.ContentType = "application/x-gzip";
  335. Assert.AreEqual (1, req.Headers.Count, "#B1");
  336. Assert.AreEqual ("Content-Type", req.Headers.GetKey (0), "#B2");
  337. Assert.AreEqual ("application/x-gzip", req.Headers.Get (0), "#B3");
  338. Assert.AreEqual ("application/x-gzip", req.ContentType, "#B4");
  339. req.Headers.Set ("Content-Type", "image/png");
  340. Assert.AreEqual ("image/png", req.ContentType, "#C1");
  341. req.ContentType = null;
  342. Assert.AreEqual (1, req.Headers.Count, "#D1");
  343. Assert.AreEqual ("Content-Type", req.Headers.GetKey (0), "#D2");
  344. Assert.AreEqual (string.Empty, req.Headers.Get (0), "#D3");
  345. Assert.AreEqual (string.Empty, req.ContentType, "#D4");
  346. req.Headers.Remove ("Content-Type");
  347. Assert.AreEqual (0, req.Headers.Count, "#E1");
  348. Assert.IsNull (req.ContentType, "#E2");
  349. }
  350. [Test]
  351. public void Credentials ()
  352. {
  353. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  354. Assert.IsNull (req.Credentials, "#1");
  355. req.Credentials = new NetworkCredential ();
  356. Assert.IsNotNull (req.Credentials, "#2");
  357. req.Credentials = null;
  358. Assert.IsNull (req.Credentials, "#3");
  359. }
  360. [Test]
  361. [Category ("NotWorking")]
  362. public void GetRequestStream ()
  363. {
  364. FileWebRequest req = (FileWebRequest) WebRequest.Create (
  365. _tempFileUri);
  366. req.Timeout = 1000;
  367. req.Method = "POST";
  368. FileStream fsA = null;
  369. FileStream fsB = null;
  370. try {
  371. fsA = req.GetRequestStream () as FileStream;
  372. Assert.IsNotNull (fsA, "#A1");
  373. #if NET_2_0
  374. try {
  375. req.GetRequestStream ();
  376. Assert.Fail ("#A2");
  377. } catch (WebException) {
  378. // The operation has timed out
  379. }
  380. fsA.Close ();
  381. try {
  382. req.GetRequestStream ();
  383. Assert.Fail ("#A3");
  384. } catch (InvalidOperationException) {
  385. // Cannot re-call BeginGetRequestStream/BeginGetResponse
  386. // while a previous call is still in progress.
  387. }
  388. #else
  389. fsB = req.GetRequestStream () as FileStream;
  390. Assert.IsNotNull (fsB, "#A2");
  391. Assert.AreSame (fsA, fsB, "#A3");
  392. #endif
  393. } finally {
  394. if (fsA != null)
  395. fsA.Close ();
  396. if (fsB != null)
  397. fsB.Close ();
  398. }
  399. req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  400. req.Timeout = 1000;
  401. req.Method = "POST";
  402. try {
  403. fsA = req.GetRequestStream () as FileStream;
  404. Assert.IsNotNull (fsA, "#B1");
  405. fsA.Close ();
  406. #if NET_2_0
  407. try {
  408. req.GetRequestStream ();
  409. Assert.Fail ("#B2");
  410. } catch (WebException) {
  411. // The operation has timed out
  412. }
  413. fsA.Close ();
  414. try {
  415. req.GetRequestStream ();
  416. Assert.Fail ("#B3");
  417. } catch (InvalidOperationException) {
  418. // Cannot re-call BeginGetRequestStream/BeginGetResponse
  419. // while a previous call is still in progress.
  420. }
  421. #else
  422. fsB = req.GetRequestStream () as FileStream;
  423. Assert.IsNotNull (fsB, "#B2");
  424. Assert.AreSame (fsA, fsB, "#B3");
  425. #endif
  426. } finally {
  427. if (fsA != null)
  428. fsA.Close ();
  429. if (fsB != null)
  430. fsB.Close ();
  431. }
  432. }
  433. [Test]
  434. public void GetRequestStream_File_Exists ()
  435. {
  436. Stream s = File.Create (_tempFile);
  437. s.Close ();
  438. FileWebRequest req = (FileWebRequest) WebRequest.Create (
  439. _tempFileUri);
  440. req.Method = "POST";
  441. s = req.GetRequestStream ();
  442. s.Close ();
  443. }
  444. [Test]
  445. public void GetRequestStream_Method_Valid ()
  446. {
  447. string [] methods = new string [] { "PUT", "POST", "CHECKOUT",
  448. "DELETE", "OPTIONS", "TRACE", "GET ", "DUNNO" };
  449. foreach (string method in methods) {
  450. FileWebRequest req = (FileWebRequest) WebRequest.Create (
  451. _tempFileUri);
  452. req.Method = method;
  453. using (Stream s = req.GetRequestStream ()) {
  454. Assert.IsNotNull (s, "#1:" + method);
  455. Assert.IsFalse (s.CanRead, "#2:" + method);
  456. Assert.IsTrue (s.CanSeek, "#3:" + method);
  457. #if NET_2_0
  458. Assert.IsFalse (s.CanTimeout, "#4:" + method);
  459. #endif
  460. Assert.IsTrue (s.CanWrite, "#5:" + method);
  461. Assert.AreEqual (0, s.Length, "#6:" + method);
  462. Assert.AreEqual (0, s.Position, "#7:" + method);
  463. #if NET_2_0
  464. try {
  465. int i = s.ReadTimeout;
  466. Assert.Fail ("#8:" + method + "=>" + i);
  467. } catch (InvalidOperationException) {
  468. }
  469. try {
  470. int i = s.WriteTimeout;
  471. Assert.Fail ("#9:" + method + "=>" + i);
  472. } catch (InvalidOperationException) {
  473. }
  474. #endif
  475. }
  476. }
  477. }
  478. [Test]
  479. public void GetRequestStream_Method_Invalid ()
  480. {
  481. string [] methods = new string [] { "GET", "get", "HEAD", "head",
  482. "CONNECT", "connect"};
  483. foreach (string method in methods) {
  484. FileWebRequest req = (FileWebRequest) WebRequest.Create (
  485. _tempFileUri);
  486. req.Method = method;
  487. try {
  488. req.GetRequestStream ();
  489. Assert.Fail ("#1:" + method);
  490. } catch (ProtocolViolationException ex) {
  491. Assert.AreEqual (typeof (ProtocolViolationException), ex.GetType (), "#2:" + method);
  492. Assert.IsNotNull (ex.Message, "#3:" + method);
  493. Assert.IsNull (ex.InnerException, "#4:" + method);
  494. }
  495. }
  496. }
  497. [Test]
  498. public void GetResponse_File_Exists ()
  499. {
  500. Stream s = File.Create (_tempFile);
  501. s.Close ();
  502. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  503. FileWebResponse respA = null;
  504. FileWebResponse respB = null;
  505. try {
  506. respA = req.GetResponse () as FileWebResponse;
  507. Assert.IsNotNull (respA, "#1");
  508. respB = req.GetResponse () as FileWebResponse;
  509. Assert.IsNotNull (respB, "#2");
  510. Assert.AreSame (respA, respB, "#3");
  511. } finally {
  512. if (respA != null)
  513. respA.Close ();
  514. if (respB != null)
  515. respB.Close ();
  516. }
  517. }
  518. [Test]
  519. public void GetResponse_File_DoesNotExist ()
  520. {
  521. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  522. try {
  523. req.GetResponse ();
  524. Assert.Fail ("#1");
  525. } catch (WebException ex) {
  526. Assert.AreEqual (typeof (WebException), ex.GetType (), "#1");
  527. Assert.IsNotNull (ex.Message, "#2");
  528. #if !TARGET_JVM
  529. Assert.IsTrue (ex.Message.IndexOf ("FileWebRequestTest.tmp") != -1, "#3");
  530. Assert.IsNull (ex.Response, "#4");
  531. Assert.IsNotNull (ex.InnerException, "#5");
  532. #endif
  533. #if ONLY_1_1
  534. FileNotFoundException fnf = ex.InnerException as FileNotFoundException;
  535. Assert.IsNotNull (fnf, "#6");
  536. Assert.AreEqual (typeof (FileNotFoundException), fnf.GetType (), "#7");
  537. Assert.IsNotNull (fnf.FileName, "#8");
  538. Assert.IsTrue (fnf.FileName.IndexOf ("FileWebRequestTest.tmp") != -1, "#9");
  539. Assert.IsNotNull (fnf.Message, "#10");
  540. Assert.IsTrue (fnf.Message.IndexOf ("FileWebRequestTest.tmp") != -1, "#11");
  541. Assert.IsNull (fnf.InnerException, "#12");
  542. #endif
  543. }
  544. }
  545. [Test]
  546. public void Method ()
  547. {
  548. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  549. Assert.IsNotNull (req.Method, "#A1");
  550. Assert.AreEqual ("GET", req.Method, "#A2");
  551. req.Method = "whatever";
  552. Assert.IsNotNull (req.Method, "#B1");
  553. Assert.AreEqual ("whatever", req.Method, "#B2");
  554. req.Method = "get ";
  555. Assert.IsNotNull (req.Method, "#C1");
  556. Assert.AreEqual ("get ", req.Method, "#C2");
  557. }
  558. [Test]
  559. public void Method_Empty ()
  560. {
  561. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  562. try {
  563. req.Method = string.Empty;
  564. Assert.Fail ("#1");
  565. } catch (ArgumentException ex) {
  566. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
  567. Assert.IsNotNull (ex.Message, "#3");
  568. #if !TARGET_JVM
  569. #if NET_2_0
  570. Assert.AreEqual ("value", ex.ParamName, "#4");
  571. #else
  572. Assert.IsNull (ex.ParamName, "#4");
  573. #endif
  574. #endif
  575. Assert.IsNull (ex.InnerException, "#5");
  576. }
  577. }
  578. [Test]
  579. public void Method_Null ()
  580. {
  581. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  582. try {
  583. req.Method = null;
  584. Assert.Fail ("#1");
  585. } catch (ArgumentException ex) {
  586. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
  587. Assert.IsNotNull (ex.Message, "#3");
  588. #if !TARGET_JVM
  589. #if NET_2_0
  590. Assert.AreEqual ("value", ex.ParamName, "#4");
  591. #else
  592. Assert.IsNull (ex.ParamName, "#4");
  593. #endif
  594. #endif
  595. Assert.IsNull (ex.InnerException, "#5");
  596. }
  597. }
  598. [Test]
  599. public void PreAuthenticate ()
  600. {
  601. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  602. Assert.IsFalse (req.PreAuthenticate, "#1");
  603. req.PreAuthenticate = true;
  604. Assert.IsTrue (req.PreAuthenticate, "#2");
  605. }
  606. [Test]
  607. public void Proxy ()
  608. {
  609. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  610. Assert.IsNull (req.Proxy, "#1");
  611. req.Proxy = new WebProxy ();
  612. Assert.IsNotNull (req.Proxy, "#2");
  613. req.Proxy = null;
  614. Assert.IsNull (req.Proxy, "#3");
  615. }
  616. [Test]
  617. public void RequestUri ()
  618. {
  619. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  620. Assert.AreSame (_tempFileUri, req.RequestUri);
  621. }
  622. [Test]
  623. public void Timeout ()
  624. {
  625. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  626. Assert.AreEqual (100000, req.Timeout, "#1");
  627. req.Timeout = int.MaxValue;
  628. Assert.AreEqual (int.MaxValue, req.Timeout, "#2");
  629. req.Timeout = 0;
  630. Assert.AreEqual (0, req.Timeout, "#3");
  631. }
  632. [Test]
  633. public void Timeout_Negative ()
  634. {
  635. FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri);
  636. req.Timeout = -1;
  637. Assert.AreEqual (-1, req.Timeout, "#1");
  638. try {
  639. req.Timeout = -2;
  640. Assert.Fail ("#2");
  641. } catch (ArgumentOutOfRangeException ex) {
  642. Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#3");
  643. Assert.IsNotNull (ex.Message, "#4");
  644. #if !TARGET_JVM
  645. Assert.IsNotNull (ex.ParamName, "#5");
  646. #if NET_2_0
  647. Assert.IsFalse (ex.ParamName == "value", "#6");
  648. #else
  649. Assert.AreEqual ("value", ex.ParamName, "#6");
  650. #endif
  651. #endif
  652. Assert.IsNull (ex.InnerException, "#7");
  653. }
  654. }
  655. [Test]
  656. #if TARGET_JVM
  657. //FIXME: include Java serialization compliant tests
  658. [Ignore ("The MS compliant binary serialization is not supported")]
  659. #endif
  660. public void GetObjectData ()
  661. {
  662. FileWebRequest fwr = (FileWebRequest) WebRequest.Create ("file:///test.txt");
  663. fwr.ConnectionGroupName = "CGN";
  664. fwr.ContentLength = 10;
  665. fwr.ContentType = "image/png";
  666. fwr.Credentials = new NetworkCredential ("Miguel", "de Icaza", "Novell");
  667. fwr.Headers.Add ("Disposition", "attach");
  668. fwr.Method = "PUT";
  669. fwr.PreAuthenticate = true;
  670. fwr.Proxy = new WebProxy ("proxy.ximian.com");
  671. fwr.Timeout = 20;
  672. SerializationInfo si = new SerializationInfo (typeof (FileWebRequest),
  673. new FormatterConverter ());
  674. ((ISerializable) fwr).GetObjectData (si, new StreamingContext ());
  675. Assert.AreEqual (9, si.MemberCount, "#A1");
  676. int i = 0;
  677. foreach (SerializationEntry entry in si) {
  678. Assert.IsNotNull (entry.Name, "#B1:" + i);
  679. Assert.IsNotNull (entry.ObjectType, "#B2:" + i);
  680. Assert.IsNotNull (entry.Value, "#B3:" + i);
  681. switch (i) {
  682. case 0:
  683. Assert.AreEqual ("headers", entry.Name, "#B4:" + i);
  684. Assert.AreEqual (typeof (WebHeaderCollection), entry.ObjectType, "#B5:" + i);
  685. break;
  686. case 1:
  687. Assert.AreEqual ("proxy", entry.Name, "#B4:" + i);
  688. Assert.AreEqual (typeof (IWebProxy), entry.ObjectType, "#B5:" + i);
  689. break;
  690. case 2:
  691. Assert.AreEqual ("uri", entry.Name, "#B4:" + i);
  692. Assert.AreEqual (typeof (Uri), entry.ObjectType, "#B5:" + i);
  693. break;
  694. case 3:
  695. Assert.AreEqual ("connectionGroupName", entry.Name, "#B4:" + i);
  696. Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
  697. Assert.AreEqual ("CGN", entry.Value, "#B6:" + i);
  698. break;
  699. case 4:
  700. Assert.AreEqual ("method", entry.Name, "#B4:" + i);
  701. Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
  702. Assert.AreEqual ("PUT", entry.Value, "#B6:" + i);
  703. break;
  704. case 5:
  705. Assert.AreEqual ("contentLength", entry.Name, "#B4:" + i);
  706. Assert.AreEqual (typeof (long), entry.ObjectType, "#B5:" + i);
  707. Assert.AreEqual (10, entry.Value, "#B6:" + i);
  708. break;
  709. case 6:
  710. Assert.AreEqual ("timeout", entry.Name, "#B4:" + i);
  711. Assert.AreEqual (typeof (int), entry.ObjectType, "#B5:" + i);
  712. Assert.AreEqual (20, entry.Value, "#B6:" + i);
  713. break;
  714. case 7:
  715. Assert.AreEqual ("fileAccess", entry.Name, "#B4:" + i);
  716. Assert.AreEqual (typeof (FileAccess), entry.ObjectType, "#B5:" + i);
  717. Assert.AreEqual (FileAccess.Read, entry.Value, "#B6:" + i);
  718. break;
  719. case 8:
  720. Assert.AreEqual ("preauthenticate", entry.Name, "#B4:" + i);
  721. Assert.AreEqual (typeof (bool), entry.ObjectType, "#B5:" + i);
  722. #if NET_2_0
  723. Assert.AreEqual (false, entry.Value, "#B6:" + i);
  724. #else
  725. Assert.AreEqual (true, entry.Value, "#B6:" + i);
  726. #endif
  727. break;
  728. }
  729. i++;
  730. }
  731. }
  732. [Test]
  733. [Category ("NotWorking")] // Difference at index 272: 20 instead of 19
  734. public void Serialize ()
  735. {
  736. FileWebRequest fwr = (FileWebRequest) WebRequest.Create ("file://test.txt/");
  737. fwr.ConnectionGroupName = "CGN";
  738. fwr.ContentLength = 10;
  739. fwr.ContentType = "image/png";
  740. fwr.Credentials = new NetworkCredential ("Miguel", "de Icaza", "Novell");
  741. fwr.Headers.Add ("Disposition", "attach");
  742. fwr.Method = "PUT";
  743. fwr.PreAuthenticate = true;
  744. fwr.Proxy = new WebProxy ("proxy.ximian.com");
  745. fwr.Timeout = 20;
  746. BinaryFormatter bf = new BinaryFormatter ();
  747. bf.AssemblyFormat = FormatterAssemblyStyle.Full;
  748. MemoryStream ms = new MemoryStream ();
  749. bf.Serialize (ms, fwr);
  750. ms.Position = 0;
  751. byte [] buffer = new byte [ms.Length];
  752. ms.Read (buffer, 0, buffer.Length);
  753. Assert.AreEqual (_serialized, buffer);
  754. }
  755. [Test]
  756. #if TARGET_JVM
  757. [Ignore ("The MS compliant binary serialization is not supported")]
  758. #endif
  759. public void Deserialize ()
  760. {
  761. MemoryStream ms = new MemoryStream ();
  762. ms.Write (_serialized, 0, _serialized.Length);
  763. ms.Position = 0;
  764. BinaryFormatter bf = new BinaryFormatter ();
  765. FileWebRequest req = (FileWebRequest) bf.Deserialize (ms);
  766. Assert.AreEqual ("CGN", req.ConnectionGroupName, "#A1");
  767. Assert.AreEqual (10, req.ContentLength, "#A2");
  768. Assert.AreEqual ("image/png", req.ContentType, "#A3");
  769. Assert.IsNull (req.Credentials, "#A4");
  770. Assert.AreEqual ("PUT", req.Method, "#A5");
  771. #if NET_2_0
  772. Assert.IsFalse (req.PreAuthenticate, "#A6");
  773. #else
  774. Assert.IsTrue (req.PreAuthenticate, "#A6");
  775. #endif
  776. Assert.AreEqual ("file://test.txt/", req.RequestUri.AbsoluteUri, "#A7");
  777. Assert.AreEqual (20, req.Timeout, "#A8");
  778. WebHeaderCollection headers = req.Headers;
  779. Assert.IsNotNull (headers, "#C1");
  780. Assert.AreEqual (2, headers.Count, "#C2");
  781. Assert.AreEqual ("Content-Type", req.Headers.GetKey (0), "#C3");
  782. Assert.AreEqual ("image/png", req.Headers.Get (0), "#C4");
  783. Assert.AreEqual ("Disposition", req.Headers.GetKey (1), "#C5");
  784. Assert.AreEqual ("attach", req.Headers.Get (1), "#C6");
  785. WebProxy proxy = req.Proxy as WebProxy;
  786. Assert.IsNotNull (proxy, "#D1");
  787. Assert.AreEqual ("http://proxy.ximian.com/", proxy.Address.AbsoluteUri, "#D2");
  788. Assert.IsNotNull (proxy.BypassArrayList, "#D3");
  789. Assert.AreEqual (0, proxy.BypassArrayList.Count, "#D4");
  790. Assert.IsNotNull (proxy.BypassList, "#D5");
  791. Assert.AreEqual (0, proxy.BypassList.Length, "#D6");
  792. Assert.IsFalse (proxy.BypassProxyOnLocal, "#D7");
  793. Assert.IsNull (proxy.Credentials, "#D8");
  794. }
  795. private Uri GetTempFileUri ()
  796. {
  797. string tempFile = _tempFile;
  798. if (RunningOnUnix) {
  799. // remove leading slash for absolute paths
  800. tempFile = tempFile.TrimStart ('/');
  801. } else {
  802. tempFile = tempFile.Replace ('\\', '/');
  803. }
  804. return new Uri ("file:///" + tempFile);
  805. }
  806. #if TARGET_JVM
  807. private bool RunningOnUnix {
  808. get {
  809. Type t = Type.GetType("java.lang.System");
  810. MethodInfo mi = t.GetMethod("getProperty", new Type[] { typeof(string) });
  811. string osName = (string) mi.Invoke(null, new object[] { "os.name" });
  812. if(osName == null) {
  813. return false;
  814. }
  815. return !osName.StartsWith("win", true, CultureInfo.InvariantCulture);
  816. }
  817. }
  818. #else
  819. private bool RunningOnUnix {
  820. get {
  821. // check for Unix platforms - see FAQ for more details
  822. // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
  823. int platform = (int) Environment.OSVersion.Platform;
  824. return ((platform == 4) || (platform == 128));
  825. }
  826. }
  827. #endif
  828. private static readonly byte [] _serialized = new byte [] {
  829. #if NET_2_0
  830. 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
  831. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
  832. 0x49, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
  833. 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e, 0x30, 0x2e, 0x30,
  834. 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65,
  835. 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50,
  836. 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b,
  837. 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36,
  838. 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x05, 0x01, 0x00,
  839. 0x00, 0x00, 0x19, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e,
  840. 0x65, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x57, 0x65, 0x62, 0x52,
  841. 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x09, 0x00, 0x00, 0x00, 0x07,
  842. 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x05, 0x70, 0x72, 0x6f,
  843. 0x78, 0x79, 0x03, 0x75, 0x72, 0x69, 0x13, 0x63, 0x6f, 0x6e, 0x6e,
  844. 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70,
  845. 0x4e, 0x61, 0x6d, 0x65, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64,
  846. 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e,
  847. 0x67, 0x74, 0x68, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
  848. 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
  849. 0x0f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
  850. 0x69, 0x63, 0x61, 0x74, 0x65, 0x04, 0x04, 0x04, 0x01, 0x01, 0x00,
  851. 0x00, 0x03, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
  852. 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65, 0x61, 0x64,
  853. 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
  854. 0x6e, 0x02, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65,
  855. 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x50, 0x72,
  856. 0x6f, 0x78, 0x79, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x53, 0x79, 0x73,
  857. 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02, 0x00, 0x00, 0x00,
  858. 0x09, 0x08, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x49,
  859. 0x4f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73,
  860. 0x73, 0x01, 0x02, 0x00, 0x00, 0x00, 0x09, 0x03, 0x00, 0x00, 0x00,
  861. 0x09, 0x04, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00, 0x00, 0x00, 0x06,
  862. 0x06, 0x00, 0x00, 0x00, 0x03, 0x43, 0x47, 0x4e, 0x06, 0x07, 0x00,
  863. 0x00, 0x00, 0x03, 0x50, 0x55, 0x54, 0x0a, 0x00, 0x00, 0x00, 0x00,
  864. 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0xf8, 0xff, 0xff,
  865. 0xff, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x4f,
  866. 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
  867. 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f,
  868. 0x5f, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00,
  869. 0x00, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e,
  870. 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65,
  871. 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
  872. 0x05, 0x00, 0x00, 0x00, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x01,
  873. 0x30, 0x01, 0x32, 0x01, 0x31, 0x01, 0x33, 0x00, 0x01, 0x01, 0x01,
  874. 0x01, 0x08, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06,
  875. 0x09, 0x00, 0x00, 0x00, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
  876. 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x06, 0x0a, 0x00, 0x00, 0x00,
  877. 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x06,
  878. 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x44, 0x69, 0x73, 0x70, 0x6f, 0x73,
  879. 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x06,
  880. 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x05, 0x04, 0x00, 0x00, 0x00,
  881. 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e, 0x65, 0x74,
  882. 0x2e, 0x57, 0x65, 0x62, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x04, 0x00,
  883. 0x00, 0x00, 0x0e, 0x5f, 0x42, 0x79, 0x70, 0x61, 0x73, 0x73, 0x4f,
  884. 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x0d, 0x5f, 0x50, 0x72, 0x6f,
  885. 0x78, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x0b, 0x5f,
  886. 0x42, 0x79, 0x70, 0x61, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x16,
  887. 0x5f, 0x55, 0x73, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
  888. 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73,
  889. 0x00, 0x04, 0x02, 0x00, 0x01, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65,
  890. 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02,
  891. 0x00, 0x00, 0x00, 0x00, 0x09, 0x0d, 0x00, 0x00, 0x00, 0x0a, 0x00,
  892. 0x05, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65,
  893. 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x41,
  894. 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x55, 0x72, 0x69, 0x01,
  895. 0x02, 0x00, 0x00, 0x00, 0x06, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x66,
  896. 0x69, 0x6c, 0x65, 0x3a, 0x2f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e,
  897. 0x74, 0x78, 0x74, 0x2f, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x00,
  898. 0x00, 0x00, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x68, 0x74, 0x74,
  899. 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x78,
  900. 0x69, 0x6d, 0x69, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x0b
  901. #else
  902. 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
  903. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
  904. 0x4c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
  905. 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e, 0x30, 0x2e, 0x35,
  906. 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
  907. 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
  908. 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
  909. 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35,
  910. 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39,
  911. 0x05, 0x01, 0x00, 0x00, 0x00, 0x19, 0x53, 0x79, 0x73, 0x74, 0x65,
  912. 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x57,
  913. 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x09, 0x00,
  914. 0x00, 0x00, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x05,
  915. 0x70, 0x72, 0x6f, 0x78, 0x79, 0x03, 0x75, 0x72, 0x69, 0x13, 0x63,
  916. 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72,
  917. 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x06, 0x6d, 0x65, 0x74,
  918. 0x68, 0x6f, 0x64, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
  919. 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x07, 0x74, 0x69, 0x6d, 0x65,
  920. 0x6f, 0x75, 0x74, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63,
  921. 0x65, 0x73, 0x73, 0x0f, 0x70, 0x72, 0x65, 0x61, 0x75, 0x74, 0x68,
  922. 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x04, 0x04, 0x04,
  923. 0x01, 0x01, 0x00, 0x00, 0x03, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74,
  924. 0x65, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48,
  925. 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
  926. 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79,
  927. 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65,
  928. 0x62, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x02, 0x00, 0x00, 0x00, 0x0a,
  929. 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02,
  930. 0x00, 0x00, 0x00, 0x09, 0x08, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65,
  931. 0x6d, 0x2e, 0x49, 0x4f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63,
  932. 0x63, 0x65, 0x73, 0x73, 0x01, 0x02, 0x00, 0x00, 0x00, 0x09, 0x03,
  933. 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x09, 0x05, 0x00,
  934. 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x03, 0x43, 0x47, 0x4e,
  935. 0x06, 0x07, 0x00, 0x00, 0x00, 0x03, 0x50, 0x55, 0x54, 0x0a, 0x00,
  936. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04,
  937. 0xf8, 0xff, 0xff, 0xff, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
  938. 0x2e, 0x49, 0x4f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x63,
  939. 0x65, 0x73, 0x73, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c,
  940. 0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x01,
  941. 0x05, 0x03, 0x00, 0x00, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65,
  942. 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65,
  943. 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
  944. 0x69, 0x6f, 0x6e, 0x05, 0x00, 0x00, 0x00, 0x05, 0x43, 0x6f, 0x75,
  945. 0x6e, 0x74, 0x01, 0x30, 0x01, 0x32, 0x01, 0x31, 0x01, 0x33, 0x00,
  946. 0x01, 0x01, 0x01, 0x01, 0x08, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
  947. 0x00, 0x00, 0x06, 0x09, 0x00, 0x00, 0x00, 0x0c, 0x43, 0x6f, 0x6e,
  948. 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x06, 0x0a,
  949. 0x00, 0x00, 0x00, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70,
  950. 0x6e, 0x67, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x44, 0x69, 0x73,
  951. 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x06, 0x0c, 0x00,
  952. 0x00, 0x00, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x05, 0x04,
  953. 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
  954. 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x50, 0x72, 0x6f, 0x78,
  955. 0x79, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x5f, 0x42, 0x79, 0x70, 0x61,
  956. 0x73, 0x73, 0x4f, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x0d, 0x5f,
  957. 0x50, 0x72, 0x6f, 0x78, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
  958. 0x73, 0x0b, 0x5f, 0x42, 0x79, 0x70, 0x61, 0x73, 0x73, 0x4c, 0x69,
  959. 0x73, 0x74, 0x00, 0x04, 0x02, 0x01, 0x0a, 0x53, 0x79, 0x73, 0x74,
  960. 0x65, 0x6d, 0x2e, 0x55, 0x72, 0x69, 0x02, 0x00, 0x00, 0x00, 0x02,
  961. 0x00, 0x00, 0x00, 0x00, 0x09, 0x0d, 0x00, 0x00, 0x00, 0x0a, 0x05,
  962. 0x05, 0x00, 0x00, 0x00, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
  963. 0x2e, 0x55, 0x72, 0x69, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x41, 0x62,
  964. 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x55, 0x72, 0x69, 0x01, 0x02,
  965. 0x00, 0x00, 0x00, 0x06, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x66, 0x69,
  966. 0x6c, 0x65, 0x3a, 0x2f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74,
  967. 0x78, 0x74, 0x2f, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
  968. 0x00, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x18, 0x68, 0x74, 0x74, 0x70,
  969. 0x3a, 0x2f, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x78, 0x69,
  970. 0x6d, 0x69, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x0b
  971. #endif
  972. };
  973. }
  974. }