FileWebRequestTest.cs 35 KB

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