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