HttpClientManager.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. using MediaBrowser.Common.Configuration;
  2. using MediaBrowser.Common.IO;
  3. using MediaBrowser.Common.Net;
  4. using MediaBrowser.Model.Logging;
  5. using MediaBrowser.Model.Net;
  6. using System;
  7. using System.Collections.Concurrent;
  8. using System.Collections.Generic;
  9. using System.Collections.Specialized;
  10. using System.Globalization;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Net;
  14. using System.Net.Cache;
  15. using System.Net.Http;
  16. using System.Text;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. namespace MediaBrowser.Common.Implementations.HttpClientManager
  20. {
  21. /// <summary>
  22. /// Class HttpClientManager
  23. /// </summary>
  24. public class HttpClientManager : IHttpClient
  25. {
  26. /// <summary>
  27. /// When one request to a host times out, we'll ban all other requests for this period of time, to prevent scans from stalling
  28. /// </summary>
  29. private const int TimeoutSeconds = 30;
  30. /// <summary>
  31. /// The _logger
  32. /// </summary>
  33. private readonly ILogger _logger;
  34. /// <summary>
  35. /// The _app paths
  36. /// </summary>
  37. private readonly IApplicationPaths _appPaths;
  38. private readonly IFileSystem _fileSystem;
  39. private readonly IConfigurationManager _config;
  40. /// <summary>
  41. /// Initializes a new instance of the <see cref="HttpClientManager" /> class.
  42. /// </summary>
  43. /// <param name="appPaths">The app paths.</param>
  44. /// <param name="logger">The logger.</param>
  45. /// <param name="fileSystem">The file system.</param>
  46. /// <exception cref="System.ArgumentNullException">appPaths
  47. /// or
  48. /// logger</exception>
  49. public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, IConfigurationManager config)
  50. {
  51. if (appPaths == null)
  52. {
  53. throw new ArgumentNullException("appPaths");
  54. }
  55. if (logger == null)
  56. {
  57. throw new ArgumentNullException("logger");
  58. }
  59. _logger = logger;
  60. _fileSystem = fileSystem;
  61. _config = config;
  62. _appPaths = appPaths;
  63. // http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c
  64. ServicePointManager.Expect100Continue = false;
  65. }
  66. /// <summary>
  67. /// Holds a dictionary of http clients by host. Use GetHttpClient(host) to retrieve or create a client for web requests.
  68. /// DON'T dispose it after use.
  69. /// </summary>
  70. /// <value>The HTTP clients.</value>
  71. private readonly ConcurrentDictionary<string, HttpClientInfo> _httpClients = new ConcurrentDictionary<string, HttpClientInfo>();
  72. /// <summary>
  73. /// Gets
  74. /// </summary>
  75. /// <param name="host">The host.</param>
  76. /// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
  77. /// <returns>HttpClient.</returns>
  78. /// <exception cref="System.ArgumentNullException">host</exception>
  79. private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression)
  80. {
  81. if (string.IsNullOrEmpty(host))
  82. {
  83. throw new ArgumentNullException("host");
  84. }
  85. HttpClientInfo client;
  86. var key = host + enableHttpCompression;
  87. if (!_httpClients.TryGetValue(key, out client))
  88. {
  89. client = new HttpClientInfo();
  90. _httpClients.TryAdd(key, client);
  91. }
  92. return client;
  93. }
  94. private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
  95. {
  96. var request = (HttpWebRequest)WebRequest.Create(options.Url);
  97. AddRequestHeaders(request, options);
  98. request.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None;
  99. request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
  100. if (options.EnableKeepAlive)
  101. {
  102. request.KeepAlive = true;
  103. }
  104. request.Method = method;
  105. request.Timeout = 20000;
  106. if (!string.IsNullOrEmpty(options.Host))
  107. {
  108. request.Host = options.Host;
  109. }
  110. if (!string.IsNullOrEmpty(options.Referer))
  111. {
  112. request.Referer = options.Referer;
  113. }
  114. return request;
  115. }
  116. private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options)
  117. {
  118. foreach (var header in options.RequestHeaders.ToList())
  119. {
  120. if (string.Equals(header.Key, "Accept", StringComparison.OrdinalIgnoreCase))
  121. {
  122. request.Accept = header.Value;
  123. }
  124. else if (string.Equals(header.Key, "User-Agent", StringComparison.OrdinalIgnoreCase))
  125. {
  126. request.UserAgent = header.Value;
  127. }
  128. else
  129. {
  130. request.Headers.Set(header.Key, header.Value);
  131. }
  132. }
  133. }
  134. /// <summary>
  135. /// Gets the response internal.
  136. /// </summary>
  137. /// <param name="options">The options.</param>
  138. /// <returns>Task{HttpResponseInfo}.</returns>
  139. public Task<HttpResponseInfo> GetResponse(HttpRequestOptions options)
  140. {
  141. return SendAsync(options, "GET");
  142. }
  143. /// <summary>
  144. /// Performs a GET request and returns the resulting stream
  145. /// </summary>
  146. /// <param name="options">The options.</param>
  147. /// <returns>Task{Stream}.</returns>
  148. public async Task<Stream> Get(HttpRequestOptions options)
  149. {
  150. var response = await GetResponse(options).ConfigureAwait(false);
  151. return response.Content;
  152. }
  153. /// <summary>
  154. /// Performs a GET request and returns the resulting stream
  155. /// </summary>
  156. /// <param name="url">The URL.</param>
  157. /// <param name="resourcePool">The resource pool.</param>
  158. /// <param name="cancellationToken">The cancellation token.</param>
  159. /// <returns>Task{Stream}.</returns>
  160. public Task<Stream> Get(string url, SemaphoreSlim resourcePool, CancellationToken cancellationToken)
  161. {
  162. return Get(new HttpRequestOptions
  163. {
  164. Url = url,
  165. ResourcePool = resourcePool,
  166. CancellationToken = cancellationToken,
  167. });
  168. }
  169. /// <summary>
  170. /// Gets the specified URL.
  171. /// </summary>
  172. /// <param name="url">The URL.</param>
  173. /// <param name="cancellationToken">The cancellation token.</param>
  174. /// <returns>Task{Stream}.</returns>
  175. public Task<Stream> Get(string url, CancellationToken cancellationToken)
  176. {
  177. return Get(url, null, cancellationToken);
  178. }
  179. /// <summary>
  180. /// send as an asynchronous operation.
  181. /// </summary>
  182. /// <param name="options">The options.</param>
  183. /// <param name="httpMethod">The HTTP method.</param>
  184. /// <returns>Task{HttpResponseInfo}.</returns>
  185. /// <exception cref="HttpException">
  186. /// </exception>
  187. public async Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
  188. {
  189. ValidateParams(options);
  190. options.CancellationToken.ThrowIfCancellationRequested();
  191. var client = GetHttpClient(GetHostFromUrl(options.Url), options.EnableHttpCompression);
  192. if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds)
  193. {
  194. throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url))
  195. {
  196. IsTimedOut = true
  197. };
  198. }
  199. var httpWebRequest = GetRequest(options, httpMethod, options.EnableHttpCompression);
  200. if (options.RequestContentBytes != null ||
  201. !string.IsNullOrEmpty(options.RequestContent) ||
  202. string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase))
  203. {
  204. var bytes = options.RequestContentBytes ??
  205. Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty);
  206. httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
  207. httpWebRequest.ContentLength = bytes.Length;
  208. httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
  209. }
  210. if (options.ResourcePool != null)
  211. {
  212. await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
  213. }
  214. if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds)
  215. {
  216. if (options.ResourcePool != null)
  217. {
  218. options.ResourcePool.Release();
  219. }
  220. throw new HttpException(string.Format("Connection to {0} timed out", options.Url)) { IsTimedOut = true };
  221. }
  222. if (options.LogRequest)
  223. {
  224. _logger.Info("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
  225. }
  226. try
  227. {
  228. options.CancellationToken.ThrowIfCancellationRequested();
  229. if (!options.BufferContent)
  230. {
  231. var response = await httpWebRequest.GetResponseAsync().ConfigureAwait(false);
  232. var httpResponse = (HttpWebResponse)response;
  233. EnsureSuccessStatusCode(httpResponse, options);
  234. options.CancellationToken.ThrowIfCancellationRequested();
  235. return GetResponseInfo(httpResponse, httpResponse.GetResponseStream(), GetContentLength(httpResponse));
  236. }
  237. using (var response = await httpWebRequest.GetResponseAsync().ConfigureAwait(false))
  238. {
  239. var httpResponse = (HttpWebResponse)response;
  240. EnsureSuccessStatusCode(httpResponse, options);
  241. options.CancellationToken.ThrowIfCancellationRequested();
  242. using (var stream = httpResponse.GetResponseStream())
  243. {
  244. var memoryStream = new MemoryStream();
  245. await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
  246. memoryStream.Position = 0;
  247. return GetResponseInfo(httpResponse, memoryStream, memoryStream.Length);
  248. }
  249. }
  250. }
  251. catch (OperationCanceledException ex)
  252. {
  253. var exception = GetCancellationException(options.Url, options.CancellationToken, ex);
  254. var httpException = exception as HttpException;
  255. if (httpException != null && httpException.IsTimedOut)
  256. {
  257. client.LastTimeout = DateTime.UtcNow;
  258. }
  259. throw exception;
  260. }
  261. catch (HttpRequestException ex)
  262. {
  263. _logger.ErrorException("Error getting response from " + options.Url, ex);
  264. throw new HttpException(ex.Message, ex);
  265. }
  266. catch (WebException ex)
  267. {
  268. throw GetException(ex, options);
  269. }
  270. catch (Exception ex)
  271. {
  272. _logger.ErrorException("Error getting response from " + options.Url, ex);
  273. throw;
  274. }
  275. finally
  276. {
  277. if (options.ResourcePool != null)
  278. {
  279. options.ResourcePool.Release();
  280. }
  281. }
  282. }
  283. /// <summary>
  284. /// Gets the exception.
  285. /// </summary>
  286. /// <param name="ex">The ex.</param>
  287. /// <param name="options">The options.</param>
  288. /// <returns>HttpException.</returns>
  289. private HttpException GetException(WebException ex, HttpRequestOptions options)
  290. {
  291. _logger.ErrorException("Error getting response from " + options.Url, ex);
  292. var exception = new HttpException(ex.Message, ex);
  293. var response = ex.Response as HttpWebResponse;
  294. if (response != null)
  295. {
  296. exception.StatusCode = response.StatusCode;
  297. }
  298. return exception;
  299. }
  300. private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long? contentLength)
  301. {
  302. return new HttpResponseInfo
  303. {
  304. Content = content,
  305. StatusCode = httpResponse.StatusCode,
  306. ContentType = httpResponse.ContentType,
  307. Headers = new NameValueCollection(httpResponse.Headers),
  308. ContentLength = contentLength,
  309. ResponseUrl = httpResponse.ResponseUri.ToString()
  310. };
  311. }
  312. private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, string tempFile, long? contentLength)
  313. {
  314. return new HttpResponseInfo
  315. {
  316. TempFilePath = tempFile,
  317. StatusCode = httpResponse.StatusCode,
  318. ContentType = httpResponse.ContentType,
  319. Headers = httpResponse.Headers,
  320. ContentLength = contentLength
  321. };
  322. }
  323. public Task<HttpResponseInfo> Post(HttpRequestOptions options)
  324. {
  325. return SendAsync(options, "POST");
  326. }
  327. /// <summary>
  328. /// Performs a POST request
  329. /// </summary>
  330. /// <param name="options">The options.</param>
  331. /// <param name="postData">Params to add to the POST data.</param>
  332. /// <returns>stream on success, null on failure</returns>
  333. public async Task<Stream> Post(HttpRequestOptions options, Dictionary<string, string> postData)
  334. {
  335. options.SetPostData(postData);
  336. var response = await Post(options).ConfigureAwait(false);
  337. return response.Content;
  338. }
  339. /// <summary>
  340. /// Performs a POST request
  341. /// </summary>
  342. /// <param name="url">The URL.</param>
  343. /// <param name="postData">Params to add to the POST data.</param>
  344. /// <param name="resourcePool">The resource pool.</param>
  345. /// <param name="cancellationToken">The cancellation token.</param>
  346. /// <returns>stream on success, null on failure</returns>
  347. public Task<Stream> Post(string url, Dictionary<string, string> postData, SemaphoreSlim resourcePool, CancellationToken cancellationToken)
  348. {
  349. return Post(new HttpRequestOptions
  350. {
  351. Url = url,
  352. ResourcePool = resourcePool,
  353. CancellationToken = cancellationToken
  354. }, postData);
  355. }
  356. /// <summary>
  357. /// Downloads the contents of a given url into a temporary location
  358. /// </summary>
  359. /// <param name="options">The options.</param>
  360. /// <returns>Task{System.String}.</returns>
  361. /// <exception cref="System.ArgumentNullException">progress</exception>
  362. public async Task<string> GetTempFile(HttpRequestOptions options)
  363. {
  364. var response = await GetTempFileResponse(options).ConfigureAwait(false);
  365. return response.TempFilePath;
  366. }
  367. public async Task<HttpResponseInfo> GetTempFileResponse(HttpRequestOptions options)
  368. {
  369. ValidateParams(options);
  370. Directory.CreateDirectory(_appPaths.TempDirectory);
  371. var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".tmp");
  372. if (options.Progress == null)
  373. {
  374. throw new ArgumentNullException("progress");
  375. }
  376. options.CancellationToken.ThrowIfCancellationRequested();
  377. var httpWebRequest = GetRequest(options, "GET", options.EnableHttpCompression);
  378. if (options.ResourcePool != null)
  379. {
  380. await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
  381. }
  382. options.Progress.Report(0);
  383. if (options.LogRequest)
  384. {
  385. _logger.Info("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
  386. }
  387. try
  388. {
  389. options.CancellationToken.ThrowIfCancellationRequested();
  390. using (var response = await httpWebRequest.GetResponseAsync().ConfigureAwait(false))
  391. {
  392. var httpResponse = (HttpWebResponse)response;
  393. EnsureSuccessStatusCode(httpResponse, options);
  394. options.CancellationToken.ThrowIfCancellationRequested();
  395. var contentLength = GetContentLength(httpResponse);
  396. if (!contentLength.HasValue)
  397. {
  398. // We're not able to track progress
  399. using (var stream = httpResponse.GetResponseStream())
  400. {
  401. using (var fs = _fileSystem.GetFileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, true))
  402. {
  403. await stream.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, options.CancellationToken).ConfigureAwait(false);
  404. }
  405. }
  406. }
  407. else
  408. {
  409. using (var stream = ProgressStream.CreateReadProgressStream(httpResponse.GetResponseStream(), options.Progress.Report, contentLength.Value))
  410. {
  411. using (var fs = _fileSystem.GetFileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.Read, true))
  412. {
  413. await stream.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, options.CancellationToken).ConfigureAwait(false);
  414. }
  415. }
  416. }
  417. options.Progress.Report(100);
  418. return GetResponseInfo(httpResponse, tempFile, contentLength);
  419. }
  420. }
  421. catch (OperationCanceledException ex)
  422. {
  423. throw GetTempFileException(ex, options, tempFile);
  424. }
  425. catch (HttpRequestException ex)
  426. {
  427. throw GetTempFileException(ex, options, tempFile);
  428. }
  429. catch (WebException ex)
  430. {
  431. throw GetTempFileException(ex, options, tempFile);
  432. }
  433. catch (Exception ex)
  434. {
  435. throw GetTempFileException(ex, options, tempFile);
  436. }
  437. finally
  438. {
  439. if (options.ResourcePool != null)
  440. {
  441. options.ResourcePool.Release();
  442. }
  443. }
  444. }
  445. private long? GetContentLength(HttpWebResponse response)
  446. {
  447. var length = response.ContentLength;
  448. if (length == 0)
  449. {
  450. return null;
  451. }
  452. return length;
  453. }
  454. protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
  455. /// <summary>
  456. /// Handles the temp file exception.
  457. /// </summary>
  458. /// <param name="ex">The ex.</param>
  459. /// <param name="options">The options.</param>
  460. /// <param name="tempFile">The temp file.</param>
  461. /// <returns>Task.</returns>
  462. /// <exception cref="HttpException"></exception>
  463. private Exception GetTempFileException(Exception ex, HttpRequestOptions options, string tempFile)
  464. {
  465. var operationCanceledException = ex as OperationCanceledException;
  466. if (operationCanceledException != null)
  467. {
  468. // Cleanup
  469. DeleteTempFile(tempFile);
  470. return GetCancellationException(options.Url, options.CancellationToken, operationCanceledException);
  471. }
  472. _logger.ErrorException("Error getting response from " + options.Url, ex);
  473. // Cleanup
  474. DeleteTempFile(tempFile);
  475. var httpRequestException = ex as HttpRequestException;
  476. if (httpRequestException != null)
  477. {
  478. return new HttpException(ex.Message, ex);
  479. }
  480. var webException = ex as WebException;
  481. if (webException != null)
  482. {
  483. throw GetException(webException, options);
  484. }
  485. return ex;
  486. }
  487. private void DeleteTempFile(string file)
  488. {
  489. try
  490. {
  491. File.Delete(file);
  492. }
  493. catch (IOException)
  494. {
  495. // Might not have been created at all. No need to worry.
  496. }
  497. }
  498. private void ValidateParams(HttpRequestOptions options)
  499. {
  500. if (string.IsNullOrEmpty(options.Url))
  501. {
  502. throw new ArgumentNullException("options");
  503. }
  504. }
  505. /// <summary>
  506. /// Gets the host from URL.
  507. /// </summary>
  508. /// <param name="url">The URL.</param>
  509. /// <returns>System.String.</returns>
  510. private string GetHostFromUrl(string url)
  511. {
  512. var start = url.IndexOf("://", StringComparison.OrdinalIgnoreCase) + 3;
  513. var len = url.IndexOf('/', start) - start;
  514. return url.Substring(start, len);
  515. }
  516. /// <summary>
  517. /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
  518. /// </summary>
  519. public void Dispose()
  520. {
  521. Dispose(true);
  522. GC.SuppressFinalize(this);
  523. }
  524. /// <summary>
  525. /// Releases unmanaged and - optionally - managed resources.
  526. /// </summary>
  527. /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
  528. protected virtual void Dispose(bool dispose)
  529. {
  530. if (dispose)
  531. {
  532. _httpClients.Clear();
  533. }
  534. }
  535. /// <summary>
  536. /// Throws the cancellation exception.
  537. /// </summary>
  538. /// <param name="url">The URL.</param>
  539. /// <param name="cancellationToken">The cancellation token.</param>
  540. /// <param name="exception">The exception.</param>
  541. /// <returns>Exception.</returns>
  542. private Exception GetCancellationException(string url, CancellationToken cancellationToken, OperationCanceledException exception)
  543. {
  544. // If the HttpClient's timeout is reached, it will cancel the Task internally
  545. if (!cancellationToken.IsCancellationRequested)
  546. {
  547. var msg = string.Format("Connection to {0} timed out", url);
  548. _logger.Error(msg);
  549. // Throw an HttpException so that the caller doesn't think it was cancelled by user code
  550. return new HttpException(msg, exception)
  551. {
  552. IsTimedOut = true
  553. };
  554. }
  555. return exception;
  556. }
  557. private void EnsureSuccessStatusCode(HttpWebResponse response, HttpRequestOptions options)
  558. {
  559. var statusCode = response.StatusCode;
  560. var isSuccessful = statusCode >= HttpStatusCode.OK && statusCode <= (HttpStatusCode)299;
  561. if (!isSuccessful)
  562. {
  563. if (options.LogErrorResponseBody)
  564. {
  565. try
  566. {
  567. using (var stream = response.GetResponseStream())
  568. {
  569. if (stream != null)
  570. {
  571. using (var reader = new StreamReader(stream))
  572. {
  573. var msg = reader.ReadToEnd();
  574. _logger.Error(msg);
  575. }
  576. }
  577. }
  578. }
  579. catch
  580. {
  581. }
  582. }
  583. throw new HttpException(response.StatusDescription)
  584. {
  585. StatusCode = response.StatusCode
  586. };
  587. }
  588. }
  589. /// <summary>
  590. /// Posts the specified URL.
  591. /// </summary>
  592. /// <param name="url">The URL.</param>
  593. /// <param name="postData">The post data.</param>
  594. /// <param name="cancellationToken">The cancellation token.</param>
  595. /// <returns>Task{Stream}.</returns>
  596. public Task<Stream> Post(string url, Dictionary<string, string> postData, CancellationToken cancellationToken)
  597. {
  598. return Post(url, postData, null, cancellationToken);
  599. }
  600. }
  601. }