diff --git a/out/DIRECTORY_LISTING b/out/DIRECTORY_LISTING index f116d10..a31096a 100644 --- a/out/DIRECTORY_LISTING +++ b/out/DIRECTORY_LISTING @@ -18,13 +18,13 @@
-

Directory Listing for /

📁.. (Previous Directory)
📁articles 2022-05-11T20:17:07.361619Z gitpod 190
-
🗎codeBackground 2022-05-11T20:17:07.273619Z gitpod 2635
-
🗎otherpage.html 2022-05-11T20:17:07.333619Z gitpod 8892
-
🗎reset.css 2022-05-11T20:17:07.285619Z gitpod 1093
-
🗎sig.css 2022-05-11T20:17:07.297619Z gitpod 4702
-
🗎testfile.html 2022-05-11T20:17:07.333619Z gitpod 829
-
🗎uploadform.html 2022-05-11T20:17:07.337619Z gitpod 884
+

Directory Listing for /

📁.. (Previous Directory)
📁articles 2022-05-12T15:25:09.71463Z gitpod 190
+
🗎codeBackground 2022-05-12T15:25:09.526631Z gitpod 2635
+
🗎otherpage.html 2022-05-12T15:25:09.634631Z gitpod 8892
+
🗎reset.css 2022-05-12T15:25:09.534631Z gitpod 1093
+
🗎sig.css 2022-05-12T15:25:09.542631Z gitpod 4702
+
🗎testfile.html 2022-05-12T15:25:09.634631Z gitpod 829
+
🗎uploadform.html 2022-05-12T15:25:09.634631Z gitpod 884
diff --git a/out/articles/DIRECTORY_LISTING b/out/articles/DIRECTORY_LISTING index c5b9ccc..cd83c88 100644 --- a/out/articles/DIRECTORY_LISTING +++ b/out/articles/DIRECTORY_LISTING @@ -18,11 +18,11 @@
-

Directory Listing for /articles/

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-11T20:17:07.257619Z gitpod 579
-
🗎sigplace1.article 2022-05-11T20:17:07.265619Z gitpod 3807
-
📁test articles 2022-05-11T20:17:07.353619Z gitpod 147
-
🗎curabitur vel tempus ex.article.html 2022-05-11T20:17:07.341619Z gitpod 1296
-
🗎sigplace1.article.html 2022-05-11T20:17:07.345619Z gitpod 4524
+

Directory Listing for /articles/

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-12T15:25:09.478631Z gitpod 579
+
🗎sigplace1.article 2022-05-12T15:25:09.482631Z gitpod 3807
+
📁test articles 2022-05-12T15:25:09.650631Z gitpod 147
+
🗎curabitur vel tempus ex.article.html 2022-05-12T15:25:09.642631Z gitpod 1296
+
🗎sigplace1.article.html 2022-05-12T15:25:09.642631Z gitpod 4524
diff --git a/out/articles/test articles/DIRECTORY_LISTING b/out/articles/test articles/DIRECTORY_LISTING index eb98df3..733f6ab 100644 --- a/out/articles/test articles/DIRECTORY_LISTING +++ b/out/articles/test articles/DIRECTORY_LISTING @@ -18,12 +18,12 @@
-

Directory Listing for /articles/test articles/

📁.. (Previous Directory)
🗎test1.article 2022-05-11T20:17:07.265619Z gitpod 1068
-
🗎test2.article 2022-05-11T20:17:07.265619Z gitpod 764
-
🗎test3.article 2022-05-11T20:17:07.269619Z gitpod 977
-
🗎test1.article.html 2022-05-11T20:17:07.345619Z gitpod 1785
-
🗎test2.article.html 2022-05-11T20:17:07.349619Z gitpod 1481
-
🗎test3.article.html 2022-05-11T20:17:07.353619Z gitpod 1694
+

Directory Listing for /articles/test articles/

