You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Christophe Jaillet <ch...@wanadoo.fr> on 2018/05/25 20:03:09 UTC

Re: svn commit: r1832275 - in /httpd/test/framework/trunk/t: conf/extra.conf.in modules/proxy.t

Hi,

just looking for a feedback to know if I did right (i.e. adding a lua 
script to be have a tool to tweak header, "hard coding" the SetCookie 
this way, ...).

Thx in advance for your comments.

CJ


Le 25/05/2018 à 22:00, jailletc36@apache.org a écrit :
> Author: jailletc36
> Date: Fri May 25 20:00:04 2018
> New Revision: 1832275
> 
> URL: http://svn.apache.org/viewvc?rev=1832275&view=rev
> Log:
> Add test for ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath.
> 
> See PR 61560.
> Corrently broken, but working on a fix :)
> 
> Modified:
>      httpd/test/framework/trunk/t/conf/extra.conf.in
>      httpd/test/framework/trunk/t/modules/proxy.t
> 
> Modified: httpd/test/framework/trunk/t/conf/extra.conf.in
> URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1832275&r1=1832274&r2=1832275&view=diff
> ==============================================================================
> --- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
> +++ httpd/test/framework/trunk/t/conf/extra.conf.in Fri May 25 20:00:04 2018
> @@ -283,6 +283,8 @@
>         ProxyPass /reverse/notproxy/ !
>         ProxyPass /reverse/ http://@SERVERNAME@:@PORT@/
>         ProxyPassReverse /reverse/ http://@SERVERNAME@:@PORT@/
> +      ProxyPassReverseCookieDomain local remote
> +      ProxyPassReverseCookiePath /local /remote
>         <IfVersion >= 2.4.7>
>           ProxyPass /uds/ unix:/tmp/test-ptf.sock|http:
>         </IfVersion>
> 
> Modified: httpd/test/framework/trunk/t/modules/proxy.t
> URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/proxy.t?rev=1832275&r1=1832274&r2=1832275&view=diff
> ==============================================================================
> --- httpd/test/framework/trunk/t/modules/proxy.t (original)
> +++ httpd/test/framework/trunk/t/modules/proxy.t Fri May 25 20:00:04 2018
> @@ -7,7 +7,7 @@ use Apache::TestUtil;
>   use Apache::TestConfig ();
>   use Misc;
>   
> -my $num_tests = 23;
> +my $num_tests = 23 + 4;
>   if (have_min_apache_version('2.4.7')) {
>       $num_tests += 2;
>   }
> @@ -97,6 +97,23 @@ my $c = $r->content;
>   chomp $c;
>   ok t_cmp($c, "hello world", "ProxyPass not-proxied content OK");
>   
> +# Testing ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath
> +if (have_module('lua')) {
> +    # '/' is escaped as %2F
> +    # ';' is escaped as %3B
> +    # '=' is escaped as %3D
> +    $r = GET("/reverse//modules/lua/setheaderfromparam.lua?HeaderName=Set-Cookie&HeaderValue=fakedomain%3Dlocal%3Bdomain%3Dlocal");
> +    ok t_cmp($r->code, 200, "Lua executed");
> +    ok t_cmp($r->header("Set-Cookie"), "fakedomain=local;domain=remote", "'Set-Cookie domain=' wrongly updated by the ProxyPassReverseCookieDomain, PR 61560");
> +
> +    $r = GET("/reverse//modules/lua/setheaderfromparam.lua?HeaderName=Set-Cookie&HeaderValue=fakepath%3D%2Flocal%3Bpath%3D%2Flocal");
> +    ok t_cmp($r->code, 200, "Lua executed");
> +    ok t_cmp($r->header("Set-Cookie"), "fakepath=/local;path=/remote", "'Set-Cookie path=' wrongly updated by the ProxyPassReverseCookiePath, PR 61560");
> +}
> +else {
> +    skip "skipping tests which need mod_lua" foreach (1..4);
> +}
> +
>   if (have_module('alias')) {
>       $r = GET("/reverse/perm");
>       ok t_cmp($r->code, 301, "reverse proxy of redirect");
> 
> 
>