Revision e6491c8e
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
313 | 313 |
$main::lxdebug->leave_sub(); |
314 | 314 |
} |
315 | 315 |
|
316 |
sub _get_request_uri { |
|
317 |
my $self = shift; |
|
318 |
|
|
319 |
return URI->new($ENV{HTTP_REFERER})->canonical() if $ENV{HTTP_X_FORWARDED_FOR}; |
|
320 |
return URI->new if !$ENV{REQUEST_URI}; # for testing |
|
321 |
|
|
322 |
my $scheme = $::request->is_https ? 'https' : 'http'; |
|
323 |
my $port = $ENV{SERVER_PORT}; |
|
324 |
$port = undef if (($scheme eq 'http' ) && ($port == 80)) |
|
325 |
|| (($scheme eq 'https') && ($port == 443)); |
|
326 |
|
|
327 |
my $uri = URI->new("${scheme}://"); |
|
328 |
$uri->scheme($scheme); |
|
329 |
$uri->port($port); |
|
330 |
$uri->host($ENV{HTTP_HOST} || $ENV{SERVER_ADDR}); |
|
331 |
$uri->path_query($ENV{REQUEST_URI}); |
|
332 |
$uri->query(''); |
|
333 |
|
|
334 |
return $uri; |
|
335 |
} |
|
336 |
|
|
337 |
sub _add_to_request_uri { |
|
338 |
my $self = shift; |
|
339 |
|
|
340 |
my $relative_new_path = shift; |
|
341 |
my $request_uri = shift || $self->_get_request_uri; |
|
342 |
my $relative_new_uri = URI->new($relative_new_path); |
|
343 |
my @request_segments = $request_uri->path_segments; |
|
344 |
|
|
345 |
my $new_uri = $request_uri->clone; |
|
346 |
$new_uri->path_segments(@request_segments[0..scalar(@request_segments) - 2], $relative_new_uri->path_segments); |
|
347 |
|
|
348 |
return $new_uri; |
|
349 |
} |
|
350 |
|
|
351 | 316 |
sub create_http_response { |
352 | 317 |
my $self = shift; |
353 | 318 |
my %params = @_; |
354 | 319 |
|
355 | 320 |
if (defined $::auth) { |
356 |
my $uri = $self->_get_request_uri;
|
|
321 |
my $uri = $::request->request_uri;
|
|
357 | 322 |
my @segments = $uri->path_segments; |
358 | 323 |
pop @segments; |
359 | 324 |
$uri->path_segments(@segments); |
... | ... | |
477 | 442 |
my $self = shift; |
478 | 443 |
my $new_url = shift; |
479 | 444 |
|
480 |
my $base_uri = $self->_get_request_uri;
|
|
445 |
my $base_uri = $::request->request_uri;
|
|
481 | 446 |
my $new_uri = URI->new_abs($new_url, $base_uri); |
482 | 447 |
|
483 | 448 |
die "Headers already sent" if $self->{header}; |
Auch abrufbar als: Unified diff
Form::_get_request_uri nach SL::Request::request_uri verschoben.
Form::_add_to_request_uri ersatzlos gelöscht.