New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip port from HTTP_HOST #2335

Merged
merged 1 commit into from Dec 6, 2018

Conversation

Projects
None yet
3 participants
@connortechnology
Copy link
Member

connortechnology commented Dec 6, 2018

HTTP_HOST will contain port if it is other than default. So we need to strip it.

Isaac Connor

@knight-of-ni knight-of-ni merged commit 5258415 into ZoneMinder:master Dec 6, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@heegard

This comment has been minimized.

Copy link

heegard commented Dec 8, 2018

I tried the change to Server.php, it didn't work. I found a second instance where $_SERVER['HTTP_HOST'] is used. I introduced a similar change there also. That seemed to
fix the problem.

These are the changes:
55c55,60
< return $_SERVER['HTTP_HOST'];

# return $_SERVER['HTTP_HOST'];
 # ICON: Hi, I just met you, and this is crazy, but I need to strip port.
$host_with_port_maybe = $_SERVER['HTTP_HOST'];
$heres_my_host = preg_replace('/([^:]+)(:\d+)?/','${1}', $host_with_port_maybe);
#Just use it baby
return $heres_my_host;

98c103,108
< $url .= $_SERVER['HTTP_HOST'];

  	     # ICON: Hi, I just met you, and this is crazy, but I need to strip port.
  	$host_with_port_maybe = $_SERVER['HTTP_HOST'];
  	$heres_my_host = preg_replace('/([^:]+)(:\d+)?/','${1}', $host_with_port_maybe);
  	#Just use it baby
  	#$url .= $_SERVER['HTTP_HOST'];
  	$url .= $heres_my_host;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment