~ubuntu-branches/ubuntu/utopic/gnustep-base/utopic

« back to all changes in this revision

Viewing changes to Source/NSHTTPCookie.m

  • Committer: Package Import Robot
  • Author(s): Paul Gevers
  • Date: 2014-07-19 13:02:18 UTC
  • mfrom: (20.1.6 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140719130218-pn967l7wzjjf90yi
Tags: 1.24.6-2ubuntu1
* debian/rules:
  - Print the config.log if configure fails to debug
    powerpc/ppc64el FTBFS. (LP: #1277975)

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#import "Foundation/NSString.h"
46
46
#import "Foundation/NSCalendarDate.h"
47
47
#import "GNUstepBase/Unicode.h"
48
 
#import "GNUstepBase/NSObject+GNUstepBase.h"
49
48
 
50
49
NSString * const NSHTTPCookieComment = @"Comment";
51
50
NSString * const NSHTTPCookieCommentURL = @"CommentURL";
199
198
  NSEnumerator   *henum = [headerFields keyEnumerator];
200
199
  NSMutableArray *a = [NSMutableArray array];
201
200
  NSString *header;
 
201
 
202
202
  while ((header = [henum nextObject]))
203
203
    {
204
204
      NSMutableArray *suba 
288
288
 
289
289
  /* Check a few values.  Based on Mac OS X tests. */
290
290
  if (![self _isValidProperty: [properties objectForKey: NSHTTPCookiePath]] 
291
 
      || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieDomain]]
292
 
      || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieName]]
293
 
      || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieValue]]
294
 
      )
 
291
    || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieDomain]]
 
292
    || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieName]]
 
293
    || ![self _isValidProperty: [properties objectForKey: NSHTTPCookieValue]]
 
294
    )
295
295
    {
296
296
      [self release];
297
297
      return nil;
299
299
 
300
300
  rawProps = [[properties mutableCopy] autorelease];
301
301
  if ([rawProps objectForKey: @"Created"] == nil)
302
 
    [rawProps setObject: [NSDate date] forKey: @"Created"];
 
302
    {
 
303
      NSInteger seconds;
 
304
      NSDate    *now;
 
305
 
 
306
      /* Round to whole seconds, so that a serialization/deserialisation
 
307
       * cycle produces an identical object whic hcan be used to eliminate
 
308
       * duplicates.
 
309
       */
 
310
      seconds = [NSDate timeIntervalSinceReferenceDate];
 
311
      now = [NSDate dateWithTimeIntervalSinceReferenceDate: seconds]; 
 
312
      [rawProps setObject: now forKey: @"Created"];
 
313
    }
303
314
  if ([rawProps objectForKey: NSHTTPCookieExpires] == nil
304
 
        || [[rawProps objectForKey: NSHTTPCookieExpires] 
 
315
    || [[rawProps objectForKey: NSHTTPCookieExpires] 
305
316
                isKindOfClass: [NSDate class]] == NO)
306
 
    [rawProps setObject: [NSNumber numberWithBool: YES] 
307
 
                 forKey: NSHTTPCookieDiscard];
 
317
    {
 
318
      [rawProps setObject: [NSNumber numberWithBool: YES] 
 
319
                   forKey: NSHTTPCookieDiscard];
 
320
    }
308
321
 
309
322
  this->_properties = [rawProps copy];
310
323
  return self;
357
370
                   [self name], [self value]];
358
371
}
359
372
 
 
373
- (NSUInteger) hash
 
374
{
 
375
  return [[self properties] hash];
 
376
}
 
377
 
 
378
- (BOOL) isEqual: (id)other
 
379
{
 
380
  return [[other properties] isEqual: [self properties]];
 
381
}
360
382
 
361
383
@end
362
384