stas 2003/02/19 17:28:25
Modified: t/response/TestAPI uri.pm
xs/APR/URI APR__URI.h
. Changes
Log:
fix a bug for apr < 0.9.3, where it segfaults in apr_uri_unparse, if
hostname is set, but not the scheme.
Revision Changes Path
1.9 +13 -1 modperl-2.0/t/response/TestAPI/uri.pm
Index: uri.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/uri.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- uri.pm 14 May 2002 01:32:50 -0000 1.8
+++ uri.pm 20 Feb 2003 01:28:24 -0000 1.9
@@ -4,6 +4,7 @@
use warnings FATAL => 'all';
use Apache::Test;
+use Apache::TestUtil;
use APR::URI ();
use Apache::URI ();
@@ -17,7 +18,7 @@
sub handler {
my $r = shift;
- plan $r, tests => 14;
+ plan $r, tests => 15;
$r->args('query');
@@ -49,6 +50,17 @@
$parsed->path($path);
ok $parsed->path eq $path;
+
+ {
+ # test the segfault in apr < 0.9.3 (fixed on mod_perl side)
+ # passing only the /path
+ my $parsed = APR::URI->parse($r->pool, $r->uri);
+ # set hostname, but not the scheme
+ $parsed->hostname($r->get_server_name);
+ $parsed->port($r->get_server_port);
+ #$parsed->scheme('http');
+ ok t_cmp($r->construct_url, $parsed->unparse);
+ }
my $newr = Apache::RequestRec->new($r->connection, $r->pool);
my $url_string = "$path?query";
1.5 +9 -0 modperl-2.0/xs/APR/URI/APR__URI.h
Index: APR__URI.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/URI/APR__URI.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- APR__URI.h 14 May 2002 01:32:50 -0000 1.4
+++ APR__URI.h 20 Feb 2003 01:28:24 -0000 1.5
@@ -3,6 +3,15 @@
apr_uri_t *uptr,
unsigned flags)
{
+
+ /* XXX: check that my patch was actually applied in apr v9.3 */
+#if APR_MINOR_VERSION == 9 && APR_PATCH_VERSION < 3
+ /* apr < 0.9.3 segfaults if hostname is set, but scheme is not */
+ if (uptr->hostname && !uptr->scheme) {
+ uptr->scheme = "http";
+ }
+#endif
+
return apr_uri_unparse(((modperl_uri_t *)uptr)->pool,
uptr, flags);
}
1.131 +3 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -r1.130 -r1.131
--- Changes 19 Feb 2003 23:55:22 -0000 1.130
+++ Changes 20 Feb 2003 01:28:25 -0000 1.131
@@ -10,6 +10,9 @@
=item 1.99_09-dev
+fix a bug for apr < 0.9.3, where it segfaults in apr_uri_unparse, if
+hostname is set, but not the scheme. [Stas]
+
move $r->send_http_header implementation to Apache::compat. This
allows the 1.0 code to run unmodified if $r->send_http_header is
called before the response change. we already handle the check whether