~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/univint/CFHTTPStream.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
     File:       CFNetwork/CFHTTPStream.h
3
 
 
4
 
     Contains:   CoreFoundation Network HTTP streams header
5
 
 
6
 
     Version:    CFNetwork-71.2~1
7
 
 
8
 
     Copyright:  � 2001-2003 by Apple Computer, Inc., all rights reserved
9
 
 
10
 
     Bugs?:      For bug reports, consult the following page on
11
 
                 the World Wide Web:
12
 
 
13
 
                     http://www.freepascal.org/bugs.html
14
 
 
15
 
}
16
 
{         Pascal Translation:  Peter N Lewis, <peter@stairways.com.au>, 2004 }
17
 
 
18
 
 
19
 
{
20
 
    Modified for use with Free Pascal
21
 
    Version 200
22
 
    Please report any bugs to <gpc@microbizz.nl>
23
 
}
24
 
 
25
 
{$mode macpas}
26
 
{$packenum 1}
27
 
{$macro on}
28
 
{$inline on}
29
 
{$CALLING MWPASCAL}
30
 
 
31
 
unit CFHTTPStream;
32
 
interface
33
 
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
34
 
{$setc GAP_INTERFACES_VERSION := $0200}
35
 
 
36
 
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
37
 
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
38
 
{$endc}
39
 
 
40
 
