From 0e3b004add2dee74802702f467e3240d81ce0c7a Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 23 Mar 2010 12:00:00 +0100 Subject: [PATCH] Problem with error message output_html_with_http_headers now takes status too --- C4/Output.pm | 6 ++++-- errors/400.pl | 2 +- errors/401.pl | 2 +- errors/402.pl | 2 +- errors/403.pl | 2 +- errors/404.pl | 2 +- errors/500.pl | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 1e00d4f8f4..788d89d4fd 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -358,7 +358,7 @@ sub pagination_bar { =item output_html_with_http_headers - &output_html_with_http_headers($query, $cookie, $html[, $content_type]) + &output_html_with_http_headers($query, $cookie, $html[, $content_type][, status]) Outputs the HTML page $html with the appropriate HTTP headers, with the authentication cookie $cookie and a Content-Type that @@ -369,7 +369,7 @@ response's Content-Type to that value instead of "text/html". =cut -sub output_html_with_http_headers ($$$;$) { +sub output_html_with_http_headers ($$$;$$) { my $query = shift; my $cookie = shift; my $html = shift; @@ -383,8 +383,10 @@ sub output_html_with_http_headers ($$$;$) { //gx; my $content_type = @_ ? shift : "text/html"; + my $status = shift; $content_type = "text/html" unless $content_type =~ m!/!; # very basic sanity check print $query->header( + -status => $status, -type => $content_type, -charset => 'UTF-8', -cookie => $cookie, diff --git a/errors/400.pl b/errors/400.pl index b04b7fdf73..58363bf71b 100755 --- a/errors/400.pl +++ b/errors/400.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '400 Bad Request'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '400 Bad Request'; diff --git a/errors/401.pl b/errors/401.pl index 3ea459a0b1..665f1d8b08 100755 --- a/errors/401.pl +++ b/errors/401.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '401 Unauthorized'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '401 Unauthorized'; diff --git a/errors/402.pl b/errors/402.pl index 4bfe7cee90..b94d0bda33 100755 --- a/errors/402.pl +++ b/errors/402.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '402 Payment Required'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '402 Payment Required'; diff --git a/errors/403.pl b/errors/403.pl index 4058ce9ae7..b08ae392e6 100755 --- a/errors/403.pl +++ b/errors/403.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '403 Forbidden'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '403 Forbidden'; diff --git a/errors/404.pl b/errors/404.pl index 418723fead..806ad2c8f8 100755 --- a/errors/404.pl +++ b/errors/404.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found'; diff --git a/errors/500.pl b/errors/500.pl index 6f570a251e..28c7aefd42 100755 --- a/errors/500.pl +++ b/errors/500.pl @@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); $template->param( admin => $admin ); -output_with_http_headers $query, $cookie, $template->output, 'html', '500 Internal Server Error'; +output_html_with_http_headers $query, $cookie, $template->output, 'html', '500 Internal Server Error'; -- 2.39.5