CFHTTPStream.pas 19 KB

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