You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2018/05/25 20:00:04 UTC
svn commit: r1832275 - in /httpd/test/framework/trunk/t: conf/extra.conf.in
modules/proxy.t
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");
Re: svn commit: r1832275 - in /httpd/test/framework/trunk/t:
conf/extra.conf.in modules/proxy.t
Posted by Marion et Christophe JAILLET <ch...@wanadoo.fr>.
Le 30/05/2018 à 00:40, Yann Ylavic a écrit :
> Hi Christophe,
>
> On Fri, May 25, 2018 at 10:00 PM, <ja...@apache.org> wrote:
>> 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 :)
> Even after r1832283, t/modules/proxy.t fails in 2.4.x:
Yes. I was not clear enough about what I was about to fix. Not the test
itself (r1832283 only adds some other cases), but the code in trunk (in
r1832280), which will be proposed for backport soon.
I still waiting, because I want to double check something.I think that
the 'apr_pstrdup' added before the main 'while' loop I've added can be
avoided. I was thinking that 'apr_strtok' would modify the source (i.e.
add a \0 where needed to split the string), but in fact, it duplicates
each token and only keep track of the current position in the,
un-modified, input.
So, a follow-up should arrive tonight or tomorrow's evening.
> Do these depend on r1832280 (not in 2.4.x yet)?
>
> Thanks,
> Yann.
>
Yes, that's it.
CJ
Re: svn commit: r1832275 - in /httpd/test/framework/trunk/t:
conf/extra.conf.in modules/proxy.t
Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, May 30, 2018 at 12:40 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
> Do these depend on r1832280 (not in 2.4.x yet)?
Works with r1832507.
Re: svn commit: r1832275 - in /httpd/test/framework/trunk/t:
conf/extra.conf.in modules/proxy.t
Posted by Yann Ylavic <yl...@gmail.com>.
Hi Christophe,
On Fri, May 25, 2018 at 10:00 PM, <ja...@apache.org> wrote:
> 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 :)
Even after r1832283, t/modules/proxy.t fails in 2.4.x:
# testing : 'Set-Cookie domain=' wrongly updated by
ProxyPassReverseCookieDomain, PR 61560
# expected: 'fakedomain=local;domain=remote'
# received: 'fakedomain=remote;domain=local'
not ok 21
# testing : 'Set-Cookie path=' wrongly updated by
ProxyPassReverseCookiePath, PR 61560
# expected: 'fakepath=/local;path=/remote'
# received: 'fakepath=/remote;path=/local'
not ok 23
Do these depend on r1832280 (not in 2.4.x yet)?
Thanks,
Yann.
Re: svn commit: r1832275 - in /httpd/test/framework/trunk/t:
conf/extra.conf.in modules/proxy.t
Posted by Christophe Jaillet <ch...@wanadoo.fr>.
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");
>
>
>