http_protocol.inc 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. {* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *}
  16. (**
  17. * @file http_protocol.h
  18. * @brief HTTP protocol handling
  19. *
  20. * @defgroup APACHE_CORE_PROTO HTTP Protocol Handling
  21. * @ingroup APACHE_CORE
  22. * @{
  23. *)
  24. //#ifndef APACHE_HTTP_PROTOCOL_H
  25. //#define APACHE_HTTP_PROTOCOL_H
  26. //#include "httpd.h"
  27. //#include "apr_portable.h"
  28. //#include "apr_mmap.h"
  29. //#include "apr_buckets.h"
  30. //#include "util_filter.h"
  31. {**
  32. * This hook allows modules to insert filters for the current error response
  33. * @param r the current request
  34. * @ingroup hooks
  35. *}
  36. //AP_DECLARE_HOOK(void,insert_error_filter,(request_rec *r))
  37. (*macro expanded:
  38. typedef
  39. void ap_HOOK_insert_error_filter_t (request_rec *r);
  40. void ap_hook_insert_error_filter(ap_HOOK_insert_error_filter_t *pf,
  41. const char * const *aszPre,
  42. const char * const *aszSucc,
  43. int nOrder);
  44. void ap_run_insert_error_filter (request_rec *r);
  45. apr_array_header_t * ap_hook_get_insert_error_filter(void);
  46. typedef struct ap_LINK_insert_error_filter_t { ap_HOOK_insert_error_filter_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_insert_error_filter_t;
  47. *)
  48. type
  49. ap_HOOK_insert_error_filter_t = procedure(r: Prequest_rec); cdecl;
  50. procedure ap_hook_insert_error_filter(pf: ap_HOOK_insert_error_filter_t;
  51. const aszPre, aszSucc: PPChar;
  52. nOrder: Integer);
  53. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  54. external LibHTTPD name LibNamePrefix + 'ap_hook_insert_error_filter' + LibSuff16;
  55. procedure ap_run_insert_error_filter(r: Prequest_rec);
  56. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  57. external LibHTTPD name LibNamePrefix + 'ap_run_insert_error_filter' + LibSuff4;
  58. function ap_hook_get_insert_error_filter: Papr_array_header_t;
  59. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  60. external LibHTTPD name LibNamePrefix + 'ap_hook_get_insert_error_filter' + LibSuff0;
  61. {rest of macro ignored}
  62. {** This is an optimization. We keep a record of the filter_rec that
  63. * stores the old_write filter, so that we can avoid strcmp's later.
  64. *}
  65. //AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
  66. {*
  67. * Prototypes for routines which either talk directly back to the user,
  68. * or control the ones that eventually do.
  69. *}
  70. {**
  71. * Read a request and fill in the fields.
  72. * @param c The current connection
  73. * @return The new request_rec
  74. *}
  75. //request_rec *ap_read_request(conn_rec *c);
  76. {**
  77. * Read the mime-encoded headers.
  78. * @param r The current request
  79. *}
  80. //AP_DECLARE(void) ap_get_mime_headers(request_rec *r);
  81. procedure ap_get_mime_headers(r: Prequest_rec);
  82. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  83. external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers' + LibSuff4;
  84. {**
  85. * Optimized version of ap_get_mime_headers() that requires a
  86. * temporary brigade to work with
  87. * @param r The current request
  88. * @param bb temp brigade
  89. *}
  90. //AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r,
  91. // apr_bucket_brigade *bb);
  92. procedure ap_get_mime_headers_core(r: Prequest_rec; bb: Papr_bucket_brigade);
  93. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  94. external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers_core' + LibSuff8;
  95. //* Finish up stuff after a request */
  96. {**
  97. * Called at completion of sending the response. It sends the terminating
  98. * protocol information.
  99. * @param r The current request
  100. *}
  101. //AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r);
  102. procedure ap_finalize_request_protocol(r: Prequest_rec);
  103. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  104. external LibHTTPD name LibNamePrefix + 'ap_finalize_request_protocol' + LibSuff4;
  105. {**
  106. * Send error back to client.
  107. * @param r The current request
  108. * @param recursive_error last arg indicates error status in case we get
  109. * an error in the process of trying to deal with an ErrorDocument
  110. * to handle some other error. In that case, we print the default
  111. * report for the first thing that went wrong, and more briefly report
  112. * on the problem with the ErrorDocument.
  113. *}
  114. //AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error);
  115. procedure ap_send_error_response(r: Prequest_rec; recursive_error: Integer);
  116. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  117. external LibHTTPD name LibNamePrefix + 'ap_send_error_response' + LibSuff8;
  118. {* Set last modified header line from the lastmod date of the associated file.
  119. * Also, set content length.
  120. *
  121. * May return an error status, typically HTTP_NOT_MODIFIED (that when the
  122. * permit_cache argument is set to one).
  123. *}
  124. {**
  125. * Set the content length for this request
  126. * @param r The current request
  127. * @param length The new content length
  128. *}
  129. //AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length);
  130. procedure ap_set_content_length(r: Prequest_rec; length: apr_off_t);
  131. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  132. external LibHTTPD name LibNamePrefix + 'ap_set_content_length' + LibSuff12;
  133. {**
  134. * Set the keepalive status for this request
  135. * @param r The current request
  136. * @return 1 if keepalive can be set, 0 otherwise
  137. *}
  138. //AP_DECLARE(int) ap_set_keepalive(request_rec *r);
  139. function ap_set_keepalive(r: Prequest_rec): Integer;
  140. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  141. external LibHTTPD name LibNamePrefix + 'ap_set_keepalive' + LibSuff4;
  142. {**
  143. * Return the latest rational time from a request/mtime pair. Mtime is
  144. * returned unless it's in the future, in which case we return the current time.
  145. * @param r The current request
  146. * @param mtime The last modified time
  147. * @return the latest rational time.
  148. *}
  149. //AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime);
  150. function ap_rationalize_mtime(r: Prequest_rec; mtime: apr_time_t): apr_time_t;
  151. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  152. external LibHTTPD name LibNamePrefix + 'ap_rationalize_mtime' + LibSuff12;
  153. {**
  154. * Build the content-type that should be sent to the client from the
  155. * content-type specified. The following rules are followed:
  156. * - if type is NULL or "", return NULL (do not set content-type).
  157. * - if charset adding is disabled, stop processing and return type.
  158. * - then, if there are no parameters on type, add the default charset
  159. * - return type
  160. * @param r The current request
  161. * @param type The content type
  162. * @return The content-type
  163. *}
  164. //AP_DECLARE(const char *) ap_make_content_type(request_rec *r,
  165. // const char *type);
  166. function ap_make_content_type(r: Prequest_rec; type_: PChar): PChar;
  167. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  168. external LibHTTPD name LibNamePrefix + 'ap_make_content_type' + LibSuff8;
  169. {**
  170. * Precompile metadata structures used by ap_make_content_type()
  171. * @param pool The pool to use for allocations
  172. *}
  173. //AP_DECLARE(void) ap_setup_make_content_type(apr_pool_t *pool);
  174. procedure ap_setup_make_content_type(pool: Papr_pool_t);
  175. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  176. external LibHTTPD name LibNamePrefix + 'ap_setup_make_content_type' + LibSuff4;
  177. {**
  178. * Construct an entity tag from the resource information. If it's a real
  179. * file, build in some of the file characteristics.
  180. * @param r The current request
  181. * @param force_weak Force the entity tag to be weak - it could be modified
  182. * again in as short an interval.
  183. * @return The entity tag
  184. *}
  185. //AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak);
  186. function ap_make_etag(r: Prequest_rec; force_weak: Integer): PChar;
  187. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  188. external LibHTTPD name LibNamePrefix + 'ap_make_etag' + LibSuff8;
  189. {**
  190. * Set the E-tag outgoing header
  191. * @param r The current request
  192. *}
  193. //AP_DECLARE(void) ap_set_etag(request_rec *r);
  194. procedure ap_set_etag(r: Prequest_rec);
  195. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  196. external LibHTTPD name LibNamePrefix + 'ap_set_etag' + LibSuff4;
  197. {**
  198. * Set the last modified time for the file being sent
  199. * @param r The current request
  200. *}
  201. //AP_DECLARE(void) ap_set_last_modified(request_rec *r);
  202. procedure ap_set_last_modified(r: Prequest_rec);
  203. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  204. external LibHTTPD name LibNamePrefix + 'ap_set_last_modified' + LibSuff4;
  205. {**
  206. * Implements condition GET rules for HTTP/1.1 specification. This function
  207. * inspects the client headers and determines if the response fulfills
  208. * the requirements specified.
  209. * @param r The current request
  210. * @return OK if the response fulfills the condition GET rules, some
  211. * other status code otherwise
  212. *}
  213. //AP_DECLARE(int) ap_meets_conditions(request_rec *r);
  214. function ap_meets_conditions(r: Prequest_rec): Integer;
  215. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  216. external LibHTTPD name LibNamePrefix + 'ap_meets_conditions' + LibSuff4;
  217. {* Other ways to send stuff at the client. All of these keep track
  218. * of bytes_sent automatically. This indirection is intended to make
  219. * it a little more painless to slide things like HTTP-NG packetization
  220. * underneath the main body of the code later. In the meantime, it lets
  221. * us centralize a bit of accounting (bytes_sent).
  222. *
  223. * These also return the number of bytes written by the call.
  224. * They should only be called with a timeout registered, for obvious reaasons.
  225. * (Ditto the send_header stuff).
  226. *}
  227. {**
  228. * Send an entire file to the client, using sendfile if supported by the
  229. * current platform
  230. * @param fd The file to send.
  231. * @param r The current request
  232. * @param offset Offset into the file to start sending.
  233. * @param length Amount of data to send
  234. * @param nbytes Amount of data actually sent
  235. *}
  236. //AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset,
  237. // apr_size_t length, apr_size_t *nbytes);
  238. function ap_send_fd(fd: Papr_file_t; r: Prequest_rec; offset: apr_off_t;
  239. length: apr_size_t; nbytes: Papr_size_t): apr_status_t;
  240. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  241. external LibHTTPD name LibNamePrefix + 'ap_send_fd' + LibSuff24;
  242. //#if APR_HAS_MMAP
  243. {**
  244. * Send an MMAP'ed file to the client
  245. * @param mm The MMAP'ed file to send
  246. * @param r The current request
  247. * @param offset The offset into the MMAP to start sending
  248. * @param length The amount of data to send
  249. * @return The number of bytes sent
  250. *}
  251. //AP_DECLARE(apr_size_t) ap_send_mmap(apr_mmap_t *mm,
  252. // request_rec *r,
  253. // apr_size_t offset,
  254. // apr_size_t length);
  255. function ap_send_mmap(mm: Papr_mmap_t;
  256. r: Prequest_rec;
  257. offset,
  258. length: apr_size_t): apr_size_t;
  259. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  260. external LibHTTPD name LibNamePrefix + 'ap_send_mmap' + LibSuff20;
  261. //#endif
  262. {**
  263. * Register a new request method, and return the offset that will be
  264. * associated with that method.
  265. *
  266. * @param p The pool to create registered method numbers from.
  267. * @param methname The name of the new method to register.
  268. * @return Ab int value representing an offset into a bitmask.
  269. *}
  270. //AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname);
  271. function ap_method_register(p: Papr_pool_t; methname: PChar): Integer;
  272. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  273. external LibHTTPD name LibNamePrefix + 'ap_method_register' + LibSuff8;
  274. {**
  275. * Initialize the method_registry and allocate memory for it.
  276. *
  277. * @param p Pool to allocate memory for the registry from.
  278. *}
  279. //AP_DECLARE(void) ap_method_registry_init(apr_pool_t *p);
  280. procedure ap_method_registry_init(p: Papr_pool_t);
  281. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  282. external LibHTTPD name LibNamePrefix + 'ap_method_registry_init' + LibSuff4;
  283. {**
  284. * This is a convenience macro to ease with checking a mask
  285. * against a method name.
  286. *}
  287. //#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
  288. // ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
  289. {**
  290. * Create a new method list with the specified number of preallocated
  291. * slots for extension methods.
  292. *
  293. * @param p Pointer to a pool in which the structure should be
  294. * allocated.
  295. * @param nelts Number of preallocated extension slots
  296. * @return Pointer to the newly created structure.
  297. *}
  298. //AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts);
  299. function ap_make_method_list(p: Papr_pool_t; nelts: Integer): Pap_method_list_t;
  300. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  301. external LibHTTPD name LibNamePrefix + 'ap_make_method_list' + LibSuff8;
  302. {**
  303. * Copy a method list
  304. *
  305. * @param dest List to copy to
  306. * @param src List to copy from
  307. *}
  308. //AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest,
  309. // ap_method_list_t *src);
  310. procedure ap_copy_method_list(dest, src: Pap_method_list_t);
  311. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  312. external LibHTTPD name LibNamePrefix + 'ap_copy_method_list' + LibSuff8;
  313. {**
  314. * Search for an HTTP method name in an ap_method_list_t structure, and
  315. * return true if found.
  316. *
  317. * @param method String containing the name of the method to check.
  318. * @param l Pointer to a method list, such as r->allowed_methods.
  319. * @return 1 if method is in the list, otherwise 0
  320. *}
  321. //AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method);
  322. function ap_method_in_list(l: Pap_method_list_t; const method: PChar): Integer;
  323. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  324. external LibHTTPD name LibNamePrefix + 'ap_method_in_list' + LibSuff8;
  325. {**
  326. * Add an HTTP method name to an ap_method_list_t structure if it isn't
  327. * already listed.
  328. *
  329. * @param method String containing the name of the method to check.
  330. * @param l Pointer to a method list, such as r->allowed_methods.
  331. * @return None.
  332. *}
  333. //AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method);
  334. procedure ap_method_list_add(l: Pap_method_list_t; const method: PChar);
  335. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  336. external LibHTTPD name LibNamePrefix + 'ap_method_list_add' + LibSuff8;
  337. {**
  338. * Remove an HTTP method name from an ap_method_list_t structure.
  339. *
  340. * @param l Pointer to a method list, such as r->allowed_methods.
  341. * @param method String containing the name of the method to remove.
  342. * @return None.
  343. *}
  344. //AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l,
  345. // const char *method);
  346. procedure ap_method_list_remove(l: Pap_method_list_t; const method: PChar);
  347. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  348. external LibHTTPD name LibNamePrefix + 'ap_method_list_remove' + LibSuff8;
  349. {**
  350. * Reset a method list to be completely empty.
  351. *
  352. * @param l Pointer to a method list, such as r->allowed_methods.
  353. * @return None.
  354. *}
  355. //AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
  356. procedure ap_clear_method_list(l: Pap_method_list_t);
  357. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  358. external LibHTTPD name LibNamePrefix + 'ap_clear_method_list' + LibSuff4;
  359. {**
  360. * Set the content type for this request (r->content_type).
  361. * @param r The current request
  362. * @param ct The new content type
  363. * @warning This function must be called to set r->content_type in order
  364. * for the AddOutputFilterByType directive to work correctly.
  365. *}
  366. //AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct);
  367. procedure ap_set_content_type(r: Prequest_rec; const ct: PChar);
  368. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  369. external LibHTTPD name LibNamePrefix + 'ap_set_content_type' + LibSuff8;
  370. {**
  371. * Set the Accept-Ranges header for this response
  372. * @param r The current request
  373. *}
  374. //AP_DECLARE(void) ap_set_accept_ranges(request_rec *r);
  375. procedure ap_set_accept_ranges(r: Prequest_rec);
  376. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  377. external LibHTTPD name LibNamePrefix + 'ap_set_accept_ranges' + LibSuff4;
  378. {* Hmmm... could macrofy these for now, and maybe forever, though the
  379. * definitions of the macros would get a whole lot hairier.
  380. *}
  381. {**
  382. * Output one character for this request
  383. * @param c the character to output
  384. * @param r the current request
  385. * @return The number of bytes sent
  386. *}
  387. //AP_DECLARE(int) ap_rputc(int c, request_rec *r);
  388. function ap_rputc(c: Integer; r: Prequest_rec): Integer;
  389. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  390. external LibHTTPD name LibNamePrefix + 'ap_rputc' + LibSuff8;
  391. {**
  392. * Write a buffer for the current request
  393. * @param buf The buffer to write
  394. * @param nbyte The number of bytes to send from the buffer
  395. * @param r The current request
  396. * @return The number of bytes sent
  397. *}
  398. //AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
  399. function ap_rwrite(const buf: Pointer; nbyte: Integer; r: Prequest_rec): Integer;
  400. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  401. external LibHTTPD name LibNamePrefix + 'ap_rwrite' + LibSuff12;
  402. {**
  403. * Output a string for the current request
  404. * @param str The string to output
  405. * @param r The current request
  406. * @return The number of bytes sent
  407. * @note ap_rputs may be implemented as macro or inline function
  408. *}
  409. //static APR_INLINE int ap_rputs(const char *str, request_rec *r)
  410. //{
  411. // return ap_rwrite(str, strlen(str), r);
  412. //}
  413. {**
  414. * Write an unspecified number of strings to the request
  415. * @param r The current request
  416. * @param ... The strings to write
  417. * @return The number of bytes sent
  418. *}
  419. //AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...)
  420. // AP_FN_ATTR_SENTINEL;
  421. function ap_rvputs(r: Prequest_rec; params: array of const): Integer; cdecl;
  422. external LibHTTPD name 'ap_rvputs';
  423. {**
  424. * Output data to the client in a printf format
  425. * @param r The current request
  426. * @param fmt The format string
  427. * @param vlist The arguments to use to fill out the format string
  428. * @return The number of bytes sent
  429. *}
  430. //AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
  431. function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): Integer;
  432. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  433. external LibHTTPD name LibNamePrefix + 'ap_vrprintf' + LibSuff12;
  434. {**
  435. * Output data to the client in a printf format
  436. * @param r The current request
  437. * @param fmt The format string
  438. * @param ... The arguments to use to fill out the format string
  439. * @return The number of bytes sent
  440. *}
  441. //AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
  442. // __attribute__((format(printf,2,3)));
  443. function ap_rprintf(r: Prequest_rec;
  444. const fmt: PChar; params: array of const): Integer; cdecl;
  445. external LibHTTPD name 'ap_rprintf';
  446. {**
  447. * Flush all of the data for the current request to the client
  448. * @param r The current request
  449. * @return 0 on success, -1 if an error occurred
  450. *}
  451. //AP_DECLARE(int) ap_rflush(request_rec *r);
  452. function ap_rflush(r: Prequest_rec): Integer;
  453. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  454. external LibHTTPD name LibNamePrefix + 'ap_rflush' + LibSuff4;
  455. {**
  456. * Index used in custom_responses array for a specific error code
  457. * (only use outside protocol.c is in getting them configured).
  458. * @param status HTTP status code
  459. * @return The index of the response
  460. *}
  461. //AP_DECLARE(int) ap_index_of_response(int status);
  462. function ap_index_of_response(status: Integer): Integer;
  463. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  464. external LibHTTPD name LibNamePrefix + 'ap_index_of_response' + LibSuff4;
  465. {**
  466. * Return the Status-Line for a given status code (excluding the
  467. * HTTP-Version field). If an invalid or unknown status code is
  468. * passed, "500 Internal Server Error" will be returned.
  469. * @param status The HTTP status code
  470. * @return The Status-Line
  471. *}
  472. //AP_DECLARE(const char *) ap_get_status_line(int status);
  473. function ap_get_status_line(status: Integer): PChar;
  474. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  475. external LibHTTPD name LibNamePrefix + 'ap_get_status_line' + LibSuff4;
  476. //* Reading a block of data from the client connection (e.g., POST arg) */
  477. {**
  478. * Setup the client to allow Apache to read the request body.
  479. * @param r The current request
  480. * @param read_policy How the server should interpret a chunked
  481. * transfer-encoding. One of: <pre>
  482. * REQUEST_NO_BODY Send 413 error if message has any body
  483. * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
  484. * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
  485. * </pre>
  486. * @return either OK or an error code
  487. *}
  488. //AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy);
  489. function ap_setup_client_block(r: Prequest_rec; read_policy: Integer): Integer;
  490. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  491. external LibHTTPD name LibNamePrefix + 'ap_setup_client_block' + LibSuff8;
  492. {**
  493. * Determine if the client has sent any data. This also sends a
  494. * 100 Continue response to HTTP/1.1 clients, so modules should not be called
  495. * until the module is ready to read content.
  496. * @warning Never call this function more than once.
  497. * @param r The current request
  498. * @return 0 if there is no message to read, 1 otherwise
  499. *}
  500. //AP_DECLARE(int) ap_should_client_block(request_rec *r);
  501. function ap_should_client_block(r: Prequest_rec): Integer;
  502. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  503. external LibHTTPD name LibNamePrefix + 'ap_should_client_block' + LibSuff4;
  504. {**
  505. * Call this in a loop. It will put data into a buffer and return the length
  506. * of the input block
  507. * @param r The current request
  508. * @param buffer The buffer in which to store the data
  509. * @param bufsiz The size of the buffer
  510. * @return Number of bytes inserted into the buffer. When done reading, 0
  511. * if EOF, or -1 if there was an error
  512. *}
  513. //AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
  514. function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: apr_size_t): cLong;
  515. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  516. external LibHTTPD name LibNamePrefix + 'ap_get_client_block' + LibSuff12;
  517. {**
  518. * In HTTP/1.1, any method can have a body. However, most GET handlers
  519. * wouldn't know what to do with a request body if they received one.
  520. * This helper routine tests for and reads any message body in the request,
  521. * simply discarding whatever it receives. We need to do this because
  522. * failing to read the request body would cause it to be interpreted
  523. * as the next request on a persistent connection.
  524. * @param r The current request
  525. * @return error status if request is malformed, OK otherwise
  526. *}
  527. //AP_DECLARE(int) ap_discard_request_body(request_rec *r);
  528. function ap_discard_request_body(r: Prequest_rec): Integer;
  529. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  530. external LibHTTPD name LibNamePrefix + 'ap_discard_request_body' + LibSuff4;
  531. {**
  532. * Setup the output headers so that the client knows how to authenticate
  533. * itself the next time, if an authentication request failed.
  534. * @param r The current request
  535. *}
  536. //AP_DECLARE(void) ap_note_auth_failure(request_rec *r);
  537. procedure ap_note_auth_failure(r: Prequest_rec);
  538. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  539. external LibHTTPD name LibNamePrefix + 'ap_note_auth_failure' + LibSuff4;
  540. {**
  541. * @deprecated @see ap_note_auth_failure
  542. *}
  543. //AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r);
  544. procedure ap_note_basic_auth_failure(r: Prequest_rec);
  545. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  546. external LibHTTPD name LibNamePrefix + 'ap_note_basic_auth_failure' + LibSuff4;
  547. {**
  548. * @deprecated @see ap_note_auth_failure
  549. *}
  550. //AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r);
  551. procedure ap_note_digest_auth_failure(r: Prequest_rec);
  552. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  553. external LibHTTPD name LibNamePrefix + 'ap_note_digest_auth_failure' + LibSuff4;
  554. {**
  555. * This hook allows modules to add support for a specific auth type to
  556. * ap_note_auth_failure
  557. * @param r the current request
  558. * @param auth_type the configured auth_type
  559. * @return OK, DECLINED
  560. *}
  561. //AP_DECLARE_HOOK(int, note_auth_failure, (request_rec *r, const char *auth_type))
  562. (*macro expanded:
  563. typedef
  564. int ap_HOOK_note_auth_failure_t (request_rec *r, const char *auth_type);
  565. void ap_hook_note_auth_failure(ap_HOOK_note_auth_failure_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
  566. int ap_run_note_auth_failure (request_rec *r, const char *auth_type);
  567. apr_array_header_t * ap_hook_get_note_auth_failure(void);
  568. typedef struct ap_LINK_note_auth_failure_t { ap_HOOK_note_auth_failure_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_note_auth_failure_t;
  569. *)
  570. type
  571. ap_HOOK_note_auth_failure_t = procedure(r: Prequest_rec); cdecl;
  572. procedure ap_hook_note_auth_failure(pf: ap_HOOK_note_auth_failure_t;
  573. const aszPre, aszSucc: PPChar;
  574. nOrder: Integer);
  575. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  576. external LibHTTPD name LibNamePrefix + 'ap_HOOK_note_auth_failure' + LibSuff16;
  577. procedure ap_run_note_auth_failure(r: Prequest_rec; auth_type: PChar);
  578. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  579. external LibHTTPD name LibNamePrefix + 'ap_run_note_auth_failure' + LibSuff8;
  580. function ap_hook_get_note_auth_failure: Papr_array_header_t;
  581. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  582. external LibHTTPD name LibNamePrefix + 'ap_hook_get_note_auth_failure' + LibSuff0;
  583. {rest of macro ignored}
  584. {**
  585. * Get the password from the request headers
  586. * @param r The current request
  587. * @param pw The password as set in the headers
  588. * @return 0 (OK) if it set the 'pw' argument (and assured
  589. * a correct value in r->user); otherwise it returns
  590. * an error code, either HTTP_INTERNAL_SERVER_ERROR if things are
  591. * really confused, HTTP_UNAUTHORIZED if no authentication at all
  592. * seemed to be in use, or DECLINED if there was authentication but
  593. * it wasn't Basic (in which case, the caller should presumably
  594. * decline as well).
  595. *}
  596. //AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw);
  597. function ap_get_basic_auth_pw(r: Prequest_rec; pw: PPChar): Integer;
  598. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  599. external LibHTTPD name LibNamePrefix + 'ap_get_basic_auth_pw' + LibSuff8;
  600. {**
  601. * parse_uri: break apart the uri
  602. * @warning Side Effects:
  603. * @li sets r->args to rest after '?' (or NULL if no '?')
  604. * @li sets r->uri to request uri (without r->args part)
  605. * @li sets r->hostname (if not set already) from request (scheme://host:port)
  606. * @param r The current request
  607. * @param uri The uri to break apart
  608. *}
  609. //AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri);
  610. procedure ap_parse_uri(r: Prequest_rec; const uri: PChar);
  611. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  612. external LibHTTPD name LibNamePrefix + 'ap_parse_uri' + LibSuff8;
  613. {**
  614. * Get the next line of input for the request
  615. * @param s The buffer into which to read the line
  616. * @param n The size of the buffer
  617. * @param r The request
  618. * @param fold Whether to merge continuation lines
  619. * @return The length of the line, if successful
  620. * n, if the line is too big to fit in the buffer
  621. * -1 for miscellaneous errors
  622. *}
  623. //AP_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold);
  624. function ap_getline(s: PChar; n: Integer; r: Prequest_rec; fold: Integer): Integer;
  625. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  626. external LibHTTPD name LibNamePrefix + 'ap_getline' + LibSuff16;
  627. {**
  628. * Get the next line of input for the request
  629. *
  630. * Note: on ASCII boxes, ap_rgetline is a macro which simply calls
  631. * ap_rgetline_core to get the line of input.
  632. *
  633. * on EBCDIC boxes, ap_rgetline is a wrapper function which
  634. * translates ASCII protocol lines to the local EBCDIC code page
  635. * after getting the line of input.
  636. *
  637. * @param s Pointer to the pointer to the buffer into which the line
  638. * should be read; if *s==NULL, a buffer of the necessary size
  639. * to hold the data will be allocated from the request pool
  640. * @param n The size of the buffer
  641. * @param read The length of the line.
  642. * @param r The request
  643. * @param fold Whether to merge continuation lines
  644. * @param bb Working brigade to use when reading buckets
  645. * @return APR_SUCCESS, if successful
  646. * APR_ENOSPC, if the line is too big to fit in the buffer
  647. * Other errors where appropriate
  648. *}
  649. //#if APR_CHARSET_EBCDIC
  650. //AP_DECLARE(apr_status_t) ap_rgetline(char **s, apr_size_t n,
  651. // apr_size_t *read,
  652. // request_rec *r, int fold,
  653. // apr_bucket_brigade *bb);
  654. //#else //* ASCII box */
  655. //#define ap_rgetline(s, n, read, r, fold, bb) \
  656. // ap_rgetline_core((s), (n), (read), (r), (fold), (bb))
  657. //#endif
  658. {** @see ap_rgetline *}
  659. //AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n,
  660. // apr_size_t *read,
  661. // request_rec *r, int fold,
  662. // apr_bucket_brigade *bb);
  663. function ap_rgetline_core(s: PPChar; n: apr_size_t;
  664. read: Papr_size_t;
  665. r: Prequest_rec; fold: Integer;
  666. bb: apr_bucket_brigade): apr_status_t;
  667. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  668. external LibHTTPD name LibNamePrefix + 'ap_rgetline_core' + LibSuff24;
  669. {**
  670. * Get the method number associated with the given string, assumed to
  671. * contain an HTTP method. Returns M_INVALID if not recognized.
  672. * @param method A string containing a valid HTTP method
  673. * @return The method number
  674. *}
  675. //AP_DECLARE(int) ap_method_number_of(const char *method);
  676. function ap_method_number_of(const method: PChar): Integer;
  677. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  678. external LibHTTPD name LibNamePrefix + 'ap_method_number_of' + LibSuff4;
  679. {**
  680. * Get the method name associated with the given internal method
  681. * number. Returns NULL if not recognized.
  682. * @param p A pool to use for temporary allocations.
  683. * @param methnum An integer value corresponding to an internal method number
  684. * @return The name corresponding to the method number
  685. *}
  686. //AP_DECLARE(const char *) ap_method_name_of(apr_pool_t *p, int methnum);
  687. function ap_method_name_of(p: Papr_pool_t; methnum: Integer): PChar;
  688. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  689. external LibHTTPD name LibNamePrefix + 'ap_method_name_of' + LibSuff8;
  690. //* Hooks */
  691. {*
  692. * pre_read_request --- run right before read_request_line(),
  693. * and not run during any subrequests.
  694. *}
  695. {**
  696. * This hook allows modules to affect the request or connection immediately before
  697. * the request has been read, and before any other phases have been processes.
  698. * @param r The current request of the soon-to-be-read request
  699. * @param c The connection
  700. * @return None/void
  701. *}
  702. //AP_DECLARE_HOOK(void,pre_read_request,(request_rec *r, conn_rec *c))
  703. (*macro expanded:
  704. typedef
  705. void ap_HOOK_pre_read_request_t (request_rec *r, conn_rec *c);
  706. void ap_hook_pre_read_request(ap_HOOK_pre_read_request_t *pf,
  707. const char * const *aszPre,
  708. const char * const *aszSucc,
  709. int nOrder);
  710. void ap_run_pre_read_request (request_rec *r,
  711. conn_rec *c);
  712. apr_array_header_t * ap_hook_get_pre_read_request(void);
  713. typedef struct ap_LINK_pre_read_request_t { ap_HOOK_pre_read_request_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_pre_read_request_t;
  714. *)
  715. type
  716. ap_HOOK_pre_read_request_t = function(r: Prequest_rec): Integer; cdecl;
  717. procedure ap_hook_pre_read_request(pf: ap_HOOK_pre_read_request_t;
  718. const aszPre: PPChar;
  719. const aszSucc: PPChar;
  720. nOrder: Integer);
  721. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  722. external LibHTTPD name LibNamePrefix + 'ap_hook_pre_read_request' + LibSuff16;
  723. function ap_run_pre_read_request(r: Prequest_rec; c: Pconn_rec): Integer;
  724. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  725. external LibHTTPD name LibNamePrefix + 'ap_run_pre_read_request' + LibSuff8;
  726. function ap_hook_get_pre_read_request: Papr_array_header_t;
  727. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  728. external LibHTTPD name LibNamePrefix + 'ap_hook_get_pre_read_request' + LibSuff0;
  729. {rest of macro ignored}
  730. {*
  731. * post_read_request --- run right after read_request or internal_redirect,
  732. * and not run during any subrequests.
  733. *}
  734. {**
  735. * This hook allows modules to affect the request immediately after the request
  736. * has been read, and before any other phases have been processes. This allows
  737. * modules to make decisions based upon the input header fields
  738. * @param r The current request
  739. * @return OK or DECLINED
  740. *}
  741. //AP_DECLARE_HOOK(int,post_read_request,(request_rec *r))
  742. (*macro expanded:
  743. typedef
  744. int ap_HOOK_post_read_request_t (request_rec *r);
  745. void ap_hook_post_read_request(ap_HOOK_post_read_request_t *pf,
  746. const char * const *aszPre,
  747. const char * const *aszSucc,
  748. int nOrder);
  749. int ap_run_post_read_request (request_rec *r);
  750. apr_array_header_t * ap_hook_get_post_read_request(void);
  751. typedef struct ap_LINK_post_read_request_t { ap_HOOK_post_read_request_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_post_read_request_t;
  752. *)
  753. type
  754. ap_HOOK_post_read_request_t = function(r: Prequest_rec): Integer; cdecl;
  755. procedure ap_hook_post_read_request(pf: ap_HOOK_post_read_request_t;
  756. const aszPre: PPChar;
  757. const aszSucc: PPChar;
  758. nOrder: Integer);
  759. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  760. external LibHTTPD name LibNamePrefix + 'ap_hook_post_read_request' + LibSuff16;
  761. function ap_run_post_read_request(r: Prequest_rec): Integer;
  762. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  763. external LibHTTPD name LibNamePrefix + 'ap_run_post_read_request' + LibSuff4;
  764. function ap_hook_get_post_read_request: Papr_array_header_t;
  765. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  766. external LibHTTPD name LibNamePrefix + 'ap_hook_get_post_read_request' + LibSuff0;
  767. {rest of macro ignored}
  768. {**
  769. * This hook allows modules to perform any module-specific logging activities
  770. * over and above the normal server things.
  771. * @param r The current request
  772. * @return OK, DECLINED, or HTTP_...
  773. *}
  774. //AP_DECLARE_HOOK(int,log_transaction,(request_rec *r))
  775. (*macro expanded:
  776. typedef
  777. int ap_HOOK_log_transaction_t (request_rec *r);
  778. void ap_hook_log_transaction(ap_HOOK_log_transaction_t *pf,
  779. const char * const *aszPre,
  780. const char * const *aszSucc,
  781. int nOrder);
  782. int ap_run_log_transaction (request_rec *r);
  783. apr_array_header_t * ap_hook_get_log_transaction(void);
  784. typedef struct ap_LINK_log_transaction_t { ap_HOOK_log_transaction_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_log_transaction_t;
  785. *)
  786. type
  787. ap_HOOK_log_transaction_t = function(r: Prequest_rec): Integer; cdecl;
  788. procedure ap_hook_log_transaction(pf: ap_HOOK_log_transaction_t;
  789. const aszPre: PPChar;
  790. const aszSucc: PPChar;
  791. nOrder: Integer);
  792. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  793. external LibHTTPD name LibNamePrefix + 'ap_hook_log_transaction' + LibSuff16;
  794. function ap_run_log_transaction(r: Prequest_rec): Integer;
  795. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  796. external LibHTTPD name LibNamePrefix + 'ap_run_log_transaction' + LibSuff4;
  797. function ap_hook_get_log_transaction: Papr_array_header_t;
  798. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  799. external LibHTTPD name LibNamePrefix + 'ap_hook_get_log_transaction' + LibSuff0;
  800. {rest of macro ignored}
  801. {**
  802. * This hook allows modules to retrieve the http scheme for a request. This
  803. * allows Apache modules to easily extend the schemes that Apache understands
  804. * @param r The current request
  805. * @return The http scheme from the request
  806. *}
  807. //AP_DECLARE_HOOK(const char *,http_scheme,(const request_rec *r))
  808. (*macro expanded:
  809. typedef
  810. const char * ap_HOOK_http_scheme_t (const request_rec *r);
  811. void ap_hook_http_scheme(ap_HOOK_http_scheme_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
  812. const char * ap_run_http_scheme (const request_rec *r);
  813. apr_array_header_t * ap_hook_get_http_scheme(void);
  814. typedef struct ap_LINK_http_scheme_t { ap_HOOK_http_scheme_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_http_scheme_t;
  815. *)
  816. type
  817. ap_HOOK_http_scheme_t = function(r: Prequest_rec): Integer; cdecl;
  818. procedure ap_hook_http_scheme(pf: ap_HOOK_http_scheme_t;
  819. const aszPre: PPChar;
  820. const aszSucc: PPChar;
  821. nOrder: Integer);
  822. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  823. external LibHTTPD name LibNamePrefix + 'ap_hook_http_scheme' + LibSuff16;
  824. function ap_run_http_scheme(r: Prequest_rec): Integer;
  825. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  826. external LibHTTPD name LibNamePrefix + 'ap_run_http_scheme' + LibSuff4;
  827. function ap_hook_get_http_scheme: Papr_array_header_t;
  828. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  829. external LibHTTPD name LibNamePrefix + 'ap_hook_get_http_scheme' + LibSuff0;
  830. {rest of macro ignored}
  831. {**
  832. * Return the default port from the current request
  833. * @param r The current request
  834. * @return The current port
  835. *}
  836. //AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r))
  837. (*macro expanded:
  838. typedef
  839. apr_port_t ap_HOOK_default_port_t (const request_rec *r);
  840. void ap_hook_default_port(ap_HOOK_default_port_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
  841. apr_port_t ap_run_default_port (const request_rec *r);
  842. apr_array_header_t * ap_hook_get_default_port(void);
  843. typedef struct ap_LINK_default_port_t { ap_HOOK_default_port_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_default_port_t;
  844. *)
  845. type
  846. ap_HOOK_default_port_t = function(r: Prequest_rec): Integer; cdecl;
  847. procedure ap_hook_default_port(pf: ap_HOOK_default_port_t;
  848. const aszPre: PPChar;
  849. const aszSucc: PPChar;
  850. nOrder: Integer);
  851. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  852. external LibHTTPD name LibNamePrefix + 'ap_hook_default_port' + LibSuff16;
  853. function ap_run_default_port(r: Prequest_rec): Integer;
  854. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  855. external LibHTTPD name LibNamePrefix + 'ap_run_default_port' + LibSuff4;
  856. function ap_hook_get_default_port: Papr_array_header_t;
  857. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  858. external LibHTTPD name LibNamePrefix + 'ap_hook_get_default_port' + LibSuff0;
  859. {rest of macro ignored}
  860. {** @see ap_bucket_type_error *}
  861. //typedef struct ap_bucket_error ap_bucket_error;
  862. type
  863. Pap_bucket_error = ^ap_bucket_error;
  864. {**
  865. * @struct ap_bucket_error
  866. * @brief A bucket referring to an HTTP error
  867. *
  868. * This bucket can be passed down the filter stack to indicate that an
  869. * HTTP error occurred while running a filter. In order for this bucket
  870. * to be used successfully, it MUST be sent as the first bucket in the
  871. * first brigade to be sent from a given filter.
  872. *}
  873. ap_bucket_error = record
  874. {** Number of buckets using this memory *}
  875. refcount: apr_bucket_refcount;
  876. {** The error code *}
  877. status: Integer;
  878. {** The error string *}
  879. data: PChar;
  880. end;
  881. {** @see ap_bucket_type_error *}
  882. //AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error;
  883. {**
  884. * Determine if a bucket is an error bucket
  885. * @param e The bucket to inspect
  886. * @return true or false
  887. *}
  888. //#define AP_BUCKET_IS_ERROR(e) (e->type == &ap_bucket_type_error)
  889. {**
  890. * Make the bucket passed in an error bucket
  891. * @param b The bucket to make into an error bucket
  892. * @param error The HTTP error code to put in the bucket.
  893. * @param buf An optional error string to put in the bucket.
  894. * @param p A pool to allocate out of.
  895. * @return The new bucket, or NULL if allocation failed
  896. *}
  897. //AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error,
  898. // const char *buf, apr_pool_t *p);
  899. function ap_bucket_error_make(b: Papr_bucket; error: Integer;
  900. const buf: PChar; p: Papr_pool_t): Papr_bucket;
  901. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  902. external LibHTTPD name LibNamePrefix + 'ap_bucket_error_make' + LibSuff16;
  903. {**
  904. * Create a bucket referring to an HTTP error.
  905. * @param error The HTTP error code to put in the bucket.
  906. * @param buf An optional error string to put in the bucket.
  907. * @param p A pool to allocate the error string out of.
  908. * @param list The bucket allocator from which to allocate the bucket
  909. * @return The new bucket, or NULL if allocation failed
  910. *}
  911. //AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, const char *buf,
  912. // apr_pool_t *p,
  913. // apr_bucket_alloc_t *list);
  914. function ap_bucket_error_create(error: Integer; const buf: PChar;
  915. p: Papr_pool_t;
  916. list: Papr_bucket_alloc_t): Papr_bucket;
  917. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  918. external LibHTTPD name LibNamePrefix + 'ap_bucket_error_create' + LibSuff16;
  919. //AP_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b);
  920. function ap_byterange_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
  921. external LibHTTPD name 'ap_byterange_filter';
  922. //AP_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b);
  923. function ap_http_header_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
  924. external LibHTTPD name 'ap_http_header_filter';
  925. //AP_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *,
  926. // apr_bucket_brigade *);
  927. function ap_content_length_filter(f: Pap_filter_t;
  928. b: Papr_bucket_brigade): apr_status_t; cdecl;
  929. external LibHTTPD name 'ap_content_length_filter';
  930. //AP_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b);
  931. function ap_old_write_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
  932. external LibHTTPD name 'ap_old_write_filter';
  933. {**
  934. * Sett up the protocol fields for subsidiary requests
  935. * @param rnew New Sub Request
  936. * @param r current request
  937. *}
  938. //AP_DECLARE(void) ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
  939. procedure ap_set_sub_req_protocol(rnew: Prequest_rec; const r: Prequest_rec);
  940. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  941. external LibHTTPD name LibNamePrefix + 'ap_set_sub_req_protocol' + LibSuff8;
  942. {**
  943. * A wrapup function to keep the internal accounting straight.
  944. * Indicates that there is no more content coming.
  945. * @param sub_r Subrequest that is now compete
  946. *}
  947. //AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r);
  948. procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
  949. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  950. external LibHTTPD name LibNamePrefix + 'ap_finalize_sub_req_protocol' + LibSuff4;
  951. {**
  952. * Send an interim (HTTP 1xx) response immediately.
  953. * @param r The request
  954. * @param send_headers Whether to send&clear headers in r->headers_out
  955. *}
  956. //AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers);
  957. procedure ap_send_interim_response(r: Prequest_rec; send_headers: Integer);
  958. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  959. external LibHTTPD name LibNamePrefix + 'ap_send_interim_response' + LibSuff8;
  960. //#endif /* !APACHE_HTTP_PROTOCOL_H */
  961. (** @} *)