Commit 681481b0 authored by Xavier Guimard's avatar Xavier Guimard

Fix #1630

parent 27c7e375
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
auth_request_set $headername10 $upstream_http_headername10; auth_request_set $headername10 $upstream_http_headername10;
auth_request_set $headervalue10 $upstream_http_headervalue10; auth_request_set $headervalue10 $upstream_http_headervalue10;
auth_request_set $lmcookie $upstream_http_cookie; auth_request_set $lmcookie $upstream_http_cookie;
add_header Set-Cookie $lmcookie;
access_by_lua ' access_by_lua '
i = 1 i = 1
ngx.req.set_header("Cookie",ngx.var.lmcookie) ngx.req.set_header("Cookie",ngx.var.lmcookie)
......
...@@ -27,10 +27,11 @@ sub set_header_in { ...@@ -27,10 +27,11 @@ sub set_header_in {
sub unset_header_in { sub unset_header_in {
my ( $class, $req, $header ) = @_; my ( $class, $req, $header ) = @_;
$req->{respHeaders} = [ grep { $_ ne $header } @{ $req->{respHeaders} } ]; $req->{respHeaders} = [ grep { $_ ne $header and $_ ne cgiName($header) }
@{ $req->{respHeaders} } ];
delete $req->{env}->{ cgiName($header) };
$header =~ s/-/_/g; $header =~ s/-/_/g;
delete $req->{env}->{$header}; delete $req->{env}->{$header};
delete $req->{env}->{"HTTP_$header"};
} }
# Inheritence is broken in this case with Debian >= jessie # Inheritence is broken in this case with Debian >= jessie
......
...@@ -67,11 +67,8 @@ sub handler { ...@@ -67,11 +67,8 @@ sub handler {
my ( $self, $req ) = @_; my ( $self, $req ) = @_;
my $hdrs = $req->{respHeaders}; my $hdrs = $req->{respHeaders};
$req->{respHeaders} = []; $req->{respHeaders} = [];
my $cookie = $req->env->{HTTP_COOKIE};
my $cn = $self->Lemonldap::NG::Handler::Main::tsv->{cookieName};
$cookie =~ s/\b$cn(http)?=[^,;]*[,;\s]*//og;
my @convertedHdrs = my @convertedHdrs =
( 'Content-Length' => 0, Cookie => ( $cookie // '' ) ); ( 'Content-Length' => 0, Cookie => ( $req->env->{HTTP_COOKIE} // '' ) );
my $i = 0; my $i = 0;
while ( my $k = shift @$hdrs ) { while ( my $k = shift @$hdrs ) {
my $v = shift @$hdrs; my $v = shift @$hdrs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment