You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "J. Rhett Aultman" <wl...@weatherlight.com> on 2006/01/26 19:24:18 UTC

[users@httpd] Modifying the WebDAV module

Apache users,

I'm part of a project where we are trying to slightly change the
behavior of the way the WebDAV module works.  Basically, our goal is to
be able to create a number of directories under a given webroot
(/.../htdocs/user1, /.../htdocs/user2, etc), and then make it such that
each user's requests for file activities take place in their own little
"sandbox".  Thus, the user "user1" requesting the file "/test.txt" gets
the file from /.../htdocs/user1/test.txt and is unaware the file is
coming from his own sandbox directory.  We want to do this in such a way
that adding a new user doesn't require modifications to httpd.conf, as well.

Our original plan was to require authentication to the root directory. 
This would put the user's id in a field in the request_rec structure. 
Then, we would modify the code in mod_dav.c to detect the user's id and
rewrite the fields in the request_rec structure to point to a location
inside the user's sandbox directory.  This seemed like a good idea at
the time, but our attempts at implementing this haven't worked.  To be
specific, our modifications seem to do nothing at all.  Specifically,
we've been focusing on altering the function dav_get_resource( ) in
mod_dav.c.  Within this function, we have tried rewriting the field
r->uri and have also tried rewriting the field conf->dir.  In either
case, the effect produced behavior identical to an unmodified copy of
mod_dav.c.

So, I have two questions: (1) Is there an easier way to do this?  (2) If
the idea is sound, what would be the correct way to rewrite the
variables involved in mod_dav's behavior?

--
Rhett.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Modifying the WebDAV module

Posted by Joshua Slive <jo...@slive.ca>.
On 1/26/06, J. Rhett Aultman <wl...@weatherlight.com> wrote:
> Apache users,
>
> I'm part of a project where we are trying to slightly change the
> behavior of the way the WebDAV module works.  Basically, our goal is to
> be able to create a number of directories under a given webroot
> (/.../htdocs/user1, /.../htdocs/user2, etc), and then make it such that
> each user's requests for file activities take place in their own little
> "sandbox".  Thus, the user "user1" requesting the file "/test.txt" gets
> the file from /.../htdocs/user1/test.txt and is unaware the file is
> coming from his own sandbox directory.  We want to do this in such a way
> that adding a new user doesn't require modifications to httpd.conf, as well.
>
> Our original plan was to require authentication to the root directory.
> This would put the user's id in a field in the request_rec structure.
> Then, we would modify the code in mod_dav.c to detect the user's id and
> rewrite the fields in the request_rec structure to point to a location
> inside the user's sandbox directory.  This seemed like a good idea at
> the time, but our attempts at implementing this haven't worked.  To be
> specific, our modifications seem to do nothing at all.  Specifically,
> we've been focusing on altering the function dav_get_resource( ) in
> mod_dav.c.  Within this function, we have tried rewriting the field
> r->uri and have also tried rewriting the field conf->dir.  In either
> case, the effect produced behavior identical to an unmodified copy of
> mod_dav.c.
>
> So, I have two questions: (1) Is there an easier way to do this?

I would do something like:

RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule (.*) /.../htdocs/%1$1 [PT]

I'm not sure if the [PT] is necessary, and I haven't actually tried
this, but it should work.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Cookie problem in IE, but not FF

Posted by Boysenberry Payne <bo...@humaniteque.com>.
You'll probably get a better response from the mailing list that are 
more geared towards Apache2::Cookie...

the mod_perl list is:
modperl@perl.apache.org

The module specific list for Apache2::Cookie is:
apreq-dev@httpd.apache.org

Without knowing what you're trying to do with your code I might not be 
able to answer you effectively.

So far in my limitted experience with Apache2::Cookie I've found the IE 
for the Windows is particularly
finicky about how cookies are made.  Here is an example of code I have 
to set cookies:

#
# Object's constructor
#
sub new {

	$self->{jar} = Apache2::Cookie::Jar->new( $self->{req} );
	$self->{cookies} = $self->{jar}->cookies();
}


#
# Set Cookie Array Up for baking later
# $cookie = { name => "", value => "" }
#
sub set {

	my( $self, $cookie ) = ( shift, shift );
	my $data = $self->{data}; # an array I use to set cookies later
	if( $cookie ) {
		push( @$data, Apache2::Cookie->new( $self->{req}, %{$cookie} ) ) or 
return;
	}
	return 1;
}



