FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Small update · bug8975/NetCoreServer@3ccd754 · GitHub

Repository navigation

Commit 3ccd754

Browse files
committed
Small update
1 parent 9e80b52 commit 3ccd754

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎source/NetCoreServer/HttpServer.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ public void AddStaticContent(string path, string prefix = "/", string filter = "
5151

5252
bool Handler(FileCache cache, string key, byte[] value, TimeSpan timespan)
5353
{
54-
HttpResponse header = new HttpResponse();
55-
header.SetBegin(200);
56-
header.SetContentType(Path.GetExtension(key));
57-
header.SetHeader("Cache-Control", $"max-age={timespan.Seconds}");
58-
header.SetBody(value);
59-
return cache.Add(key, header.Cache.Data, timespan);
54+
var response = new HttpResponse();
55+
response.SetBegin(200);
56+
response.SetContentType(Path.GetExtension(key));
57+
response.SetHeader("Cache-Control", $"max-age={timespan.Seconds}");
58+
response.SetBody(value);
59+
return cache.Add(key, response.Cache.Data, timespan);
6060
}
6161

6262
Cache.InsertPath(path, prefix, filter, timeout.Value, Handler);

‎source/NetCoreServer/HttpsServer.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public void AddStaticContent(string path, string prefix = "/", string filter = "
5555

5656
bool Handler(FileCache cache, string key, byte[] value, TimeSpan timespan)
5757
{
58-
HttpResponse header = new HttpResponse();
59-
header.SetBegin(200);
60-
header.SetContentType(Path.GetExtension(key));
61-
header.SetHeader("Cache-Control", $"max-age={timespan.Seconds}");
62-
header.SetBody(value);
63-
return cache.Add(key, header.Cache.Data, timespan);
58+
var response = new HttpResponse();
59+
response.SetBegin(200);
60+
response.SetContentType(Path.GetExtension(key));
61+
response.SetHeader("Cache-Control", $"max-age={timespan.Seconds}");
62+
response.SetBody(value);
63+
return cache.Add(key, response.Cache.Data, timespan);
6464
}
6565

6666
Cache.InsertPath(path, prefix, filter, timeout.Value, Handler);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL