Attempt to parse file using bytes

main
sigonasr2 3 years ago
parent be139980a5
commit ad134823a3
  1. BIN
      debug
  2. 9
      out/DIRECTORY_LISTING
  3. 10
      out/articles/DIRECTORY_LISTING
  4. 2
      out/articles/curabitur vel tempus ex.article
  5. 2
      out/articles/curabitur vel tempus ex.article.html
  6. 2
      out/articles/sigplace1.article
  7. 2
      out/articles/sigplace1.article.html
  8. 12
      out/articles/test articles/DIRECTORY_LISTING
  9. 2
      out/articles/test articles/test1.article
  10. 2
      out/articles/test articles/test1.article.html
  11. 2
      out/articles/test articles/test2.article
  12. 2
      out/articles/test articles/test2.article.html
  13. 2
      out/articles/test articles/test3.article
  14. 2
      out/articles/test articles/test3.article.html
  15. 54
      out/codeBackground
  16. 20
      out/otherpage.html
  17. BIN
      out/uploads/Untitled.png
  18. 1
      sigPlace.java
  19. 102
      sigServer.java

BIN
debug

Binary file not shown.

@ -30,14 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<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-12T19:25:11.189763Z 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="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-05-12T19:25:11.137763Z gitpod 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-05-12T19:25:11.169763Z gitpod 9684</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-05-12T19:25:11.145763Z gitpod 1093</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-05-12T19:25:11.153763Z gitpod 5175</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-05-12T19:25:11.173763Z gitpod 1621</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-05-12T19:25:11.173763Z gitpod 1676</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>
<div class="codeBackground" id="codeBackground"></div> <div class="codeBackground" id="codeBackground"></div>

@ -30,11 +30,11 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<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-12T19:25:11.125763Z 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-19T03:42:49.8911626Z LAPTOP-NEAKT518\sigon (User) 582</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-12T19:25:11.129763Z gitpod 3807</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-19T03:42:49.9478986Z LAPTOP-NEAKT518\sigon (User) 2088</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-05-12T19:25:11.185763Z gitpod 147</div> <div class="filelisting"><a href="\articles\sigplace1.article" class="icon">&#x1F5CE;</a><a href="\articles\sigplace1.article">sigplace1.article</a> 2022-05-19T03:42:49.8946864Z LAPTOP-NEAKT518\sigon (User) 3821</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-12T19:25:11.177763Z gitpod 2088</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-19T03:42:49.9512871Z LAPTOP-NEAKT518\sigon (User) 5316</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-12T19:25:11.177763Z gitpod 5316</div> <div class="folderlisting"><a href="\articles\test articles" class="icon">&#x1F4C1;</a><a href="\articles\test articles">test articles</a> 2022-05-19T03:42:49.9718854Z LAPTOP-NEAKT518\sigon (User) 4096</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article"> <div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out\articles\curabitur vel tempus ex.article">
<p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p> <p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div>%CONDITIONAL_EXPAND%</div>

@ -30,7 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="expandedContent" id="content_out/articles/curabitur vel tempus ex.article"> <div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="expandedContent" id="content_out\articles\curabitur vel tempus ex.article">
<p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p> <p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div></div> </div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div></div>

@ -1,4 +1,4 @@
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out/articles/sigplace1.article"> <div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out\articles\sigplace1.article">
<p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p> <p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p>
<p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p> <p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p>
<p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p> <p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p>

@ -30,7 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="expandedContent" id="content_out/articles/sigplace1.article"> <div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="expandedContent" id="content_out\articles\sigplace1.article">
<p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p> <p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p>
<p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p> <p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p>
<p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p> <p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p>

@ -30,12 +30,12 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<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-12T19:25:11.129763Z 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-19T03:42:49.8963007Z LAPTOP-NEAKT518\sigon (User) 1071</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-12T19:25:11.133763Z gitpod 764</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-19T03:42:49.9539501Z LAPTOP-NEAKT518\sigon (User) 2577</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-12T19:25:11.133763Z gitpod 977</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-19T03:42:49.8982941Z LAPTOP-NEAKT518\sigon (User) 767</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-12T19:25:11.181763Z gitpod 2577</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-19T03:42:49.957395Z LAPTOP-NEAKT518\sigon (User) 2273</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-12T19:25:11.181763Z gitpod 2273</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-19T03:42:49.8999694Z LAPTOP-NEAKT518\sigon (User) 980</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-12T19:25:11.185763Z gitpod 2486</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-19T03:42:49.959957Z LAPTOP-NEAKT518\sigon (User) 2486</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article"> <div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out\articles\test articles\test1.article">
<p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p> <p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div>%CONDITIONAL_EXPAND%</div>

