Download & Extend

Fails if site is on a non-standard HTTPS port

Project:Certificate login
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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'];

Comments

#1

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

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

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

#4

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

#5

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

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

Status:active» fixed

fixed

#8

Status:fixed» closed (fixed)

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