{$ifc defined CPUPOWERPC and defined CPUI386}
41
 
        {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
42
 
{$endc}
43
 
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
44
 
        {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
45
 
{$endc}
46
 
 
47
 
{$ifc not defined __ppc__ and defined CPUPOWERPC}
48
 
        {$setc __ppc__ := 1}
49
 
{$elsec}
50
 
        {$setc __ppc__ := 0}
51
 
{$endc}
52
 
{$ifc not defined __i386__ and defined CPUI386}
53
 
        {$setc __i386__ := 1}
54
 
{$elsec}
55
 
        {$setc __i386__ := 0}
56
 
{$endc}
57
 
 
58
 
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
59
 
        {$error Conflicting definitions for __ppc__ and __i386__}
60
 
{$endc}
61
 
 
62
 
{$ifc defined __ppc__ and __ppc__}
63
 
        {$setc TARGET_CPU_PPC := TRUE}
64
 
        {$setc TARGET_CPU_X86 := FALSE}
65
 
{$elifc defined __i386__ and __i386__}
66
 
        {$setc TARGET_CPU_PPC := FALSE}
67
 
        {$setc TARGET_CPU_X86 := TRUE}
68
 
{$elsec}
69
 
        {$error Neither __ppc__ nor __i386__ is defined.}
70
 
{$endc}
71
 
{$setc TARGET_CPU_PPC_64 := FALSE}
72
 
 
73
 
{$ifc defined FPC_BIG_ENDIAN}
74
 
        {$setc TARGET_RT_BIG_ENDIAN := TRUE}
75
 
        {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
76
 
{$elifc defined FPC_LITTLE_ENDIAN}
77
 
        {$setc TARGET_RT_BIG_ENDIAN := FALSE}
78
 
        {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
79
 
{$elsec}
80
 
        {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
81
 
{$endc}
82
 
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
83
 
{$setc CALL_NOT_IN_CARBON := FALSE}
84
 
{$setc OLDROUTINENAMES := FALSE}
85
 
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
86
 
{$setc OPAQUE_UPP_TYPES := TRUE}
87
 
{$setc OTCARBONAPPLICATION := TRUE}
88
 
{$setc OTKERNEL := FALSE}
89
 
{$setc PM_USE_SESSION_APIS := TRUE}
90
 
{$setc TARGET_API_MAC_CARBON := TRUE}
91
 
{$setc TARGET_API_MAC_OS8 := FALSE}
92
 
{$setc TARGET_API_MAC_OSX := TRUE}
93
 
{$setc TARGET_CARBON := TRUE}
94
 
{$setc TARGET_CPU_68K := FALSE}
95
 
{$setc TARGET_CPU_MIPS := FALSE}
96
 
{$setc TARGET_CPU_SPARC := FALSE}
97
 
{$setc TARGET_OS_MAC := TRUE}
98
 
{$setc TARGET_OS_UNIX := FALSE}
99
 
{$setc TARGET_OS_WIN32 := FALSE}
100
 
{$setc TARGET_RT_MAC_68881 := FALSE}
101
 
{$setc TARGET_RT_MAC_CFM := FALSE}
102
 
{$setc TARGET_RT_MAC_MACHO := TRUE}
103
 
{$setc TYPED_FUNCTION_POINTERS := TRUE}
104
 
{$setc TYPE_BOOL := FALSE}
105
 
{$setc TYPE_EXTENDED := FALSE}
106
 
{$setc TYPE_LONGLONG := TRUE}
107
 
uses MacTypes,CFStream,CFBase,CFHTTPMessage;
108
 
{$ALIGN MAC68K}
109
 
 
110
 
{
111
 
 *  kCFStreamErrorDomainHTTP
112
 
 *  
113
 
 *  Availability:
114
 
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
115
 
 *    CarbonLib:        not available
116
 
 *    Non-Carbon CFM:   not available
117
 
 }
118
 
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
119
 
var kCFStreamErrorDomainHTTP: SInt32; external name '_kCFStreamErrorDomainHTTP'; (* attribute const *)
120
 
type
121
 
        CFStreamErrorHTTP = SInt32;
122
 
const
123
 
  kCFStreamErrorHTTPParseFailure = -1;
124
 
  kCFStreamErrorHTTPRedirectionLoop = -2;
125
 
  kCFStreamErrorHTTPBadURL      = -3;
126
 
 
127
 
{ Value is a CFHTTPMessage with 0 bytes data. }
128
 
{
129
 
 *  kCFStreamPropertyHTTPResponseHeader
130
 
 *  
131
 
 *  Availability:
132
 
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
133
 
 *    CarbonLib:        not available
134
 
 *    Non-Carbon CFM:   not available
135
 
 }
136
 
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
137
 
var kCFStreamPropertyHTTPResponseHeader: CFStringRef; external name '_kCFStreamPropertyHTTPResponseHeader'; (* attribute const *)
138
 
{ Value is the CFURL from the final request; will only differ from the URL in the original request if an autoredirection has occurred. }
139
 
{
140
 
 *  kCFStreamPropertyHTTPFinalURL
141
 
 *  
142
 
 *  Availability:
143
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
144
 
 *    CarbonLib:        not available
145
 
 *    Non-Carbon CFM:   not available
146
 
 }
147
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
148
 
var kCFStreamPropertyHTTPFinalURL: CFStringRef; external name '_kCFStreamPropertyHTTPFinalURL'; (* attribute const *)
149
 
{************************************}
150
 
{Set-able properties on HTTP streams }
151
 
{************************************}
152
 
{ HTTP proxy information is set the same way as SOCKS proxies (see CFSocketStream.h).
153
 
   Call CFReadStreamSetProperty() passing an HTTP stream and the property kCFStreamPropertyHTTPProxy.  
154
 
   The value should be a CFDictionary that includes at least one Host/Port pair from the keys below.  
155
 
   The dictionary returned by SystemConfiguration.framework can also be passed directly as the value }
156
 
{
157
 
 *  kCFStreamPropertyHTTPProxy
158
 
 *  
159
 
 *  Availability:
160
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
161
 
 *    CarbonLib:        not available
162
 
 *    Non-Carbon CFM:   not available
163
 
 }
164
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
165
 
var kCFStreamPropertyHTTPProxy: CFStringRef; external name '_kCFStreamPropertyHTTPProxy'; (* attribute const *)
166
 
{
167
 
 *  kCFStreamPropertyHTTPProxyHost
168
 
 *  
169
 
 *  Availability:
170
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
171
 
 *    CarbonLib:        not available
172
 
 *    Non-Carbon CFM:   not available
173
 
 }
174
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
175
 
var kCFStreamPropertyHTTPProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPProxyHost'; (* attribute const *)
176
 
{ matches kSCPropNetProxiesHTTPProxy; value should be a CFString}
177
 
{
178
 
 *  kCFStreamPropertyHTTPProxyPort
179
 
 *  
180
 
 *  Availability:
181
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
182
 
 *    CarbonLib:        not available
183
 
 *    Non-Carbon CFM:   not available
184
 
 }
185
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
186
 
var kCFStreamPropertyHTTPProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPProxyPort'; (* attribute const *)
187
 
{ matches kSCPropNetProxiesHTTPPort; value should be a CFNumber }
188
 
{
189
 
 *  kCFStreamPropertyHTTPSProxyHost
190
 
 *  
191
 
 *  Availability:
192
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
193
 
 *    CarbonLib:        not available
194
 
 *    Non-Carbon CFM:   not available
195
 
 }
196
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
197
 
var kCFStreamPropertyHTTPSProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyHost'; (* attribute const *)
198
 
{ matches kSCPropNetProxiesHTTPSProxy; value should be a CFString }
199
 
{
200
 
 *  kCFStreamPropertyHTTPSProxyPort
201
 
 *  
202
 
 *  Availability:
203
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
204
 
 *    CarbonLib:        not available
205
 
 *    Non-Carbon CFM:   not available
206
 
 }
207
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
208
 
var kCFStreamPropertyHTTPSProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyPort'; (* attribute const *)
209
 
{ matches kSCPropNetProxiesHTTPSPort; value should be a CFNumber }
210
 
{ Value should be a CFBoolean }
211
 
{
212
 
 *  kCFStreamPropertyHTTPShouldAutoredirect
213
 
 *  
214
 
 *  Availability:
215
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
216
 
 *    CarbonLib:        not available
217
 
 *    Non-Carbon CFM:   not available
218
 
 }
219
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
220
 
var kCFStreamPropertyHTTPShouldAutoredirect: CFStringRef; external name '_kCFStreamPropertyHTTPShouldAutoredirect'; (* attribute const *)
221
 
{ Value should be a CFBoolean.  If this property is set to true, an HTTP stream will look for an appropriate extant persistent connection to use, and if it finds none, will try to create one.  }
222
 
{
223
 
 *  kCFStreamPropertyHTTPAttemptPersistentConnection
224
 
 *  
225
 
 *  Availability:
226
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
227
 
 *    CarbonLib:        not available
228
 
 *    Non-Carbon CFM:   not available
229
 
 }
230
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
231
 
var kCFStreamPropertyHTTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyHTTPAttemptPersistentConnection'; (* attribute const *)
232
 
{ Value is a CFNumber; this property can only be retrieved, not set.  The number returned is the number of bytes from the body of the request that have been written to the underlying socket }
233
 
{
234
 
 *  kCFStreamPropertyHTTPRequestBytesWrittenCount
235
 
 *  
236
 
 *  Availability:
237
 
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
238
 
 *    CarbonLib:        not available
239
 
 *    Non-Carbon CFM:   not available
240
 
 }
241
 
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
242
 
var kCFStreamPropertyHTTPRequestBytesWrittenCount: CFStringRef; external name '_kCFStreamPropertyHTTPRequestBytesWrittenCount'; (* attribute const *)
243
 
{*******************}
244
 
{ Creation routines }
245
 
{*******************}
246
 
{ Creates a read stream for the response to the given request; when the stream is opened,
247
 
  it will begin transmitting the request.  The bytes returned are the pure body bytes; the response header has been parsed off.
248
 
  To retrieve the response header, ask for kCFStreamPropertyHTTPResponseHeader, above, any time after the first bytes arrive on 
249
 
  the stream (or when stream end is reported, if there are no data bytes).
250
 
}
251
 
{
252
 
 *  CFReadStreamCreateForHTTPRequest()
253
 
 *  
254
 
 *  Availability:
255
 
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
256
 
 *    CarbonLib:        not available
257
 
 *    Non-Carbon CFM:   not available
258
 
 }
259
 
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
260
 
function CFReadStreamCreateForHTTPRequest( alloc: CFAllocatorRef; request: CFHTTPMessageRef ): CFReadStreamRef; external name '_CFReadStreamCreateForHTTPRequest';
261
 
 
262
 
 
263
 
{ Creates a read stream for the response to the given requestHeaders plus requestBody.  Use in preference to
264
 
  CFReadStreamCreateForHTTPRequest() when the body of the request is larger than you wish to be resident in memory.  Note that 
265
 
  because streams cannot be reset, read streams created this way cannot have autoredirection enabled.  If the Content-Length 
266
 
  header is set in requestHeaders, it is assumed that the caller got the length right and that requestBody will report 
267
 
  end-of-stream after precisely Content-Length bytes have been read from it.  If the Content-Length header is not set, the 
268
 
  chunked transfer-encoding will be added to requestHeaders, and bytes read from requestBody will be transmitted chunked.
269
 
  The body of requestHeaders is ignored.
270
 
}
271
 
{
272
 
 *  CFReadStreamCreateForStreamedHTTPRequest()
273
 
 *  
274
 
 *  Availability:
275
 
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
276
 
 *    CarbonLib:        not available
277
 
 *    Non-Carbon CFM:   not available
278
 
 }
279
 
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
280
 
function CFReadStreamCreateForStreamedHTTPRequest( alloc: CFAllocatorRef; requestHeaders: CFHTTPMessageRef; requestBody: CFReadStreamRef ): CFReadStreamRef; external name '_CFReadStreamCreateForStreamedHTTPRequest';
281
 
 
282
 
 
283
 
{ Deprecated - Use the properties kCFStreamPropertyHTTPShouldAutoredirect and kCFStreamPropertyHTTPProxy above instead }
284
 
{
285
 
 *  CFHTTPReadStreamSetRedirectsAutomatically()
286
 
 *  
287
 
 *  Availability:
288
 
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
289
 
 *    CarbonLib:        not available
290
 
 *    Non-Carbon CFM:   not available
291
 
 }
292
 
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
293
 
procedure CFHTTPReadStreamSetRedirectsAutomatically( httpStream: CFReadStreamRef; shouldAutoRedirect: Boolean ); external name '_CFHTTPReadStreamSetRedirectsAutomatically';
294
 
 
295
 
 
296
 
{
297
 
 *  CFHTTPReadStreamSetProxy()
298
 
 *  
299
 
 *  Availability:
300
 
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
301
 
 *    CarbonLib:        not available
302
 
 *    Non-Carbon CFM:   not available
303
 
 }
304
 
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
305
 
procedure CFHTTPReadStreamSetProxy( httpStream: CFReadStreamRef; proxyHost: CFStringRef; proxyPort: CFIndex ); external name '_CFHTTPReadStreamSetProxy';
306
 
 
307
 
end.