Dispatch.pm (interchange-5.8.2) | : | Dispatch.pm (interchange-5.10.0) | ||
---|---|---|---|---|
skipping to change at line 1239 | skipping to change at line 1239 | |||
} | } | |||
if ($inspect_sub) { | if ($inspect_sub) { | |||
unless ($inspect_sub->($m, $ret)) { | unless ($inspect_sub->($m, $ret)) { | |||
last; | last; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
sub set_source { | ||||
my ($source, $priority) = @_; | ||||
my ($subname, $sub); | ||||
if ($subname = $Vend::Cfg->{SpecialSub}{set_source} and | ||||
$sub = $Vend::Cfg->{Sub}{$subname} || $Global::GlobalSub->{$subname}) { | ||||
my $ret; | ||||
eval { $ret = $sub->($source, $priority, $Vend::Session->{source}) }; | ||||
if($@) { | ||||
::logError("Error running %s subroutine %s: %s", | ||||
'set_source', $subname, $@); | ||||
return; | ||||
} | ||||
if (defined $ret) { | ||||
$Vend::Session->{source} = $ret; | ||||
} | ||||
return $ret; | ||||
} | ||||
$Vend::Session->{source} = $source; | ||||
return $source; | ||||
} | ||||
sub dispatch { | sub dispatch { | |||
my($http) = @_; | my($http) = @_; | |||
$H = $http; | $H = $http; | |||
adjust_cgi(); | adjust_cgi(); | |||
## If returns false then was a 404 no catalog or a delivered image | ## If returns false then was a 404 no catalog or a delivered image | |||
open_cat('', $http) or return 1; | open_cat('', $http) or return 1; | |||
Vend::Server::set_process_name("$Vend::Cat $CGI::host"); | Vend::Server::set_process_name("$Vend::Cat $CGI::host"); | |||
skipping to change at line 1277 | skipping to change at line 1302 | |||
$Vend::tmp_session = $Vend::new_session = 1; | $Vend::tmp_session = $Vend::new_session = 1; | |||
$sessionid = 'nsession'; | $sessionid = 'nsession'; | |||
$Vend::Cookie = 1; | $Vend::Cookie = 1; | |||
$Vend::Cfg->{ScratchDefault}{mv_no_count} = 1; | $Vend::Cfg->{ScratchDefault}{mv_no_count} = 1; | |||
$Vend::Cfg->{ScratchDefault}{mv_no_session_id} = 1; | $Vend::Cfg->{ScratchDefault}{mv_no_session_id} = 1; | |||
} | } | |||
elsif ($sessionid and $CGI::values{mv_force_session}) { | elsif ($sessionid and $CGI::values{mv_force_session}) { | |||
# do nothing | # do nothing | |||
} | } | |||
elsif ($::Instance->{CookieName} and ! $Vend::Cfg->{InternalCookie} and $ CGI::cookie) { | elsif ($::Instance->{CookieName} and ! $Vend::Cfg->{InternalCookie} and $ CGI::cookie) { | |||
$Vend::allow_qc = 1; ## Allow the QueryCache AJAX access | ||||
$CGI::cookie =~ m{$::Instance->{CookieName}=($Vend::Cfg->{CookieP attern})}; | $CGI::cookie =~ m{$::Instance->{CookieName}=($Vend::Cfg->{CookieP attern})}; | |||
$seed = $sessionid = $1; | $seed = $sessionid = $1; | |||
if($Vend::Cfg->{InternalCookie}) { | if($Vend::Cfg->{InternalCookie}) { | |||
$CGI::cookiehost = $4; | $CGI::cookiehost = $4; | |||
$CGI::cookieuser = $5; | $CGI::cookieuser = $5; | |||
} | } | |||
else { | else { | |||
$::Instance->{ExternalCookie} = 1; | $::Instance->{ExternalCookie} = 1; | |||
} | } | |||
$Vend::CookieID = $Vend::Cookie = 1; | $Vend::CookieID = $Vend::Cookie = 1; | |||
} | } | |||
elsif ( $CGI::cookie | elsif ( $CGI::cookie | |||
and $::Instance->{CookieName} ||= 'MV_SESSION_ID' | and $::Instance->{CookieName} ||= 'MV_SESSION_ID' | |||
and $CGI::cookie =~ /\b$::Instance->{CookieName}=(\w{8,32 | and $CGI::cookie =~ /\b$::Instance->{CookieName}=(\w{8,32 | |||
})(?:[:_]|%3[aA])([-\@.:A-Za-z0-9]+)/ ) { | })(?:[:_]|%3[aA])([-\@.:A-Za-z0-9]+)/ ) | |||
{ | ||||
$Vend::allow_qc = 1; ## Allow the QueryCache AJAX access | ||||
SESSION_COOKIE: { | SESSION_COOKIE: { | |||
my $id = $1; | my $id = $1; | |||
my $host = $2; | my $host = $2; | |||
if (is_ipv4($host) || is_ipv6($host)) { | if (is_ipv4($host) || is_ipv6($host)) { | |||
$CGI::cookiehost = $host; | $CGI::cookiehost = $host; | |||
} | } | |||
elsif ($host =~ /[A-Za-z0-9][-\@A-Za-z.0-9]+/) { | elsif ($host =~ /[A-Za-z0-9][-\@A-Za-z.0-9]+/) { | |||
$CGI::cookieuser = $host; | $CGI::cookieuser = $host; | |||
} | } | |||
else { | else { | |||
skipping to change at line 1312 | skipping to change at line 1340 | |||
} | } | |||
$sessionid = $id; | $sessionid = $id; | |||
$Vend::CookieID = $Vend::Cookie = 1; | $Vend::CookieID = $Vend::Cookie = 1; | |||
} | } | |||
} | } | |||
#::logDebug("Instance CookieName=$::Instance->{CookieName}, found sessionid=$ses sionid cookiehost=$CGI::cookiehost cookieuser=$CGI::cookieuser external=$::Inst ance->{ExternalCookie}"); | #::logDebug("Instance CookieName=$::Instance->{CookieName}, found sessionid=$ses sionid cookiehost=$CGI::cookiehost cookieuser=$CGI::cookieuser external=$::Inst ance->{ExternalCookie}"); | |||
Vend::Server::set_process_name("$Vend::Cat $CGI::host $sessionid"); | Vend::Server::set_process_name("$Vend::Cat $CGI::host $sessionid"); | |||
my $qc; | ||||
if($qc = $Vend::Cfg->{QueryCache} and $CGI::path_info =~ m{^/$qc->{intro}/} | ||||
) { | ||||
## Received cached query. Will gate $Vend::allow_qc in target (allows pu | ||||
blic queries) | ||||
return response(Vend::Data::run_query_cache($qc,$sessionid)); | ||||
} | ||||
$::Instance->{CookieName} = 'MV_SESSION_ID' if ! $::Instance->{CookieName }; | $::Instance->{CookieName} = 'MV_SESSION_ID' if ! $::Instance->{CookieName }; | |||
$CGI::host = 'nobody' if $Vend::Cfg->{WideOpen}; | $CGI::host = 'nobody' if $Vend::Cfg->{WideOpen}; | |||
if(! $sessionid) { | if(! $sessionid) { | |||
if(my $id = $::Variable->{MV_SESSION_ID}) { | if(my $id = $::Variable->{MV_SESSION_ID}) { | |||
$sessionid = $CGI::values{$id} if $CGI::values{$id}; | $sessionid = $CGI::values{$id} if $CGI::values{$id}; | |||
} | } | |||
if(! $sessionid and $CGI::redirect_status and $Vend::Cfg->{Redire ctCache}) { | if(! $sessionid and $CGI::redirect_status and $Vend::Cfg->{Redire ctCache}) { | |||
skipping to change at line 1500 | skipping to change at line 1534 | |||
} | } | |||
#::logDebug('$Session->{source} before SourcePriority loop: %s', $Vend::Session- >{source}); | #::logDebug('$Session->{source} before SourcePriority loop: %s', $Vend::Session- >{source}); | |||
foreach (@{$Vend::Cfg->{SourcePriority}}) { | foreach (@{$Vend::Cfg->{SourcePriority}}) { | |||
#::logDebug("Looking at $_"); | #::logDebug("Looking at $_"); | |||
if ($_ eq 'mv_pc') { | if ($_ eq 'mv_pc') { | |||
#::logDebug('$CGI::values{mv_pc} is %s', $CGI::values{mv_pc}); | #::logDebug('$CGI::values{mv_pc} is %s', $CGI::values{mv_pc}); | |||
if ($CGI::values{mv_pc} and $CGI::values{mv_pc} =~ /\D/) { | if ($CGI::values{mv_pc} and $CGI::values{mv_pc} =~ /\D/) { | |||
$new_source = $CGI::values{mv_pc}; | $new_source = $CGI::values{mv_pc}; | |||
$new_source =~ s/[\r\n\t]//g; | $new_source =~ s/[\r\n\t]//g; | |||
$Vend::Session->{source} = $new_source; | last SOURCEPRIORITY if defined set_source($new_source, $_); | |||
last SOURCEPRIORITY; | ||||
} | } | |||
} | } | |||
elsif (/^cookie-(.+)/) { | elsif (/^cookie-(.+)/) { | |||
my $cookie_source = Vend::Util::read_cookie($1); | my $cookie_source = Vend::Util::read_cookie($1); | |||
#::logDebug("Cookie $1 is $cookie_source"); | #::logDebug("Cookie $1 is $cookie_source"); | |||
if (length $cookie_source) { | if (length $cookie_source) { | |||
$cookie_source =~ s/[\r\n\t]//g; | $cookie_source =~ s/[\r\n\t]//g; | |||
$Vend::Session->{source} = $cookie_source; | last SOURCEPRIORITY if defined set_source($cookie_source, $_); | |||
last SOURCEPRIORITY; | ||||
} | } | |||
} | } | |||
elsif ($_ eq 'session') { | elsif ($_ eq 'session') { | |||
#::logDebug('$sessionid is %s', $sessionid); | #::logDebug('$sessionid is %s', $sessionid); | |||
if ($sessionid) { | if ($sessionid) { | |||
last SOURCEPRIORITY; | last SOURCEPRIORITY; | |||
} | } | |||
} | } | |||
skipping to change at line 1534 | skipping to change at line 1566 | |||
if (length $Vend::Session->{$1}) { | if (length $Vend::Session->{$1}) { | |||
last SOURCEPRIORITY; | last SOURCEPRIORITY; | |||
} | } | |||
} | } | |||
else { | else { | |||
#::logDebug('$CGI::values{%s} is %s', $_, $CGI::values{$_}); | #::logDebug('$CGI::values{%s} is %s', $_, $CGI::values{$_}); | |||
if (length $CGI::values{$_}) { | if (length $CGI::values{$_}) { | |||
$new_source = $CGI::values{$_}; | $new_source = $CGI::values{$_}; | |||
$new_source =~ s/[\r\n\t]//g; | $new_source =~ s/[\r\n\t]//g; | |||
$Vend::Session->{source} = $new_source; | last SOURCEPRIORITY if defined set_source($new_source, $_); | |||
last SOURCEPRIORITY; | ||||
} | } | |||
} | } | |||
} | } | |||
} #SOURCEPRIORITY | } #SOURCEPRIORITY | |||
#::logDebug('$Session->{source} after SourcePriority loop: %s', $Vend::Session-> {source}); | #::logDebug('$Session->{source} after SourcePriority loop: %s', $Vend::Session-> {source}); | |||
# Set a cookie if applicable. | # Set a cookie if applicable. | |||
if ( | if ( | |||
# Obviously must be true | # Obviously must be true | |||
length ($Vend::Cfg->{SourceCookie}{name}) | length ($Vend::Cfg->{SourceCookie}{name}) | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 41 lines changed or added |