Fix 304 caching errors

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent f0100ceaf1
commit 710f58b034
  1. 5
      comments/Love%20Live!%20Custom%20Arcade%20Controller.comment
  2. 18
      out/DIRECTORY_LISTING
  3. 14
      out/articles/DIRECTORY_LISTING
  4. 8
      out/articles/Love Live! Custom Arcade Controller.article.html
  5. 8
      out/articles/curabitur vel tempus ex.article.html
  6. 8
      out/articles/sigplace1.article.html
  7. 12
      out/articles/test articles/DIRECTORY_LISTING
  8. 8
      out/articles/test articles/test1.article.html
  9. 8
      out/articles/test articles/test2.article.html
  10. 8
      out/articles/test articles/test3.article.html
  11. 2
      out/codeBackground
  12. 8
      ref/COMMENT.html
  13. 6
      sigServer.java

@ -0,0 +1,5 @@
2
First!
Sig2022-08-01T15:32:36.648104Z[Etc/UTC];MAGENTA
Second!<br/>
Sig2022-08-01T16:00:26.660317Z[Etc/UTC];RED

@ -17,15 +17,15 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">&#x1F4C1;</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-08-01T15:25:23.920536Z gitpod 4096</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-08-01T15:25:23.916536Z gitpod 77</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-08-01T15:25:23.800536Z gitpod 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-08-01T15:25:23.836536Z gitpod 88370</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-08-01T15:25:23.808536Z gitpod 1092</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-08-01T15:25:23.836536Z gitpod 1627</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-08-01T15:25:23.836536Z gitpod 1707</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-08-01T15:25:23.824536Z gitpod 10595</div>
<div class="filelisting"><a href="/error.html" class="icon">&#x1F5CE;</a><a href="/error.html">error.html</a> 2022-08-01T15:25:23.840536Z gitpod 1672</div>
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">&#x1F4C1;</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-08-01T15:59:35.330694Z gitpod 4096</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-08-01T15:59:35.326694Z gitpod 77</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-08-01T15:59:35.214694Z gitpod 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-08-01T15:59:35.258694Z gitpod 88370</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-08-01T15:59:35.218694Z gitpod 1092</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-08-01T15:59:35.262694Z gitpod 1627</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-08-01T15:59:35.262694Z gitpod 1707</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-08-01T15:59:35.246694Z gitpod 10595</div>
<div class="filelisting"><a href="/error.html" class="icon">&#x1F5CE;</a><a href="/error.html">error.html</a> 2022-08-01T15:59:35.262694Z gitpod 1672</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -17,13 +17,13 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">&#x1F4C1;</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-08-01T15:25:23.848536Z gitpod 147</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-08-01T15:25:23.320536Z gitpod 497</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-08-01T15:25:23.356536Z gitpod 730</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-08-01T15:25:23.796536Z gitpod 80858</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-08-01T15:25:23.852536Z gitpod 8268</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-08-01T15:25:23.900536Z gitpod 8477</div>
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-08-01T15:25:23.904536Z gitpod 88577</div>
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">&#x1F4C1;</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-08-01T15:59:35.278694Z gitpod 147</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-08-01T15:59:34.742695Z gitpod 497</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-08-01T15:59:34.770695Z gitpod 730</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-08-01T15:59:35.210694Z gitpod 80858</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-08-01T15:59:35.278694Z gitpod 8626</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-08-01T15:59:35.306694Z gitpod 8835</div>
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-08-01T15:59:35.318694Z gitpod 88935</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -67,6 +67,12 @@ For over a year since I first got into <u>Love Live! School Idol Festival ~after
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -124,6 +130,7 @@ For over a year since I first got into <u>Love Live! School Idol Festival ~after
fetch("/COMMENTS?article=Love Live! Custom Arcade Controller.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -135,6 +142,7 @@ For over a year since I first got into <u>Love Live! School Idol Festival ~after
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -71,6 +71,12 @@ Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut.
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -128,6 +134,7 @@ Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut.
fetch("/COMMENTS?article=curabitur vel tempus ex.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -139,6 +146,7 @@ Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut.
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -546,6 +546,12 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -603,6 +609,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
fetch("/COMMENTS?article=sigplace1.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -614,6 +621,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -17,12 +17,12 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">&#x1F4C1;</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-08-01T15:25:23.312536Z gitpod 1085</div>
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-08-01T15:25:23.316536Z gitpod 781</div>
<div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-08-01T15:25:23.316536Z gitpod 994</div>
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-08-01T15:25:23.844536Z gitpod 8796</div>
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-08-01T15:25:23.848536Z gitpod 8492</div>
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-08-01T15:25:23.848536Z gitpod 8705</div>
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">&#x1F4C1;</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-08-01T15:59:34.738695Z gitpod 1085</div>
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-08-01T15:59:34.738695Z gitpod 781</div>
<div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-08-01T15:59:34.742695Z gitpod 994</div>
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-08-01T15:59:35.266694Z gitpod 9154</div>
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-08-01T15:59:35.274694Z gitpod 8850</div>
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-08-01T15:59:35.278694Z gitpod 9063</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -65,6 +65,12 @@
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -122,6 +128,7 @@
fetch("/COMMENTS?article=test1.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -133,6 +140,7 @@
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -65,6 +65,12 @@
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -122,6 +128,7 @@
fetch("/COMMENTS?article=test2.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -133,6 +140,7 @@
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -65,6 +65,12 @@
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -122,6 +128,7 @@
fetch("/COMMENTS?article=test3.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -133,6 +140,7 @@
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -12,6 +12,7 @@
String filename=null;
OutputStream stream = null;
requestLine=in.readLine(); //Read the first line, this should be our request.
System.out.println(requestLine);
if (requestLine!=null) {
String[] splitter = requestLine.split(Pattern.quote(" "));
boolean ISPOST = splitter[0].equals("POST");
@ -37,4 +38,3 @@
System.out.println(line);
}
} else {
File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);

@ -21,6 +21,12 @@
document.getElementById("msg").disabled=false;
fetchComments()
})
.catch((err)=>{
document.getElementById("submit").disabled=
document.getElementById("name").disabled=
document.getElementById("col").disabled=
document.getElementById("msg").disabled=false;
})
}
function insert(c1,c2) {
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
@ -78,6 +84,7 @@
fetch("/COMMENTS?article=$ARTICLE.comment").then((data)=>data.text())
.then((data)=>{
data=data.split("\n");
if (!isNaN(Number(data[0]))) {
document.getElementById("comments").innerHTML="";
document.getElementById("commentCounter").innerText=data[0]
for (var i=data.length-3;i>=1;i-=2) {
@ -89,6 +96,7 @@
}
}
document.getElementById("commentContainer").style.visibility="visible"
}
})
}
fetchComments()

@ -462,16 +462,16 @@ public class sigServer {
}
System.out.println("Sent "+file+" to client "+client+".");
} else {
System.out.println("Did not find "+file+". Sending an error instead.");
file=Paths.get(sigPlace.OUTDIR,"error.html");
CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
CreateRawRequest(clientOutput,"404",statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
String contentType = Files.probeContentType(file);
if (contentType!=null&&contentType.equals("text/html")) {
clientOutput.write(("<div class=\"generateTime\">Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms</div>\r\n").getBytes());
}
}
} else {
file=Paths.get(sigPlace.OUTDIR,"error.html");
CreateRawRequest(clientOutput,"404",statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
String contentType = Files.probeContentType(file);
if (contentType!=null&&contentType.equals("text/html")) {
clientOutput.write(("<div class=\"generateTime\">Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms</div>\r\n").getBytes());

Loading…
Cancel
Save