randyk 2003/10/21 12:31:47
Modified: env libapreq_cgi.c
env/cgi_test/t cgi.t
Log:
- use apr_file_open_stdout/apr_file_printf for sending headers
- enable header tests
Revision Changes Path
1.13 +8 -2 httpd-apreq-2/env/libapreq_cgi.c
Index: libapreq_cgi.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/libapreq_cgi.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- libapreq_cgi.c 21 Oct 2003 16:20:17 -0000 1.12
+++ libapreq_cgi.c 21 Oct 2003 19:31:47 -0000 1.13
@@ -144,8 +144,14 @@
APREQ_DECLARE(apr_status_t)apreq_env_header_out(void *env, const char *name,
char *value)
-{
- return printf("%s: %s" CRLF, name, value) > 0 ? APR_SUCCESS :
APR_EGENERAL;
+{
+ dCTX;
+ apr_file_t *out;
+ int bytes;
+ apr_file_open_stdout(&out, ctx->pool);
+ bytes = apr_file_printf(out, "%s: %s" CRLF, name, value);
+ apreq_log(APREQ_DEBUG 0, ctx, "Setting header: %s => %s", name, value);
+ return bytes > 0 ? APR_SUCCESS : APR_EGENERAL;
}
1.5 +1 -3 httpd-apreq-2/env/cgi_test/t/cgi.t
Index: cgi.t
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/cgi_test/t/cgi.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- cgi.t 21 Oct 2003 16:20:17 -0000 1.4
+++ cgi.t 21 Oct 2003 19:31:47 -0000 1.5
@@ -16,7 +16,7 @@
my @big_key_num = (5, 15, 25);
my @big_keys = ('a'..'z');
-plan tests => 8 + @key_len * @key_num + @big_key_len * @big_key_num;
+plan tests => 10 + @key_len * @key_num + @big_key_len * @big_key_num;
my $script = WIN32 ? '/cgi-bin/cgi_test.exe' : '/cgi-bin/cgi_test';
my $line_end = WIN32 ? "\r\n" : "\n";
@@ -115,7 +115,6 @@
GET_BODY("$script?test=$test&key=$key", Cookie => $cookie),
$test);
}
-exit;
{
my $test = 'bake';
my $key = 'apache';
@@ -123,7 +122,6 @@
my $cookie = "$key=$value";
my ($header) = GET_HEAD("$script?test=$test&key=$key",
Cookie => $cookie) =~ /^#Set-Cookie:\s+(.+)/m;
-
ok t_cmp($cookie, $header, $test);
}
{