2
File: CFNetwork/CFHTTPStream.h
4
Contains: CoreFoundation Network HTTP streams header
6
Version: CFNetwork-71.2~1
8
Copyright: � 2001-2003 by Apple Computer, Inc., all rights reserved
10
Bugs?: For bug reports, consult the following page on
13
http://www.freepascal.org/bugs.html
16
{ Pascal Translation: Peter N Lewis, <peter@stairways.com.au>, 2004 }
20
Modified for use with Free Pascal
22
Please report any bugs to <gpc@microbizz.nl>
33
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
34
{$setc GAP_INTERFACES_VERSION := $0200}
36
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
37
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
40
{$ifc defined CPUPOWERPC and defined CPUI386}
41
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
43
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
44
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
47
{$ifc not defined __ppc__ and defined CPUPOWERPC}
52
{$ifc not defined __i386__ and defined CPUI386}
58
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
59
{$error Conflicting definitions for __ppc__ and __i386__}
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}
69
{$error Neither __ppc__ nor __i386__ is defined.}
71
{$setc TARGET_CPU_PPC_64 := FALSE}
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}
80
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
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;
111
* kCFStreamErrorDomainHTTP
114
* Mac OS X: in version 10.1 and later in CoreServices.framework
115
* CarbonLib: not available
116
* Non-Carbon CFM: not available
118
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
119
var kCFStreamErrorDomainHTTP: SInt32; external name '_kCFStreamErrorDomainHTTP'; (* attribute const *)
121
CFStreamErrorHTTP = SInt32;
123
kCFStreamErrorHTTPParseFailure = -1;
124
kCFStreamErrorHTTPRedirectionLoop = -2;
125
kCFStreamErrorHTTPBadURL = -3;
127
{ Value is a CFHTTPMessage with 0 bytes data. }
129
* kCFStreamPropertyHTTPResponseHeader
132
* Mac OS X: in version 10.1 and later in CoreServices.framework
133
* CarbonLib: not available
134
* Non-Carbon CFM: not available
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. }
140
* kCFStreamPropertyHTTPFinalURL
143
* Mac OS X: in version 10.2 and later in CoreServices.framework
144
* CarbonLib: not available
145
* Non-Carbon CFM: not available
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 }
157
* kCFStreamPropertyHTTPProxy
160
* Mac OS X: in version 10.2 and later in CoreServices.framework
161
* CarbonLib: not available
162
* Non-Carbon CFM: not available
164
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
165
var kCFStreamPropertyHTTPProxy: CFStringRef; external name '_kCFStreamPropertyHTTPProxy'; (* attribute const *)
167
* kCFStreamPropertyHTTPProxyHost
170
* Mac OS X: in version 10.2 and later in CoreServices.framework
171
* CarbonLib: not available
172
* Non-Carbon CFM: not available
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}
178
* kCFStreamPropertyHTTPProxyPort
181
* Mac OS X: in version 10.2 and later in CoreServices.framework
182
* CarbonLib: not available
183
* Non-Carbon CFM: not available
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 }
189
* kCFStreamPropertyHTTPSProxyHost
192
* Mac OS X: in version 10.2 and later in CoreServices.framework
193
* CarbonLib: not available
194
* Non-Carbon CFM: not available
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 }
200
* kCFStreamPropertyHTTPSProxyPort
203
* Mac OS X: in version 10.2 and later in CoreServices.framework
204
* CarbonLib: not available
205
* Non-Carbon CFM: not available
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 }
212
* kCFStreamPropertyHTTPShouldAutoredirect
215
* Mac OS X: in version 10.2 and later in CoreServices.framework
216
* CarbonLib: not available
217
* Non-Carbon CFM: not available
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. }
223
* kCFStreamPropertyHTTPAttemptPersistentConnection
226
* Mac OS X: in version 10.2 and later in CoreServices.framework
227
* CarbonLib: not available
228
* Non-Carbon CFM: not available
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 }
234
* kCFStreamPropertyHTTPRequestBytesWrittenCount
237
* Mac OS X: in version 10.3 and later in CoreServices.framework
238
* CarbonLib: not available
239
* Non-Carbon CFM: not available
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).
252
* CFReadStreamCreateForHTTPRequest()
255
* Mac OS X: in version 10.1 and later in CoreServices.framework
256
* CarbonLib: not available
257
* Non-Carbon CFM: not available
259
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
260
function CFReadStreamCreateForHTTPRequest( alloc: CFAllocatorRef; request: CFHTTPMessageRef ): CFReadStreamRef; external name '_CFReadStreamCreateForHTTPRequest';
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.
272
* CFReadStreamCreateForStreamedHTTPRequest()
275
* Mac OS X: in version 10.2 and later in CoreServices.framework
276
* CarbonLib: not available
277
* Non-Carbon CFM: not available
279
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
280
function CFReadStreamCreateForStreamedHTTPRequest( alloc: CFAllocatorRef; requestHeaders: CFHTTPMessageRef; requestBody: CFReadStreamRef ): CFReadStreamRef; external name '_CFReadStreamCreateForStreamedHTTPRequest';
283
{ Deprecated - Use the properties kCFStreamPropertyHTTPShouldAutoredirect and kCFStreamPropertyHTTPProxy above instead }
285
* CFHTTPReadStreamSetRedirectsAutomatically()
288
* Mac OS X: in version 10.1 and later in CoreServices.framework
289
* CarbonLib: not available
290
* Non-Carbon CFM: not available
292
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
293
procedure CFHTTPReadStreamSetRedirectsAutomatically( httpStream: CFReadStreamRef; shouldAutoRedirect: Boolean ); external name '_CFHTTPReadStreamSetRedirectsAutomatically';
297
* CFHTTPReadStreamSetProxy()
300
* Mac OS X: in version 10.1 and later in CoreServices.framework
301
* CarbonLib: not available
302
* Non-Carbon CFM: not available
304
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
305
procedure CFHTTPReadStreamSetProxy( httpStream: CFReadStreamRef; proxyHost: CFStringRef; proxyPort: CFIndex ); external name '_CFHTTPReadStreamSetProxy';