~ubuntu-branches/ubuntu/precise/gnustep-base/precise

« back to all changes in this revision

Viewing changes to Source/GSHTTPURLHandle.m

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-07-05 09:49:51 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080705094951-gs19i3erqo2xx6if
Tags: 1.16.1-2ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  + debian/rules:
    - Add lpia to ALL_ARCHS supported architectures.
  + debian/control:
    - Add lpia architecture where needed.
  + debian/control{,.m4}:
    - Update Maintainer field as per spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   This library is free software; you can redistribute it and/or
11
11
   modify it under the terms of the GNU Lesser General Public
12
12
   License as published by the Free Software Foundation; either
13
 
   version 3 of the License, or (at your option) any later version.
 
13
   version 2 of the License, or (at your option) any later version.
14
14
 
15
15
   This library is distributed in the hope that it will be useful,
16
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
23
23
   Boston, MA 02111 USA.
24
24
*/
25
25
 
26
 
#include "config.h"
27
 
#include "Foundation/NSArray.h"
28
 
#include "Foundation/NSByteOrder.h"
29
 
#include "Foundation/NSData.h"
30
 
#include "Foundation/NSDebug.h"
31
 
#include "Foundation/NSException.h"
32
 
#include "Foundation/NSFileHandle.h"
33
 
#include "Foundation/NSHost.h"
34
 
#include "Foundation/NSLock.h"
35
 
#include "Foundation/NSMapTable.h"
36
 
#include "Foundation/NSNotification.h"
37
 
#include "Foundation/NSPathUtilities.h"
38
 
#include "Foundation/NSProcessInfo.h"
39
 
#include "Foundation/NSRunLoop.h"
40
 
#include "Foundation/NSString.h"
41
 
#include "Foundation/NSURL.h"
42
 
#include "Foundation/NSURLHandle.h"
43
 
#include "Foundation/NSValue.h"
44
 
#include "GNUstepBase/GSMime.h"
45
 
#include "GNUstepBase/GSLock.h"
46
 
#include "NSCallBacks.h"
47
 
#include "GSURLPrivate.h"
48
 
#include "GSPrivate.h"
 
26
#import "config.h"
 
27
#import "Foundation/NSArray.h"
 
28
#import "Foundation/NSDictionary.h"
 
29
#import "Foundation/NSEnumerator.h"
 
30
#import "Foundation/NSByteOrder.h"
 
31
#import "Foundation/NSData.h"
 
32
#import "Foundation/NSDebug.h"
 
33
#import "Foundation/NSException.h"
 
34
#import "Foundation/NSFileHandle.h"
 
35
#import "Foundation/NSHost.h"
 
36
#import "Foundation/NSLock.h"
 
37
#import "Foundation/NSMapTable.h"
 
38
#import "Foundation/NSNotification.h"
 
39
#import "Foundation/NSPathUtilities.h"
 
40
#import "Foundation/NSProcessInfo.h"
 
41
#import "Foundation/NSRunLoop.h"
 
42
#import "Foundation/NSString.h"
 
43
#import "Foundation/NSURL.h"
 
44
#import "Foundation/NSURLHandle.h"
 
45
#import "Foundation/NSValue.h"
 
46
#import "GNUstepBase/GSMime.h"
 
47
#import "GNUstepBase/GSLock.h"
 
48
#import "NSCallBacks.h"
 
49
#import "GSURLPrivate.h"
 
50
#import "GSPrivate.h"
49
51
 
50
52
#include <string.h>
51
53
#ifdef HAVE_UNISTD_H
68
70
 * captialisation of headers (some http software is faulty like that).
69
71
 */
70
72
static unsigned int
71
 
_non_retained_id_hash(void *table, NSString* o)
 
73
_id_hash(void *table, NSString* o)
72
74
{
73
75
  return [[o uppercaseString] hash];
74
76
}
75
77
 
76
78
static BOOL
77
 
_non_retained_id_is_equal(void *table, NSString *o, NSString *p)
 
79
_id_is_equal(void *table, NSString *o, NSString *p)
78
80
{
79
81
  return ([o caseInsensitiveCompare: p] == NSOrderedSame) ? YES : NO;
80
82
}
87
89
 
88
90
static const NSMapTableKeyCallBacks writeKeyCallBacks =
89
91
{
90
 
  (NSMT_hash_func_t) _non_retained_id_hash,
91
 
  (NSMT_is_equal_func_t) _non_retained_id_is_equal,
92
 
  (NSMT_retain_func_t) _NS_non_retained_id_retain,
93
 
  (NSMT_release_func_t) _NS_non_retained_id_release,
94
 
  (NSMT_describe_func_t) _NS_non_retained_id_describe,
 
92
  (NSMT_hash_func_t) _id_hash,
 
93
  (NSMT_is_equal_func_t) _id_is_equal,
 
94
  (NSMT_retain_func_t) _NS_id_retain,
 
95
  (NSMT_release_func_t) _NS_id_release,
 
96
  (NSMT_describe_func_t) _NS_id_describe,
95
97
  NSNotAPointerMapKey
96
98
};
97
99
 
382
384
 
383
385
+ (BOOL) canInitWithURL: (NSURL*)newUrl
384
386
{
385
 
  if ([[newUrl scheme] isEqualToString: @"http"]
386
 
    || [[newUrl scheme] isEqualToString: @"https"])
 
387
  NSString      *scheme = [newUrl scheme];
 
388
 
 
389
  if ([scheme isEqualToString: @"http"]
 
390
    || [scheme isEqualToString: @"https"])
387
391
    {
388
392
      return YES;
389
393
    }
980
984
    }
981
985
  if ([[u scheme] isEqualToString: @"https"])
982
986
    {
983
 
      /*
984
 
       * If we are an https connection, negotiate secure connection
 
987
      /* If we are an https connection, negotiate secure connection.
 
988
       * Make sure we are not an observer of the file handle while
 
989
       * it is connecting...
985
990
       */
 
991
      [nc removeObserver: self name: nil object: sock];
986
992
      if ([sock sslConnect] == NO)
987
993
        {
988
994
          [self endLoadInBackground];