2
0

FileWebRequestTest.cs 36 KB

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