Upload form included, currently hangs server without a response

main
sigonasr2, Sig, Sigo 3 years ago
parent 03d9c31e14
commit c16461ed56
  1. 3
      notes.md
  2. 13
      out/DIRECTORY_LISTING
  3. 10
      out/articles/DIRECTORY_LISTING
  4. 12
      out/articles/test articles/DIRECTORY_LISTING
  5. 4
      out/codeBackground
  6. 34
      out/uploadform.html
  7. 8
      sigServer.java
  8. 5
      sitefiles/uploadform.html

@ -0,0 +1,3 @@
User Database
=============
Storage using flat files. User information stores the password hash. Store a session token too. Avatar uploader.

@ -18,12 +18,13 @@
<body> <body>
<div class="contentBody"> <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-05-06T18:25:24.961387Z gitpod 190</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-05-11T20:04:09.890362Z gitpod 190</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-05-06T18:25:24.901387Z gitpod 2635</div> <div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-05-11T20:04:09.826362Z gitpod 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-05-06T18:25:24.941387Z gitpod 8892</div> <div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-05-11T20:04:09.866362Z gitpod 8892</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-05-06T18:25:24.909387Z gitpod 1093</div> <div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-05-11T20:04:09.834362Z gitpod 1093</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-05-06T18:25:24.917387Z gitpod 4702</div> <div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-05-11T20:04:09.842362Z gitpod 4702</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-05-06T18:25:24.941387Z gitpod 829</div> <div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-05-11T20:04:09.866362Z gitpod 829</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-05-11T20:04:09.866362Z gitpod 871</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -18,11 +18,11 @@
<body> <body>
<div class="contentBody"> <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="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-05-06T18:25:24.885387Z gitpod 579</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="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-05-11T20:04:09.810362Z gitpod 579</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-06T18:25:24.889387Z gitpod 3807</div> <div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-11T20:04:09.814362Z gitpod 3807</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-05-06T18:25:24.953387Z gitpod 147</div> <div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-05-11T20:04:09.882362Z gitpod 147</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-05-06T18:25:24.945387Z gitpod 1296</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-05-11T20:04:09.874362Z gitpod 1296</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-05-06T18:25:24.949387Z gitpod 4524</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-05-11T20:04:09.878362Z gitpod 4524</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -18,12 +18,12 @@
<body> <body>
<div class="contentBody"> <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-05-06T18:25:24.889387Z gitpod 1068</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-05-11T20:04:09.818362Z gitpod 1068</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-05-06T18:25:24.893387Z gitpod 764</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-05-11T20:04:09.818362Z gitpod 764</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-05-06T18:25:24.893387Z gitpod 977</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-05-11T20:04:09.818362Z gitpod 977</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-05-06T18:25:24.949387Z gitpod 1785</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-05-11T20:04:09.878362Z gitpod 1785</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-05-06T18:25:24.953387Z gitpod 1481</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-05-11T20:04:09.882362Z gitpod 1481</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-05-06T18:25:24.953387Z gitpod 1694</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-05-11T20:04:09.882362Z gitpod 1694</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -9,8 +9,8 @@
ZonedDateTime modifiedDate = null; ZonedDateTime modifiedDate = null;
requestLine=in.readLine(); //Read the first line, this should be our request. requestLine=in.readLine(); //Read the first line, this should be our request.
if (requestLine!=null) { if (requestLine!=null) {
while (!(line=in.readLine()).isBlank()) { while ((line=in.readLine())!=null) {
//System.out.println(requestLine); System.out.println(line);
if (line.contains("If-Modified-Since: ")) { if (line.contains("If-Modified-Since: ")) {
String modifiedSince=line.replace("If-Modified-Since: ",""); String modifiedSince=line.replace("If-Modified-Since: ","");
modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME); modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME);

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/reset.css">
<link rel="stylesheet" type="text/css" href="/sig.css">
<meta charset="UTF-8">
<script type="text/javascript">
function loadCodeBackground() {
fetch("/codeBackground").then((data)=>data.text())
.then((data)=>{
document.getElementById("codeForeground").innerText=data
document.getElementById("codeBackground").innerText=data
})
}
loadCodeBackground();
</script>
</head>
<body>
<div class="contentBody">
SigPlace
<form method="post" action="./SUBMITFILE" enctype="multipart/form-data">
<input type="file"/>
<input type="submit"/>
</form>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>
<div class="codeBackground" id="codeBackground"></div>
</body>
<footer>
</footer>
</html>

@ -17,7 +17,6 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class sigServer { public class sigServer {
@ -34,8 +33,8 @@ public class sigServer {
ZonedDateTime modifiedDate = null; ZonedDateTime modifiedDate = null;
requestLine=in.readLine(); //Read the first line, this should be our request. requestLine=in.readLine(); //Read the first line, this should be our request.
if (requestLine!=null) { if (requestLine!=null) {
while (!(line=in.readLine()).isBlank()) { while ((line=in.readLine())!=null) {
//System.out.println(requestLine); System.out.println(line);
if (line.contains("If-Modified-Since: ")) { if (line.contains("If-Modified-Since: ")) {
String modifiedSince=line.replace("If-Modified-Since: ",""); String modifiedSince=line.replace("If-Modified-Since: ","");
modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME); modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME);
@ -79,6 +78,9 @@ public class sigServer {
} }
} }
} }
} else
if (splitter[0].equals("POST")) { //This is a POST request.
CreateRequest(client,"501","Not Implemented","testfile.html");
} else { } else {
CreateRequest(client,"501","Not Implemented","testfile.html"); CreateRequest(client,"501","Not Implemented","testfile.html");
} }

@ -0,0 +1,5 @@
$SITENAME
<form method="post" action="./SUBMITFILE" enctype="multipart/form-data">
<input type="file"/>
<input type="submit"/>
</form>
Loading…
Cancel
Save