]> err.no Git - scalable-opengroupware.org/blob - SOPE/sope-patchset-r1546.diff
55614c2519d16fb2b548e7459fdba107c51817f9
[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-core/NGExtensions/FdExt.subproj/NSString+Encoding.m
556 ===================================================================
557 --- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m    (révision 1546)
558 +++ sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m    (copie de travail)
559 @@ -20,6 +20,8 @@
560    02111-1307, USA.
561  */
562  
563 +#include <unistd.h>
564 +
565  #include <NGExtensions/NSString+Encoding.h>
566  #include <NGExtensions/NSObject+Logs.h>
567  #include "common.h"
568 @@ -81,7 +83,6 @@
569  
570  #else /* ! NeXT_Foundation_LIBRARY */
571  
572 -
573  @implementation NSString(Encoding)
574  
575  #if GNUSTEP_BASE_LIBRARY
576 @@ -192,17 +193,17 @@
577  
578      memcpy(outbuf, _src, _srcLen);
579      *outLen_ = outlen;
580 -    
581 +
582      return outbuf;
583    }
584    result     = nil;
585    fromEncode = [_fromEncode cString];
586    toEncode   = [_toEncode   cString];
587 -  
588 +
589    type       = iconv_open(toEncode, fromEncode);
590    inbuf      = NULL;
591    outbuf     = NULL;
592 -  
593 +
594    if ((type == (iconv_t)-1)) {
595      [self logWithFormat:@"%s: Could not handle iconv encoding. FromEncoding:%@"
596            @" to encoding:%@", __PRETTY_FUNCTION__, _fromEncode, _toEncode];
597 @@ -228,25 +229,25 @@
598      }
599      else if (errno == EINVAL) {
600        [self logWithFormat:@"Got incomplete multibyte sequence. ToEncode: %@"
601 -       @" FromEncode: %@", _toEncode, _fromEncode];
602 +           @" FromEncode: %@", _toEncode, _fromEncode];
603        if (IconvLogEnabled)
604          [self logWithFormat:@"ByteSequence:\n%s\n", _src];
605 -      
606 +
607      }
608      else if (errno == E2BIG) {
609        [self logWithFormat:
610 -             @"Got to small outputbuffer (inbytesleft=%d, outbytesleft=%d, "
611 -             @"outlen=%d). ToEncode: %@ FromEncode: %@", 
612 -             inbytesleft, outbytesleft, outlen,
613 -             _toEncode, _fromEncode];
614 +              @"Got to small outputbuffer (inbytesleft=%d, outbytesleft=%d, "
615 +           @"outlen=%d). ToEncode: %@ FromEncode: %@",
616 +           inbytesleft, outbytesleft, outlen,
617 +           _toEncode, _fromEncode];
618        if (IconvLogEnabled)
619          [self logWithFormat:@"ByteSequence:\n%s\n", _src];
620 -      
621 +
622        goto CLEAR_AND_RETURN;
623      }
624      else {
625        [self logWithFormat:@"Got unexpected error. ToEncode: %@"
626 -       @" FromEncode: %@", _toEncode, _fromEncode];
627 +           @" FromEncode: %@", _toEncode, _fromEncode];
628        goto CLEAR_AND_RETURN;
629      }
630    }
631 @@ -255,45 +256,224 @@
632  #endif
633    if (type)
634      iconv_close(type);
635 -  
636 +
637    *outLen_ = outlen - outbytesleft;
638 -  
639 +
640    return outbuf;
641 -  
642 +
643   CLEAR_AND_RETURN:
644    if (type)
645      iconv_close(type);
646 -  
647 +
648    if (outbuf) {
649      free(outbuf); outbuf = NULL;
650    }
651    return NULL;
652  }
653  
654 -+ (NSString *)stringWithData:(NSData *)_data
655 -  usingEncodingNamed:(NSString *)_encoding
656 ++ (int) encodingForCharset: (NSString *) theCharset
657 + convertToNSStringEncoding: (BOOL) shouldConvert
658  {
659 -  void      *inbuf, *res;
660 -  unsigned  len, inbufLen;
661 -  NSString  *result;
662 +  // We define some aliases for the string encoding.
663 +  static struct { NSString *name; int encoding; BOOL fromCoreFoundation; } encodings[] = {
664 +    {@"ascii"         ,NSASCIIStringEncoding          ,NO},
665 +    {@"us-ascii"      ,NSASCIIStringEncoding          ,NO},
666 +    {@"default"       ,NSASCIIStringEncoding          ,NO},  // Ah... spammers.
667 +    {@"utf-8"         ,NSUTF8StringEncoding           ,NO},
668 +    {@"iso-8859-1"    ,NSISOLatin1StringEncoding      ,NO},
669 +    {@"x-user-defined",NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in Outlook.
670 +    {@"unknown"       ,NSISOLatin1StringEncoding      ,NO},  // Once more, blame Outlook.
671 +    {@"x-unknown"     ,NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in Pine 4.21.
672 +    {@"unknown-8bit"  ,NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in Mutt/1.3.28i
673 +    {@"0"             ,NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in QUALCOMM Windows Eudora Version 6.0.1.1
674 +    {@""              ,NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in Ximian Evolution
675 +    {@"iso8859_1"     ,NSISOLatin1StringEncoding      ,NO},  // To prevent a lame bug in Openwave WebEngine
676 +    {@"iso-8859-2"    ,NSISOLatin2StringEncoding      ,NO},
677 +#ifndef MACOSX
678 +    {@"iso-8859-3"   ,NSISOLatin3StringEncoding                 ,NO},
679 +    {@"iso-8859-4"   ,NSISOLatin4StringEncoding                 ,NO},
680 +    {@"iso-8859-5"   ,NSISOCyrillicStringEncoding               ,NO},
681 +    {@"iso-8859-6"   ,NSISOArabicStringEncoding                 ,NO},
682 +    {@"iso-8859-7"   ,NSISOGreekStringEncoding                  ,NO},
683 +    {@"iso-8859-8"   ,NSISOHebrewStringEncoding                 ,NO},
684 +    {@"iso-8859-9"   ,NSISOLatin5StringEncoding                 ,NO},
685 +    {@"iso-8859-10"  ,NSISOLatin6StringEncoding                 ,NO},
686 +    {@"iso-8859-11"  ,NSISOThaiStringEncoding                   ,NO},
687 +    {@"iso-8859-13"  ,NSISOLatin7StringEncoding                 ,NO},
688 +    {@"iso-8859-14"  ,NSISOLatin8StringEncoding                 ,NO},
689 +    {@"iso-8859-15"  ,NSISOLatin9StringEncoding                 ,NO},
690 +    {@"koi8-r"       ,NSKOI8RStringEncoding                     ,NO},
691 +    {@"big5"         ,NSBIG5StringEncoding                      ,NO},
692 +    {@"gb2312"       ,NSGB2312StringEncoding                    ,NO},
693 +    {@"utf-7"        ,NSUTF7StringEncoding                      ,NO},
694 +    {@"unicode-1-1-utf-7", NSUTF7StringEncoding                 ,NO},  // To prever a bug (sort of) in MS Hotmail
695 +#endif
696 +    {@"windows-1250" ,NSWindowsCP1250StringEncoding             ,NO},
697 +    {@"windows-1251" ,NSWindowsCP1251StringEncoding             ,NO},
698 +    {@"cyrillic (windows-1251)", NSWindowsCP1251StringEncoding  ,NO},  // To prevent a bug in MS Hotmail
699 +    {@"windows-1252" ,NSWindowsCP1252StringEncoding             ,NO},
700 +    {@"windows-1253" ,NSWindowsCP1253StringEncoding             ,NO},
701 +    {@"windows-1254" ,NSWindowsCP1254StringEncoding             ,NO},
702 +    {@"iso-2022-jp"  ,NSISO2022JPStringEncoding                 ,NO},
703 +    {@"euc-jp"       ,NSJapaneseEUCStringEncoding               ,NO},
704 +  };
705 +  
706 +  NSString *name;
707 +  int i;
708  
709 -  if (![_encoding length])
710 -    return nil;
711 +  name = [theCharset lowercaseString];
712    
713 -  inbufLen = [_data length];
714 -  inbuf    = calloc(sizeof(char), inbufLen + 4);
715 -  [_data getBytes:inbuf];
716 +  for (i = 0; i < sizeof(encodings)/sizeof(encodings[0]); i++)
717 +    {
718 +      if ([name isEqualToString: encodings[i].name])
719 +        {
720 +          int enc = encodings[i].encoding;
721 +          // Under OS X, we use CoreFoundation if necessary to convert the encoding
722 +          // to a NSString encoding.
723 +#ifdef MACOSX
724 +          if (encodings[i].fromCoreFoundation)
725 +            {
726 +              if (shouldConvert)
727 +               {
728 +                 return CFStringConvertEncodingToNSStringEncoding(enc);
729 +               }
730 +             else
731 +               {
732 +                 return enc;
733 +               }
734 +           }
735 +          else
736 +            {
737 +              if (!shouldConvert)
738 +               {
739 +                 return CFStringConvertNSStringEncodingToEncoding(enc);
740 +               }
741 +              else
742 +               {
743 +                 return enc;
744 +               }
745 +           }
746 +#else
747 +          return enc;
748 +#endif
749 +        }
750 +    }
751    
752 -  result = nil;
753 -  res    = iconv_wrapper(self, inbuf, inbufLen, _encoding, unicharEncoding, &len);
754 -  if (res) {
755 -    result = [[NSString alloc] initWithCharacters:res length:(len / 2)];
756 -    free(res); res = NULL;
757 -  }
758 -  if (inbuf) free(inbuf); inbuf = NULL;
759 -  return [result autorelease];
760 +#ifdef MACOSX
761 +  // Last resort: try using CoreFoundation...
762 +  CFStringEncoding enc;
763 +  
764 +  enc = CFStringConvertIANACharSetNameToEncoding((CFStringRef)name);
765 +  if (kCFStringEncodingInvalidId != enc)
766 +    {
767 +      if (shouldConvert)
768 +       {
769 +         return CFStringConvertEncodingToNSStringEncoding(enc);
770 +       }
771 +      else
772 +       {
773 +         return enc;
774 +       }
775 +    }
776 +#endif
777 +  
778 +  return -1;
779  }
780  
781 ++ (int) encodingForCharset: (NSString *) theCharset
782 +{
783 +  return [self encodingForCharset: theCharset convertToNSStringEncoding: YES];
784 +}
785 +
786 ++ (NSString *) stringWithData: (NSData *) theData
787 +          usingEncodingNamed: (NSString *) theCharset
788 +{
789 +  int encoding;
790 +  
791 +  if (theData == nil)
792 +    {
793 +      return nil;
794 +    }
795 +  
796 +#ifdef MACOSX
797 +  encoding = [NSString encodingForCharset: theCharset
798 +                convertToNSStringEncoding: NO];
799 +#else
800 +  encoding = [NSString encodingForCharset: theCharset];
801 +#endif
802 +
803 +  if (encoding == -1)
804 +    {
805 +      NSString *aString;
806 +      const char *i_bytes;
807 +      char *o_bytes;
808 +
809 +      size_t i_length, o_length;
810 +      int total_length, ret;
811 +      iconv_t conv;
812 +      
813 +      // Instead of calling cString directly on theCharset, we first try
814 +      // to obtain the ASCII string of the data object.
815 +      if (!theCharset)
816 +       {
817 +         return nil;
818 +       }
819 +      
820 +      conv = iconv_open("UTF-8", [[theCharset uppercaseString] cStringUsingEncoding: NSISOLatin1StringEncoding]);
821 +      
822 +      if ((int)conv < 0)
823 +       {
824 +         // Let's assume we got US-ASCII here.
825 +         return AUTORELEASE([[NSString alloc] initWithData: theData  encoding: NSASCIIStringEncoding]);
826 +       }
827 +      
828 +      i_bytes = [theData bytes];
829 +      i_length = [theData length];
830 +      
831 +      total_length = o_length = sizeof(unichar)*i_length;
832 +      o_bytes = (char *)malloc(o_length);
833 +      
834 +      if (o_bytes == NULL) return nil;
835 +
836 +      while (i_length > 0)
837 +       {
838 +         ret = iconv(conv, (char **)&i_bytes, &i_length, &o_bytes, &o_length);
839 +         
840 +         if (ret == (size_t)-1)
841 +           {
842 +             iconv_close(conv);
843 +             
844 +             total_length = total_length - o_length;
845 +             o_bytes -= total_length;
846 +             free(o_bytes);
847 +             return nil;
848 +           }
849 +       }
850 +      
851 +      total_length = total_length - o_length;
852 +      o_bytes -= total_length;
853 +      
854 +      // If we haven't used all our allocated buffer, we shrink it.
855 +      if (o_length > 0)
856 +       {
857 +         o_bytes = realloc(o_bytes, total_length);
858 +       }
859 +      
860 +      aString = [[NSString alloc] initWithData: [NSData dataWithBytesNoCopy: o_bytes
861 +                                                       length: total_length]
862 +                                 encoding: NSUTF8StringEncoding];
863 +      iconv_close(conv);
864 +      
865 +      return AUTORELEASE(aString);
866 +    }
867 +
868 +#ifdef MACOSX
869 +  return AUTORELEASE((NSString *)CFStringCreateFromExternalRepresentation(NULL, (CFDataRef)theData, encoding));
870 +#else
871 +  return AUTORELEASE([[NSString alloc] initWithData: theData  encoding: encoding]);
872 +#endif
873 +}
874 +
875  - (NSData *)dataUsingEncodingNamed:(NSString *)_encoding {
876    unichar  *chars;
877    char     *res;
878 Index: sope-core/NGExtensions/ChangeLog
879 ===================================================================
880 --- sope-core/NGExtensions/ChangeLog    (révision 1546)
881 +++ sope-core/NGExtensions/ChangeLog    (copie de travail)
882 @@ -1,3 +1,10 @@
883 +2007-11-04  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
884 +
885 +       * FdExt.subproj/NSString+Encoding.m: replaced the code of
886 +       stringWithData:usingEncodingNamed: with the code from
887 +       Pantomime/NSString+Extensions.m/stringWithData:charset:, which in
888 +       turn was adapted to take the same argument types.
889 +
890  2007-07-31  Marcus Mueller  <znek@mulle-kybernetik.com>
891  
892         * FdExt.subproj/NSMethodSignature+misc.m: added warning and bogus
893 Index: sope-appserver/NGObjWeb/GNUmakefile.postamble
894 ===================================================================
895 --- sope-appserver/NGObjWeb/GNUmakefile.postamble       (révision 1546)
896 +++ sope-appserver/NGObjWeb/GNUmakefile.postamble       (copie de travail)
897 @@ -23,14 +23,20 @@
898  
899  # install makefiles
900  
901 -after-install ::
902 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
903 +
904 +ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
905 +after-install :: $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
906 +endif
907 +
908 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make: ngobjweb.make
909         $(MKDIRS) $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/
910         $(INSTALL_DATA) ngobjweb.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
911  
912 -ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
913 -after-install ::
914 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make: woapp-gs.make
915         $(INSTALL_DATA) woapp-gs.make    \
916                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make
917 +
918 +$(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make: wobundle-gs.make
919         $(INSTALL_DATA) wobundle-gs.make \
920                 $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
921 -endif
922 Index: sope-appserver/NGObjWeb/WOContext.m
923 ===================================================================
924 --- sope-appserver/NGObjWeb/WOContext.m (révision 1546)
925 +++ sope-appserver/NGObjWeb/WOContext.m (copie de travail)
926 @@ -64,11 +64,13 @@
927  static BOOL     testNSURLs           = NO;
928  static BOOL     newCURLStyle         = NO;
929  static NSString *WOApplicationSuffix = nil;
930 +static NSURL    *redirectURL         = nil;
931  
932  + (void)initialize {
933    static BOOL    didInit = NO;
934    NSUserDefaults *ud;
935    NSString       *cn;
936 +  NSString       *url;
937  
938    if (didInit) return;
939  
940 @@ -91,6 +93,9 @@
941    debugCursor         = [ud boolForKey:@"WODebugCursor"] ? 1 : 0;
942    debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"];
943    WOApplicationSuffix = [[ud stringForKey:@"WOApplicationSuffix"] copy];
944 +  url                 = [ud stringForKey:@"WOApplicationRedirectURL"];
945 +  if (url != nil)
946 +    redirectURL       = [NSURL URLWithString: url];
947  }
948  
949  + (id)contextWithRequest:(WORequest *)_r {
950 @@ -503,6 +508,11 @@
951      return nil;
952    }
953    
954 +  if (redirectURL) {
955 +    // Use URL from user defaults (WOApplicationRedirectURL)
956 +    return redirectURL;
957 +  }
958 +  
959    if ((serverURL = [rq headerForKey:@"x-webobjects-server-url"]) == nil) {
960      if ((host = [rq headerForKey:@"host"]))
961        serverURL = [@"http://" stringByAppendingString:host];
962 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
963 ===================================================================
964 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (révision 1546)
965 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m   (copie de travail)
966 @@ -216,6 +216,12 @@
967        assocCount++;
968      }
969    }
970 +  if (count > 0) {
971 +    if ((self->isAbsolute = OWGetProperty(_config, @"absolute"))) {
972 +      count--;
973 +      assocCount++;
974 +    }
975 +  }
976    
977    self->rest = _config;
978    
979 Index: sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
980 ===================================================================
981 --- sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (révision 1546)
982 +++ sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m       (copie de travail)
983 @@ -40,6 +40,7 @@
984    WOAssociation *string;
985    WOAssociation *target;
986    WOAssociation *disabled;
987 +  WOAssociation *isAbsolute;
988    WOElement     *template;
989    
990    /* new in WO4: */
991 @@ -359,6 +360,7 @@
992  {
993    if ((self = [super initWithName:_name hyperlinkInfo:_info template:_t])) {
994      self->href = _info->href;
995 +    self->isAbsolute = _info->isAbsolute;
996    }
997    return self;
998  }
999 @@ -374,6 +376,9 @@
1000    // TODO: we need a binding to disable rewriting!
1001    NSRange  r;
1002    
1003 +  if ([[self->isAbsolute valueInContext:_ctx] boolValue] == YES)
1004 +    return NO;
1005 +
1006    r = [_s rangeOfString:@":"];
1007    if (r.length == 0) 
1008      return YES;
1009 Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h
1010 ===================================================================
1011 --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (révision 1546)
1012 +++ sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h   (copie de travail)
1013 @@ -41,7 +41,8 @@
1014    WOAssociation *pageName;
1015    WOAssociation *actionClass;
1016    WOAssociation *directActionName;
1017 -  
1018 +  WOAssociation *isAbsolute;
1019 +
1020    BOOL          sidInUrl;
1021  
1022    /* 'ivar' associations */
1023 Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m
1024 ===================================================================
1025 --- sope-appserver/NGObjWeb/SoObjects/SoObject.m        (révision 1546)
1026 +++ sope-appserver/NGObjWeb/SoObjects/SoObject.m        (copie de travail)
1027 @@ -39,22 +39,34 @@
1028  static int debugLookup  = -1;
1029  static int debugBaseURL = -1;
1030  static int useRelativeURLs = -1;
1031 +static int redirectInitted = -1;
1032 +static NSURL *redirectURL = nil;
1033 +
1034  static void _initialize(void) {
1035 +  NSString *url;
1036 +  NSUserDefaults *ud;
1037 +
1038 +  ud = [NSUserDefaults standardUserDefaults];
1039 +
1040    if (debugLookup == -1) {
1041 -    debugLookup = [[NSUserDefaults standardUserDefaults]
1042 -                                  boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
1043 +    debugLookup = [ud boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
1044      NSLog(@"Note(SoObject): SoDebugKeyLookup is enabled!");
1045    }
1046    if (debugBaseURL == -1) {
1047 -    debugBaseURL = [[NSUserDefaults standardUserDefaults]
1048 -                                    boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
1049 +    debugBaseURL = [ud boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
1050      NSLog(@"Note(SoObject): SoDebugBaseURL is enabled!");
1051    }
1052    if (useRelativeURLs == -1) {
1053 -    useRelativeURLs = [[NSUserDefaults standardUserDefaults]
1054 -                                      boolForKey:@"WOUseRelativeURLs"] ?1:0;
1055 +    useRelativeURLs = [ud boolForKey:@"WOUseRelativeURLs"] ?1:0;
1056      NSLog(@"Note(SoObject): relative base URLs are enabled.");
1057    }
1058 +  if (redirectInitted == -1) {
1059 +    url = [ud stringForKey:@"WOApplicationRedirectURL"];
1060 +    if ([url length]) {
1061 +      redirectURL = [[NSURL alloc] initWithString: url];
1062 +    }
1063 +    redirectInitted = 1;
1064 +  }
1065  }
1066  
1067  /* classes */
1068 @@ -318,56 +330,61 @@
1069    
1070    rq = [_ctx request];
1071    ms = [[NSMutableString alloc] initWithCapacity:128];
1072 +
1073 +  if (redirectURL) {
1074 +    [ms appendString: [redirectURL absoluteString]];
1075 +  }
1076 +  else {  
1077 +    if (!useRelativeURLs) {
1078 +      port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
1079    
1080 -  if (!useRelativeURLs) {
1081 -    port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
1082 -  
1083 -    /* this is actually a bug in Apache */
1084 -    if (port == 0) {
1085 -      static BOOL didWarn = NO;
1086 -      if (!didWarn) {
1087 -       [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
1088 -              __PRETTY_FUNCTION__, __LINE__];
1089 -       didWarn = YES;
1090 +      /* this is actually a bug in Apache */
1091 +      if (port == 0) {
1092 +       static BOOL didWarn = NO;
1093 +       if (!didWarn) {
1094 +         [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
1095 +               __PRETTY_FUNCTION__, __LINE__];
1096 +         didWarn = YES;
1097 +       }
1098 +       port = 80;
1099        }
1100 -      port = 80;
1101 -    }
1102    
1103 -    if ((tmp = [rq headerForKey:@"host"]) != nil) { 
1104 -      /* check whether we have a host header with port */
1105 -      if ([tmp rangeOfString:@":"].length == 0)
1106 -       tmp = nil;
1107 -    }
1108 -    if (tmp != nil) { /* we have a host header with port */
1109 -      isHTTPS = 
1110 -       [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
1111 -      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
1112 -      [ms appendString:tmp];
1113 -    }
1114 -    else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
1115 -      /* sometimes the URL is just wrong! (suggests port 80) */
1116 -      if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
1117 -       [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
1118 -             __PRETTY_FUNCTION__, tmp];
1119 -       tmp = [tmp substringToIndex:([tmp length] - 2)];
1120 +      if ((tmp = [rq headerForKey:@"host"]) != nil) { 
1121 +       /* check whether we have a host header with port */
1122 +       if ([tmp rangeOfString:@":"].length == 0)
1123 +         tmp = nil;
1124        }
1125 -      else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
1126 -       /* see OGo bug #1435, Debian Apache hack */
1127 -       [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
1128 -             @"assuming Debian/Apache bug (OGo #1435): '%@'",
1129 -             __PRETTY_FUNCTION__, tmp];
1130 -       tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
1131 -       tmp = [@"https" stringByAppendingString:tmp];
1132 +      if (tmp != nil) { /* we have a host header with port */
1133 +       isHTTPS = 
1134 +         [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
1135 +       [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
1136 +       [ms appendString:tmp];
1137        }
1138 -      [ms appendString:tmp];
1139 -    }
1140 -    else {
1141 -      // TODO: isHTTPS always no in this case?
1142 -      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
1143 +      else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
1144 +       /* sometimes the URL is just wrong! (suggests port 80) */
1145 +       if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
1146 +         [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
1147 +               __PRETTY_FUNCTION__, tmp];
1148 +         tmp = [tmp substringToIndex:([tmp length] - 2)];
1149 +       }
1150 +       else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
1151 +         /* see OGo bug #1435, Debian Apache hack */
1152 +         [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
1153 +               @"assuming Debian/Apache bug (OGo #1435): '%@'",
1154 +               __PRETTY_FUNCTION__, tmp];
1155 +         tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
1156 +         tmp = [@"https" stringByAppendingString:tmp];
1157 +       }
1158 +       [ms appendString:tmp];
1159 +      }
1160 +      else {
1161 +       // TODO: isHTTPS always no in this case?
1162 +       [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
1163    
1164 -      [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
1165 -      if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
1166 -       [ms appendFormat:@":%i", port];
1167 +       [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
1168 +       if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
1169 +         [ms appendFormat:@":%i", port];
1170 +      }
1171      }
1172    }
1173    
1174 Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
1175 ===================================================================
1176 --- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (révision 1546)
1177 +++ sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m   (copie de travail)
1178 @@ -31,6 +31,7 @@
1179  #include <NGObjWeb/WOCookie.h>
1180  #include <NGExtensions/NSData+gzip.h>
1181  #include <NGHttp/NGHttp.h>
1182 +#include <NGMime/NGMimeType.h>
1183  #include "common.h"
1184  
1185  #include <string.h>
1186 @@ -1016,6 +1017,12 @@
1187  - (void)parser:(NGMimePartParser *)_parser didParseHeader:(NGHashMap *)_header {
1188  }
1189  
1190 +- (NGMimeType *)parser:(id)_parser
1191 +  contentTypeOfPart:(id<NGMimePart>)_part
1192 +{
1193 +  return [NGMimeType mimeType: @"text/plain; charset=utf-8"];
1194 +}
1195 +
1196  @end /* WOHttpAdaptor */
1197  
1198  @implementation WOCoreApplication(SimpleParserSelection)