@ -30,7 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<div class="contentWrapper"><h1>A Test Title</h1><div class="expandedContent" id="content_out/articles/test articles/test1.article"> <div class="contentWrapper"><h1>A Test Title</h1><div class="expandedContent" id="content_out\articles\test articles\test1.article">
<p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p> <p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div></div> </div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div></div>

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article"> <div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out\articles\test articles\test2.article">
<p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p> <p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div>%CONDITIONAL_EXPAND%</div>

@ -30,7 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<div class="contentWrapper"><h1>Another test title</h1><div class="expandedContent" id="content_out/articles/test articles/test2.article"> <div class="contentWrapper"><h1>Another test title</h1><div class="expandedContent" id="content_out\articles\test articles\test2.article">
<p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p> <p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div></div> </div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div></div>

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out/articles/test articles/test3.article"> <div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out\articles\test articles\test3.article">
<p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p> <p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div>%CONDITIONAL_EXPAND%</div>

@ -30,7 +30,7 @@ bunch of random Java code.
<span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>); <span class="variable">System</span>.<span class="variable">err</span>.<span class="function">println</span>(<span class="string">Failed to build directory listings!"</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
}</pre> }</pre>
<div class="contentWrapper"><h1>And More</h1><div class="expandedContent" id="content_out/articles/test articles/test3.article"> <div class="contentWrapper"><h1>And More</h1><div class="expandedContent" id="content_out\articles\test articles\test3.article">
<p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p> <p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div></div> </div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div></div>

