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