Lines Matching refs:r

39 static int curltest_echo_handler(request_rec *r);
40 static int curltest_put_handler(request_rec *r);
41 static int curltest_tweak_handler(request_rec *r);
42 static int curltest_1_1_required(request_rec *r);
43 static int curltest_sslinfo_handler(request_rec *r);
182 static int curltest_echo_handler(request_rec *r) in curltest_echo_handler() argument
184 conn_rec *c = r->connection; in curltest_echo_handler()
194 if(strcmp(r->handler, "curltest-echo")) { in curltest_echo_handler()
197 if(r->method_number != M_GET && r->method_number != M_POST) { in curltest_echo_handler()
201 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "echo_handler: processing"); in curltest_echo_handler()
202 if(r->args) { in curltest_echo_handler()
205 args = apr_cstr_split(r->args, "&", 1, r->pool); in curltest_echo_handler()
229 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, in curltest_echo_handler()
232 ap_remove_output_filter_byhandle(r->output_filters, "HTTP_HEADER"); in curltest_echo_handler()
233 r->connection->keepalive = AP_CONN_CLOSE; in curltest_echo_handler()
237 r->status = 200; in curltest_echo_handler()
239 r->clength = die_after_len + 1; in curltest_echo_handler()
240 r->chunked = 0; in curltest_echo_handler()
241 apr_table_set(r->headers_out, "Content-Length", in curltest_echo_handler()
242 apr_ltoa(r->pool, (long)r->clength)); in curltest_echo_handler()
245 r->clength = -1; in curltest_echo_handler()
246 r->chunked = 1; in curltest_echo_handler()
247 apr_table_unset(r->headers_out, "Content-Length"); in curltest_echo_handler()
250 apr_table_unset(r->headers_out, "Content-Encoding"); in curltest_echo_handler()
251 apr_table_setn(r->subprocess_env, "no-brotli", "1"); in curltest_echo_handler()
252 apr_table_setn(r->subprocess_env, "no-gzip", "1"); in curltest_echo_handler()
254 ct = apr_table_get(r->headers_in, "content-type"); in curltest_echo_handler()
255 ap_set_content_type(r, ct ? ct : "application/octet-stream"); in curltest_echo_handler()
257 bb = apr_brigade_create(r->pool, c->bucket_alloc); in curltest_echo_handler()
259 rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK); in curltest_echo_handler()
263 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, in curltest_echo_handler()
266 ap_remove_output_filter_byhandle(r->output_filters, "HTTP_HEADER"); in curltest_echo_handler()
267 r->connection->keepalive = AP_CONN_CLOSE; in curltest_echo_handler()
270 if(ap_should_client_block(r)) { in curltest_echo_handler()
271 while(0 < (l = ap_get_client_block(r, &buffer[0], sizeof(buffer)))) { in curltest_echo_handler()
274 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, in curltest_echo_handler()
277 ap_pass_brigade(r->output_filters, bb); in curltest_echo_handler()
278 ap_remove_output_filter_byhandle(r->output_filters, "HTTP_HEADER"); in curltest_echo_handler()
279 r->connection->keepalive = AP_CONN_CLOSE; in curltest_echo_handler()
282 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, in curltest_echo_handler()
287 rv = ap_pass_brigade(r->output_filters, bb); in curltest_echo_handler()
290 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, in curltest_echo_handler()
297 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "echo_handler: request read"); in curltest_echo_handler()
299 if(r->trailers_in && !apr_is_empty_table(r->trailers_in)) { in curltest_echo_handler()
300 ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, in curltest_echo_handler()
302 apr_table_setn(r->trailers_out, "h2test-trailers-in", in curltest_echo_handler()
303 apr_itoa(r->pool, 1)); in curltest_echo_handler()
306 rv = ap_pass_brigade(r->output_filters, bb); in curltest_echo_handler()
310 r->status != HTTP_OK || in curltest_echo_handler()
312 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "echo_handler: done"); in curltest_echo_handler()
317 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "echo_handler failed"); in curltest_echo_handler()
323 static int curltest_tweak_handler(request_rec *r) in curltest_tweak_handler() argument
325 conn_rec *c = r->connection; in curltest_tweak_handler()
339 if(strcmp(r->handler, "curltest-tweak")) { in curltest_tweak_handler()
342 if(r->method_number == M_DELETE) { in curltest_tweak_handler()
346 else if(r->method_number != M_GET && r->method_number != M_POST) { in curltest_tweak_handler()
350 if(r->args) { in curltest_tweak_handler()
351 args = apr_cstr_split(r->args, "&", 1, r->pool); in curltest_tweak_handler()
374 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, in curltest_tweak_handler()
376 ap_die(HTTP_BAD_REQUEST, r); in curltest_tweak_handler()
431 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "query parameter not " in curltest_tweak_handler()
433 arg, r->args); in curltest_tweak_handler()
434 ap_die(HTTP_BAD_REQUEST, r); in curltest_tweak_handler()
439 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "error_handler: processing " in curltest_tweak_handler()
440 "request, %s", r->args? r->args : "(no args)"); in curltest_tweak_handler()
441 r->status = http_status; in curltest_tweak_handler()
442 r->clength = with_cl ? (chunks * chunk_size) : -1; in curltest_tweak_handler()
443 r->chunked = (r->proto_num >= HTTP_VERSION(1, 1)) && !with_cl; in curltest_tweak_handler()
444 apr_table_setn(r->headers_out, "request-id", request_id); in curltest_tweak_handler()
445 if(r->clength >= 0) { in curltest_tweak_handler()
446 apr_table_set(r->headers_out, "Content-Length", in curltest_tweak_handler()
447 apr_ltoa(r->pool, (long)r->clength)); in curltest_tweak_handler()
450 apr_table_unset(r->headers_out, "Content-Length"); in curltest_tweak_handler()
452 apr_table_unset(r->headers_out, "Content-Encoding"); in curltest_tweak_handler()
453 apr_table_setn(r->subprocess_env, "no-brotli", "1"); in curltest_tweak_handler()
454 apr_table_setn(r->subprocess_env, "no-gzip", "1"); in curltest_tweak_handler()
456 ap_set_content_type(r, "application/octet-stream"); in curltest_tweak_handler()
457 bb = apr_brigade_create(r->pool, c->bucket_alloc); in curltest_tweak_handler()
468 rv = ap_pass_brigade(r->output_filters, bb); in curltest_tweak_handler()
480 rv = ap_pass_brigade(r->output_filters, bb); in curltest_tweak_handler()
483 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, in curltest_tweak_handler()
494 rv = ap_pass_brigade(r->output_filters, bb); in curltest_tweak_handler()
496 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, in curltest_tweak_handler()
504 rv = ap_pass_brigade(r->output_filters, bb); in curltest_tweak_handler()
508 r->connection->keepalive = AP_CONN_CLOSE; in curltest_tweak_handler()
510 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, in curltest_tweak_handler()
512 "close=%d", r->status, c->aborted, close_conn); in curltest_tweak_handler()
518 b = ap_bucket_error_create(http_status, NULL, r->pool, c->bucket_alloc); in curltest_tweak_handler()
519 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, in curltest_tweak_handler()
523 ap_pass_brigade(r->output_filters, bb); in curltest_tweak_handler()
528 static int curltest_put_handler(request_rec *r) in curltest_put_handler() argument
530 conn_rec *c = r->connection; in curltest_put_handler()
545 if(strcmp(r->handler, "curltest-put")) { in curltest_put_handler()
548 if(r->method_number != M_PUT) { in curltest_put_handler()
552 if(r->args) { in curltest_put_handler()
553 args = apr_cstr_split(r->args, "&", 1, r->pool); in curltest_put_handler()
582 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "query parameter not " in curltest_put_handler()
584 arg, r->args); in curltest_put_handler()
585 ap_die(HTTP_BAD_REQUEST, r); in curltest_put_handler()
590 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "put_handler: processing"); in curltest_put_handler()
591 r->status = 200; in curltest_put_handler()
592 r->clength = -1; in curltest_put_handler()
593 r->chunked = 1; in curltest_put_handler()
594 apr_table_unset(r->headers_out, "Content-Length"); in curltest_put_handler()
596 apr_table_unset(r->headers_out, "Content-Encoding"); in curltest_put_handler()
597 apr_table_setn(r->subprocess_env, "no-brotli", "1"); in curltest_put_handler()
598 apr_table_setn(r->subprocess_env, "no-gzip", "1"); in curltest_put_handler()
600 ct = apr_table_get(r->headers_in, "content-type"); in curltest_put_handler()
601 ap_set_content_type(r, ct ? ct : "text/plain"); in curltest_put_handler()
606 bb = apr_brigade_create(r->pool, c->bucket_alloc); in curltest_put_handler()
608 rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK); in curltest_put_handler()
611 if(ap_should_client_block(r)) { in curltest_put_handler()
612 while(0 < (l = ap_get_client_block(r, &buffer[0], sizeof(buffer)))) { in curltest_put_handler()
613 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, in curltest_put_handler()
620 r->status = 413; in curltest_put_handler()
626 s_rbody_len = apr_psprintf(r->pool, "%"APR_OFF_T_FMT, rbody_len); in curltest_put_handler()
627 apr_table_setn(r->headers_out, "Received-Length", s_rbody_len); in curltest_put_handler()
633 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "put_handler: request read"); in curltest_put_handler()
635 rv = ap_pass_brigade(r->output_filters, bb); in curltest_put_handler()
637 if(r->status == 413) { in curltest_put_handler()
643 || r->status != HTTP_OK in curltest_put_handler()
645 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "put_handler: done"); in curltest_put_handler()
650 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "put_handler failed"); in curltest_put_handler()
656 static int curltest_1_1_required(request_rec *r) in curltest_1_1_required() argument
658 conn_rec *c = r->connection; in curltest_1_1_required()
670 if(strcmp(r->handler, "curltest-1_1-required")) { in curltest_1_1_required()
674 if(HTTP_VERSION_MAJOR(r->proto_num) > 1) { in curltest_1_1_required()
675 apr_table_setn(r->notes, "ssl-renegotiate-forbidden", "1"); in curltest_1_1_required()
676 ap_die(HTTP_FORBIDDEN, r); in curltest_1_1_required()
680 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "1_1_handler: processing"); in curltest_1_1_required()
681 r->status = 200; in curltest_1_1_required()
682 r->clength = -1; in curltest_1_1_required()
683 r->chunked = 1; in curltest_1_1_required()
684 apr_table_unset(r->headers_out, "Content-Length"); in curltest_1_1_required()
686 apr_table_unset(r->headers_out, "Content-Encoding"); in curltest_1_1_required()
687 apr_table_setn(r->subprocess_env, "no-brotli", "1"); in curltest_1_1_required()
688 apr_table_setn(r->subprocess_env, "no-gzip", "1"); in curltest_1_1_required()
690 ct = apr_table_get(r->headers_in, "content-type"); in curltest_1_1_required()
691 ap_set_content_type(r, ct ? ct : "text/plain"); in curltest_1_1_required()
693 bb = apr_brigade_create(r->pool, c->bucket_alloc); in curltest_1_1_required()
697 rv = ap_pass_brigade(r->output_filters, bb); in curltest_1_1_required()
707 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "1_1_handler: request read"); in curltest_1_1_required()
709 rv = ap_pass_brigade(r->output_filters, bb); in curltest_1_1_required()
713 || r->status != HTTP_OK in curltest_1_1_required()
715 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "1_1_handler: done"); in curltest_1_1_required()
720 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "1_1_handler failed"); in curltest_1_1_required()
726 static int brigade_env_var(request_rec *r, apr_bucket_brigade *bb, in brigade_env_var() argument
730 s = apr_table_get(r->subprocess_env, name); in brigade_env_var()
736 static int curltest_sslinfo_handler(request_rec *r) in curltest_sslinfo_handler() argument
738 conn_rec *c = r->connection; in curltest_sslinfo_handler()
748 if(strcmp(r->handler, "curltest-sslinfo")) { in curltest_sslinfo_handler()
751 if(r->method_number != M_GET) { in curltest_sslinfo_handler()
755 if(r->args) { in curltest_sslinfo_handler()
756 apr_array_header_t *args = apr_cstr_split(r->args, "&", 1, r->pool); in curltest_sslinfo_handler()
774 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "query parameter not " in curltest_sslinfo_handler()
776 arg, r->args); in curltest_sslinfo_handler()
777 ap_die(HTTP_BAD_REQUEST, r); in curltest_sslinfo_handler()
782 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "sslinfo: processing"); in curltest_sslinfo_handler()
783 r->status = 200; in curltest_sslinfo_handler()
784 r->clength = -1; in curltest_sslinfo_handler()
785 r->chunked = 1; in curltest_sslinfo_handler()
786 apr_table_unset(r->headers_out, "Content-Length"); in curltest_sslinfo_handler()
788 apr_table_unset(r->headers_out, "Content-Encoding"); in curltest_sslinfo_handler()
789 apr_table_setn(r->subprocess_env, "no-brotli", "1"); in curltest_sslinfo_handler()
790 apr_table_setn(r->subprocess_env, "no-gzip", "1"); in curltest_sslinfo_handler()
792 ap_set_content_type(r, "application/json"); in curltest_sslinfo_handler()
794 bb = apr_brigade_create(r->pool, c->bucket_alloc); in curltest_sslinfo_handler()
797 brigade_env_var(r, bb, "HTTPS"); in curltest_sslinfo_handler()
798 brigade_env_var(r, bb, "SSL_PROTOCOL"); in curltest_sslinfo_handler()
799 brigade_env_var(r, bb, "SSL_CIPHER"); in curltest_sslinfo_handler()
800 brigade_env_var(r, bb, "SSL_SESSION_ID"); in curltest_sslinfo_handler()
801 brigade_env_var(r, bb, "SSL_SESSION_RESUMED"); in curltest_sslinfo_handler()
802 brigade_env_var(r, bb, "SSL_SRP_USER"); in curltest_sslinfo_handler()
803 brigade_env_var(r, bb, "SSL_SRP_USERINFO"); in curltest_sslinfo_handler()
804 brigade_env_var(r, bb, "SSL_TLS_SNI"); in curltest_sslinfo_handler()
810 rv = ap_pass_brigade(r->output_filters, bb); in curltest_sslinfo_handler()
817 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "1_1_handler: request read"); in curltest_sslinfo_handler()
819 rv = ap_pass_brigade(r->output_filters, bb); in curltest_sslinfo_handler()
823 r->connection->keepalive = AP_CONN_CLOSE; in curltest_sslinfo_handler()
825 || r->status != HTTP_OK in curltest_sslinfo_handler()
827 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "1_1_handler: done"); in curltest_sslinfo_handler()
832 ap_log_rerror(APLOG_MARK, APLOG_TRACE1, rv, r, "1_1_handler failed"); in curltest_sslinfo_handler()