Lines 63-68
rate_limit_filter(ap_filter_t *f, apr_bucket_briga
Link Here
|
63 |
rl_ctx_t *ctx = f->ctx; |
63 |
rl_ctx_t *ctx = f->ctx; |
64 |
apr_bucket_alloc_t *ba = f->r->connection->bucket_alloc; |
64 |
apr_bucket_alloc_t *ba = f->r->connection->bucket_alloc; |
65 |
|
65 |
|
|
|
66 |
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, f->r, |
67 |
"rate_limit_filter()"); |
68 |
|
66 |
/* Set up our rl_ctx_t on first use */ |
69 |
/* Set up our rl_ctx_t on first use */ |
67 |
if (ctx == NULL) { |
70 |
if (ctx == NULL) { |
68 |
|
71 |
|
Lines 192-200
rate_limit_filter(ap_filter_t *f, apr_bucket_briga
Link Here
|
192 |
* Adjust the burst amount depending on how much |
195 |
* Adjust the burst amount depending on how much |
193 |
* we've done up to now. |
196 |
* we've done up to now. |
194 |
*/ |
197 |
*/ |
|
|
198 |
if (APLOGrdebug(f->r)) { |
199 |
apr_off_t rem = 0; |
200 |
apr_brigade_length(bb, 0, &rem); |
201 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, |
202 |
APLOGNO(03485) "rl: chunk %d; burst %d; " |
203 |
"len %"APR_OFF_T_FMT"; rem %"APR_OFF_T_FMT, |
204 |
ctx->chunk_size, ctx->burst, len, rem); |
205 |
} |
195 |
if (ctx->burst) { |
206 |
if (ctx->burst) { |
196 |
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, |
|
|
197 |
APLOGNO(03485) "rl: burst %d; len %"APR_OFF_T_FMT, ctx->burst, len); |
198 |
if (len < ctx->burst) { |
207 |
if (len < ctx->burst) { |
199 |
ctx->burst -= len; |
208 |
ctx->burst -= len; |
200 |
} |
209 |
} |
Lines 327-333
static void register_hooks(apr_pool_t *p)
Link Here
|
327 |
{ |
336 |
{ |
328 |
/* run after mod_deflate etc etc, but not at connection level, ie, mod_ssl. */ |
337 |
/* run after mod_deflate etc etc, but not at connection level, ie, mod_ssl. */ |
329 |
ap_register_output_filter(RATE_LIMIT_FILTER_NAME, rate_limit_filter, |
338 |
ap_register_output_filter(RATE_LIMIT_FILTER_NAME, rate_limit_filter, |
330 |
NULL, AP_FTYPE_PROTOCOL + 3); |
339 |
NULL, AP_FTYPE_CONNECTION - 1); |
331 |
} |
340 |
} |
332 |
|
341 |
|
333 |
AP_DECLARE_MODULE(ratelimit) = { |
342 |
AP_DECLARE_MODULE(ratelimit) = { |