/*
- Copyright (C) 2000-2004 SKYRIX Software AG
+ Copyright (C) 2000-2005 SKYRIX Software AG
- This file is part of OpenGroupware.org.
+ This file is part of SOPE.
- OGo is free software; you can redistribute it and/or modify it under
+ SOPE is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
- OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with OGo; see the file COPYING. If not, write to the
+ License along with SOPE; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
- (NSString *)loggingPrefix {
/* improve perf ... */
if (self->url) {
- return [NSString stringWithFormat:@"WOHTTP[0x%08X]<%@>",
+ return [NSString stringWithFormat:@"WOHTTP[0x%p]<%@>",
self, [self->url absoluteString]];
}
else
- return [NSString stringWithFormat:@"WOHTTP[0x%08X]", self];
+ return [NSString stringWithFormat:@"WOHTTP[0x%p]", self];
}
/* accessors */
[(NGActiveSocket *)self->socket setSendTimeout:[self sendTimeout]];
[(NGActiveSocket *)self->socket setReceiveTimeout:[self receiveTimeout]];
- if (self->socket) {
- id bStr;
+ if (self->socket != nil) {
+ NGBufferedStream *bStr;
- bStr = [[NGBufferedStream alloc] initWithSource:self->socket];
- if (logStream)
- self->log = [[WORecordRequestStream alloc] initWithSource:bStr];
+ bStr = [NGBufferedStream alloc]; // keep gcc happy
+ bStr = [bStr initWithSource:self->socket];
+ if (logStream) {
+ self->log = [WORecordRequestStream alloc]; // keep gcc happy
+ self->log = [(WORecordRequestStream *)self->log initWithSource:bStr];
+ }
else
self->log = nil;
- self->io =
- [[NGCTextStream alloc] initWithSource:(id)(self->log?self->log:bStr)];
+ self->io = [NGCTextStream alloc]; // keep gcc happy
+ self->io = [self->io initWithSource:
+ (id)(self->log != nil ? self->log : (id)bStr)];
[bStr release]; bStr = nil;
}
[self debugWithFormat:@" wrote accept header ..."];
}
if ([_request headerForKey:@"user-agent"] == nil) {
- if (isok) isok = [self->io writeString:@"User-Agent: SOPE/4.2\r\n"];
+ if (isok) {
+ static NSString *s = nil;
+ if (s == nil) {
+ s = [[NSString alloc] initWithFormat:@"User-Agent: SOPE/%i.%i.%i\r\n",
+ SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION,
+ SOPE_SUBMINOR_VERSION];
+ }
+ isok = [self->io writeString:s];
+ }
[self debugWithFormat:@" wrote user-agent header ..."];
}
NSMutableString *str;
str = [NSMutableString stringWithCapacity:128];
- [str appendFormat:@"<%@[0x%08X]:", NSStringFromClass([self class]), self];
+ [str appendFormat:@"<%@[0x%p]:", NSStringFromClass([self class]), self];
if (self->url) [str appendFormat:@" url=%@", self->url];
if (self->useProxy) [str appendString:@" proxy"];