[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #33181] (WebServer 1.4.0) WebSerber`s -_audit: is called 3 times pe
From: |
T.Somequare |
Subject: |
[bug #33181] (WebServer 1.4.0) WebSerber`s -_audit: is called 3 times per 1 request |
Date: |
Thu, 05 May 2011 14:18:29 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1 |
Follow-up Comment #4, bug #33181 (project gnustep):
> Only if we added new API for this (or broke all existing code using the
library) ..
All right.
Currently the WebServerConnection class and WebServer`s -_audit method are
private.
So the behavior could not be changed without parsing and replacing passed
string or modifying library.
How about to split implementaion like below?
//---
WebServerConnection.m
- -(NSString*)audit
+ -(id)audit
{
NSDate *d;
NSString *h;
/* ... ( code set local variables is here) ... */
+ NSDictionary* info = [[NSDictionary
alloc]initWithObjectsAndKeys:h,@"host"
+ ,u,@"user", d , @"date", c, @"command", a, @"agent", r, @"result", nil];
+ id audit = [server provideAuditFor:info];
+ [info release];
+ return audit;
- return [NSStringClass stringWithFormat: @"%@ - %@ [%@] %@ %@
%@",h,u,d,c,a,r];
}
WebServer.m
+ -(id)provideAuditFor:(NSDictionary*)info
+ {
+ NSString* h = [info objectForKey:@"host"];
+ /* ... ( code to get other parts and put them into local vars) ... */
+ return [NSString stringWithFormat:@"%@ - %@ [%@] %@ %@ %@",h,u,d,c,a,r];
+}
//---
This will give a chance to create custom message with writing a subclass of
WebServer and override the method +provideAuditFor: .
Although this is a bit expensive and complex way, considering additional
information (cookie, env, other headers, etc) would be supported in future.
This is just an opinion . Please show us if you have any better idea.
Thanks anyway.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33181>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/