| 
									
										
										
										
											2022-05-02 21:03:16 -05:00
										 |  |  |         try { | 
					
						
							| 
									
										
										
										
											2022-05-03 13:45:03 +00:00
										 |  |  |             socket = new ServerSocket(sigPlace.PORT); | 
					
						
							|  |  |  |             System.out.println("Listening on port "+sigPlace.PORT+"."); | 
					
						
							| 
									
										
										
										
											2022-05-02 21:03:16 -05:00
										 |  |  |             while (true) { | 
					
						
							|  |  |  |                 try (Socket client = socket.accept()) { | 
					
						
							|  |  |  |                     System.out.println("New client connection detected: "+client.toString()); | 
					
						
							|  |  |  |                     BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); | 
					
						
							| 
									
										
										
										
											2022-05-06 18:16:42 +00:00
										 |  |  |                     String requestLine,line; | 
					
						
							|  |  |  |                     ZonedDateTime modifiedDate = null; | 
					
						
							| 
									
										
										
										
											2022-05-12 19:25:44 +00:00
										 |  |  |                     /*String boundary=""; | 
					
						
							|  |  |  |                     boolean truncateUntilBoundary=false;*/ | 
					
						
							| 
									
										
										
										
											2022-05-06 18:16:42 +00:00
										 |  |  |                     requestLine=in.readLine(); //Read the first line, this should be our request. | 
					
						
							|  |  |  |                     if (requestLine!=null) { | 
					
						
							| 
									
										
										
										
											2022-05-11 20:22:43 +00:00
										 |  |  |                         while (in.ready()) { | 
					
						
							|  |  |  |                             line=in.readLine(); | 
					
						
							| 
									
										
										
										
											2022-05-12 19:25:44 +00:00
										 |  |  |                             /* | 
					
						
							| 
									
										
										
										
											2022-05-12 15:27:48 +00:00
										 |  |  |                             if (!truncateUntilBoundary) { | 
					
						
							|  |  |  |                                 System.out.println(line); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                                 if (boundary.length()>0) { | 
					
						
							|  |  |  |                                     if (line.equals(boundary)) { | 
					
						
							|  |  |  |                                         truncateUntilBoundary=true; | 
					
						
							|  |  |  |                                     } | 
					
						
							|  |  |  |                                 } | 
					
						
							|  |  |  |                             } else  | 
					
						
							|  |  |  |                             if (line.contains(boundary)) { | 
					
						
							| 
									
										
										
										
											2022-05-12 19:25:44 +00:00
										 |  |  |                                 System.out.println(""); | 
					
						
							| 
									
										
										
										
											2022-05-12 15:27:48 +00:00
										 |  |  |                                 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()); | 
					
						
							| 
									
										
										
										
											2022-05-12 19:25:44 +00:00
										 |  |  |                             } else*/ | 
					
						
							|  |  |  |                             if (modifiedDate==null&&line.startsWith("If-Modified-Since: ")) { |