WebHeaderCollection.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. //
  2. // WebHeaderCollection.cs
  3. // Copied from System.Net.WebHeaderCollection
  4. //
  5. // Authors:
  6. // Lawrence Pit (loz@cable.a2000.nl)
  7. // Gonzalo Paniagua Javier (gonzalo@ximian.com)
  8. // Miguel de Icaza (miguel@novell.com)
  9. //
  10. // Copyright 2003 Ximian, Inc. (http://www.ximian.com)
  11. // Copyright 2007 Novell, Inc. (http://www.novell.com)
  12. //
  13. // Permission is hereby granted, free of charge, to any person obtaining
  14. // a copy of this software and associated documentation files (the
  15. // "Software"), to deal in the Software without restriction, including
  16. // without limitation the rights to use, copy, modify, merge, publish,
  17. // distribute, sublicense, and/or sell copies of the Software, and to
  18. // permit persons to whom the Software is furnished to do so, subject to
  19. // the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be
  22. // included in all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  28. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  29. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  30. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. using System;
  33. using System.Collections;
  34. using System.Collections.Generic;
  35. using System.Collections.Specialized;
  36. using System.Net;
  37. using System.Runtime.InteropServices;
  38. using System.Runtime.Serialization;
  39. using System.Text;
  40. // See RFC 2068 par 4.2 Message Headers
  41. namespace WebSocketSharp.Net {
  42. [Serializable]
  43. [ComVisible(true)]
  44. public class WebHeaderCollection : NameValueCollection, ISerializable
  45. {
  46. private static readonly Dictionary<string, bool> multiValue;
  47. private static readonly Dictionary<string, bool> restricted;
  48. private static readonly Dictionary<string, bool> restricted_response;
  49. private bool internallyCreated = false;
  50. // Static Initializer
  51. static WebHeaderCollection ()
  52. {
  53. // the list of restricted header names as defined
  54. // by the ms.net spec
  55. restricted = new Dictionary<string, bool> (StringComparer.InvariantCultureIgnoreCase);
  56. restricted.Add ("accept", true);
  57. restricted.Add ("connection", true);
  58. restricted.Add ("content-length", true);
  59. restricted.Add ("content-type", true);
  60. restricted.Add ("date", true);
  61. restricted.Add ("expect", true);
  62. restricted.Add ("host", true);
  63. restricted.Add ("if-modified-since", true);
  64. restricted.Add ("range", true);
  65. restricted.Add ("referer", true);
  66. restricted.Add ("transfer-encoding", true);
  67. restricted.Add ("user-agent", true);
  68. restricted.Add ("proxy-connection", true);
  69. //
  70. restricted_response = new Dictionary<string, bool> (StringComparer.InvariantCultureIgnoreCase);
  71. restricted_response.Add ("Content-Length", true);
  72. restricted_response.Add ("Transfer-Encoding", true);
  73. restricted_response.Add ("WWW-Authenticate", true);
  74. // see par 14 of RFC 2068 to see which header names
  75. // accept multiple values each separated by a comma
  76. multiValue = new Dictionary<string, bool> (StringComparer.InvariantCultureIgnoreCase);
  77. multiValue.Add ("accept", true);
  78. multiValue.Add ("accept-charset", true);
  79. multiValue.Add ("accept-encoding", true);
  80. multiValue.Add ("accept-language", true);
  81. multiValue.Add ("accept-ranges", true);
  82. multiValue.Add ("allow", true);
  83. multiValue.Add ("authorization", true);
  84. multiValue.Add ("cache-control", true);
  85. multiValue.Add ("connection", true);
  86. multiValue.Add ("content-encoding", true);
  87. multiValue.Add ("content-language", true);
  88. multiValue.Add ("expect", true);
  89. multiValue.Add ("if-match", true);
  90. multiValue.Add ("if-none-match", true);
  91. multiValue.Add ("proxy-authenticate", true);
  92. multiValue.Add ("public", true);
  93. multiValue.Add ("range", true);
  94. multiValue.Add ("transfer-encoding", true);
  95. multiValue.Add ("upgrade", true);
  96. multiValue.Add ("vary", true);
  97. multiValue.Add ("via", true);
  98. multiValue.Add ("warning", true);
  99. multiValue.Add ("www-authenticate", true);
  100. // Extra
  101. multiValue.Add ("set-cookie", true);
  102. multiValue.Add ("set-cookie2", true);
  103. }
  104. // Constructors
  105. public WebHeaderCollection () { }
  106. protected WebHeaderCollection (
  107. SerializationInfo serializationInfo,
  108. StreamingContext streamingContext)
  109. {
  110. int count;
  111. try {
  112. count = serializationInfo.GetInt32("Count");
  113. for (int i = 0; i < count; i++)
  114. this.Add (serializationInfo.GetString (i.ToString ()),
  115. serializationInfo.GetString ((count + i).ToString ()));
  116. } catch (SerializationException){
  117. count = serializationInfo.GetInt32("count");
  118. for (int i = 0; i < count; i++)
  119. this.Add (serializationInfo.GetString ("k" + i),
  120. serializationInfo.GetString ("v" + i));
  121. }
  122. }
  123. internal WebHeaderCollection (bool internallyCreated)
  124. {
  125. this.internallyCreated = internallyCreated;
  126. }
  127. // Methods
  128. public void Add (string header)
  129. {
  130. if (header == null)
  131. throw new ArgumentNullException ("header");
  132. int pos = header.IndexOf (':');
  133. if (pos == -1)
  134. throw new ArgumentException ("no colon found", "header");
  135. this.Add (header.Substring (0, pos),
  136. header.Substring (pos + 1));
  137. }
  138. public override void Add (string name, string value)
  139. {
  140. if (name == null)
  141. throw new ArgumentNullException ("name");
  142. if (internallyCreated && IsRestricted (name))
  143. throw new ArgumentException ("This header must be modified with the appropiate property.");
  144. this.AddWithoutValidate (name, value);
  145. }
  146. protected void AddWithoutValidate (string headerName, string headerValue)
  147. {
  148. if (!IsHeaderName (headerName))
  149. throw new ArgumentException ("invalid header name: " + headerName, "headerName");
  150. if (headerValue == null)
  151. headerValue = String.Empty;
  152. else
  153. headerValue = headerValue.Trim ();
  154. if (!IsHeaderValue (headerValue))
  155. throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
  156. base.Add (headerName, headerValue);
  157. }
  158. public override string [] GetValues (string header)
  159. {
  160. if (header == null)
  161. throw new ArgumentNullException ("header");
  162. string [] values = base.GetValues (header);
  163. if (values == null || values.Length == 0)
  164. return null;
  165. /*
  166. if (IsMultiValue (header)) {
  167. values = GetMultipleValues (values);
  168. }
  169. */
  170. return values;
  171. }
  172. public override string[] GetValues (int index)
  173. {
  174. string[] values = base.GetValues (index);
  175. if (values == null || values.Length == 0) {
  176. return(null);
  177. }
  178. return(values);
  179. }
  180. /* Now i wonder why this is here...
  181. static string [] GetMultipleValues (string [] values)
  182. {
  183. ArrayList mvalues = new ArrayList (values.Length);
  184. StringBuilder sb = null;
  185. for (int i = 0; i < values.Length; ++i) {
  186. string val = values [i];
  187. if (val.IndexOf (',') == -1) {
  188. mvalues.Add (val);
  189. continue;
  190. }
  191. if (sb == null)
  192. sb = new StringBuilder ();
  193. bool quote = false;
  194. for (int k = 0; k < val.Length; k++) {
  195. char c = val [k];
  196. if (c == '"') {
  197. quote = !quote;
  198. } else if (!quote && c == ',') {
  199. mvalues.Add (sb.ToString ().Trim ());
  200. sb.Length = 0;
  201. continue;
  202. }
  203. sb.Append (c);
  204. }
  205. if (sb.Length > 0) {
  206. mvalues.Add (sb.ToString ().Trim ());
  207. sb.Length = 0;
  208. }
  209. }
  210. return (string []) mvalues.ToArray (typeof (string));
  211. }
  212. */
  213. public static bool IsRestricted (string headerName)
  214. {
  215. if (headerName == null)
  216. throw new ArgumentNullException ("headerName");
  217. if (headerName == "") // MS throw nullexception here!
  218. throw new ArgumentException ("empty string", "headerName");
  219. if (!IsHeaderName (headerName))
  220. throw new ArgumentException ("Invalid character in header");
  221. return restricted.ContainsKey (headerName);
  222. }
  223. public static bool IsRestricted (string headerName, bool response)
  224. {
  225. if (String.IsNullOrEmpty (headerName))
  226. throw new ArgumentNullException ("headerName");
  227. if (!IsHeaderName (headerName))
  228. throw new ArgumentException ("Invalid character in header");
  229. if (response)
  230. return restricted_response.ContainsKey (headerName);
  231. return restricted.ContainsKey (headerName);
  232. }
  233. public override void OnDeserialization (object sender)
  234. {
  235. }
  236. public override void Remove (string name)
  237. {
  238. if (name == null)
  239. throw new ArgumentNullException ("name");
  240. if (internallyCreated && IsRestricted (name))
  241. throw new ArgumentException ("restricted header");
  242. base.Remove (name);
  243. }
  244. public override void Set (string name, string value)
  245. {
  246. if (name == null)
  247. throw new ArgumentNullException ("name");
  248. if (internallyCreated && IsRestricted (name))
  249. throw new ArgumentException ("restricted header");
  250. if (!IsHeaderName (name))
  251. throw new ArgumentException ("invalid header name");
  252. if (value == null)
  253. value = String.Empty;
  254. else
  255. value = value.Trim ();
  256. if (!IsHeaderValue (value))
  257. throw new ArgumentException ("invalid header value");
  258. base.Set (name, value);
  259. }
  260. public byte[] ToByteArray ()
  261. {
  262. return Encoding.UTF8.GetBytes(ToString ());
  263. }
  264. internal string ToStringMultiValue ()
  265. {
  266. StringBuilder sb = new StringBuilder();
  267. int count = base.Count;
  268. for (int i = 0; i < count ; i++) {
  269. string key = GetKey (i);
  270. if (IsMultiValue (key)) {
  271. foreach (string v in GetValues (i)) {
  272. sb.Append (key)
  273. .Append (": ")
  274. .Append (v)
  275. .Append ("\r\n");
  276. }
  277. } else {
  278. sb.Append (key)
  279. .Append (": ")
  280. .Append (Get (i))
  281. .Append ("\r\n");
  282. }
  283. }
  284. return sb.Append("\r\n").ToString();
  285. }
  286. public override string ToString ()
  287. {
  288. StringBuilder sb = new StringBuilder();
  289. int count = base.Count;
  290. for (int i = 0; i < count ; i++)
  291. sb.Append (GetKey (i))
  292. .Append (": ")
  293. .Append (Get (i))
  294. .Append ("\r\n");
  295. return sb.Append("\r\n").ToString();
  296. }
  297. void ISerializable.GetObjectData (
  298. SerializationInfo serializationInfo,
  299. StreamingContext streamingContext)
  300. {
  301. GetObjectData (serializationInfo, streamingContext);
  302. }
  303. public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
  304. {
  305. int count = base.Count;
  306. serializationInfo.AddValue ("Count", count);
  307. for (int i = 0; i < count; i++) {
  308. serializationInfo.AddValue (i.ToString (), GetKey (i));
  309. serializationInfo.AddValue ((count + i).ToString (), Get (i));
  310. }
  311. }
  312. public override string[] AllKeys
  313. {
  314. get {
  315. return(base.AllKeys);
  316. }
  317. }
  318. public override int Count
  319. {
  320. get {
  321. return(base.Count);
  322. }
  323. }
  324. public override KeysCollection Keys
  325. {
  326. get {
  327. return(base.Keys);
  328. }
  329. }
  330. public override string Get (int index)
  331. {
  332. return(base.Get (index));
  333. }
  334. public override string Get (string name)
  335. {
  336. return(base.Get (name));
  337. }
  338. public override string GetKey (int index)
  339. {
  340. return(base.GetKey (index));
  341. }
  342. public void Add (HttpRequestHeader header, string value)
  343. {
  344. Add (RequestHeaderToString (header), value);
  345. }
  346. public void Remove (HttpRequestHeader header)
  347. {
  348. Remove (RequestHeaderToString (header));
  349. }
  350. public void Set (HttpRequestHeader header, string value)
  351. {
  352. Set (RequestHeaderToString (header), value);
  353. }
  354. public void Add (HttpResponseHeader header, string value)
  355. {
  356. Add (ResponseHeaderToString (header), value);
  357. }
  358. public void Remove (HttpResponseHeader header)
  359. {
  360. Remove (ResponseHeaderToString (header));
  361. }
  362. public void Set (HttpResponseHeader header, string value)
  363. {
  364. Set (ResponseHeaderToString (header), value);
  365. }
  366. string RequestHeaderToString (HttpRequestHeader value)
  367. {
  368. switch (value){
  369. case HttpRequestHeader.CacheControl:
  370. return "Cache-Control";
  371. case HttpRequestHeader.Connection:
  372. return "Connection";
  373. case HttpRequestHeader.Date:
  374. return "Date";
  375. case HttpRequestHeader.KeepAlive:
  376. return "Keep-Alive";
  377. case HttpRequestHeader.Pragma:
  378. return "Pragma";
  379. case HttpRequestHeader.Trailer:
  380. return "Trailer";
  381. case HttpRequestHeader.TransferEncoding:
  382. return "Transfer-Encoding";
  383. case HttpRequestHeader.Upgrade:
  384. return "Upgrade";
  385. case HttpRequestHeader.Via:
  386. return "Via";
  387. case HttpRequestHeader.Warning:
  388. return "Warning";
  389. case HttpRequestHeader.Allow:
  390. return "Allow";
  391. case HttpRequestHeader.ContentLength:
  392. return "Content-Length";
  393. case HttpRequestHeader.ContentType:
  394. return "Content-Type";
  395. case HttpRequestHeader.ContentEncoding:
  396. return "Content-Encoding";
  397. case HttpRequestHeader.ContentLanguage:
  398. return "Content-Language";
  399. case HttpRequestHeader.ContentLocation:
  400. return "Content-Location";
  401. case HttpRequestHeader.ContentMd5:
  402. return "Content-MD5";
  403. case HttpRequestHeader.ContentRange:
  404. return "Content-Range";
  405. case HttpRequestHeader.Expires:
  406. return "Expires";
  407. case HttpRequestHeader.LastModified:
  408. return "Last-Modified";
  409. case HttpRequestHeader.Accept:
  410. return "Accept";
  411. case HttpRequestHeader.AcceptCharset:
  412. return "Accept-Charset";
  413. case HttpRequestHeader.AcceptEncoding:
  414. return "Accept-Encoding";
  415. case HttpRequestHeader.AcceptLanguage:
  416. return "accept-language";
  417. case HttpRequestHeader.Authorization:
  418. return "Authorization";
  419. case HttpRequestHeader.Cookie:
  420. return "Cookie";
  421. case HttpRequestHeader.Expect:
  422. return "Expect";
  423. case HttpRequestHeader.From:
  424. return "From";
  425. case HttpRequestHeader.Host:
  426. return "Host";
  427. case HttpRequestHeader.IfMatch:
  428. return "If-Match";
  429. case HttpRequestHeader.IfModifiedSince:
  430. return "If-Modified-Since";
  431. case HttpRequestHeader.IfNoneMatch:
  432. return "If-None-Match";
  433. case HttpRequestHeader.IfRange:
  434. return "If-Range";
  435. case HttpRequestHeader.IfUnmodifiedSince:
  436. return "If-Unmodified-Since";
  437. case HttpRequestHeader.MaxForwards:
  438. return "Max-Forwards";
  439. case HttpRequestHeader.ProxyAuthorization:
  440. return "Proxy-Authorization";
  441. case HttpRequestHeader.Referer:
  442. return "Referer";
  443. case HttpRequestHeader.Range:
  444. return "Range";
  445. case HttpRequestHeader.Te:
  446. return "TE";
  447. case HttpRequestHeader.Translate:
  448. return "Translate";
  449. case HttpRequestHeader.UserAgent:
  450. return "User-Agent";
  451. default:
  452. throw new InvalidOperationException ();
  453. }
  454. }
  455. public string this[HttpRequestHeader hrh]
  456. {
  457. get {
  458. return Get (RequestHeaderToString (hrh));
  459. }
  460. set {
  461. Add (RequestHeaderToString (hrh), value);
  462. }
  463. }
  464. string ResponseHeaderToString (HttpResponseHeader value)
  465. {
  466. switch (value){
  467. case HttpResponseHeader.CacheControl:
  468. return "Cache-Control";
  469. case HttpResponseHeader.Connection:
  470. return "Connection";
  471. case HttpResponseHeader.Date:
  472. return "Date";
  473. case HttpResponseHeader.KeepAlive:
  474. return "Keep-Alive";
  475. case HttpResponseHeader.Pragma:
  476. return "Pragma";
  477. case HttpResponseHeader.Trailer:
  478. return "Trailer";
  479. case HttpResponseHeader.TransferEncoding:
  480. return "Transfer-Encoding";
  481. case HttpResponseHeader.Upgrade:
  482. return "Upgrade";
  483. case HttpResponseHeader.Via:
  484. return "Via";
  485. case HttpResponseHeader.Warning:
  486. return "Warning";
  487. case HttpResponseHeader.Allow:
  488. return "Allow";
  489. case HttpResponseHeader.ContentLength:
  490. return "Content-Length";
  491. case HttpResponseHeader.ContentType:
  492. return "Content-Type";
  493. case HttpResponseHeader.ContentEncoding:
  494. return "Content-Encoding";
  495. case HttpResponseHeader.ContentLanguage:
  496. return "Content-Language";
  497. case HttpResponseHeader.ContentLocation:
  498. return "Content-Location";
  499. case HttpResponseHeader.ContentMd5:
  500. return "Content-MD5";
  501. case HttpResponseHeader.ContentRange:
  502. return "Content-Range";
  503. case HttpResponseHeader.Expires:
  504. return "Expires";
  505. case HttpResponseHeader.LastModified:
  506. return "Last-Modified";
  507. case HttpResponseHeader.AcceptRanges:
  508. return "Accept-Ranges";
  509. case HttpResponseHeader.Age:
  510. return "Age";
  511. case HttpResponseHeader.ETag:
  512. return "ETag";
  513. case HttpResponseHeader.Location:
  514. return "Location";
  515. case HttpResponseHeader.ProxyAuthenticate:
  516. return "Proxy-Authenticate";
  517. case HttpResponseHeader.RetryAfter:
  518. return "Retry-After";
  519. case HttpResponseHeader.Server:
  520. return "Server";
  521. case HttpResponseHeader.SetCookie:
  522. return "Set-Cookie";
  523. case HttpResponseHeader.Vary:
  524. return "Vary";
  525. case HttpResponseHeader.WwwAuthenticate:
  526. return "WWW-Authenticate";
  527. default:
  528. throw new InvalidOperationException ();
  529. }
  530. }
  531. public string this[HttpResponseHeader hrh]
  532. {
  533. get
  534. {
  535. return Get (ResponseHeaderToString (hrh));
  536. }
  537. set
  538. {
  539. Add (ResponseHeaderToString (hrh), value);
  540. }
  541. }
  542. public override void Clear ()
  543. {
  544. base.Clear ();
  545. }
  546. public override IEnumerator GetEnumerator ()
  547. {
  548. return(base.GetEnumerator ());
  549. }
  550. // Internal Methods
  551. // With this we don't check for invalid characters in header. See bug #55994.
  552. internal void SetInternal (string header)
  553. {
  554. int pos = header.IndexOf (':');
  555. if (pos == -1)
  556. throw new ArgumentException ("no colon found", "header");
  557. SetInternal (header.Substring (0, pos), header.Substring (pos + 1));
  558. }
  559. internal void SetInternal (string name, string value)
  560. {
  561. if (value == null)
  562. value = String.Empty;
  563. else
  564. value = value.Trim ();
  565. if (!IsHeaderValue (value))
  566. throw new ArgumentException ("invalid header value");
  567. if (IsMultiValue (name)) {
  568. base.Add (name, value);
  569. } else {
  570. base.Remove (name);
  571. base.Set (name, value);
  572. }
  573. }
  574. internal void RemoveAndAdd (string name, string value)
  575. {
  576. if (value == null)
  577. value = String.Empty;
  578. else
  579. value = value.Trim ();
  580. base.Remove (name);
  581. base.Set (name, value);
  582. }
  583. internal void RemoveInternal (string name)
  584. {
  585. if (name == null)
  586. throw new ArgumentNullException ("name");
  587. base.Remove (name);
  588. }
  589. // Private Methods
  590. internal static bool IsMultiValue (string headerName)
  591. {
  592. if (headerName == null || headerName == "")
  593. return false;
  594. return multiValue.ContainsKey (headerName);
  595. }
  596. internal static bool IsHeaderValue (string value)
  597. {
  598. // TEXT any 8 bit value except CTL's (0-31 and 127)
  599. // but including \r\n space and \t
  600. // after a newline at least one space or \t must follow
  601. // certain header fields allow comments ()
  602. int len = value.Length;
  603. for (int i = 0; i < len; i++) {
  604. char c = value [i];
  605. if (c == 127)
  606. return false;
  607. if (c < 0x20 && (c != '\r' && c != '\n' && c != '\t'))
  608. return false;
  609. if (c == '\n' && ++i < len) {
  610. c = value [i];
  611. if (c != ' ' && c != '\t')
  612. return false;
  613. }
  614. }
  615. return true;
  616. }
  617. internal static bool IsHeaderName (string name)
  618. {
  619. if (name == null || name.Length == 0)
  620. return false;
  621. int len = name.Length;
  622. for (int i = 0; i < len; i++) {
  623. char c = name [i];
  624. if (c > 126 || !allowed_chars [(int) c])
  625. return false;
  626. }
  627. return true;
  628. }
  629. static bool [] allowed_chars = new bool [126] {
  630. false, false, false, false, false, false, false, false, false, false, false, false, false, false,
  631. false, false, false, false, false, false, false, false, false, false, false, false, false, false,
  632. false, false, false, false, false, true, false, true, true, true, true, false, false, false, true,
  633. true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false,
  634. false, false, false, false, false, false, true, true, true, true, true, true, true, true, true,
  635. true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
  636. false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true,
  637. true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
  638. false, true, false
  639. };
  640. }
  641. }