Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes for Ruby 1.9.

  • Loading branch information...
commit 3348c11ea4dc9f43e40b3d605d3034c2d46da141 1 parent c81a5f6
@shugo authored
View
2  Makefile.in
@@ -16,6 +16,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
datadir = @datadir@
libdir = @libdir@
+rubylibprefix = @rubylibprefix@
rubylibdir = @rubylibdir@
archdir = @archdir@
sitedir = @sitedir@
@@ -29,6 +30,7 @@ AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
RUBY = @RUBY@
+RUBY_BASE_NAME = @RUBY_BASE_NAME@
RM = @RM@
CFLAGS = @CFLAGS@ -I. -I$(hdrdir) -I$(hdrdir)/$(arch) $(APACHE_INCLUDES) $(LIBAPREQ_INCLUDES) @DEFS@
View
4 autoconf.rb
@@ -243,6 +243,8 @@ def AC_PROG_INSTALL
$bindir = CONFIG["bindir"].sub(prefix, "$(exec_prefix)").sub(drive, '')
$datadir = CONFIG["datadir"].sub(prefix, "$(prefix)").sub(drive, '')
$libdir = CONFIG["libdir"].sub(prefix, "$(exec_prefix)").sub(drive, '')
+$RUBY_BASE_NAME = CONFIG["RUBY_BASE_NAME"]
+$rubylibprefix = CONFIG["rubylibprefix"]
$archdir = $archdir.sub(prefix, "$(prefix)").sub(drive, '')
$sitelibdir = $sitelibdir.sub(prefix, "$(prefix)").sub(drive, '')
$sitearchdir = $sitearchdir.sub(prefix, "$(prefix)").sub(drive, '')
@@ -416,6 +418,7 @@ def AC_PROG_INSTALL
AC_SUBST("bindir")
AC_SUBST("datadir")
AC_SUBST("libdir")
+AC_SUBST("rubylibprefix")
AC_SUBST("rubylibdir")
AC_SUBST("archdir")
AC_SUBST("sitedir")
@@ -429,6 +432,7 @@ def AC_PROG_INSTALL
AC_SUBST("LD")
AC_SUBST("RANLIB")
AC_SUBST("RUBY")
+AC_SUBST("RUBY_BASE_NAME")
AC_SUBST("RM")
AC_SUBST("CFLAGS")
View
4 configure.rb
@@ -221,6 +221,8 @@ def AC_PROG_INSTALL
$bindir = CONFIG["bindir"].sub(prefix, "$(exec_prefix)").sub(drive, '')
$datadir = CONFIG["datadir"].sub(prefix, "$(prefix)").sub(drive, '')
$libdir = CONFIG["libdir"].sub(prefix, "$(exec_prefix)").sub(drive, '')
+$RUBY_BASE_NAME = CONFIG["RUBY_BASE_NAME"]
+$rubylibprefix = CONFIG["rubylibprefix"]
$archdir = $archdir.sub(prefix, "$(prefix)").sub(drive, '')
$sitelibdir = $sitelibdir.sub(prefix, "$(prefix)").sub(drive, '')
$sitearchdir = $sitearchdir.sub(prefix, "$(prefix)").sub(drive, '')
@@ -394,6 +396,7 @@ def AC_PROG_INSTALL
AC_SUBST("bindir")
AC_SUBST("datadir")
AC_SUBST("libdir")
+AC_SUBST("rubylibprefix")
AC_SUBST("rubylibdir")
AC_SUBST("archdir")
AC_SUBST("sitedir")
@@ -407,6 +410,7 @@ def AC_PROG_INSTALL
AC_SUBST("LD")
AC_SUBST("RANLIB")
AC_SUBST("RUBY")
+AC_SUBST("RUBY_BASE_NAME")
AC_SUBST("RM")
AC_SUBST("CFLAGS")
View
2  lib/apache/erb-run.rb
@@ -97,7 +97,7 @@ def handler(r)
r.allowed |= (1 << M_POST)
return DECLINED
end
- if r.finfo.mode == 0
+ if r.finfo.nil? || r.finfo.mode == 0
return NOT_FOUND
end
View
2  lib/apache/eruby-run.rb
@@ -89,7 +89,7 @@ def check_request(r)
r.allowed |= (1 << M_POST)
return DECLINED
end
- if r.finfo.mode == 0
+ if r.finfo.nil? || r.finfo.mode == 0
return NOT_FOUND
end
return OK
View
3  lib/apache/ruby-run.rb
@@ -62,7 +62,7 @@ def check_request(r)
r.allowed |= (1 << M_POST)
return DECLINED
end
- if r.finfo.mode == 0
+ if r.finfo.nil? || r.finfo.mode == 0
return NOT_FOUND
end
if r.allow_options & OPT_EXECCGI == 0
@@ -80,6 +80,7 @@ def setup(r)
r.setup_cgi_env
filename = r.filename.dup
filename.untaint
+ filename.freeze # to avoid SecurityError in 1.9
Apache.chdir_file(filename)
return filename
end
View
2  mod_ruby.c
@@ -706,7 +706,7 @@ static void ruby_init_interpreter(server_rec *s)
#ifdef RUBY_VM
Init_prelude();
#endif
- default_load_path = GET_LOAD_PATH();
+ default_load_path = rb_ary_dup(GET_LOAD_PATH());
rb_global_variable(&default_load_path);
rb_define_variable("$0", &progname);
list = (char **) conf->load_path->elts;
View
12 request.c
@@ -788,7 +788,7 @@ static VALUE request_notes(VALUE self)
return data->notes;
}
-#ifdef APACHE2
+#if defined(APACHE2) && !defined(RUBY_VM)
#ifdef WIN32
typedef int mode_t;
@@ -859,12 +859,17 @@ static mode_t get_mode(apr_finfo_t *finfo)
static VALUE request_finfo(VALUE self)
{
- VALUE cStat;
request_data *data;
- struct stat *st;
data = get_request_data(self);
if (NIL_P(data->finfo)) {
+#ifdef RUBY_VM
+ data->finfo = rb_protect_funcall(rb_cFile, rb_intern("stat"), NULL, 1,
+ rb_str_new2(data->request->filename));
+#else
+ VALUE cStat;
+ struct stat *st;
+
cStat = rb_const_get(rb_cFile, rb_intern("Stat"));
data->finfo = Data_Make_Struct(cStat, struct stat, NULL, free, st);
#ifdef APACHE2
@@ -884,6 +889,7 @@ static VALUE request_finfo(VALUE self)
#else /* Apache 1.x */
*st = data->request->finfo;
#endif
+#endif
}
return data->finfo;
}
Please sign in to comment.
Something went wrong with that request. Please try again.