]> err.no Git - scalable-opengroupware.org/blob - SOPE/sope-patchset-r1546.diff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1227 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SOPE / sope-patchset-r1546.diff
1 Index: sope-mime/NGImap4/NGImap4Connection.m
2 ===================================================================
3 --- sope-mime/NGImap4/NGImap4Connection.m       (révision 1546)
4 +++ sope-mime/NGImap4/NGImap4Connection.m       (copie de travail)
5 @@ -381,7 +381,7 @@
6    
7    if (debugCache) [self logWithFormat:@"  no folders cached yet .."];
8    
9 -  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"*")
10 +  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"")
11                           pattern:@"*"];
12    if (![[result valueForKey:@"result"] boolValue]) {
13      [self errorWithFormat:@"Could not list mailbox hierarchy!"];
14 Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m
15 ===================================================================
16 --- sope-mime/NGImap4/NGImap4ResponseNormalizer.m       (révision 1546)
17 +++ sope-mime/NGImap4/NGImap4ResponseNormalizer.m       (copie de travail)
18 @@ -648,14 +648,13 @@
19    enumerator = [_flags objectEnumerator];
20    cnt = 0;
21    while ((obj = [enumerator nextObject])) {
22 -    if (![obj isNotEmpty])
23 -      continue;
24 -    
25 -    if (![[obj substringToIndex:1] isEqualToString:@"\\"])
26 -      continue;
27 -
28 -    objs[cnt] = [obj substringFromIndex:1];
29 -    cnt++;
30 +    if ([obj isNotEmpty]) {
31 +      if ([obj hasPrefix:@"\\"])
32 +       objs[cnt] = [obj substringFromIndex:1];
33 +      else
34 +       objs[cnt] = obj;
35 +      cnt++;
36 +    }
37    }
38    result = [NSArray arrayWithObjects:objs count:cnt];
39    if (objs) free(objs);
40 Index: sope-mime/NGImap4/NGImap4ResponseParser.m
41 ===================================================================
42 --- sope-mime/NGImap4/NGImap4ResponseParser.m   (révision 1546)
43 +++ sope-mime/NGImap4/NGImap4ResponseParser.m   (copie de travail)
44 @@ -84,6 +84,8 @@
45  static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
46                                          BOOL isBodyStructure);
47  
48 +static NSArray *_parseLanguages();
49 +
50  static NSString *_parseBodyString(NGImap4ResponseParser *self,
51                                    BOOL _convertString);
52  static NSString *_parseBodyDecodeString(NGImap4ResponseParser *self,
53 @@ -111,6 +113,7 @@
54  static NSNumber *_parseUnsigned(NGImap4ResponseParser *self);
55  static NSString *_parseUntil(NGImap4ResponseParser *self, char _c);
56  static NSString *_parseUntil2(NGImap4ResponseParser *self, char _c1, char _c2);
57 +static BOOL _endsWithCQuote(NSString *_string);
58  
59  static __inline__ NSException *_consumeIfMatch
60    (NGImap4ResponseParser *self, unsigned char _m);
61 @@ -649,12 +652,31 @@
62  }
63  
64  - (NSString *)_parseQuotedString {
65 +  NSMutableString *quotedString;
66 +  NSString *tmpString;
67 +  BOOL stop;
68 +
69    /* parse a quoted string, eg '"' */
70    if (_la(self, 0) == '"') {
71      _consume(self, 1);
72 -    return _parseUntil(self, '"');
73 +    quotedString = [NSMutableString string];
74 +    stop = NO;
75 +    while (!stop) {
76 +      tmpString = _parseUntil(self, '"');
77 +      [quotedString appendString: tmpString];
78 +      if(_endsWithCQuote(tmpString)) {
79 +       [quotedString deleteSuffix: @"\\"];
80 +       [quotedString appendString: @"\""];
81 +      }
82 +      else {
83 +       stop = YES;
84 +      }
85 +    }
86    }
87 -  return nil;
88 +  else {
89 +    quotedString = nil;
90 +  }
91 +  return quotedString;
92  }
93  - (void)_consumeOptionalSpace {
94    if (_la(self, 0) == ' ') _consume(self, 1);
95 @@ -1185,7 +1207,7 @@
96    route   = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
97    mailbox = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
98    host    = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
99 -  
100 +
101    if (_la(self, 0) != ')') {
102      [self logWithFormat:@"WARNING: IMAP4 envelope "
103             @"address not properly closed (c0=%c,c1=%c): %@",
104 @@ -1197,6 +1219,7 @@
105    address = [[NGImap4EnvelopeAddress alloc] initWithPersonalName:pname
106                                             sourceRoute:route mailbox:mailbox
107                                             host:host];
108 +
109    return address;
110  }
111  
112 @@ -1627,6 +1650,29 @@
113    return _parseBodyDecodeString(self, _convertString, NO /* no decode */);
114  }
115  
116 +static NSArray *_parseLanguages(NGImap4ResponseParser *self) {
117 +  NSMutableArray *languages;
118 +  NSString *language;
119 +
120 +  languages = [NSMutableArray array];
121 +  if (_la(self, 0) == '(') {
122 +    while (_la(self, 0) != ')') {
123 +      _consume(self,1);
124 +      language = _parseBodyString(self, YES);
125 +      if ([language length])
126 +       [languages addObject: language];
127 +    }
128 +    _consume(self,1);
129 +  }
130 +  else {
131 +    language = _parseBodyString(self, YES);
132 +    if ([language length])
133 +      [languages addObject: language];
134 +  }
135 +
136 +  return languages;
137 +}
138 +
139  static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self)
140  {
141    NSMutableDictionary *list;
142 @@ -1734,10 +1780,11 @@
143                       *encoding, *bodysize;
144    NSDictionary        *parameterList;
145    NSMutableDictionary *dict;
146 +  NSArray            *languages;
147  
148    type = [_parseBodyString(self, YES) lowercaseString];
149    _consumeIfMatch(self, ' ');
150 -  subtype = _parseBodyString(self, YES);
151 +  subtype = [_parseBodyString(self, YES) lowercaseString];
152    _consumeIfMatch(self, ' ');
153    parameterList = _parseBodyParameterList(self);
154    _consumeIfMatch(self, ' ');
155 @@ -1762,7 +1809,8 @@
156      _consumeIfMatch(self, ' ');
157      [dict setObject:_parseBodyString(self, YES) forKey:@"lines"];
158    }
159 -  else if ([type isEqualToString:@"message"]) {
160 +  else if ([type isEqualToString:@"message"]
161 +          && [subtype isEqualToString:@"rfc822"]) {
162      if (_la(self, 0) != ')') {
163        _consumeIfMatch(self, ' ');
164        _consumeIfMatch(self, '(');
165 @@ -1805,14 +1853,9 @@
166               forKey: @"disposition"];
167         if (_la(self, 0) != ')') {
168           _consume(self,1);
169 -         if (_la(self, 0) == '(') {
170 -           [dict setObject: _parseBodyParameterList(self)
171 -                 forKey: @"language"];
172 -         }
173 -         else {
174 -           [dict setObject: _parseBodyString(self, YES)
175 -                 forKey: @"language"];
176 -         }
177 +         languages = _parseLanguages(self);
178 +         if ([languages count])
179 +           [dict setObject: languages forKey: @"languages"];
180           if (_la(self, 0) != ')') {
181             _consume(self,1);
182             [dict setObject: _parseBodyString(self, YES)
183 @@ -1829,6 +1872,7 @@
184  static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
185                                          BOOL isBodyStructure) {
186    NSMutableArray *parts;
187 +  NSArray       *languages;
188    NSString       *kind;
189    NSMutableDictionary *dict;
190  
191 @@ -1854,14 +1898,9 @@
192               forKey: @"disposition"];
193         if (_la(self, 0) != ')') {
194           _consume(self,1);
195 -         if (_la(self, 0) == '(') {
196 -           [dict setObject: _parseBodyParameterList(self)
197 -                 forKey: @"language"];
198 -         }
199 -         else {
200 -           [dict setObject: _parseBodyString(self, YES)
201 -                 forKey: @"language"];
202 -         }
203 +         languages = _parseLanguages(self);
204 +         if ([languages count])
205 +           [dict setObject: languages forKey: @"languages"];
206           if (_la(self, 0) != ')') {
207             _consume(self,1);
208             [dict setObject: _parseBodyString(self, YES)
209 @@ -2170,6 +2209,21 @@
210    }
211  }
212  
213 +static BOOL _endsWithCQuote(NSString *_string){
214 +  unsigned int quoteSlashes;
215 +  int pos;
216 +
217 +  quoteSlashes = 0;
218 +  pos = [_string length] - 1;
219 +  while (pos > -1
220 +        && [_string characterAtIndex: pos] == '\\') {
221 +    quoteSlashes++;
222 +    pos--;
223 +  }
224 +
225 +  return ((quoteSlashes % 2) == 1);
226 +}
227 +
228  - (NSException *)exceptionForFailedMatch:(unsigned char)_match
229    got:(unsigned char)_avail
230  {
231 Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
232 ===================================================================
233 --- sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m        (révision 1546)
234 +++ sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m        (copie de travail)
235 @@ -285,24 +285,16 @@
236  - (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
237    // TODO: use UNICODE
238    NSCalendarDate *date       = nil;
239 -  unsigned char  buf[256];
240 -  unsigned char  *bytes = buf, *pe;
241 +  unsigned char  *bytes, *pe;
242    unsigned       length = 0;
243    NSTimeZone     *tz = nil;
244    char  dayOfMonth, monthOfYear, hour, minute, second;
245    short year;
246    BOOL  flag;
247 -  
248 -  if ((length = [_data cStringLength]) > 254) {
249 -    [self logWithFormat:
250 -           @"header field value to large for date parsing: '%@'(%i)",
251 -           _data, length];
252 -    length = 254;
253 -  }
254 -  
255 -  [_data getCString:(char *)buf maxLength:length];
256 -  buf[length] = '\0';
257 -  
258 +
259 +  length = [_data length];
260 +  bytes = [_data cStringUsingEncoding: NSASCIIStringEncoding];
261 +
262    /* remove leading chars (skip to first digit, the day of the month) */
263    while (length > 0 && (!isdigit(*bytes))) {
264      bytes++;
265 Index: sope-mime/NGMime/NGMimeBodyPart.m
266 ===================================================================
267 --- sope-mime/NGMime/NGMimeBodyPart.m   (révision 1546)
268 +++ sope-mime/NGMime/NGMimeBodyPart.m   (copie de travail)
269 @@ -31,18 +31,6 @@
270    return 2;
271  }
272  
273 -static NGMimeType *defaultType = nil;
274 -
275 -+ (void)initialize {
276 -  static BOOL isInitialized = NO;
277 -  if (!isInitialized) {
278 -    isInitialized = YES;
279 -    
280 -    defaultType =
281 -      [[NGMimeType mimeType:@"text/plain; charset=us-ascii"] retain];
282 -  }
283 -}
284 -  
285  + (id)bodyPartWithHeader:(NGHashMap *)_header {
286    return [[[self alloc] initWithHeader:_header] autorelease];
287  }
288 @@ -156,13 +144,12 @@
289    if (!Fields)
290      Fields = (NGMimeHeaderNames *)[NGMimePartParser headerFieldNames];
291    
292 -  
293    type = [self->header objectForKey:Fields->contentType];
294    
295    if (![type isKindOfClass:[NGMimeType class]])
296      type = [NGMimeType mimeType:[type stringValue]];
297    
298 -  return (type != nil ? type : (id)defaultType);
299 +  return type;
300  }
301  
302  - (NSString *)contentId {
303 Index: sope-mime/NGMime/NGMimeBodyParser.m
304 ===================================================================
305 --- sope-mime/NGMime/NGMimeBodyParser.m (révision 1546)
306 +++ sope-mime/NGMime/NGMimeBodyParser.m (copie de travail)
307 @@ -67,7 +67,10 @@
308    if (_data == nil) return nil;
309    
310    ctype = [_part contentType];
311 -  
312 +  if (!ctype
313 +      && [_d respondsToSelector: @selector(parser:contentTypeOfPart:)])
314 +    ctype = [_d parser: self contentTypeOfPart: _part];
315 +
316    if (![ctype isKindOfClass:[NGMimeType class]])
317      ctype = [NGMimeType mimeType:[ctype stringValue]];
318    
319 Index: sope-mime/NGMime/NGMimePartParser.h
320 ===================================================================
321 --- sope-mime/NGMime/NGMimePartParser.h (révision 1546)
322 +++ sope-mime/NGMime/NGMimePartParser.h (copie de travail)
323 @@ -117,6 +117,7 @@
324      BOOL parserParseRawBodyDataOfPart:1;
325      BOOL parserBodyParserForPart:1;
326      BOOL parserDecodeBodyOfPart:1;
327 +    BOOL parserContentTypeOfPart:1;
328    } delegateRespondsTo;
329  
330    
331 @@ -275,6 +276,9 @@
332  - (id<NGMimeBodyParser>)parser:(NGMimePartParser *)_parser
333    bodyParserForPart:(id<NGMimePart>)_part;
334  
335 +- (NGMimeType *)parser:(id)_parser
336 +  contentTypeOfPart:(id<NGMimePart>)_part;
337 +
338  @end /* NSObject(NGMimePartParserDelegate) */
339  
340  @interface NSObject(NGMimePartParser)
341 Index: sope-mime/NGMime/NGMimePartParser.m
342 ===================================================================
343 --- sope-mime/NGMime/NGMimePartParser.m (révision 1546)
344 +++ sope-mime/NGMime/NGMimePartParser.m (copie de travail)
345 @@ -1091,7 +1091,10 @@
346    id<NGMimeBodyParser> bodyParser   = nil;
347    
348    ctype = [_p contentType];
349 -  
350 +  if (!ctype
351 +      && self->delegateRespondsTo.parserContentTypeOfPart)
352 +    ctype = [self->delegate parser: self contentTypeOfPart: _p];
353 +
354    contentType = ([ctype isKindOfClass:[NGMimeType class]])
355      ? ctype
356      : [NGMimeType mimeType:[ctype stringValue]];
357 Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
358 ===================================================================
359 --- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m  (révision 1546)
360 +++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m  (copie de travail)
361 @@ -713,6 +713,39 @@
362    return ms;
363  }
364  
365 +/* GCSEOAdaptorChannel protocol */
366 +static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n"     \
367 +                                   @"  c_name VARCHAR (256) NOT NULL,\n"
368 +                                   @"  c_content VARCHAR (100000) NOT NULL,\n"
369 +                                   @"  c_creationdate INT4 NOT NULL,\n"
370 +                                   @"  c_lastmodified INT4 NOT NULL,\n"
371 +                                   @"  c_version INT4 NOT NULL,\n"
372 +                                   @"  c_deleted INT4 NULL\n"
373 +                                   @")");
374 +static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n"  \
375 +                                      @"  c_uid VARCHAR (256) NOT NULL,\n"
376 +                                      @"  c_object VARCHAR (256) NOT NULL,\n"
377 +                                      @"  c_role VARCHAR (80) NOT NULL\n"
378 +                                      @")");
379 +
380 +- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
381 +{
382 +  NSString *sql;
383 +
384 +  sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
385 +
386 +  return [self evaluateExpressionX: sql];
387 +}
388 +
389 +- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
390 +{
391 +  NSString *sql;
392 +
393 +  sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
394 +
395 +  return [self evaluateExpressionX: sql];
396 +}
397 +
398  @end /* PostgreSQL72Channel */
399  
400  @implementation PostgreSQL72Channel(PrimaryKeyGeneration)
401 Index: sope-gdl1/Oracle8/GNUmakefile
402 ===================================================================
403 --- sope-gdl1/Oracle8/GNUmakefile       (révision 1546)
404 +++ sope-gdl1/Oracle8/GNUmakefile       (copie de travail)
405 @@ -28,15 +28,23 @@
406  SOPE_ROOT=../..
407  ORACLE_VERSION=10.2.0.3
408  #ORACLE_VERSION=11.1.0.1
409 -ADDITIONAL_INCLUDE_DIRS += -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
410 +ADDITIONAL_INCLUDE_DIRS += -I../../sope-core -I../../sope-core/NGExtensions -I../GDLAccess -I.. -I/usr/include/oracle/$(ORACLE_VERSION)/client
411  
412 +local_arch = $(subst 64,,$(shell uname -m))
413 +
414 +ifeq ($(local_arch),ppc)
415 +PPC_LDFLAGS=-L/opt/ibmcmp/lib -libmc++
416 +else
417 +PPC_LDFLAGS=
418 +endif
419 +
420  ifneq ($(frameworks),yes)
421 -Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
422 -otest_TOOL_LIBS   += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -lGDLAccess -lEOControl
423 +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)
424  else
425 -Oracle8_BUNDLE_LIBS += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
426 -otest_TOOL_LIBS   += -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl
427 +common_LIBS = -L/usr/lib/oracle/$(ORACLE_VERSION)/client/lib/ -locci -lociei -lclntsh -lnnz10 -framework GDLAccess -framework EOControl $(PPC_LDFLAGS)
428  endif
429 +Oracle8_BUNDLE_LIBS += $(common_LIBS)
430 +otest_TOOL_LIBS   += $(common_LIBS)
431  
432  # Bundle
433  BUNDLE_NAME = Oracle8
434 Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
435 ===================================================================
436 --- sope-gdl1/Oracle8/OracleAdaptorChannel.m    (révision 1546)
437 +++ sope-gdl1/Oracle8/OracleAdaptorChannel.m    (copie de travail)
438 @@ -53,14 +53,17 @@
439    while (c--)
440      {
441        info = [[_row_buffer objectAtIndex: c] pointerValue];
442 -      [_row_buffer removeObjectAtIndex: c];
443  
444        // We free our LOB object. If it fails, it likely mean it isn't a LOB
445        // so we just free the value instead.
446 -      if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
447 -       {
448 -         free(info->value);
449 -       }
450 +      if (info->value)
451 +       {
452 +         if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
453 +           free(info->value);
454 +         info->value = NULL;
455 +       }
456 +      free(info);
457 +      [_row_buffer removeObjectAtIndex: c];
458      }
459  
460    OCIHandleFree(_current_stm, OCI_HTYPE_STMT);
461 @@ -75,6 +78,30 @@
462  //
463  @implementation OracleAdaptorChannel
464  
465 +static void
466 +DBTerminate()
467 +{
468 +  if (OCITerminate(OCI_DEFAULT))
469 +    NSLog(@"FAILED: OCITerminate()");
470 +  else
471 +    NSLog(@"Oracle8: environment shut down");
472 +}
473 +
474 ++ (void) initialize
475 +{
476 +  // We Initialize the OCI process environment.
477 +  if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
478 +                    (dvoid * (*)(dvoid *, size_t)) 0,
479 +                    (dvoid * (*)(dvoid *, dvoid *, size_t))0,
480 +                    (void (*)(dvoid *, dvoid *)) 0 ))
481 +    NSLog(@"FAILED: OCIInitialize()");
482 +  else
483 +    {
484 +      NSLog(@"Oracle8: environment initialized");
485 +      atexit(DBTerminate);
486 +    }
487 +}
488 +
489  - (id) initWithAdaptorContext: (EOAdaptorContext *) theAdaptorContext
490  {
491    if ((self = [super initWithAdaptorContext: theAdaptorContext]))
492 @@ -134,10 +161,14 @@
493           NSLog(@"FAILED: OCILogoff()");
494         }
495  
496 -      if (OCITerminate(OCI_DEFAULT))
497 -       {
498 -         NSLog(@"FAILED: OCITerminate()");
499 -       }
500 +
501 +      OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
502 +      OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
503 +      OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
504 +
505 +      _oci_ctx = (OCISvcCtx *)0;
506 +      _oci_err = (OCIError *)0;
507 +      _oci_env = (OCIEnv *)0;
508      }
509  }
510  
511 @@ -151,11 +182,6 @@
512    [self _cleanup];
513  
514    RELEASE(_resultSetProperties);
515 -
516 -  OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
517 -  OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
518 -  OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
519 -
520    RELEASE(delegate);
521  
522    [super dealloc];
523 @@ -368,15 +394,6 @@
524        return NO;
525      }
526  
527 -  // We Initialize the OCI process environment.
528 -  if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
529 -                    (dvoid * (*)(dvoid *, size_t)) 0,
530 -                    (dvoid * (*)(dvoid *, dvoid *, size_t))0,
531 -                    (void (*)(dvoid *, dvoid *)) 0 ))
532 -    {
533 -      NSLog(@"FAILED: OCIInitialize()");
534 -      return NO;
535 -    }
536    
537    if (OCIEnvInit((OCIEnv **)&_oci_env, (ub4)OCI_DEFAULT, (size_t)0, (dvoid **)0))
538      {
539 Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
540 ===================================================================
541 --- sope-gdl1/Oracle8/OracleAdaptorChannelController.m  (révision 1546)
542 +++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m  (copie de travail)
543 @@ -155,7 +155,9 @@
544           OCILobFreeTemporary([theChannel serviceContext], [theChannel errorHandle], info->value);
545           OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB);
546         }
547 +      free(info);
548      }
549 +  [theColumns release];
550  
551    OCIHandleFree(theStatement, OCI_HTYPE_STMT);
552  }
553 Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
554 ===================================================================
555 --- sope-appserver/NGObjWeb/GNUmakefile.postamble       (révision 1546)
556 +++ sope-appserver/NGObjWeb/GNUmakefile.postamble       (copie de travail)
557 @@ -23,14 +23,20 @@
558  
559  # install makefiles
560  
561 -after-install ::
562 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
563 +
564 +ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
565 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
566 +endif
567 +
568 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make: ngobjweb.make
569         $(MKDIRS) $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/
570         $(INSTALL_DATA) ngobjweb.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
571  
572 -ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
573 -after-install ::
574 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make: woapp-gs.make
575         $(INSTALL_DATA) woapp-gs.make    \
576                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make
577 +
578 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make: wobundle-gs.make
579         $(INSTALL_DATA) wobundle-gs.make \
580                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
581 -endif
582 Index: sope-appserver/NGObjWeb/WOContext.m
583 ===================================================================
584 --- sope-appserver/NGObjWeb/WOContext.m (révision 1546)
585 +++ sope-appserver/NGObjWeb/WOContext.m (copie de travail)
586 @@ -64,11 +64,13 @@
587  static BOOL     testNSURLs           = NO;
588  static BOOL     newCURLStyle         = NO;
589  static NSString *WOApplicationSuffix = nil;
590 +static NSURL    *redirectURL         = nil;
591  
592  + (void)initialize {
593    static BOOL    didInit = NO;
594    NSUserDefaults *ud;
595    NSString       *cn;
596 +  NSString       *url;
597  
598    if (didInit) return;
599  
600 @@ -91,6 +93,9 @@
601    debugCursor         = [ud boolForKey:@"WODebugCursor"] ? 1 : 0;
602    debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"];
603    WOApplicationSuffix = [[ud stringForKey:@"WOApplicationSuffix"] copy];
604 +  url                 = [ud stringForKey:@"WOApplicationRedirectURL"];
605 +  if (url != nil)
606 +    redirectURL       = [NSURL URLWithString: url];
607  }
608  
609  + (id)contextWithRequest:(WORequest *)_r {
610 @@ -503,6 +508,11 @@
611      return nil;
612    }
613    
614 +  if (redirectURL) {
615 +    // Use URL from user defaults (WOApplicationRedirectURL)
616 +    return redirectURL;
617 +  }
618 +  
619    if ((serverURL = [rq headerForKey:@"x-webobjects-server-url"]) == nil) {
620      if ((host = [rq headerForKey:@"host"]))
621        serverURL = [@"http://" stringByAppendingString:host];
622 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
623 ===================================================================
624 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (révision 1546)
625 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (copie de travail)
626 @@ -216,6 +216,12 @@
627        assocCount++;
628      }
629    }
630 +  if (count > 0) {
631 +    if ((self->isAbsolute = OWGetProperty(_config, @"absolute"))) {
632 +      count--;
633 +      assocCount++;
634 +    }
635 +  }
636    
637    self->rest = _config;
638    
639 Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
640 ===================================================================
641 --- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (révision 1546)
642 +++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (copie de travail)
643 @@ -40,6 +40,7 @@
644    WOAssociation *string;
645    WOAssociation *target;
646    WOAssociation *disabled;
647 +  WOAssociation *isAbsolute;
648    WOElement     *template;
649    
650    /* new in WO4: */
651 @@ -359,6 +360,7 @@
652  {
653    if ((self = [super initWithName:_name hyperlinkInfo:_info template:_t])) {
654      self->href = _info->href;
655 +    self->isAbsolute = _info->isAbsolute;
656    }
657    return self;
658  }
659 @@ -374,6 +376,9 @@
660    // TODO: we need a binding to disable rewriting!
661    NSRange  r;
662    
663 +  if ([[self->isAbsolute valueInContext:_ctx] boolValue] == YES)
664 +    return NO;
665 +
666    r = [_s rangeOfString:@":"];
667    if (r.length == 0) 
668      return YES;
669 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h
670 ===================================================================
671 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (révision 1546)
672 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (copie de travail)
673 @@ -41,7 +41,8 @@
674    WOAssociation *pageName;
675    WOAssociation *actionClass;
676    WOAssociation *directActionName;
677 -  
678 +  WOAssociation *isAbsolute;
679 +
680    BOOL          sidInUrl;
681  
682    /* 'ivar' associations */
683 Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m
684 ===================================================================
685 --- sope-appserver/NGObjWeb/SoObjects/SoObject.m        (révision 1546)
686 +++ sope-appserver/NGObjWeb/SoObjects/SoObject.m        (copie de travail)
687 @@ -39,22 +39,34 @@
688  static int debugLookup  = -1;
689  static int debugBaseURL = -1;
690  static int useRelativeURLs = -1;
691 +static int redirectInitted = -1;
692 +static NSURL *redirectURL = nil;
693 +
694  static void _initialize(void) {
695 +  NSString *url;
696 +  NSUserDefaults *ud;
697 +
698 +  ud = [NSUserDefaults standardUserDefaults];
699 +
700    if (debugLookup == -1) {
701 -    debugLookup = [[NSUserDefaults standardUserDefaults]
702 -                                  boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
703 +    debugLookup = [ud boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
704      NSLog(@"Note(SoObject): SoDebugKeyLookup is enabled!");
705    }
706    if (debugBaseURL == -1) {
707 -    debugBaseURL = [[NSUserDefaults standardUserDefaults]
708 -                                    boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
709 +    debugBaseURL = [ud boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
710      NSLog(@"Note(SoObject): SoDebugBaseURL is enabled!");
711    }
712    if (useRelativeURLs == -1) {
713 -    useRelativeURLs = [[NSUserDefaults standardUserDefaults]
714 -                                      boolForKey:@"WOUseRelativeURLs"] ?1:0;
715 +    useRelativeURLs = [ud boolForKey:@"WOUseRelativeURLs"] ?1:0;
716      NSLog(@"Note(SoObject): relative base URLs are enabled.");
717    }
718 +  if (redirectInitted == -1) {
719 +    url = [ud stringForKey:@"WOApplicationRedirectURL"];
720 +    if ([url length]) {
721 +      redirectURL = [[NSURL alloc] initWithString: url];
722 +    }
723 +    redirectInitted = 1;
724 +  }
725  }
726  
727  /* classes */
728 @@ -318,56 +330,61 @@
729    
730    rq = [_ctx request];
731    ms = [[NSMutableString alloc] initWithCapacity:128];
732 +
733 +  if (redirectURL) {
734 +    [ms appendString: [redirectURL absoluteString]];
735 +  }
736 +  else {  
737 +    if (!useRelativeURLs) {
738 +      port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
739    
740 -  if (!useRelativeURLs) {
741 -    port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
742 -  
743 -    /* this is actually a bug in Apache */
744 -    if (port == 0) {
745 -      static BOOL didWarn = NO;
746 -      if (!didWarn) {
747 -       [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
748 -              __PRETTY_FUNCTION__, __LINE__];
749 -       didWarn = YES;
750 +      /* this is actually a bug in Apache */
751 +      if (port == 0) {
752 +       static BOOL didWarn = NO;
753 +       if (!didWarn) {
754 +         [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
755 +               __PRETTY_FUNCTION__, __LINE__];
756 +         didWarn = YES;
757 +       }
758 +       port = 80;
759        }
760 -      port = 80;
761 -    }
762    
763 -    if ((tmp = [rq headerForKey:@"host"]) != nil) { 
764 -      /* check whether we have a host header with port */
765 -      if ([tmp rangeOfString:@":"].length == 0)
766 -       tmp = nil;
767 -    }
768 -    if (tmp != nil) { /* we have a host header with port */
769 -      isHTTPS = 
770 -       [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
771 -      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
772 -      [ms appendString:tmp];
773 -    }
774 -    else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
775 -      /* sometimes the URL is just wrong! (suggests port 80) */
776 -      if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
777 -       [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
778 -             __PRETTY_FUNCTION__, tmp];
779 -       tmp = [tmp substringToIndex:([tmp length] - 2)];
780 +      if ((tmp = [rq headerForKey:@"host"]) != nil) { 
781 +       /* check whether we have a host header with port */
782 +       if ([tmp rangeOfString:@":"].length == 0)
783 +         tmp = nil;
784        }
785 -      else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
786 -       /* see OGo bug #1435, Debian Apache hack */
787 -       [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
788 -             @"assuming Debian/Apache bug (OGo #1435): '%@'",
789 -             __PRETTY_FUNCTION__, tmp];
790 -       tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
791 -       tmp = [@"https" stringByAppendingString:tmp];
792 +      if (tmp != nil) { /* we have a host header with port */
793 +       isHTTPS = 
794 +         [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
795 +       [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
796 +       [ms appendString:tmp];
797        }
798 -      [ms appendString:tmp];
799 -    }
800 -    else {
801 -      // TODO: isHTTPS always no in this case?
802 -      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
803 +      else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
804 +       /* sometimes the URL is just wrong! (suggests port 80) */
805 +       if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
806 +         [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
807 +               __PRETTY_FUNCTION__, tmp];
808 +         tmp = [tmp substringToIndex:([tmp length] - 2)];
809 +       }
810 +       else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
811 +         /* see OGo bug #1435, Debian Apache hack */
812 +         [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
813 +               @"assuming Debian/Apache bug (OGo #1435): '%@'",
814 +               __PRETTY_FUNCTION__, tmp];
815 +         tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
816 +         tmp = [@"https" stringByAppendingString:tmp];
817 +       }
818 +       [ms appendString:tmp];
819 +      }
820 +      else {
821 +       // TODO: isHTTPS always no in this case?
822 +       [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
823    
824 -      [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
825 -      if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
826 -       [ms appendFormat:@":%i", port];
827 +       [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
828 +       if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
829 +         [ms appendFormat:@":%i", port];
830 +      }
831      }
832    }
833    
834 Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
835 ===================================================================
836 --- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (révision 1546)
837 +++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (copie de travail)
838 @@ -31,6 +31,7 @@
839  #include <NGObjWeb/WOCookie.h>
840  #include <NGExtensions/NSData+gzip.h>
841  #include <NGHttp/NGHttp.h>
842 +#include <NGMime/NGMimeType.h>
843  #include "common.h"
844  
845  #include <string.h>
846 @@ -1016,6 +1017,12 @@
847  - (void)parser:(NGMimePartParser *)_parser didParseHeader:(NGHashMap *)_header {
848  }
849  
850 +- (NGMimeType *)parser:(id)_parser
851 +  contentTypeOfPart:(id<NGMimePart>)_part
852 +{
853 +  return [NGMimeType mimeType: @"text/plain; charset=utf-8"];
854 +}
855 +
856  @end /* WOHttpAdaptor */
857  
858  @implementation WOCoreApplication(SimpleParserSelection)