CFHTTPStream.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. {
  2. File: CFNetwork/CFHTTPStream.h
  3. Contains: CoreFoundation Network HTTP streams header
  4. Copyright: Copyright (c) 2001-2008, Apple Inc. All rights reserved.
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://bugs.freepascal.org
  8. }
  9. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  10. { Pascal Translation Updated: Gale R Paeper, <[email protected]>, 2008 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  12. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  13. { Pascal Translation Updated: Jonas Maebe <[email protected]>, August 2015 }
  14. {
  15. Modified for use with Free Pascal
  16. Version 308
  17. Please report any bugs to <[email protected]>
  18. }
  19. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  20. {$mode macpas}
  21. {$modeswitch cblocks}
  22. {$packenum 1}
  23. {$macro on}
  24. {$inline on}
  25. {$calling mwpascal}
  26. {$IFNDEF FPC_DOTTEDUNITS}
  27. unit CFHTTPStream;
  28. {$ENDIF FPC_DOTTEDUNITS}
  29. interface
  30. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  31. {$setc GAP_INTERFACES_VERSION := $0308}
  32. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  33. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  34. {$endc}
  35. {$ifc defined CPUPOWERPC and defined CPUI386}
  36. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  37. {$endc}
  38. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  39. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  40. {$endc}
  41. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  42. {$setc __ppc__ := 1}
  43. {$elsec}
  44. {$setc __ppc__ := 0}
  45. {$endc}
  46. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  47. {$setc __ppc64__ := 1}
  48. {$elsec}
  49. {$setc __ppc64__ := 0}
  50. {$endc}
  51. {$ifc not defined __i386__ and defined CPUI386}
  52. {$setc __i386__ := 1}
  53. {$elsec}
  54. {$setc __i386__ := 0}
  55. {$endc}
  56. {$ifc not defined __x86_64__ and defined CPUX86_64}
  57. {$setc __x86_64__ := 1}
  58. {$elsec}
  59. {$setc __x86_64__ := 0}
  60. {$endc}
  61. {$ifc not defined __arm__ and defined CPUARM}
  62. {$setc __arm__ := 1}
  63. {$elsec}
  64. {$setc __arm__ := 0}
  65. {$endc}
  66. {$ifc not defined __arm64__ and defined CPUAARCH64}
  67. {$setc __arm64__ := 1}
  68. {$elsec}
  69. {$setc __arm64__ := 0}
  70. {$endc}
  71. {$ifc defined cpu64}
  72. {$setc __LP64__ := 1}
  73. {$elsec}
  74. {$setc __LP64__ := 0}
  75. {$endc}
  76. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  77. {$error Conflicting definitions for __ppc__ and __i386__}
  78. {$endc}
  79. {$ifc defined __ppc__ and __ppc__}
  80. {$setc TARGET_CPU_PPC := TRUE}
  81. {$setc TARGET_CPU_PPC64 := FALSE}
  82. {$setc TARGET_CPU_X86 := FALSE}
  83. {$setc TARGET_CPU_X86_64 := FALSE}
  84. {$setc TARGET_CPU_ARM := FALSE}
  85. {$setc TARGET_CPU_ARM64 := FALSE}
  86. {$setc TARGET_OS_MAC := TRUE}
  87. {$setc TARGET_OS_IPHONE := FALSE}
  88. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  89. {$setc TARGET_OS_EMBEDDED := FALSE}
  90. {$elifc defined __ppc64__ and __ppc64__}
  91. {$setc TARGET_CPU_PPC := FALSE}
  92. {$setc TARGET_CPU_PPC64 := TRUE}
  93. {$setc TARGET_CPU_X86 := FALSE}
  94. {$setc TARGET_CPU_X86_64 := FALSE}
  95. {$setc TARGET_CPU_ARM := FALSE}
  96. {$setc TARGET_CPU_ARM64 := FALSE}
  97. {$setc TARGET_OS_MAC := TRUE}
  98. {$setc TARGET_OS_IPHONE := FALSE}
  99. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  100. {$setc TARGET_OS_EMBEDDED := FALSE}
  101. {$elifc defined __i386__ and __i386__}
  102. {$setc TARGET_CPU_PPC := FALSE}
  103. {$setc TARGET_CPU_PPC64 := FALSE}
  104. {$setc TARGET_CPU_X86 := TRUE}
  105. {$setc TARGET_CPU_X86_64 := FALSE}
  106. {$setc TARGET_CPU_ARM := FALSE}
  107. {$setc TARGET_CPU_ARM64 := FALSE}
  108. {$ifc defined iphonesim}
  109. {$setc TARGET_OS_MAC := FALSE}
  110. {$setc TARGET_OS_IPHONE := TRUE}
  111. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  112. {$elsec}
  113. {$setc TARGET_OS_MAC := TRUE}
  114. {$setc TARGET_OS_IPHONE := FALSE}
  115. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  116. {$endc}
  117. {$setc TARGET_OS_EMBEDDED := FALSE}
  118. {$elifc defined __x86_64__ and __x86_64__}
  119. {$setc TARGET_CPU_PPC := FALSE}
  120. {$setc TARGET_CPU_PPC64 := FALSE}
  121. {$setc TARGET_CPU_X86 := FALSE}
  122. {$setc TARGET_CPU_X86_64 := TRUE}
  123. {$setc TARGET_CPU_ARM := FALSE}
  124. {$setc TARGET_CPU_ARM64 := FALSE}
  125. {$ifc defined iphonesim}
  126. {$setc TARGET_OS_MAC := FALSE}
  127. {$setc TARGET_OS_IPHONE := TRUE}
  128. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  129. {$elsec}
  130. {$setc TARGET_OS_MAC := TRUE}
  131. {$setc TARGET_OS_IPHONE := FALSE}
  132. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  133. {$endc}
  134. {$setc TARGET_OS_EMBEDDED := FALSE}
  135. {$elifc defined __arm__ and __arm__}
  136. {$setc TARGET_CPU_PPC := FALSE}
  137. {$setc TARGET_CPU_PPC64 := FALSE}
  138. {$setc TARGET_CPU_X86 := FALSE}
  139. {$setc TARGET_CPU_X86_64 := FALSE}
  140. {$setc TARGET_CPU_ARM := TRUE}
  141. {$setc TARGET_CPU_ARM64 := FALSE}
  142. {$setc TARGET_OS_MAC := FALSE}
  143. {$setc TARGET_OS_IPHONE := TRUE}
  144. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  145. {$setc TARGET_OS_EMBEDDED := TRUE}
  146. {$elifc defined __arm64__ and __arm64__}
  147. {$setc TARGET_CPU_PPC := FALSE}
  148. {$setc TARGET_CPU_PPC64 := FALSE}
  149. {$setc TARGET_CPU_X86 := FALSE}
  150. {$setc TARGET_CPU_X86_64 := FALSE}
  151. {$setc TARGET_CPU_ARM := FALSE}
  152. {$setc TARGET_CPU_ARM64 := TRUE}
  153. {$ifc defined ios}
  154. {$setc TARGET_OS_MAC := FALSE}
  155. {$setc TARGET_OS_IPHONE := TRUE}
  156. {$setc TARGET_OS_EMBEDDED := TRUE}
  157. {$elsec}
  158. {$setc TARGET_OS_MAC := TRUE}
  159. {$setc TARGET_OS_IPHONE := FALSE}
  160. {$setc TARGET_OS_EMBEDDED := FALSE}
  161. {$endc}
  162. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  163. {$elsec}
  164. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  165. {$endc}
  166. {$ifc defined __LP64__ and __LP64__ }
  167. {$setc TARGET_CPU_64 := TRUE}
  168. {$elsec}
  169. {$setc TARGET_CPU_64 := FALSE}
  170. {$endc}
  171. {$ifc defined FPC_BIG_ENDIAN}
  172. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  173. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  174. {$elifc defined FPC_LITTLE_ENDIAN}
  175. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  176. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  177. {$elsec}
  178. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  179. {$endc}
  180. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  181. {$setc CALL_NOT_IN_CARBON := FALSE}
  182. {$setc OLDROUTINENAMES := FALSE}
  183. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  184. {$setc OPAQUE_UPP_TYPES := TRUE}
  185. {$setc OTCARBONAPPLICATION := TRUE}
  186. {$setc OTKERNEL := FALSE}
  187. {$setc PM_USE_SESSION_APIS := TRUE}
  188. {$setc TARGET_API_MAC_CARBON := TRUE}
  189. {$setc TARGET_API_MAC_OS8 := FALSE}
  190. {$setc TARGET_API_MAC_OSX := TRUE}
  191. {$setc TARGET_CARBON := TRUE}
  192. {$setc TARGET_CPU_68K := FALSE}
  193. {$setc TARGET_CPU_MIPS := FALSE}
  194. {$setc TARGET_CPU_SPARC := FALSE}
  195. {$setc TARGET_OS_UNIX := FALSE}
  196. {$setc TARGET_OS_WIN32 := FALSE}
  197. {$setc TARGET_RT_MAC_68881 := FALSE}
  198. {$setc TARGET_RT_MAC_CFM := FALSE}
  199. {$setc TARGET_RT_MAC_MACHO := TRUE}
  200. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  201. {$setc TYPE_BOOL := FALSE}
  202. {$setc TYPE_EXTENDED := FALSE}
  203. {$setc TYPE_LONGLONG := TRUE}
  204. {$IFDEF FPC_DOTTEDUNITS}
  205. uses MacOsApi.MacTypes,MacOsApi.CFStream,MacOsApi.CFBase,MacOsApi.CFHTTPMessage;
  206. {$ELSE FPC_DOTTEDUNITS}
  207. uses MacTypes,CFStream,CFBase,CFHTTPMessage;
  208. {$ENDIF FPC_DOTTEDUNITS}
  209. {$endc} {not MACOSALLINCLUDE}
  210. {$ALIGN POWER}
  211. {
  212. * kCFStreamErrorDomainHTTP
  213. *
  214. * Discussion:
  215. * Result code returned by HTTP server
  216. *
  217. * Availability:
  218. * Mac OS X: in version 10.1 and later in CoreServices.framework
  219. * CarbonLib: not available
  220. * Non-Carbon CFM: not available
  221. }
  222. var kCFStreamErrorDomainHTTP: SInt32; external name '_kCFStreamErrorDomainHTTP'; (* attribute const *)
  223. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  224. {
  225. * CFStreamErrorHTTP
  226. *
  227. * Discussion:
  228. * Errors from the kCFStreamErrorDomainHTTP domain.
  229. }
  230. type
  231. CFStreamErrorHTTP = SInt32;
  232. const
  233. {
  234. * Could not parse the request/response.
  235. }
  236. kCFStreamErrorHTTPParseFailure = -1;
  237. {
  238. * A loop was detected during redirection.
  239. }
  240. kCFStreamErrorHTTPRedirectionLoop = -2;
  241. {
  242. * Could not retreive url for request/response.
  243. }
  244. kCFStreamErrorHTTPBadURL = -3;
  245. {
  246. * kCFStreamPropertyHTTPResponseHeader
  247. *
  248. * Discussion:
  249. * Stream property key, for copy operations. Value is a
  250. * CFHTTPMessage with 0 bytes data.
  251. *
  252. * Availability:
  253. * Mac OS X: in version 10.1 and later in CoreServices.framework
  254. * CarbonLib: not available
  255. * Non-Carbon CFM: not available
  256. }
  257. var kCFStreamPropertyHTTPResponseHeader: CFStringRef; external name '_kCFStreamPropertyHTTPResponseHeader'; (* attribute const *)
  258. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  259. {
  260. * kCFStreamPropertyHTTPFinalURL
  261. *
  262. * Discussion:
  263. * Stream property key, for copy operations. The response header
  264. * value is the CFURL from the final request; will only differ from
  265. * the URL in the original request if an autoredirection has
  266. * occurred.
  267. *
  268. * Availability:
  269. * Mac OS X: in version 10.2 and later in CoreServices.framework
  270. * CarbonLib: not available
  271. * Non-Carbon CFM: not available
  272. }
  273. var kCFStreamPropertyHTTPFinalURL: CFStringRef; external name '_kCFStreamPropertyHTTPFinalURL'; (* attribute const *)
  274. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  275. {
  276. * kCFStreamPropertyHTTPFinalRequest
  277. *
  278. * Discussion:
  279. * Stream property key, for copy operations. The value is the
  280. * CFHTTPMessage transmitted by the stream, after all modifications
  281. * (such as for authentication, connection policy, or redirection)
  282. * have been made.
  283. *
  284. * Availability:
  285. * Mac OS X: in version 10.5 and later in CoreServices.framework
  286. * CarbonLib: not available
  287. * Non-Carbon CFM: not available
  288. }
  289. var kCFStreamPropertyHTTPFinalRequest: CFStringRef; external name '_kCFStreamPropertyHTTPFinalRequest'; (* attribute const *)
  290. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0) *)
  291. {
  292. * kCFStreamPropertyHTTPProxy
  293. *
  294. * Discussion:
  295. * Stream property key, for both set and copy operations. The value
  296. * is a CFDictionary. HTTP proxy information is set the same way as
  297. * SOCKS proxies (see CFSocketStream.h). Call
  298. * CFReadStreamSetProperty() passing an HTTP stream and the property
  299. * kCFStreamPropertyHTTPProxy. The value should include at least one
  300. * Host/Port pair from the keys below. Use the dictionary returned
  301. * by SystemConfiguration.framework to set the default values for
  302. * the system. HTTP proxies are not applied automatically.
  303. *
  304. * Availability:
  305. * Mac OS X: in version 10.2 and later in CoreServices.framework
  306. * CarbonLib: not available
  307. * Non-Carbon CFM: not available
  308. }
  309. var kCFStreamPropertyHTTPProxy: CFStringRef; external name '_kCFStreamPropertyHTTPProxy'; (* attribute const *)
  310. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  311. {
  312. * kCFStreamPropertyHTTPProxyHost
  313. *
  314. * Discussion:
  315. * Proxy dictionary key. The hostname of an HTTP proxy. The value is
  316. * a CFString. The key name matches kSCPropNetProxiesHTTPProxy.
  317. *
  318. * Availability:
  319. * Mac OS X: in version 10.2 and later in CoreServices.framework
  320. * CarbonLib: not available
  321. * Non-Carbon CFM: not available
  322. }
  323. var kCFStreamPropertyHTTPProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPProxyHost'; (* attribute const *)
  324. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  325. {
  326. * kCFStreamPropertyHTTPProxyPort
  327. *
  328. * Discussion:
  329. * Proxy dictionary key. Value is a CFNumber.
  330. *
  331. * Availability:
  332. * Mac OS X: in version 10.2 and later in CoreServices.framework
  333. * CarbonLib: not available
  334. * Non-Carbon CFM: not available
  335. }
  336. var kCFStreamPropertyHTTPProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPProxyPort'; (* attribute const *)
  337. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  338. { matches kSCPropNetProxiesHTTPPort }
  339. {
  340. * kCFStreamPropertyHTTPSProxyHost
  341. *
  342. * Discussion:
  343. * Proxy dictionary key. Value is a CFString.
  344. *
  345. * Availability:
  346. * Mac OS X: in version 10.2 and later in CoreServices.framework
  347. * CarbonLib: not available
  348. * Non-Carbon CFM: not available
  349. }
  350. var kCFStreamPropertyHTTPSProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyHost'; (* attribute const *)
  351. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  352. { matches kSCPropNetProxiesHTTPSProxy }
  353. {
  354. * kCFStreamPropertyHTTPSProxyPort
  355. *
  356. * Discussion:
  357. * Proxy dictionary key. Value is a CFNumber.
  358. *
  359. * Availability:
  360. * Mac OS X: in version 10.2 and later in CoreServices.framework
  361. * CarbonLib: not available
  362. * Non-Carbon CFM: not available
  363. }
  364. var kCFStreamPropertyHTTPSProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyPort'; (* attribute const *)
  365. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  366. { matches kSCPropNetProxiesHTTPSPort }
  367. {
  368. * kCFStreamPropertyHTTPShouldAutoredirect
  369. *
  370. * Discussion:
  371. * Stream property key. Value is a CFBoolean. Redirection is not
  372. * performed by default.
  373. *
  374. * Availability:
  375. * Mac OS X: in version 10.2 and later in CoreServices.framework
  376. * CarbonLib: not available
  377. * Non-Carbon CFM: not available
  378. }
  379. var kCFStreamPropertyHTTPShouldAutoredirect: CFStringRef; external name '_kCFStreamPropertyHTTPShouldAutoredirect'; (* attribute const *)
  380. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  381. {
  382. * kCFStreamPropertyHTTPAttemptPersistentConnection
  383. *
  384. * Discussion:
  385. * Stream property key. Value is a CFBoolean. If this property is
  386. * set to kCFBooleanTrue, an HTTP stream will look for an
  387. * appropriate extant persistent connection to use, and if it finds
  388. * none, will try to create one. Persistent connections are not used
  389. * by default.
  390. *
  391. * Availability:
  392. * Mac OS X: in version 10.2 and later in CoreServices.framework
  393. * CarbonLib: not available
  394. * Non-Carbon CFM: not available
  395. }
  396. var kCFStreamPropertyHTTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyHTTPAttemptPersistentConnection'; (* attribute const *)
  397. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  398. {
  399. * kCFStreamPropertyHTTPRequestBytesWrittenCount
  400. *
  401. * Discussion:
  402. * Stream property key. Value is a CFNumber. This property can only
  403. * be retrieved, not set. The number returned is the number of bytes
  404. * from the body of the request that have been written to the
  405. * underlying socket
  406. *
  407. * Availability:
  408. * Mac OS X: in version 10.3 and later in CoreServices.framework
  409. * CarbonLib: not available
  410. * Non-Carbon CFM: not available
  411. }
  412. var kCFStreamPropertyHTTPRequestBytesWrittenCount: CFStringRef; external name '_kCFStreamPropertyHTTPRequestBytesWrittenCount'; (* attribute const *)
  413. (* __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0) *)
  414. {*******************}
  415. { Creation routines }
  416. {*******************}
  417. {
  418. * CFReadStreamCreateForHTTPRequest()
  419. *
  420. * Discussion:
  421. * Create an HTTP read stream for the response to the given request.
  422. * When the stream is opened, it will begin transmitting the
  423. * request. The bytes returned are the pure body bytes; the response
  424. * header has been parsed off. To retrieve the response header, ask
  425. * for kCFStreamPropertyHTTPResponseHeader, above, any time after
  426. * the first bytes arrive on the stream (or when stream end is
  427. * reported, if there are no data bytes). When an HTTP/1.1 server
  428. * returns a chunked a response, the chunks will be formed into one
  429. * continuous stream.
  430. *
  431. * Parameters:
  432. *
  433. * alloc:
  434. * A pointer to the CFAllocator which should be used to allocate
  435. * memory for the CF read stream and its storage for values. If
  436. * this reference is not a valid CFAllocator, the behavior is
  437. * undefined.
  438. *
  439. * request:
  440. * A pointer to a CFHTTPMessage created by the
  441. * CFHTTPMessageCreateRequest function.
  442. *
  443. * Result:
  444. * A pointer to the CF read stream created, or NULL if failed. It is
  445. * caller's responsibilty to release the memory allocated for the
  446. * read stream.
  447. *
  448. * Availability:
  449. * Mac OS X: in version 10.1 and later in CoreServices.framework
  450. * CarbonLib: not available
  451. * Non-Carbon CFM: not available
  452. }
  453. function CFReadStreamCreateForHTTPRequest( alloc: CFAllocatorRef; request: CFHTTPMessageRef ): CFReadStreamRef; external name '_CFReadStreamCreateForHTTPRequest';
  454. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  455. {
  456. * CFReadStreamCreateForStreamedHTTPRequest()
  457. *
  458. * Discussion:
  459. * Creates a read stream for the response to the given
  460. * requestHeaders plus requestBody. Use in preference to
  461. * CFReadStreamCreateForHTTPRequest() when the body of the request
  462. * is larger than you wish to be resident in memory. Note that
  463. * because streams cannot be reset, read streams created this way
  464. * cannot have autoredirection enabled. If the Content-Length
  465. * header is set in requestHeaders, it is assumed that the caller
  466. * got the length right and that requestBody will report
  467. * end-of-stream after precisely Content-Length bytes have been read
  468. * from it. If the Content-Length header is not set, the chunked
  469. * transfer-encoding will be added to requestHeaders, and bytes read
  470. * from requestBody will be transmitted chunked. The body of
  471. * requestHeaders is ignored.
  472. *
  473. * Parameters:
  474. *
  475. * alloc:
  476. * A pointer to the CFAllocator which should be used to allocate
  477. * memory for the CF read stream and its storage for values. If
  478. * this reference is not a valid CFAllocator, the behavior is
  479. * undefined.
  480. *
  481. * requestHeaders:
  482. * A pointer to a CFHTTPMessage created by the
  483. * CFHTTPMessageCreateRequest function. The body of requestHeaders
  484. * is ignored.
  485. *
  486. * requestBody:
  487. * A pointer to a CFReadStream.
  488. *
  489. * Result:
  490. * A pointer to the CF read stream created, or NULL if failed. It is
  491. * caller's responsibilty to release the memory allocated for the
  492. * read stream.
  493. *
  494. * Availability:
  495. * Mac OS X: in version 10.2 and later in CoreServices.framework
  496. * CarbonLib: not available
  497. * Non-Carbon CFM: not available
  498. }
  499. function CFReadStreamCreateForStreamedHTTPRequest( alloc: CFAllocatorRef; requestHeaders: CFHTTPMessageRef; requestBody: CFReadStreamRef ): CFReadStreamRef; external name '_CFReadStreamCreateForStreamedHTTPRequest';
  500. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  501. {$ifc TARGET_OS_MAC}
  502. {
  503. * CFHTTPReadStreamSetRedirectsAutomatically() *** DEPRECATED ***
  504. *
  505. * Deprecated:
  506. * Use the kCFStreamPropertyHTTPShouldAutoredirect property above
  507. * instead.
  508. *
  509. * Discussion:
  510. * Sets the redirection property on the http stream.
  511. *
  512. * Parameters:
  513. *
  514. * httpStream:
  515. * A pointer to the CFHTTPStream to be set.
  516. *
  517. * shouldAutoRedirect:
  518. * A boolean indicating whether to redirect or not.
  519. *
  520. * Availability:
  521. * Mac OS X: in version 10.1 and later in CoreServices.framework but deprecated in 10.3
  522. * CarbonLib: not available
  523. * Non-Carbon CFM: not available
  524. }
  525. procedure CFHTTPReadStreamSetRedirectsAutomatically( httpStream: CFReadStreamRef; shouldAutoRedirect: Boolean ); external name '_CFHTTPReadStreamSetRedirectsAutomatically';
  526. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_3,__IPHONE_NA,__IPHONE_NA) *)
  527. {
  528. * CFHTTPReadStreamSetProxy() *** DEPRECATED ***
  529. *
  530. * Deprecated:
  531. * Use the kCFStreamPropertyHTTPProxy above instead.
  532. *
  533. * Discussion:
  534. * Sets the redirection property on the http stream.
  535. *
  536. * Parameters:
  537. *
  538. * httpStream:
  539. * A pointer to the CFHTTPStream to be set.
  540. *
  541. * proxyHost:
  542. * The proxy hostname. A CFString value.
  543. *
  544. * proxyPort:
  545. * The port number. A CFNumber value.
  546. *
  547. * Availability:
  548. * Mac OS X: in version 10.1 and later in CoreServices.framework but deprecated in 10.3
  549. * CarbonLib: not available
  550. * Non-Carbon CFM: not available
  551. }
  552. procedure CFHTTPReadStreamSetProxy( httpStream: CFReadStreamRef; proxyHost: CFStringRef; proxyPort: CFIndex ); external name '_CFHTTPReadStreamSetProxy';
  553. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_3,__IPHONE_NA,__IPHONE_NA) *)
  554. {$endc} {TARGET_OS_MAC}
  555. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  556. end.
  557. {$endc} {not MACOSALLINCLUDE}