@ -7,34 +7,34 @@
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
String requestLine,line; String requestLine,line;
ZonedDateTime modifiedDate = null; ZonedDateTime modifiedDate = null;
/*String boundary=""; String boundary=null;
boolean truncateUntilBoundary=false;*/ boolean uploadData = false;
boolean truncateUntilBoundary=false;
String filename=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 (in.ready()) { String[] splitter = requestLine.split(Pattern.quote(" "));
line=in.readLine(); boolean ISPOST = splitter[0].equals("POST");
/* if (splitter.length==3) {
if (!truncateUntilBoundary) { while (in.ready()) {
System.out.println(line); line=in.readLine();
if (ISPOST) {
if (boundary!=null) {
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("");
System.out.println(line);
truncateUntilBoundary=false;
if (boundary.length()>0) {
if (line.equals(boundary)) {
truncateUntilBoundary=true;
}
}
} else
if (line.contains(boundary)) {
System.out.println("");
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 (modifiedDate==null&&line.startsWith("If-Modified-Since: ")) {

@ -39,7 +39,7 @@ This is a different webpage.<hr>
modify.remove(); modify.remove();
} }
</script> </script>
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out/articles/sigplace1.article"> <div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out\articles\sigplace1.article">
<p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p> <p> This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.</p>
<p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p> <p> Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.</p>
<p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p> <p> A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.</p>
@ -52,19 +52,19 @@ This is a different webpage.<hr>
<p>Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.</p> <p>Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.</p>
<br/> <br/>
<p>Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.</p> <p>Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.</p>
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div><div class="unexpanded" id="expand_33" onClick="expand(this,'out/articles/sigplace1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div> </div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div><div class="unexpanded" id="expand_33" onClick="expand(this,'out\articles\sigplace1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article"> <div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out\articles\test articles\test1.article">
<p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p> <p> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div><div class="unexpanded" id="expand_55" onClick="expand(this,'out/articles/test articles/test1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div> </div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div><div class="unexpanded" id="expand_55" onClick="expand(this,'out\articles\test articles\test1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article"> <div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out\articles\test articles\test2.article">
<p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p> <p> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div><div class="unexpanded" id="expand_58" onClick="expand(this,'out/articles/test articles/test2.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div> </div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div><div class="unexpanded" id="expand_58" onClick="expand(this,'out\articles\test articles\test2.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out/articles/test articles/test3.article"> <div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out\articles\test articles\test3.article">
<p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p> <p> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div><div class="unexpanded" id="expand_61" onClick="expand(this,'out/articles/test articles/test3.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div> </div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div><div class="unexpanded" id="expand_61" onClick="expand(this,'out\articles\test articles\test3.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article"> <div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out\articles\curabitur vel tempus ex.article">
<p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p> <p>Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div><div class="unexpanded" id="expand_64" onClick="expand(this,'out/articles/curabitur vel tempus ex.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div> </div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div><div class="unexpanded" id="expand_64" onClick="expand(this,'out\articles\curabitur vel tempus ex.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

Binary file not shown.

@ -20,6 +20,7 @@ public class sigPlace {
final static String REFDIR = "ref"; final static String REFDIR = "ref";
final static String OUTDIR = "out"; final static String OUTDIR = "out";
final static String ARTICLESDIR = "articles"; final static String ARTICLESDIR = "articles";
final static String UPLOADSDIR = "uploads";
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
static int PORT = 8080; static int PORT = 8080;

@ -1,4 +1,6 @@
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
@ -6,17 +8,24 @@ import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.charset.UnmappableCharacterException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileTime; import java.nio.file.attribute.FileTime;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class sigServer { public class sigServer {
@ -31,44 +40,70 @@ public class sigServer {
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
String requestLine,line; String requestLine,line;
ZonedDateTime modifiedDate = null; ZonedDateTime modifiedDate = null;
/*String boundary=""; String boundary=null;
boolean truncateUntilBoundary=false;*/ boolean uploadData = false;
boolean truncateUntilBoundary=false;
String filename=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 (in.ready()) { String[] splitter = requestLine.split(Pattern.quote(" "));
line=in.readLine(); boolean ISPOST = splitter[0].equals("POST");
/* if (splitter.length==3) {
if (!truncateUntilBoundary) { while (in.ready()) {
System.out.println(line); line=in.readLine();
if (ISPOST) {
if (boundary!=null) {
if (!truncateUntilBoundary) {
System.out.println(line);
if (boundary.length()>0) { if (boundary.length()>0) {
if (line.equals(boundary)) { if (line.equals(boundary)) {
truncateUntilBoundary=true; truncateUntilBoundary=true;
}
}
} else
if (line.contains(boundary)) {
System.out.println("");
System.out.println("<...>");
System.out.println("");
System.out.println(line);
truncateUntilBoundary=false;
filename=null;
uploadData=false;
System.out.println("Saving upload to "+sigPlace.UPLOADSDIR+" directory.");
} else
if (line.contains("Content-Disposition: ")||line.contains("Content-Type: ")) {
if (line.contains("filename=")) {
filename=line.substring(line.indexOf("filename=")+"filename=".length()+1);
filename = filename.substring(0,filename.length()-1);
} else {
System.out.println(line);
}
} else {
OutputStream stream = null;
byte[] byteContent = new String(line.getBytes(),StandardCharsets.UTF_8).getBytes(StandardCharsets.UTF_8);
File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);
// check if file exist, otherwise create the file before writing
if (!myFile.exists()) {
myFile.createNewFile();
}
stream = new FileOutputStream(myFile);
stream.write(byteContent);
stream.flush();
stream.close();
}
}
if (line.contains("Content-Type: multipart/form-data; boundary=")) {
boundary="--"+line.substring("Content-Type: multipart/form-data; boundary=".length());
} }
} else
if (modifiedDate==null&&line.startsWith("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);
} }
} else
if (line.contains(boundary)) {
System.out.println("");
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 (modifiedDate==null&&line.startsWith("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. //This is valid.
if (splitter[0].equals("GET")) { //This is a GET request. if (splitter[0].equals("GET")) { //This is a GET request.
if (splitter[2].equals("HTTP/1.1")||splitter[2].equals("HTTP/2.0")) { if (splitter[2].equals("HTTP/1.1")||splitter[2].equals("HTTP/2.0")) {
@ -110,6 +145,9 @@ public class sigServer {
} else { } else {
CreateRequest(client,"501","Not Implemented","testfile.html"); CreateRequest(client,"501","Not Implemented","testfile.html");
} }
} else {
in.close();
CreateRequest(client,"400","Bad Request","testfile.html");
} }
} }
} catch(SocketException|NullPointerException e) { } catch(SocketException|NullPointerException e) {

Loading…
Cancel
Save