📁.. (Previous Directory)
🗎test1.article 2022-05-12T15:25:09.514631Z gitpod 1068
+
🗎test2.article 2022-05-12T15:25:09.514631Z gitpod 764
+
🗎test3.article 2022-05-12T15:25:09.518631Z gitpod 977
+
🗎test1.article.html 2022-05-12T15:25:09.646631Z gitpod 1785
+
🗎test2.article.html 2022-05-12T15:25:09.650631Z gitpod 1481
+
🗎test3.article.html 2022-05-12T15:25:09.650631Z gitpod 1694
diff --git a/out/codeBackground b/out/codeBackground index 5a0c191..f923c03 100644 --- a/out/codeBackground +++ b/out/codeBackground @@ -7,34 +7,34 @@ BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); String requestLine,line; ZonedDateTime modifiedDate = null; + String boundary=""; + boolean truncateUntilBoundary=false; requestLine=in.readLine(); //Read the first line, this should be our request. if (requestLine!=null) { while (in.ready()) { line=in.readLine(); - System.out.println(line); + + if (!truncateUntilBoundary) { + System.out.println(line); + + if (boundary.length()>0) { + if (line.equals(boundary)) { + truncateUntilBoundary=true; + } + } + } else + if (line.contains(boundary)) { + System.out.println("<...>"); + System.out.println(""); + System.out.println(line); + truncateUntilBoundary=false; + } else + if (line.contains("Content-Disposition: ")||line.contains("Content-Type: ")) { + System.out.println(line); + } + + if (line.contains("Content-Type: multipart/form-data; boundary=")) { + boundary="--"+line.substring("Content-Type: multipart/form-data; boundary=".length()); + } else if (line.contains("If-Modified-Since: ")) { String modifiedSince=line.replace("If-Modified-Since: ",""); - modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME); - //System.out.println("Found a modified date of: "+modifiedDate); - } - } - String[] splitter = requestLine.split(Pattern.quote(" ")); - if (splitter.length==3) { - //This is valid. - if (splitter[0].equals("GET")) { //This is a GET request. - if (splitter[2].equals("HTTP/1.1")||splitter[2].equals("HTTP/2.0")) { - String[] requestSplit = splitter[1].split(Pattern.quote("?")); - String requestloc = requestSplit[0]; - HashMap requestParams = new HashMap<>(); - if (requestSplit.length>1) { - String[] params = requestSplit[1].split(Pattern.quote("&")); - for (String s : params) { - String key = s.substring(0,s.indexOf('=')); - String value = s.substring(s.indexOf('=')+1); - requestParams.put(key,value); - } - System.out.println(" ==Params for this request are: "+requestParams); - } - if (requestloc.equals("/")) { - //Send default directory. - if (modifiedDate==null||modifiedDate.isBefore(GetLastModifiedDate(sigPlace.OUTDIR,"testfile.html"))) { diff --git a/sigServer.java b/sigServer.java index b941964..346c067 100644 --- a/sigServer.java +++ b/sigServer.java @@ -31,11 +31,36 @@ public class sigServer { BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); String requestLine,line; ZonedDateTime modifiedDate = null; + /*String boundary=""; + boolean truncateUntilBoundary=false;*/ requestLine=in.readLine(); //Read the first line, this should be our request. if (requestLine!=null) { while (in.ready()) { line=in.readLine(); - System.out.println(line); + + /* + if (!truncateUntilBoundary) { + System.out.println(line); + + if (boundary.length()>0) { + if (line.equals(boundary)) { + truncateUntilBoundary=true; + } + } + } else + if (line.contains(boundary)) { + System.out.println("<...>"); + System.out.println(""); + System.out.println(line); + truncateUntilBoundary=false; + } else + if (line.contains("Content-Disposition: ")||line.contains("Content-Type: ")) { + System.out.println(line); + }*/ + + if (line.contains("Content-Type: multipart/form-data; boundary=")) { + boundary="--"+line.substring("Content-Type: multipart/form-data; boundary=".length()); + } else if (line.contains("If-Modified-Since: ")) { String modifiedSince=line.replace("If-Modified-Since: ",""); modifiedDate = ZonedDateTime.parse(modifiedSince,DateTimeFormatter.RFC_1123_DATE_TIME);