Then when I'm done with everything else and ready to output:

my $data = $self->{cookies}->{data};

if( @$data ) {
	foreach( @$data ) {
		$_->bake( $r );
	}
}


To get cookies I use:

my $jar = $self->{cookies}->{jar};
my $cookies = $jar->cookies();
my $previous_cookie = $cookies->{previous_cookie}->thaw if( 
$cookies->{previous_cookie} );

There are probably way better examples out there already...


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 1, 2006, at 12:37 AM, Jason Younker wrote:

>
> Hello All,
>
> I recently upgraded to the following (on a rhel3 box):
> Apache/2.0.55
> mod_ssl/2.0.55
> OpenSSL/0.9.8
> DAV/2
> mod_apreq2-20050712/2.1.3-dev
> mod_perl/2.0.2 Perl/v5.8.0
>
> And now I find myself stuck for hours on what I am convinced is a 
> no-brainer. Here is what I am trying to do ($r below is of course an 
> Apache2::RequestRec object):
>
> --start--
>
> my $jar = Apache2::Cookie::Jar->new($r);
> $m->out("Jar Status: ". $jar->status() ."<br>");
>
> --end--
>
> In Firefox 1.5, this prints: "Jar Status: Success"
>
> However, in IE 6.0.28, I am getting: "Jar Status: Missing input data"
>
> Other than that, I don't know what to tell you. I have placed some 
> install information below (how I compiled mod_perl, apache, openssl in 
> case it helps). I imagine this is an httpd.conf issue, but I have no 
> idea what to ask or where to go from here. *Any* help is very, very 
> appreciated!
>
> Jason
>
> # openssl
> cd openssl-0.9.8a
> ./config --prefix=/usr/local/ssl/install 
> --openssldir=/usr/local/ssl/install/openssl
> make
> make install
>
> # Apache2
> tar -zxvf httpd-2.2.0.tar.gz
> cd httpd-2.2.0
> ./configure -with-mpm=worker --enable-modules=all 
> --enable-mods-shared=all --enable-deflate --enable-ssl 
> --with-ssl=/usr/local/ssl/install/openssl
> make
> make install
>
>
> # mod_perl 2
> tar -zxvf mod_perl-2.0-current.tar.gz
> cd mod_perl-2.0.2
> perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
> make
> make test
> make install
> ls -l /usr/local/apache2/modules/mod_perl.so
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Cookie problem in IE, but not FF

Posted by Jason Younker <do...@hotmail.com>.
Hello All,

I recently upgraded to the following (on a rhel3 box):
Apache/2.0.55
mod_ssl/2.0.55
OpenSSL/0.9.8
DAV/2
mod_apreq2-20050712/2.1.3-dev
mod_perl/2.0.2 Perl/v5.8.0

And now I find myself stuck for hours on what I am convinced is a 
no-brainer. Here is what I am trying to do ($r below is of course an 
Apache2::RequestRec object):

--start--

my $jar = Apache2::Cookie::Jar->new($r);
$m->out("Jar Status: ". $jar->status() ."<br>");

--end--

In Firefox 1.5, this prints: "Jar Status: Success"

However, in IE 6.0.28, I am getting: "Jar Status: Missing input data"

Other than that, I don't know what to tell you. I have placed some install 
information below (how I compiled mod_perl, apache, openssl in case it 
helps). I imagine this is an httpd.conf issue, but I have no idea what to 
ask or where to go from here. *Any* help is very, very appreciated!

Jason

# openssl
cd openssl-0.9.8a
./config --prefix=/usr/local/ssl/install 
--openssldir=/usr/local/ssl/install/openssl
make
make install

# Apache2
tar -zxvf httpd-2.2.0.tar.gz
cd httpd-2.2.0
./configure -with-mpm=worker --enable-modules=all --enable-mods-shared=all 
--enable-deflate --enable-ssl --with-ssl=/usr/local/ssl/install/openssl
make
make install


# mod_perl 2
tar -zxvf mod_perl-2.0-current.tar.gz
cd mod_perl-2.0.2
perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
make
make test
make install
ls -l /usr/local/apache2/modules/mod_perl.so



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org