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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
18
* Prototypes for routines which either talk directly back to the user,
19
* or control the ones that eventually do.
22
{ Read a request and fill in the fields. }
24
function ap_read_request(c: Pconn_rec): Prequest_rec;
25
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
27
{ Send a single HTTP header field }
29
function ap_send_header_field(r: Prequest_rec; const fieldname, fieldval: PChar): cint;
30
cdecl; external LibHTTPD;
32
{ Send the minimal part of an HTTP response header... but modules should be
33
* very careful about using this, and should prefer ap_send_http_header().
34
* Much of the HTTP/1.1 implementation correctness depends on code in
35
* ap_send_http_header().
37
procedure ap_basic_http_header(r: Prequest_rec);
38
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
40
{ Send the Status-Line and header fields for HTTP response }
42
procedure ap_send_http_header(l: Prequest_rec);
43
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
45
{ Send the response to special method requests }
47
function ap_send_http_trace(r: Prequest_rec): cint;
48
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
50
function ap_send_http_options(r: Prequest_rec): cint;
51
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
53
{ Finish up stuff after a request }
55
procedure ap_finalize_request_protocol(r: Prequest_rec);
56
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
58
{ Send error back to client... last arg indicates error status in case
59
* we get an error in the process of trying to deal with an ErrorDocument
60
* to handle some other error. In that case, we print the default report
61
* for the first thing that went wrong, and more briefly report on the
62
* problem with the ErrorDocument.
65
procedure ap_send_error_response(r: Prequest_rec; recursive_error: cint);
66
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
68
{ Set last modified header line from the lastmod date of the associated file.
69
* Also, set content length.
71
* May return an error status, typically USE_LOCAL_COPY (that when the
72
* permit_cache argument is set to one).
75
function ap_set_content_length(r: Prequest_rec; length: clong): cint;
76
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
78
function ap_set_keepalive(r: Prequest_rec): cint;
79
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
81
function ap_rationalize_mtime(r: Prequest_rec; mtime: time_t): time_t;
82
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
84
function ap_make_etag(r: Prequest_rec; force_weak: cint): PChar;
85
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
87
procedure ap_set_etag(r: Prequest_rec);
88
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
90
procedure ap_set_last_modified(r: Prequest_rec);
91
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
93
function ap_meets_conditions(r: Prequest_rec): cint;
94
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
96
{ Other ways to send stuff at the client. All of these keep track
97
* of bytes_sent automatically. This indirection is intended to make
98
* it a little more painless to slide things like HTTP-NG packetization
99
* underneath the main body of the code later. In the meantime, it lets
100
* us centralize a bit of accounting (bytes_sent).
102
* These also return the number of bytes written by the call.
103
* They should only be called with a timeout registered, for obvious reaasons.
104
* (Ditto the send_header stuff).
107
//function ap_send_fd(f: PFILE; r: Prequest_rec): clong;
108
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
110
//function ap_send_fd_length(f: PFILE; r: Prequest_rec; length: clong): clong;
111
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
113
function ap_send_fb(f: PBUFF; r: Prequest_rec): clong;
114
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
116
function ap_send_fb_length(f: PBUFF; r: Prequest_rec): clong;
117
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
119
function ap_send_mmap(mm: Pointer; r: Prequest_rec; offset, length: size_t): size_t;
120
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
122
{ Hmmm... could macrofy these for now, and maybe forever, though the
123
* definitions of the macros would get a whole lot hairier.
126
function ap_rputc(c: cint; r: Prequest_rec): cint;
127
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
129
function ap_rputs(const str: PChar; r: Prequest_rec): cint;
130
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
132
function ap_rwrite(const buf: Pointer; nbyte: cint; r: Prequest_rec): cint;
133
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
135
function ap_rvputs(r: Prequest_rec; others: array of const): cint;
136
cdecl; external LibHTTPD;
138
function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): cint;
139
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
141
function ap_rprintf(r: Prequest_rec; const fmt: PChar; others: array of const): cint;
142
cdecl; external LibHTTPD;
144
{ __attribute__((format(printf,2,3)));}
146
function ap_rflush(r: Prequest_rec): cint;
147
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
150
* Index used in custom_responses array for a specific error code
151
* (only use outside protocol.c is in getting them configured).
154
function ap_index_of_response(status: cint): cint;
155
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
157
{ Reading a block of data from the client connection (e.g., POST arg) }
159
function ap_setup_client_block(r: Prequest_rec; read_policy: cint): cint;
160
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
162
function ap_should_client_block(r: Prequest_rec): cint;
163
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
165
function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: cint): clong;
166
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
168
function ap_discard_request_body(r: Prequest_rec): cint;
169
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
171
{ Sending a byterange }
173
function ap_set_byterange(r: Prequest_rec): cint;
174
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
176
function ap_each_byterange(r: Prequest_rec; offset, length: Pclong): cint;
177
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
179
{ Support for the Basic authentication protocol. Note that there's
180
* nothing that prevents these from being in mod_auth.c, except that other
181
* modules which wanted to provide their own variants on finding users and
182
* passwords for Basic auth (a fairly common request) would then require
183
* mod_auth to be loaded or they wouldn't work.
185
* get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured
186
* a correct value in r->connection->user); otherwise it returns an error
187
* code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED
188
* if no authentication at all seemed to be in use, or DECLINED if there
189
* was authentication but it wasn't Basic (in which case, the caller should
190
* presumably decline as well).
192
* note_basic_auth_failure arranges for the right stuff to be scribbled on
193
* the HTTP return so that the client knows how to authenticate itself the
194
* next time. As does note_digest_auth_failure for Digest auth.
196
* note_auth_failure does the same thing, but will call the correct one
197
* based on the authentication type in use.
201
procedure ap_note_auth_failure(r: Prequest_rec);
202
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
204
procedure ap_note_basic_auth_failure(r: Prequest_rec);
205
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
207
procedure ap_note_digest_auth_failure(r: Prequest_rec);
208
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
210
function ap_get_basic_auth_pw(r: Prequest_rec; const pw: PPChar): cint;
211
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
214
* Setting up the protocol fields for subsidiary requests...
215
* Also, a wrapup function to keep the internal accounting straight.
218
procedure ap_set_sub_req_protocol(rnew, r: Prequest_rec);
219
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
221
procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
222
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
224
{ This is also useful for putting sub_reqs and internal_redirects together }
226
//CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri);
228
{ Get the method number associated with the given string, assumed to
229
* contain an HTTP method. Returns M_INVALID if not recognized.
231
function ap_method_number_of(const method: PChar): cint;
232
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
234
function ap_getline(s: PChar; n: cint; in_: PBUFF; fold: cint): cint;
235
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
237
function ap_get_chunk_size(b: PChar): clong;
238
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;