Skip to content
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

Support both HTTP and HTTPS URLs in http_server.pl #510

Merged
merged 1 commit into from
Sep 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/http_server.pl
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,9 @@ sub html_sub {
if ($data =~ /^(.+)\)\?(\d+),(\d+)$/) {
$data = "$1,xy=$2|$3)";
}
# Allow for &sub1 and &sub1(args)
if ((($sub_name, $sub_arg) = $data =~ /^\&(\S+?)\((.*)\)$/) or

# Allow for &sub1 and &sub1(args)
if ((($sub_name, $sub_arg) = $data =~ /\&([^\&]+?)\((.*)\)$/) or
(($sub_name) = $data =~ /^\&(\S+)$/)) {
$sub_arg = '' unless defined $sub_arg; # Avoid uninit warninng
# $sub_ref = \&{$sub_name}; # This does not work ... code refs are always auto-created :(
Expand Down Expand Up @@ -972,12 +973,12 @@ sub html_response {
# $leave_socket_open_action = "&speak_log_last(1)"; # Only show the last spoken text
# $leave_socket_open_action = "&Voice_Text::last_spoken(1)"; # Only show the last spoken text
}
elsif ($h_response =~ /^http:\S+$/i or $h_response =~ /^reff?erer/i) {
elsif ($h_response =~ /^https?:\S+$/i or $h_response =~ /^reff?erer/i) {
# Allow to use just the base part of the referer
# - some browsers (audrey) do not return full referer url :(
# so allow for referer(url)...
if (my ($rurl) = $h_response =~ /^reff?erer(\S+)/) {
$Http{Referer} =~ m|(http://\S+?)/|;
$Http{Referer} =~ m|(https?://\S+?)/|;
$h_response = $1 . $rurl;
}
elsif ($h_response =~ /^reff?erer/) {
Expand Down Expand Up @@ -1705,7 +1706,7 @@ sub html_page {
$body = 'No data' unless $body;

# Allow for redirect and pre-formated responses (e.g. vxml response)
return http_redirect($body) if $body =~ /^http:\S+$/i;
return http_redirect($body) if $body =~ /^https?:\S+$/i;
return $body if $body =~ /^HTTP\//; # HTTP/1.0 200 OK


Expand Down Expand Up @@ -2769,7 +2770,7 @@ sub unescape {
sub referer {
my ($r) = @_;
$r =~ tr/\|/?/;
$Http{Referer} =~ m|(http://\S+?)/|;
$Http{Referer} =~ m|(https?://\S+?)/|;
$r = $1 . $r unless $r =~ /^http/;
return $r;
}
Expand Down