-Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.h
-===================================================================
---- sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (révision 1546)
-+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.h (copie de travail)
-@@ -28,6 +28,7 @@
- #define ___PostgreSQL72_Channel_H___
-
- #include <GDLAccess/EOAdaptorChannel.h>
-+#include <GDLContentStore/EOAdaptorChannel+GCS.h>
- #include <libpq-fe.h>
-
- @class NSArray, NSString, NSMutableDictionary;
-@@ -40,7 +41,7 @@
- int modification;
- } PostgreSQL72FieldInfo;
-
--@interface PostgreSQL72Channel : EOAdaptorChannel
-+@interface PostgreSQL72Channel : EOAdaptorChannel <GCSEOAdaptorChannel>
- {
- // connection is valid after an openChannel call
- PGConnection *connection;
Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
===================================================================
--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (révision 1546)
@end /* PostgreSQL72Channel */
@implementation PostgreSQL72Channel(PrimaryKeyGeneration)
+Index: sope-gdl1/Oracle8/GNUmakefile
+===================================================================
+--- sope-gdl1/Oracle8/GNUmakefile (révision 1546)
++++ sope-gdl1/Oracle8/GNUmakefile (copie de travail)
+@@ -28,15 +28,23 @@
+ SOPE_ROOT=../..
+ ORACLE_VERSION=10.2.0.3
+ #ORACLE_VERSION=11.1.0.1
+-ADDITIONAL_INCLUDE_DIRS += -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
++ADDITIONAL_INCLUDE_DIRS += -I../../sope-core -I../../sope-core/NGExtensions -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
+
++local_arch = $(subst 64,,$(shell uname -m))
++
++ifeq ($(local_arch),ppc)
++PPC_LDFLAGS=-L/opt/ibmcmp/lib -libmc++
++else
++PPC_LDFLAGS=
++endif
++
+ ifneq ($(frameworks),yes)
+-Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
+-otest_TOOL_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
++common_LIBS = -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -L../GDLAccess/obj -lGDLAccess -L../../sope-core/EOControl/obj -lEOControl $(PPC_LDFLAGS)
+ else
+-Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
+-otest_TOOL_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
++common_LIBS = -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl $(PPC_LDFLAGS)
+ endif
++Oracle8_BUNDLE_LIBS += $(common_LIBS)
++otest_TOOL_LIBS += $(common_LIBS)
+
+ # Bundle
+ BUNDLE_NAME = Oracle8
+Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
+===================================================================
+--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (révision 1546)
++++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (copie de travail)
+@@ -53,14 +53,17 @@
+ while (c--)
+ {
+ info = [[_row_buffer objectAtIndex: c] pointerValue];
+- [_row_buffer removeObjectAtIndex: c];
+
+ // We free our LOB object. If it fails, it likely mean it isn't a LOB
+ // so we just free the value instead.
+- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
+- {
+- free(info->value);
+- }
++ if (info->value)
++ {
++ if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
++ free(info->value);
++ info->value = NULL;
++ }
++ free(info);
++ [_row_buffer removeObjectAtIndex: c];
+ }
+
+ OCIHandleFree(_current_stm, OCI_HTYPE_STMT);
+@@ -75,6 +78,30 @@
+ //
+ @implementation OracleAdaptorChannel
+
++static void
++DBTerminate()
++{
++ if (OCITerminate(OCI_DEFAULT))
++ NSLog(@"FAILED: OCITerminate()");
++ else
++ NSLog(@"Oracle8: environment shut down");
++}
++
+++ (void) initialize
++{
++ // We Initialize the OCI process environment.
++ if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
++ (dvoid * (*)(dvoid *, size_t)) 0,
++ (dvoid * (*)(dvoid *, dvoid *, size_t))0,
++ (void (*)(dvoid *, dvoid *)) 0 ))
++ NSLog(@"FAILED: OCIInitialize()");
++ else
++ {
++ NSLog(@"Oracle8: environment initialized");
++ atexit(DBTerminate);
++ }
++}
++
+ - (id) initWithAdaptorContext: (EOAdaptorContext *) theAdaptorContext
+ {
+ if ((self = [super initWithAdaptorContext: theAdaptorContext]))
+@@ -134,10 +161,14 @@
+ NSLog(@"FAILED: OCILogoff()");
+ }
+
+- if (OCITerminate(OCI_DEFAULT))
+- {
+- NSLog(@"FAILED: OCITerminate()");
+- }
++
++ OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
++ OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
++ // OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
++
++ _oci_ctx = (OCISvcCtx *)0;
++ _oci_err = (OCIError *)0;
++ _oci_env = (OCIEnv *)0;
+ }
+ }
+
+@@ -151,11 +182,6 @@
+ [self _cleanup];
+
+ RELEASE(_resultSetProperties);
+-
+- OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
+- OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
+- OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
+-
+ RELEASE(delegate);
+
+ [super dealloc];
+@@ -368,16 +394,7 @@
+ return NO;
+ }
+
+- // We Initialize the OCI process environment.
+- if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
+- (dvoid * (*)(dvoid *, size_t)) 0,
+- (dvoid * (*)(dvoid *, dvoid *, size_t))0,
+- (void (*)(dvoid *, dvoid *)) 0 ))
+- {
+- NSLog(@"FAILED: OCIInitialize()");
+- return NO;
+- }
+-
++
+ if (OCIEnvInit((OCIEnv **)&_oci_env, (ub4)OCI_DEFAULT, (size_t)0, (dvoid **)0))
+ {
+ NSLog(@"FAILED: OCIEnvInit()");
+Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
+===================================================================
+--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (révision 1546)
++++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (copie de travail)
+@@ -155,7 +155,9 @@
+ OCILobFreeTemporary([theChannel serviceContext], [theChannel errorHandle], info->value);
+ OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB);
+ }
++ free(info);
+ }
++ [theColumns release];
+
+ OCIHandleFree(theStatement, OCI_HTYPE_STMT);
+ }
Index: sope-mime/NGImap4/NGImap4Connection.m
===================================================================
--- sope-mime/NGImap4/NGImap4Connection.m (révision 1546)
- (NSException *)exceptionForFailedMatch:(unsigned char)_match
got:(unsigned char)_avail
{
+Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
+===================================================================
+--- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (révision 1546)
++++ sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m (copie de travail)
+@@ -285,24 +285,16 @@
+ - (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
+ // TODO: use UNICODE
+ NSCalendarDate *date = nil;
+- unsigned char buf[256];
+- unsigned char *bytes = buf, *pe;
++ unsigned char *bytes, *pe;
+ unsigned length = 0;
+ NSTimeZone *tz = nil;
+ char dayOfMonth, monthOfYear, hour, minute, second;
+ short year;
+ BOOL flag;
+-
+- if ((length = [_data cStringLength]) > 254) {
+- [self logWithFormat:
+- @"header field value to large for date parsing: '%@'(%i)",
+- _data, length];
+- length = 254;
+- }
+-
+- [_data getCString:(char *)buf maxLength:length];
+- buf[length] = '\0';
+-
++
++ length = [_data length];
++ bytes = [_data cStringUsingEncoding: NSASCIIStringEncoding];
++
+ /* remove leading chars (skip to first digit, the day of the month) */
+ while (length > 0 && (!isdigit(*bytes))) {
+ bytes++;
Index: sope-mime/NGMime/NGMimeBodyPart.m
===================================================================
--- sope-mime/NGMime/NGMimeBodyPart.m (révision 1546)
contentType = ([ctype isKindOfClass:[NGMimeType class]])
? ctype
: [NGMimeType mimeType:[ctype stringValue]];
+Index: sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m
+===================================================================
+--- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (révision 1546)
++++ sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m (copie de travail)
+@@ -20,6 +20,8 @@
+ 02111-1307, USA.
+ */
+
++#include <unistd.h>
++
+ #include <NGExtensions/NSString+Encoding.h>
+ #include <NGExtensions/NSObject+Logs.h>
+ #include "common.h"
+@@ -81,7 +83,6 @@
+
+ #else /* ! NeXT_Foundation_LIBRARY */
+
+-
+ @implementation NSString(Encoding)
+
+ #if GNUSTEP_BASE_LIBRARY
+@@ -192,17 +193,17 @@
+
+ memcpy(outbuf, _src, _srcLen);
+ *outLen_ = outlen;
+-
++
+ return outbuf;
+ }
+ result = nil;
+ fromEncode = [_fromEncode cString];
+ toEncode = [_toEncode cString];
+-
++
+ type = iconv_open(toEncode, fromEncode);
+ inbuf = NULL;
+ outbuf = NULL;
+-
++
+ if ((type == (iconv_t)-1)) {
+ [self logWithFormat:@"%s: Could not handle iconv encoding. FromEncoding:%@"
+ @" to encoding:%@", __PRETTY_FUNCTION__, _fromEncode, _toEncode];
+@@ -228,25 +229,25 @@
+ }
+ else if (errno == EINVAL) {
+ [self logWithFormat:@"Got incomplete multibyte sequence. ToEncode: %@"
+- @" FromEncode: %@", _toEncode, _fromEncode];
++ @" FromEncode: %@", _toEncode, _fromEncode];
+ if (IconvLogEnabled)
+ [self logWithFormat:@"ByteSequence:\n%s\n", _src];
+-
++
+ }
+ else if (errno == E2BIG) {
+ [self logWithFormat:
+- @"Got to small outputbuffer (inbytesleft=%d, outbytesleft=%d, "
+- @"outlen=%d). ToEncode: %@ FromEncode: %@",
+- inbytesleft, outbytesleft, outlen,
+- _toEncode, _fromEncode];
++ @"Got to small outputbuffer (inbytesleft=%d, outbytesleft=%d, "
++ @"outlen=%d). ToEncode: %@ FromEncode: %@",
++ inbytesleft, outbytesleft, outlen,
++ _toEncode, _fromEncode];
+ if (IconvLogEnabled)
+ [self logWithFormat:@"ByteSequence:\n%s\n", _src];
+-
++
+ goto CLEAR_AND_RETURN;
+ }
+ else {
+ [self logWithFormat:@"Got unexpected error. ToEncode: %@"
+- @" FromEncode: %@", _toEncode, _fromEncode];
++ @" FromEncode: %@", _toEncode, _fromEncode];
+ goto CLEAR_AND_RETURN;
+ }
+ }
+@@ -255,45 +256,224 @@
+ #endif
+ if (type)
+ iconv_close(type);
+-
++
+ *outLen_ = outlen - outbytesleft;
+-
++
+ return outbuf;
+-
++
+ CLEAR_AND_RETURN:
+ if (type)
+ iconv_close(type);
+-
++
+ if (outbuf) {
+ free(outbuf); outbuf = NULL;
+ }
+ return NULL;
+ }
+
+-+ (NSString *)stringWithData:(NSData *)_data
+- usingEncodingNamed:(NSString *)_encoding
+++ (int) encodingForCharset: (NSString *) theCharset
++ convertToNSStringEncoding: (BOOL) shouldConvert
+ {
+- void *inbuf, *res;
+- unsigned len, inbufLen;
+- NSString *result;
++ // We define some aliases for the string encoding.
++ static struct { NSString *name; int encoding; BOOL fromCoreFoundation; } encodings[] = {
++ {@"ascii" ,NSASCIIStringEncoding ,NO},
++ {@"us-ascii" ,NSASCIIStringEncoding ,NO},
++ {@"default" ,NSASCIIStringEncoding ,NO}, // Ah... spammers.
++ {@"utf-8" ,NSUTF8StringEncoding ,NO},
++ {@"iso-8859-1" ,NSISOLatin1StringEncoding ,NO},
++ {@"x-user-defined",NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in Outlook.
++ {@"unknown" ,NSISOLatin1StringEncoding ,NO}, // Once more, blame Outlook.
++ {@"x-unknown" ,NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in Pine 4.21.
++ {@"unknown-8bit" ,NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in Mutt/1.3.28i
++ {@"0" ,NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in QUALCOMM Windows Eudora Version 6.0.1.1
++ {@"" ,NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in Ximian Evolution
++ {@"iso8859_1" ,NSISOLatin1StringEncoding ,NO}, // To prevent a lame bug in Openwave WebEngine
++ {@"iso-8859-2" ,NSISOLatin2StringEncoding ,NO},
++#ifndef MACOSX
++ {@"iso-8859-3" ,NSISOLatin3StringEncoding ,NO},
++ {@"iso-8859-4" ,NSISOLatin4StringEncoding ,NO},
++ {@"iso-8859-5" ,NSISOCyrillicStringEncoding ,NO},
++ {@"iso-8859-6" ,NSISOArabicStringEncoding ,NO},
++ {@"iso-8859-7" ,NSISOGreekStringEncoding ,NO},
++ {@"iso-8859-8" ,NSISOHebrewStringEncoding ,NO},
++ {@"iso-8859-9" ,NSISOLatin5StringEncoding ,NO},
++ {@"iso-8859-10" ,NSISOLatin6StringEncoding ,NO},
++ {@"iso-8859-11" ,NSISOThaiStringEncoding ,NO},
++ {@"iso-8859-13" ,NSISOLatin7StringEncoding ,NO},
++ {@"iso-8859-14" ,NSISOLatin8StringEncoding ,NO},
++ {@"iso-8859-15" ,NSISOLatin9StringEncoding ,NO},
++ {@"koi8-r" ,NSKOI8RStringEncoding ,NO},
++ {@"big5" ,NSBIG5StringEncoding ,NO},
++ {@"gb2312" ,NSGB2312StringEncoding ,NO},
++ {@"utf-7" ,NSUTF7StringEncoding ,NO},
++ {@"unicode-1-1-utf-7", NSUTF7StringEncoding ,NO}, // To prever a bug (sort of) in MS Hotmail
++#endif
++ {@"windows-1250" ,NSWindowsCP1250StringEncoding ,NO},
++ {@"windows-1251" ,NSWindowsCP1251StringEncoding ,NO},
++ {@"cyrillic (windows-1251)", NSWindowsCP1251StringEncoding ,NO}, // To prevent a bug in MS Hotmail
++ {@"windows-1252" ,NSWindowsCP1252StringEncoding ,NO},
++ {@"windows-1253" ,NSWindowsCP1253StringEncoding ,NO},
++ {@"windows-1254" ,NSWindowsCP1254StringEncoding ,NO},
++ {@"iso-2022-jp" ,NSISO2022JPStringEncoding ,NO},
++ {@"euc-jp" ,NSJapaneseEUCStringEncoding ,NO},
++ };
++
++ NSString *name;
++ int i;
+
+- if (![_encoding length])
+- return nil;
++ name = [theCharset lowercaseString];
+
+- inbufLen = [_data length];
+- inbuf = calloc(sizeof(char), inbufLen + 4);
+- [_data getBytes:inbuf];
++ for (i = 0; i < sizeof(encodings)/sizeof(encodings[0]); i++)
++ {
++ if ([name isEqualToString: encodings[i].name])
++ {
++ int enc = encodings[i].encoding;
++ // Under OS X, we use CoreFoundation if necessary to convert the encoding
++ // to a NSString encoding.
++#ifdef MACOSX
++ if (encodings[i].fromCoreFoundation)
++ {
++ if (shouldConvert)
++ {
++ return CFStringConvertEncodingToNSStringEncoding(enc);
++ }
++ else
++ {
++ return enc;
++ }
++ }
++ else
++ {
++ if (!shouldConvert)
++ {
++ return CFStringConvertNSStringEncodingToEncoding(enc);
++ }
++ else
++ {
++ return enc;
++ }
++ }
++#else
++ return enc;
++#endif
++ }
++ }
+
+- result = nil;
+- res = iconv_wrapper(self, inbuf, inbufLen, _encoding, unicharEncoding, &len);
+- if (res) {
+- result = [[NSString alloc] initWithCharacters:res length:(len / 2)];
+- free(res); res = NULL;
+- }
+- if (inbuf) free(inbuf); inbuf = NULL;
+- return [result autorelease];
++#ifdef MACOSX
++ // Last resort: try using CoreFoundation...
++ CFStringEncoding enc;
++
++ enc = CFStringConvertIANACharSetNameToEncoding((CFStringRef)name);
++ if (kCFStringEncodingInvalidId != enc)
++ {
++ if (shouldConvert)
++ {
++ return CFStringConvertEncodingToNSStringEncoding(enc);
++ }
++ else
++ {
++ return enc;
++ }
++ }
++#endif
++
++ return -1;
+ }
+
+++ (int) encodingForCharset: (NSString *) theCharset
++{
++ return [self encodingForCharset: theCharset convertToNSStringEncoding: YES];
++}
++
+++ (NSString *) stringWithData: (NSData *) theData
++ usingEncodingNamed: (NSString *) theCharset
++{
++ int encoding;
++
++ if (theData == nil)
++ {
++ return nil;
++ }
++
++#ifdef MACOSX
++ encoding = [NSString encodingForCharset: theCharset
++ convertToNSStringEncoding: NO];
++#else
++ encoding = [NSString encodingForCharset: theCharset];
++#endif
++
++ if (encoding == -1)
++ {
++ NSString *aString;
++ const char *i_bytes;
++ char *o_bytes;
++
++ size_t i_length, o_length;
++ int total_length, ret;
++ iconv_t conv;
++
++ // Instead of calling cString directly on theCharset, we first try
++ // to obtain the ASCII string of the data object.
++ if (!theCharset)
++ {
++ return nil;
++ }
++
++ conv = iconv_open("UTF-8", [[theCharset uppercaseString] cStringUsingEncoding: NSISOLatin1StringEncoding]);
++
++ if ((int)conv < 0)
++ {
++ // Let's assume we got US-ASCII here.
++ return AUTORELEASE([[NSString alloc] initWithData: theData encoding: NSASCIIStringEncoding]);
++ }
++
++ i_bytes = [theData bytes];
++ i_length = [theData length];
++
++ total_length = o_length = sizeof(unichar)*i_length;
++ o_bytes = (char *)malloc(o_length);
++
++ if (o_bytes == NULL) return nil;
++
++ while (i_length > 0)
++ {
++ ret = iconv(conv, (char **)&i_bytes, &i_length, &o_bytes, &o_length);
++
++ if (ret == (size_t)-1)
++ {
++ iconv_close(conv);
++
++ total_length = total_length - o_length;
++ o_bytes -= total_length;
++ free(o_bytes);
++ return nil;
++ }
++ }
++
++ total_length = total_length - o_length;
++ o_bytes -= total_length;
++
++ // If we haven't used all our allocated buffer, we shrink it.
++ if (o_length > 0)
++ {
++ o_bytes = realloc(o_bytes, total_length);
++ }
++
++ aString = [[NSString alloc] initWithData: [NSData dataWithBytesNoCopy: o_bytes
++ length: total_length]
++ encoding: NSUTF8StringEncoding];
++ iconv_close(conv);
++
++ return AUTORELEASE(aString);
++ }
++
++#ifdef MACOSX
++ return AUTORELEASE((NSString *)CFStringCreateFromExternalRepresentation(NULL, (CFDataRef)theData, encoding));
++#else
++ return AUTORELEASE([[NSString alloc] initWithData: theData encoding: encoding]);
++#endif
++}
++
+ - (NSData *)dataUsingEncodingNamed:(NSString *)_encoding {
+ unichar *chars;
+ char *res;
+Index: sope-core/NGExtensions/ChangeLog
+===================================================================
+--- sope-core/NGExtensions/ChangeLog (révision 1546)
++++ sope-core/NGExtensions/ChangeLog (copie de travail)
+@@ -1,3 +1,10 @@
++2007-11-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
++
++ * FdExt.subproj/NSString+Encoding.m: replaced the code of
++ stringWithData:usingEncodingNamed: with the code from
++ Pantomime/NSString+Extensions.m/stringWithData:charset:, which in
++ turn was adapted to take the same argument types.
++
+ 2007-07-31 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * FdExt.subproj/NSMethodSignature+misc.m: added warning and bogus
Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
===================================================================
--- sope-appserver/NGObjWeb/GNUmakefile.postamble (révision 1546)
BOOL sidInUrl;
/* 'ivar' associations */
+Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m
+===================================================================
+--- sope-appserver/NGObjWeb/SoObjects/SoObject.m (révision 1546)
++++ sope-appserver/NGObjWeb/SoObjects/SoObject.m (copie de travail)
+@@ -39,22 +39,34 @@
+ static int debugLookup = -1;
+ static int debugBaseURL = -1;
+ static int useRelativeURLs = -1;
++static int redirectInitted = -1;
++static NSURL *redirectURL = nil;
++
+ static void _initialize(void) {
++ NSString *url;
++ NSUserDefaults *ud;
++
++ ud = [NSUserDefaults standardUserDefaults];
++
+ if (debugLookup == -1) {
+- debugLookup = [[NSUserDefaults standardUserDefaults]
+- boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
++ debugLookup = [ud boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
+ NSLog(@"Note(SoObject): SoDebugKeyLookup is enabled!");
+ }
+ if (debugBaseURL == -1) {
+- debugBaseURL = [[NSUserDefaults standardUserDefaults]
+- boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
++ debugBaseURL = [ud boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
+ NSLog(@"Note(SoObject): SoDebugBaseURL is enabled!");
+ }
+ if (useRelativeURLs == -1) {
+- useRelativeURLs = [[NSUserDefaults standardUserDefaults]
+- boolForKey:@"WOUseRelativeURLs"] ?1:0;
++ useRelativeURLs = [ud boolForKey:@"WOUseRelativeURLs"] ?1:0;
+ NSLog(@"Note(SoObject): relative base URLs are enabled.");
+ }
++ if (redirectInitted == -1) {
++ url = [ud stringForKey:@"WOApplicationRedirectURL"];
++ if ([url length]) {
++ redirectURL = [[NSURL alloc] initWithString: url];
++ }
++ redirectInitted = 1;
++ }
+ }
+
+ /* classes */
+@@ -318,56 +330,61 @@
+
+ rq = [_ctx request];
+ ms = [[NSMutableString alloc] initWithCapacity:128];
++
++ if (redirectURL) {
++ [ms appendString: [redirectURL absoluteString]];
++ }
++ else {
++ if (!useRelativeURLs) {
++ port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
+
+- if (!useRelativeURLs) {
+- port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
+-
+- /* this is actually a bug in Apache */
+- if (port == 0) {
+- static BOOL didWarn = NO;
+- if (!didWarn) {
+- [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
+- __PRETTY_FUNCTION__, __LINE__];
+- didWarn = YES;
++ /* this is actually a bug in Apache */
++ if (port == 0) {
++ static BOOL didWarn = NO;
++ if (!didWarn) {
++ [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
++ __PRETTY_FUNCTION__, __LINE__];
++ didWarn = YES;
++ }
++ port = 80;
+ }
+- port = 80;
+- }
+
+- if ((tmp = [rq headerForKey:@"host"]) != nil) {
+- /* check whether we have a host header with port */
+- if ([tmp rangeOfString:@":"].length == 0)
+- tmp = nil;
+- }
+- if (tmp != nil) { /* we have a host header with port */
+- isHTTPS =
+- [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
+- [ms appendString:isHTTPS ? @"https://" : @"http://"];
+- [ms appendString:tmp];
+- }
+- else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
+- /* sometimes the URL is just wrong! (suggests port 80) */
+- if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
+- [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
+- __PRETTY_FUNCTION__, tmp];
+- tmp = [tmp substringToIndex:([tmp length] - 2)];
++ if ((tmp = [rq headerForKey:@"host"]) != nil) {
++ /* check whether we have a host header with port */
++ if ([tmp rangeOfString:@":"].length == 0)
++ tmp = nil;
+ }
+- else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
+- /* see OGo bug #1435, Debian Apache hack */
+- [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
+- @"assuming Debian/Apache bug (OGo #1435): '%@'",
+- __PRETTY_FUNCTION__, tmp];
+- tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
+- tmp = [@"https" stringByAppendingString:tmp];
++ if (tmp != nil) { /* we have a host header with port */
++ isHTTPS =
++ [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
++ [ms appendString:isHTTPS ? @"https://" : @"http://"];
++ [ms appendString:tmp];
+ }
+- [ms appendString:tmp];
+- }
+- else {
+- // TODO: isHTTPS always no in this case?
+- [ms appendString:isHTTPS ? @"https://" : @"http://"];
++ else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
++ /* sometimes the URL is just wrong! (suggests port 80) */
++ if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
++ [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
++ __PRETTY_FUNCTION__, tmp];
++ tmp = [tmp substringToIndex:([tmp length] - 2)];
++ }
++ else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
++ /* see OGo bug #1435, Debian Apache hack */
++ [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
++ @"assuming Debian/Apache bug (OGo #1435): '%@'",
++ __PRETTY_FUNCTION__, tmp];
++ tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
++ tmp = [@"https" stringByAppendingString:tmp];
++ }
++ [ms appendString:tmp];
++ }
++ else {
++ // TODO: isHTTPS always no in this case?
++ [ms appendString:isHTTPS ? @"https://" : @"http://"];
+
+- [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
+- if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
+- [ms appendFormat:@":%i", port];
++ [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
++ if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
++ [ms appendFormat:@":%i", port];
++ }
+ }
+ }
+
Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
===================================================================
--- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1546)