Problem/Motivation
On our "user/register" page, secure pages redirects properly to https, but the form action submits improperly to http. This wasn't happening before we upgraded from the 6.x-1.9 branch to the 6.x-2.x-dev branch.
Proposed resolution
The following won't extract the path component correctly if the form action url is absolute:
$url = substr($form['#action'], strlen(base_path()));
If we run the @parse_url() function first, then strip the base path from $url['path'], we can account for whether the form action url is absolute or relative:
$url = @parse_url($form['#action']);
$path = drupal_get_normal_path(substr($url['path'], strlen(base_path())));
Patch will be attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | form-action-url-incorrect-1647754-5.patch | 1.36 KB | djbobbydrake |
| #1 | form-action-url-incorrect-1647754-1.patch | 904 bytes | djbobbydrake |
Comments
Comment #1
djbobbydrake commentedPatch attached.
Comment #2
bisonbleu commentedHey djbobbydrake,
How would you reconcile/combine your patch and the code from this issue https://drupal.org/node/1145292#comment-6042150 ?
My site is multilingual and uses language prefixes (i18n). Without the code from #1145292, URLs are broken.
p.s. when patching, I get this error:
Minor detail. :-)
Comment #3
bisonbleu commentedUpdate.
Using just your patch doesn't fix the language prefix issue raised in #1145292. When I tried to log in from mysite.com/user I got an access denied error message. Looking at the resulting URL tells it all: https://mysite.com/en/en/user.
Note the double 'en' language prefix.
My question in #2 then still stands. It would be awesome if you could revisit your patch in light of what was done in #1145292 for multilingual websites.
p.s. My hope is that this patch combined with your 2 recent other patches (#1647760 and #1638004 ) will fix a couple of 'frustrating' issues I've been having with Secure Pages. Thanks a lot.
Comment #4
djbobbydrake commented@bisonbleu, I'll revisit this patch when I get a chance. Thanks for the reply.
Comment #5
djbobbydrake commentedGot it. Here's the patch. It incorporates the fix from #1145292. I tested myself and looks to solve both issues.
Comment #6
djbobbydrake commentedI should also mention that I modified the regex slightly (in https://drupal.org/node/1145292#comment-6042150) to be more specific.
Comment #7
bisonbleu commentedHello DJ,
I've applied your latest patch on 2 live multilingual Ubercart websites. Works great. Can't fault it. This is awesome. Thanks a lot! I owe you one. :-)
Now if I could only get closure for # 1363158, I would be a vey happy camper...
Comment #8
astonvictor commentedI'm closing it because the issue was created a long time ago without any further steps.
if you still need it then raise a new one.
thanks