CFHTTPMessage.pas 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. {
  2. File: CFNetwork/CFHTTPMessage.h
  3. Contains: CoreFoundation Network socket 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 CFHTTPMessage;
  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. { will require compiler define when/if other Apple devices with ARM cpus ship }
  141. {$setc TARGET_OS_MAC := FALSE}
  142. {$setc TARGET_OS_IPHONE := TRUE}
  143. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  144. {$setc TARGET_OS_EMBEDDED := TRUE}
  145. {$elifc defined __arm64__ and __arm64__}
  146. {$setc TARGET_CPU_PPC := FALSE}
  147. {$setc TARGET_CPU_PPC64 := FALSE}
  148. {$setc TARGET_CPU_X86 := FALSE}
  149. {$setc TARGET_CPU_X86_64 := FALSE}
  150. {$setc TARGET_CPU_ARM := FALSE}
  151. {$setc TARGET_CPU_ARM64 := TRUE}
  152. { will require compiler define when/if other Apple devices with ARM cpus ship }
  153. {$setc TARGET_OS_MAC := FALSE}
  154. {$setc TARGET_OS_IPHONE := TRUE}
  155. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  156. {$setc TARGET_OS_EMBEDDED := TRUE}
  157. {$elsec}
  158. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  159. {$endc}
  160. {$ifc defined __LP64__ and __LP64__ }
  161. {$setc TARGET_CPU_64 := TRUE}
  162. {$elsec}
  163. {$setc TARGET_CPU_64 := FALSE}
  164. {$endc}
  165. {$ifc defined FPC_BIG_ENDIAN}
  166. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  167. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  168. {$elifc defined FPC_LITTLE_ENDIAN}
  169. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  170. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  171. {$elsec}
  172. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  173. {$endc}
  174. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  175. {$setc CALL_NOT_IN_CARBON := FALSE}
  176. {$setc OLDROUTINENAMES := FALSE}
  177. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  178. {$setc OPAQUE_UPP_TYPES := TRUE}
  179. {$setc OTCARBONAPPLICATION := TRUE}
  180. {$setc OTKERNEL := FALSE}
  181. {$setc PM_USE_SESSION_APIS := TRUE}
  182. {$setc TARGET_API_MAC_CARBON := TRUE}
  183. {$setc TARGET_API_MAC_OS8 := FALSE}
  184. {$setc TARGET_API_MAC_OSX := TRUE}
  185. {$setc TARGET_CARBON := TRUE}
  186. {$setc TARGET_CPU_68K := FALSE}
  187. {$setc TARGET_CPU_MIPS := FALSE}
  188. {$setc TARGET_CPU_SPARC := FALSE}
  189. {$setc TARGET_OS_UNIX := FALSE}
  190. {$setc TARGET_OS_WIN32 := FALSE}
  191. {$setc TARGET_RT_MAC_68881 := FALSE}
  192. {$setc TARGET_RT_MAC_CFM := FALSE}
  193. {$setc TARGET_RT_MAC_MACHO := TRUE}
  194. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  195. {$setc TYPE_BOOL := FALSE}
  196. {$setc TYPE_EXTENDED := FALSE}
  197. {$setc TYPE_LONGLONG := TRUE}
  198. uses MacTypes,CFString,CFURL,CFBase,CFData,CFDictionary;
  199. {$endc} {not MACOSALLINCLUDE}
  200. {$ALIGN POWER}
  201. {
  202. * kCFHTTPVersion1_0
  203. *
  204. * Discussion:
  205. * Version string for HTTP 1.0.
  206. *
  207. * Availability:
  208. * Mac OS X: in version 10.1 and later in CoreServices.framework
  209. * CarbonLib: not available
  210. * Non-Carbon CFM: not available
  211. }
  212. var kCFHTTPVersion1_0: CFStringRef; external name '_kCFHTTPVersion1_0'; (* attribute const *)
  213. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  214. {
  215. * kCFHTTPVersion1_1
  216. *
  217. * Discussion:
  218. * Version string for HTTP 1.1.
  219. *
  220. * Availability:
  221. * Mac OS X: in version 10.1 and later in CoreServices.framework
  222. * CarbonLib: not available
  223. * Non-Carbon CFM: not available
  224. }
  225. var kCFHTTPVersion1_1: CFStringRef; external name '_kCFHTTPVersion1_1'; (* attribute const *)
  226. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  227. {
  228. * kCFHTTPAuthenticationSchemeBasic
  229. *
  230. * Discussion:
  231. * HTTP Basic authentication scheme.
  232. *
  233. * Availability:
  234. * Mac OS X: in version 10.2 and later in CoreServices.framework
  235. * CarbonLib: not available
  236. * Non-Carbon CFM: not available
  237. }
  238. var kCFHTTPAuthenticationSchemeBasic: CFStringRef; external name '_kCFHTTPAuthenticationSchemeBasic'; (* attribute const *)
  239. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  240. {
  241. * kCFHTTPAuthenticationSchemeDigest
  242. *
  243. * Discussion:
  244. * HTTP Digest Access authentication scheme.
  245. *
  246. * Availability:
  247. * Mac OS X: in version 10.2 and later in CoreServices.framework
  248. * CarbonLib: not available
  249. * Non-Carbon CFM: not available
  250. }
  251. var kCFHTTPAuthenticationSchemeDigest: CFStringRef; external name '_kCFHTTPAuthenticationSchemeDigest'; (* attribute const *)
  252. (* __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0) *)
  253. {
  254. * kCFHTTPAuthenticationSchemeNTLM
  255. *
  256. * Discussion:
  257. * HTTP NTLM authentication scheme.
  258. *
  259. * Availability:
  260. * Mac OS X: in version 10.5 and later in CoreServices.framework
  261. * CarbonLib: not available
  262. * Non-Carbon CFM: not available
  263. }
  264. var kCFHTTPAuthenticationSchemeNTLM: CFStringRef; external name '_kCFHTTPAuthenticationSchemeNTLM'; (* attribute const *)
  265. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0) *)
  266. {
  267. * kCFHTTPAuthenticationSchemeNegotiate
  268. *
  269. * Discussion:
  270. * HTTP Negotiate authentication scheme.
  271. *
  272. * Availability:
  273. * Mac OS X: in version 10.5 and later in CoreServices.framework
  274. * CarbonLib: not available
  275. * Non-Carbon CFM: not available
  276. }
  277. var kCFHTTPAuthenticationSchemeNegotiate: CFStringRef; external name '_kCFHTTPAuthenticationSchemeNegotiate'; (* attribute const *)
  278. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0) *)
  279. {
  280. * kCFHTTPAuthenticationSchemeNegotiate2
  281. *
  282. * Discussion:
  283. * HTTP Negotiate v2 authentication scheme.
  284. *
  285. * Availability:
  286. * Mac OS X: in version 10.6 and later in CoreServices.framework
  287. * CarbonLib: not available
  288. * Non-Carbon CFM: not available
  289. }
  290. var kCFHTTPAuthenticationSchemeNegotiate2: CFStringRef; external name '_kCFHTTPAuthenticationSchemeNegotiate2'; (* attribute const *)
  291. (* __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0) *)
  292. {
  293. * kCFHTTPAuthenticationSchemeXMobileMeAuthToken
  294. *
  295. * Discussion:
  296. * HTTP XMobileMeAuthToken authentication scheme.
  297. *
  298. * Availability:
  299. * Mac OS X: in version 10.6 and later in CoreServices.framework
  300. * CarbonLib: not available
  301. * Non-Carbon CFM: not available
  302. }
  303. var kCFHTTPAuthenticationSchemeXMobileMeAuthToken: CFStringRef; external name '_kCFHTTPAuthenticationSchemeXMobileMeAuthToken'; (* attribute const *)
  304. (* __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_3) *)
  305. {
  306. * kCFHTTPAuthenticationSchemeKerberos
  307. *
  308. * Discussion:
  309. * HTTP Negotiate authentication scheme.
  310. *
  311. * Availability:
  312. * Mac OS X: in version 10.7 and later in CoreServices.framework
  313. * CarbonLib: not available
  314. * Non-Carbon CFM: not available
  315. }
  316. var kCFHTTPAuthenticationSchemeKerberos: CFStringRef; external name '_kCFHTTPAuthenticationSchemeKerberos'; (* attribute const *)
  317. (* __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0) *)
  318. {$ifc TARGET_OS_MAC}
  319. {
  320. * kCFHTTPAuthenticationSchemeOAuth1
  321. *
  322. * Discussion:
  323. * HTTP OAuth 1.0 authentication scheme.
  324. *
  325. * Availability:
  326. * Mac OS X: in version 10.9 and later in CoreServices.framework
  327. * CarbonLib: not available
  328. * Non-Carbon CFM: not available
  329. }
  330. var kCFHTTPAuthenticationSchemeOAuth1: CFStringRef; external name '_kCFHTTPAuthenticationSchemeOAuth1'; (* attribute const *)
  331. (* __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_NA) *)
  332. {$endc}
  333. {
  334. * CFHTTPMessageRef
  335. *
  336. * Discussion:
  337. * This is the type of a reference to an HTTP message. An HTTP
  338. * message can be a request or a response.
  339. }
  340. type
  341. CFHTTPMessageRef = ^__CFHTTPMessage; { an opaque type }
  342. __CFHTTPMessage = record end;
  343. {
  344. * CFHTTPMessageGetTypeID()
  345. *
  346. * Discussion:
  347. * Return the unique type for this class.
  348. *
  349. * Mac OS X threading:
  350. * Thread safe
  351. *
  352. * Result:
  353. * A unique CFType for CFHTTPMessage.
  354. *
  355. * Availability:
  356. * Mac OS X: in version 10.1 and later in CoreServices.framework
  357. * CarbonLib: not available
  358. * Non-Carbon CFM: not available
  359. }
  360. function CFHTTPMessageGetTypeID: CFTypeID; external name '_CFHTTPMessageGetTypeID';
  361. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  362. {
  363. * CFHTTPMessageCreateRequest()
  364. *
  365. * Discussion:
  366. * Create an HTTPMessage from an HTTP method, url and version.
  367. *
  368. * Mac OS X threading:
  369. * Thread safe
  370. *
  371. * Parameters:
  372. *
  373. * alloc:
  374. * A pointer to the CFAllocator which should be used to allocate
  375. * memory for the CF read stream and its storage for values. If
  376. * this reference is not a valid CFAllocator, the behavior is
  377. * undefined.
  378. *
  379. * requestMethod:
  380. * A pointer to a CFString indicating the method of request. For a
  381. * "GET" request, for example, the value would be CFSTR("GET").
  382. *
  383. * url:
  384. * A pointer to a CFURL structure created any of the several
  385. * CFURLCreate... functions. If this parameter is not a pointer
  386. * to a valid CFURL structure, the behavior is undefined.
  387. *
  388. * httpVersion:
  389. * A pointer to a CFString indicating the version of request.
  390. *
  391. * Result:
  392. * A pointer to the CFHTTPMessage created, or NULL if failed. It is
  393. * caller's responsibilty to release the memory allocated for the
  394. * message.
  395. *
  396. * Availability:
  397. * Mac OS X: in version 10.1 and later in CoreServices.framework
  398. * CarbonLib: not available
  399. * Non-Carbon CFM: not available
  400. }
  401. function CFHTTPMessageCreateRequest( alloc: CFAllocatorRef; requestMethod: CFStringRef; url: CFURLRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateRequest';
  402. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  403. {
  404. * CFHTTPMessageCreateResponse()
  405. *
  406. * Discussion:
  407. * Create an HTTPMessage from an HTTP status code, description and
  408. * version.
  409. *
  410. * Mac OS X threading:
  411. * Thread safe
  412. *
  413. * Parameters:
  414. *
  415. * alloc:
  416. * A pointer to the CFAllocator which should be used to allocate
  417. * memory for the CF read stream and its storage for values. If
  418. * this reference is not a valid CFAllocator, the behavior is
  419. * undefined.
  420. *
  421. * statusCode:
  422. * An integer status code for the response.
  423. *
  424. * statusDescription:
  425. * A pointer to a CFString for the status. Pass NULL to use the
  426. * standard description for the given status code, as found in RFC
  427. * 2616.
  428. *
  429. * httpVersion:
  430. * A pointer to a CFString for the HTTP version.
  431. *
  432. * Result:
  433. * A pointer to the CFHTTPMessage created, or NULL if failed. It is
  434. * caller's responsibilty to release the memory allocated for the
  435. * message.
  436. *
  437. * Availability:
  438. * Mac OS X: in version 10.1 and later in CoreServices.framework
  439. * CarbonLib: not available
  440. * Non-Carbon CFM: not available
  441. }
  442. function CFHTTPMessageCreateResponse( alloc: CFAllocatorRef; statusCode: CFIndex; statusDescription: CFStringRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateResponse';
  443. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  444. {
  445. * CFHTTPMessageCreateEmpty()
  446. *
  447. * Discussion:
  448. * Creates an empty request or response, which you can then append
  449. * bytes to via CFHTTPMessageAppendBytes().
  450. *
  451. * Mac OS X threading:
  452. * Thread safe
  453. *
  454. * Parameters:
  455. *
  456. * alloc:
  457. * A pointer to the CFAllocator which should be used to allocate
  458. * memory for the CF read stream and its storage for values. If
  459. * this reference is not a valid CFAllocator, the behavior is
  460. * undefined.
  461. *
  462. * isRequest:
  463. * A boolean. Pass kCFBooleanTrue if the message should be a
  464. * request.
  465. *
  466. * Result:
  467. * A pointer to the CFHTTPMessage created, or NULL if failed. It is
  468. * caller's responsibilty to release the memory allocated for the
  469. * message.
  470. *
  471. * Availability:
  472. * Mac OS X: in version 10.1 and later in CoreServices.framework
  473. * CarbonLib: not available
  474. * Non-Carbon CFM: not available
  475. }
  476. function CFHTTPMessageCreateEmpty( alloc: CFAllocatorRef; isRequest: Boolean ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateEmpty';
  477. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  478. {
  479. * CFHTTPMessageCreateCopy()
  480. *
  481. * Discussion:
  482. * Creates a copy of a CFHTTPMessage.
  483. *
  484. * Mac OS X threading:
  485. * Not thread safe
  486. *
  487. * Parameters:
  488. *
  489. * alloc:
  490. * A pointer to the CFAllocator which should be used to allocate
  491. * memory for the CF read stream and its storage for values. If
  492. * this reference is not a valid CFAllocator, the behavior is
  493. * undefined.
  494. *
  495. * message:
  496. * A pointer to the CFHTTPMessage to be copied. If the message is
  497. * NULL, the behavior is undefined.
  498. *
  499. * Result:
  500. * A pointer to the CFHTTPMessage created, or NULL if failed. It is
  501. * caller's responsibilty to release the memory allocated for the
  502. * message.
  503. *
  504. * Availability:
  505. * Mac OS X: in version 10.1 and later in CoreServices.framework
  506. * CarbonLib: not available
  507. * Non-Carbon CFM: not available
  508. }
  509. function CFHTTPMessageCreateCopy( alloc: CFAllocatorRef; message: CFHTTPMessageRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateCopy';
  510. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  511. {
  512. * CFHTTPMessageIsRequest()
  513. *
  514. * Discussion:
  515. * Returns whether the CFHTTPMessage is a request or a response.
  516. *
  517. * Mac OS X threading:
  518. * Not thread safe
  519. *
  520. * Parameters:
  521. *
  522. * message:
  523. * A pointer to the CFHTTPMessage to be copied. If the message is
  524. * NULL, the behavior is undefined.
  525. *
  526. * Result:
  527. * A Boolean. A value of kCFBooleanTrue indicates the message is a
  528. * request. A value of kCFBooleanFalse indicates the message is a
  529. * response.
  530. *
  531. * Availability:
  532. * Mac OS X: in version 10.1 and later in CoreServices.framework
  533. * CarbonLib: not available
  534. * Non-Carbon CFM: not available
  535. }
  536. function CFHTTPMessageIsRequest( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsRequest';
  537. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  538. {
  539. * CFHTTPMessageCopyVersion()
  540. *
  541. * Discussion:
  542. * Returns the HTTP version.
  543. *
  544. * Mac OS X threading:
  545. * Not thread safe
  546. *
  547. * Parameters:
  548. *
  549. * message:
  550. * A pointer to the CFHTTPMessage to be copied. If the message is
  551. * NULL, the behavior is undefined.
  552. *
  553. * Result:
  554. * A pointer to a CFString, or NULL if failed. It is caller's
  555. * responsibilty to release the memory allocated for the string.
  556. *
  557. * Availability:
  558. * Mac OS X: in version 10.1 and later in CoreServices.framework
  559. * CarbonLib: not available
  560. * Non-Carbon CFM: not available
  561. }
  562. function CFHTTPMessageCopyVersion( message: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyVersion';
  563. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  564. {
  565. * CFHTTPMessageCopyBody()
  566. *
  567. * Discussion:
  568. * Returns the body of the message.
  569. *
  570. * Mac OS X threading:
  571. * Not thread safe
  572. *
  573. * Parameters:
  574. *
  575. * message:
  576. * A pointer to the CFHTTPMessage to be copied. If the message is
  577. * NULL, the behavior is undefined.
  578. *
  579. * Result:
  580. * A pointer to a CFData, or NULL if failed. It is caller's
  581. * responsibilty to release the memory allocated for the data.
  582. *
  583. * Availability:
  584. * Mac OS X: in version 10.1 and later in CoreServices.framework
  585. * CarbonLib: not available
  586. * Non-Carbon CFM: not available
  587. }
  588. function CFHTTPMessageCopyBody( message: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopyBody';
  589. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  590. {
  591. * CFHTTPMessageSetBody()
  592. *
  593. * Discussion:
  594. * Sets the body of the message from a CFData.
  595. *
  596. * Mac OS X threading:
  597. * Not thread safe
  598. *
  599. * Parameters:
  600. *
  601. * message:
  602. * A pointer to the CFHTTPMessage to be copied. If the message is
  603. * NULL, the behavior is undefined.
  604. *
  605. * bodyData:
  606. * A pointer to a CFData containing the body to be set. If the
  607. * bodyData is NULL, the behavior is undefined.
  608. *
  609. * Availability:
  610. * Mac OS X: in version 10.1 and later in CoreServices.framework
  611. * CarbonLib: not available
  612. * Non-Carbon CFM: not available
  613. }
  614. procedure CFHTTPMessageSetBody( message: CFHTTPMessageRef; bodyData: CFDataRef ); external name '_CFHTTPMessageSetBody';
  615. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  616. {
  617. * CFHTTPMessageCopyHeaderFieldValue()
  618. *
  619. * Discussion:
  620. * Returns the specified header field.
  621. *
  622. * Mac OS X threading:
  623. * Not thread safe
  624. *
  625. * Parameters:
  626. *
  627. * message:
  628. * A pointer to the CFHTTPMessage to be copied. If the message is
  629. * NULL, the behavior is undefined.
  630. *
  631. * headerField:
  632. * A pointer to the CFString. If the headerField is NULL, the
  633. * behavior is undefined.
  634. *
  635. * Result:
  636. * A pointer to a CFString, or NULL if failed. It is caller's
  637. * responsibilty to release the memory allocated for the string.
  638. *
  639. * Availability:
  640. * Mac OS X: in version 10.1 and later in CoreServices.framework
  641. * CarbonLib: not available
  642. * Non-Carbon CFM: not available
  643. }
  644. function CFHTTPMessageCopyHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef ): CFStringRef; external name '_CFHTTPMessageCopyHeaderFieldValue';
  645. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  646. {
  647. * CFHTTPMessageCopyAllHeaderFields()
  648. *
  649. * Discussion:
  650. * Returns a CFDictionary containing all of the header fields.
  651. *
  652. * Mac OS X threading:
  653. * Not thread safe
  654. *
  655. * Parameters:
  656. *
  657. * message:
  658. * A pointer to the CFHTTPMessage to be copied. If the message is
  659. * NULL, the behavior is undefined.
  660. *
  661. * Result:
  662. * A pointer to a CFDictionary, or NULL if failed. It is caller's
  663. * responsibilty to release the memory allocated for the dictionary.
  664. *
  665. * Availability:
  666. * Mac OS X: in version 10.1 and later in CoreServices.framework
  667. * CarbonLib: not available
  668. * Non-Carbon CFM: not available
  669. }
  670. function CFHTTPMessageCopyAllHeaderFields( message: CFHTTPMessageRef ): CFDictionaryRef; external name '_CFHTTPMessageCopyAllHeaderFields';
  671. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  672. {
  673. * CFHTTPMessageSetHeaderFieldValue()
  674. *
  675. * Discussion:
  676. * Sets the value of the specified header field.
  677. *
  678. * Mac OS X threading:
  679. * Not thread safe
  680. *
  681. * Parameters:
  682. *
  683. * message:
  684. * A pointer to the CFHTTPMessage to be copied. If the message is
  685. * NULL, the behavior is undefined.
  686. *
  687. * headerField:
  688. * A pointer to the CFString. If headerField is NULL, the behavior
  689. * is undefined.
  690. *
  691. * value:
  692. * A pointer to the CFString containing the value to set. Set the
  693. * value to NULL to remove the header field.
  694. *
  695. * Availability:
  696. * Mac OS X: in version 10.1 and later in CoreServices.framework
  697. * CarbonLib: not available
  698. * Non-Carbon CFM: not available
  699. }
  700. procedure CFHTTPMessageSetHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef; value: CFStringRef ); external name '_CFHTTPMessageSetHeaderFieldValue';
  701. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  702. {
  703. * CFHTTPMessageAppendBytes()
  704. *
  705. * Discussion:
  706. * Appends the given bytes to the message given (parsing out any
  707. * control information if appropriate). Returns kCFBooleanFalse if
  708. * a parsing error occurs while processing the new data.
  709. *
  710. * Mac OS X threading:
  711. * Not thread safe
  712. *
  713. * Parameters:
  714. *
  715. * message:
  716. * A pointer to the CFHTTPMessage to be copied. If the message is
  717. * NULL, the behavior is undefined.
  718. *
  719. * newBytes:
  720. * A pointer to the bytes. If newBytes is NULL, the behavior is
  721. * undefined.
  722. *
  723. * numBytes:
  724. * A CFIndex of the number of bytes to append.
  725. *
  726. * Result:
  727. * A Boolean indicating success or failure.
  728. *
  729. * Availability:
  730. * Mac OS X: in version 10.1 and later in CoreServices.framework
  731. * CarbonLib: not available
  732. * Non-Carbon CFM: not available
  733. }
  734. function CFHTTPMessageAppendBytes( message: CFHTTPMessageRef; newBytes: UnivPtr; numBytes: CFIndex ): Boolean; external name '_CFHTTPMessageAppendBytes';
  735. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  736. {
  737. * CFHTTPMessageIsHeaderComplete()
  738. *
  739. * Discussion:
  740. * Returns whether further header data is expected by the message.
  741. *
  742. * Mac OS X threading:
  743. * Not thread safe
  744. *
  745. * Parameters:
  746. *
  747. * message:
  748. * A pointer to the CFHTTPMessage to be copied. If the message is
  749. * NULL, the behavior is undefined.
  750. *
  751. * Result:
  752. * A Boolean. A value of kCFBooleanTrue indicates the header is
  753. * complete and no further data is expected.
  754. *
  755. * Availability:
  756. * Mac OS X: in version 10.1 and later in CoreServices.framework
  757. * CarbonLib: not available
  758. * Non-Carbon CFM: not available
  759. }
  760. function CFHTTPMessageIsHeaderComplete( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsHeaderComplete';
  761. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  762. {
  763. * CFHTTPMessageCopySerializedMessage()
  764. *
  765. * Discussion:
  766. * Creates a self-contained copy of a CFHTTPMessage. This would be
  767. * suitable for persistant storage or for transmitting over the
  768. * network independently.
  769. *
  770. * Mac OS X threading:
  771. * Not thread safe
  772. *
  773. * Parameters:
  774. *
  775. * request:
  776. * A pointer to the CFHTTPMessage to be seralized.
  777. *
  778. * Result:
  779. * A pointer to a CFData, or NULL if failed. It is caller's
  780. * responsibilty to release the memory allocated for the data.
  781. *
  782. * Availability:
  783. * Mac OS X: in version 10.1 and later in CoreServices.framework
  784. * CarbonLib: not available
  785. * Non-Carbon CFM: not available
  786. }
  787. function CFHTTPMessageCopySerializedMessage( request: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopySerializedMessage';
  788. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  789. {*******************}
  790. { Request functions }
  791. {*******************}
  792. {
  793. * CFHTTPMessageCopyRequestURL()
  794. *
  795. * Discussion:
  796. * Creates a copy of the request URL.
  797. *
  798. * Mac OS X threading:
  799. * Not thread safe
  800. *
  801. * Parameters:
  802. *
  803. * request:
  804. * A pointer to the CFHTTPMessage.
  805. *
  806. * Result:
  807. * A pointer to a CFURL, or NULL if failed. It is caller's
  808. * responsibilty to release the memory allocated for the url.
  809. *
  810. * Availability:
  811. * Mac OS X: in version 10.1 and later in CoreServices.framework
  812. * CarbonLib: not available
  813. * Non-Carbon CFM: not available
  814. }
  815. function CFHTTPMessageCopyRequestURL( request: CFHTTPMessageRef ): CFURLRef; external name '_CFHTTPMessageCopyRequestURL';
  816. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  817. {
  818. * CFHTTPMessageCopyRequestMethod()
  819. *
  820. * Discussion:
  821. * Creates a copy of the request method.
  822. *
  823. * Mac OS X threading:
  824. * Not thread safe
  825. *
  826. * Parameters:
  827. *
  828. * request:
  829. * A pointer to the CFHTTPMessage.
  830. *
  831. * Result:
  832. * A pointer to a CFString, or NULL if failed. It is caller's
  833. * responsibilty to release the memory allocated for the string.
  834. *
  835. * Availability:
  836. * Mac OS X: in version 10.1 and later in CoreServices.framework
  837. * CarbonLib: not available
  838. * Non-Carbon CFM: not available
  839. }
  840. function CFHTTPMessageCopyRequestMethod( request: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyRequestMethod';
  841. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  842. {
  843. * CFHTTPMessageAddAuthentication()
  844. *
  845. * Discussion:
  846. * Adds authentication to the request. Tries to modify request to
  847. * contain the authentication information requested by the failed
  848. * response (which presumably is a 401 or 407 response).
  849. *
  850. * Mac OS X threading:
  851. * Not thread safe
  852. *
  853. * Parameters:
  854. *
  855. * request:
  856. * A pointer to a CFHTTPMessage request.
  857. *
  858. * authenticationFailureResponse:
  859. * A pointer to a CFHTTPMessage of the failed response.
  860. *
  861. * username:
  862. * A pointer to a CFString containing the user name to
  863. * authenticate.
  864. *
  865. * password:
  866. * A pointer to a CFString containing the password of the user.
  867. *
  868. * authenticationScheme:
  869. * A pointer to a CFString containing the authentication scheme to
  870. * use to authenticate. If authenticationScheme is NULL, strongest
  871. * supported scheme listed authenticationFailureResponse will be
  872. * used.
  873. *
  874. * forProxy:
  875. * A boolean indicating whether the authentication applies to a
  876. * proxy or not.
  877. *
  878. * Result:
  879. * A pointer to a CFString, or NULL if failed. It is caller's
  880. * responsibilty to release the memory allocated for the string.
  881. *
  882. * Availability:
  883. * Mac OS X: in version 10.1 and later in CoreServices.framework
  884. * CarbonLib: not available
  885. * Non-Carbon CFM: not available
  886. }
  887. function CFHTTPMessageAddAuthentication( request: CFHTTPMessageRef; authenticationFailureResponse: CFHTTPMessageRef; username: CFStringRef; password: CFStringRef; authenticationScheme: CFStringRef; forProxy: Boolean ): Boolean; external name '_CFHTTPMessageAddAuthentication';
  888. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  889. {********************}
  890. { Response functions }
  891. {********************}
  892. {
  893. * CFHTTPMessageGetResponseStatusCode()
  894. *
  895. * Discussion:
  896. * Returns the status code for the response.
  897. *
  898. * Mac OS X threading:
  899. * Not thread safe
  900. *
  901. * Parameters:
  902. *
  903. * response:
  904. * A pointer to the CFHTTPMessage to be copied. If the message is
  905. * NULL, the behavior is undefined.
  906. *
  907. * Result:
  908. * A UInt32 indicating the status code.
  909. *
  910. * Availability:
  911. * Mac OS X: in version 10.1 and later in CoreServices.framework
  912. * CarbonLib: not available
  913. * Non-Carbon CFM: not available
  914. }
  915. function CFHTTPMessageGetResponseStatusCode( response: CFHTTPMessageRef ): CFIndex; external name '_CFHTTPMessageGetResponseStatusCode';
  916. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  917. {
  918. * CFHTTPMessageCopyResponseStatusLine()
  919. *
  920. * Discussion:
  921. * Returns the status line for the response.
  922. *
  923. * Mac OS X threading:
  924. * Not thread safe
  925. *
  926. * Parameters:
  927. *
  928. * response:
  929. * A pointer to the CFHTTPMessage to be copied. If the message is
  930. * NULL, the behavior is undefined.
  931. *
  932. * Result:
  933. * A CFString indicating the status code, or NULL if failed. It is
  934. * caller's responsibilty to release the memory allocated for the
  935. * string.
  936. *
  937. * Availability:
  938. * Mac OS X: in version 10.1 and later in CoreServices.framework
  939. * CarbonLib: not available
  940. * Non-Carbon CFM: not available
  941. }
  942. function CFHTTPMessageCopyResponseStatusLine( response: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyResponseStatusLine';
  943. (* __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0) *)
  944. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  945. end.
  946. {$endc} {not MACOSALLINCLUDE}