From d388292f244c7143a919a53c8421bec153590d56 Mon Sep 17 00:00:00 2001 From: theli Date: Fri, 30 Sep 2005 16:02:58 +0000 Subject: [PATCH] *) adding function for user accounting which is called after each http request git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@827 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpHeader.java | 2 ++ source/de/anomic/http/httpd.java | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java index 1f21cd6e3..d086c6915 100644 --- a/source/de/anomic/http/httpHeader.java +++ b/source/de/anomic/http/httpHeader.java @@ -114,6 +114,7 @@ public final class httpHeader extends TreeMap implements Map { public static final String CACHE_CONTROL = "Cache-Control"; public static final String TRANSFER_ENCODING = "Transfer-Encoding"; public static final String LOCATION = "Location"; + public static final String ETAG = "ETag"; public static final String X_CACHE = "X-Cache"; public static final String X_CACHE_LOOKUP = "X-Cache-Lookup"; @@ -188,6 +189,7 @@ public final class httpHeader extends TreeMap implements Map { /* PROPERTIES: General properties */ public static final String CONNECTION_PROP_HTTP_VER = "HTTP"; public static final String CONNECTION_PROP_HOST = "HOST"; + public static final String CONNECTION_PROP_USER = "USER"; public static final String CONNECTION_PROP_METHOD = "METHOD"; public static final String CONNECTION_PROP_PATH = "PATH"; public static final String CONNECTION_PROP_EXT = "EXT"; diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java index 941a11508..af5656f60 100644 --- a/source/de/anomic/http/httpd.java +++ b/source/de/anomic/http/httpd.java @@ -428,6 +428,8 @@ public final class httpd implements serverHandler { } catch (Exception e) { logUnexpectedError(e); return serverCore.TERMINATE_CONNECTION; + } finally { + this.doUserAccounting(this.prop); } } @@ -499,7 +501,9 @@ public final class httpd implements serverHandler { } catch (Exception e) { logUnexpectedError(e); return serverCore.TERMINATE_CONNECTION; - } + } finally { + this.doUserAccounting(this.prop); + } } public Boolean POST(String arg) throws IOException { @@ -581,7 +585,9 @@ public final class httpd implements serverHandler { } catch (Exception e) { logUnexpectedError(e); return serverCore.TERMINATE_CONNECTION; - } + } finally { + this.doUserAccounting(this.prop); + } } @@ -1207,6 +1213,13 @@ public final class httpd implements serverHandler { return true; } + public void doUserAccounting(Properties conProps) { + // TODO: validation of conprop fields + // httpHeader.CONNECTION_PROP_USER + // httpHeader.CONNECTION_PROP_CLIENTIP + // httpHeader.CONNECTION_PROP_PROXY_RESPOND_SIZE + // httpHeader.CONNECTION_PROP_PROXY_RESPOND_STATUS + } // public static boolean isTextMime(String mime, Set whitelist) {