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

2018-05-29 Thread Marion et Christophe JAILLET




Le 30/05/2018 à 00:40, Yann Ylavic a écrit :

Hi Christophe,

On Fri, May 25, 2018 at 10:00 PM,   wrote:

Author: jailletc36
Date: Fri May 25 20:00:04 2018
New Revision: 1832275

URL: http://svn.apache.org/viewvc?rev=1832275=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

2018-05-29 Thread Yann Ylavic
On Wed, May 30, 2018 at 12:40 AM, Yann Ylavic  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

2018-05-29 Thread Yann Ylavic
Hi Christophe,

On Fri, May 25, 2018 at 10:00 PM,   wrote:
> Author: jailletc36
> Date: Fri May 25 20:00:04 2018
> New Revision: 1832275
>
> URL: http://svn.apache.org/viewvc?rev=1832275=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

2018-05-25 Thread Christophe Jaillet

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, jaillet...@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=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=1832274=1832275=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
= 2.4.7>
  ProxyPass /uds/ unix:/tmp/test-ptf.sock|http:


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=1832274=1832275=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=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=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");