FileWebRequestTest.cs 35 KB

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