[Modify] Polish it
This commit is contained in:
parent
6f6c110dc9
commit
5ffe299ebe
@ -90,12 +90,15 @@ namespace Example3
|
|||||||
var res = e.Response;
|
var res = e.Response;
|
||||||
|
|
||||||
var path = req.RawUrl;
|
var path = req.RawUrl;
|
||||||
|
|
||||||
if (path == "/")
|
if (path == "/")
|
||||||
path += "index.html";
|
path += "index.html";
|
||||||
|
|
||||||
byte[] contents;
|
byte[] contents;
|
||||||
|
|
||||||
if (!e.TryReadFile (path, out contents)) {
|
if (!e.TryReadFile (path, out contents)) {
|
||||||
res.StatusCode = (int) HttpStatusCode.NotFound;
|
res.StatusCode = (int) HttpStatusCode.NotFound;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ namespace Example3
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.ContentLength64 = contents.LongLength;
|
res.ContentLength64 = contents.LongLength;
|
||||||
|
|
||||||
res.Close (contents, true);
|
res.Close (contents, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user