Fails if site is on a non-standard HTTPS port

tony_cowderoy - October 12, 2008 - 20:43
Project:Certificate Login
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443.

Replacing $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] in line 97 of certificatelogin.module seems to fix this (at least on Debian etch with Apache 2).

Old version of line 97:

$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];

New version of line 97:

$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];

#1

tony_cowderoy - October 12, 2008 - 20:45

Correction! The first sentence should read:

When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443/login

#2

flamingvan - October 15, 2008 - 15:36

Thanks for that, tony_cowderoy. I am going to make the changes soon and release new versions. Just a couple of work hurdles to get through first.

#3

flamingvan - December 1, 2008 - 15:53

Tony,
I've made the change. Getting CVS to work always seems to take the most time for me...
Thanks,
Moses

#4

tony_cowderoy - December 22, 2008 - 22:22

Thanks. I've just installed the new version and it seems to work just fine.
Tony

#5

tony_cowderoy - December 23, 2008 - 18:15

Oops! I wrote too soon. I must have been testing the wrong installation. It doesn't work.

You have changed:

$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];

to

$form['#action'] = 'https://'.$_SERVER['SERVER_HOST'].'/'.$_SERVER['REQUEST_URI'];

In my PHP installation there is no such value as $_SERVER['SERVER_HOST'].

It should be:

$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];

BTW, ISTR that I made exactly the same mistake when I first tried to fix it.

Tony

#6

flamingvan - December 29, 2008 - 17:47

All set. I totally do not get CVS. I finally got that updated but it always takes me forever. I installed tortoise and that helps a little I guess.

#7

flamingvan - March 4, 2009 - 16:11
Status:active» fixed

fixed

#8

System Message - March 18, 2009 - 16:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.