From e966eb7630b6dfdc6ca4828b4401176a688114e7 Mon Sep 17 00:00:00 2001 From: ulrich Date: Fri, 26 Mar 2021 15:46:03 +0000 Subject: [PATCH] FileHandler Logging angepasst --- src/de/uhilger/minsrv/handler/FileHandler.java | 28 +++------------------------- 1 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/de/uhilger/minsrv/handler/FileHandler.java b/src/de/uhilger/minsrv/handler/FileHandler.java index 46929f6..5884871 100644 --- a/src/de/uhilger/minsrv/handler/FileHandler.java +++ b/src/de/uhilger/minsrv/handler/FileHandler.java @@ -83,35 +83,16 @@ @Override public void handle(HttpExchange e) throws IOException { String ctxPath = e.getHttpContext().getPath(); - logger.finer(ctxPath); String uriPath = e.getRequestURI().getPath(); - logger.finer(uriPath); + logger.info(uriPath); String fName = uriPath.substring(ctxPath.length()); - logger.finer(fName); - - Headers headers = e.getRequestHeaders(); - Set keys = headers.keySet(); - Iterator i = keys.iterator(); - StringBuilder sb = new StringBuilder(); - while(i.hasNext()) { - String key = i.next().toString(); - sb.append(" "); - sb.append(key); - sb.append(": "); - sb.append(headers.getFirst(key)); - sb.append("\r\n"); - } - logger.finer(sb.toString()); - if (fName.startsWith(".")) { sendNotFound(e, fName); } else { - //Headers headers = e.getRequestHeaders(); + Headers headers = e.getRequestHeaders(); if (headers.containsKey(RANGE_HEADER)) { - logger.finer("has range header"); serveFileParts(e, new File(basePath, fName)); } else { - logger.finer("no range header"); if (fName.endsWith("/")) { fName += "index.html"; } @@ -195,9 +176,7 @@ sb.append("/"); sb.append(file.length()); resHeaders.add(CONTENT_RANGE_HEADER, sb.toString()); - logger.info(sb.toString()); responseLength += (end - start); - logger.info("responseLength: " + responseLength); } resHeaders.add(CONTENT_TYPE, "video/mp4"); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); @@ -237,7 +216,7 @@ private RangeGroup parseRanges(HttpExchange e, File file) { RangeGroup ranges = new RangeGroup(); String rangeHeader = e.getRequestHeaders().get(RANGE_HEADER).toString(); - logger.info(rangeHeader); + /* Inhalt des Range-Headers von nicht benoetigten Angaben befreien @@ -251,7 +230,6 @@ Ziffern 0-9, Bindestrich oder Komma sind. */ rangeHeader = rangeHeader.replaceAll("[^\\d-,]", ""); - logger.info(rangeHeader); /* Die Ranges ermitteln. -- Gitblit v1.9.3