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