From: Amos Jeffries Date: Sat, 13 Sep 2008 06:00:54 +0000 (+1200) Subject: Updates auto-save X-Git-Tag: SQUID_3_1_0_1~45^2~24^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccb2461629f5ed95f6cf1e24893d3a3068fcd728;p=thirdparty%2Fsquid.git Updates auto-save --- diff --git a/src/errorpage.cc b/src/errorpage.cc index dc861135f4..4598566f7b 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -850,6 +850,17 @@ ErrorState::BuildHttpReply() * X-CACHE-MISS entry should tell us who. */ httpHeaderPutStrf(&rep->header, HDR_X_SQUID_ERROR, "%s %d", name, xerrno); + + /* add the Content-Language header according to RFC section 14.21 */ + if(err_language) { + httpHeaderPutStrf(&rep->header, HDR_CONTENT_LANGUAGE, "%s", err_language); + /* TODO: do we need to modify Vary: header as well? */ + } + else { + /* default templates are in English */ + httpHeaderPutStrf(&rep->header, HDR_CONTENT_LANGUAGE, "en"); + } + httpBodySet(&rep->body, content); /* do not memBufClean() or delete the content, it was absorbed by httpBody */ } @@ -912,7 +923,11 @@ ErrorState::BuildContent() debugs(4, 6, HERE << "Found language '" << reset << "', testing for available template in: '" << dir << "'"); m = errorTryLoadText( err_type_str[page_id], dir, false); - if(m) break; // FOUND IT!! + if(m) { + /* store the language we found for the Content-Language reply header */ + err_language = xstrdup(reset); + break; + } #if HAVE_GLOB if( (dt - reset) == 2) { diff --git a/src/errorpage.h b/src/errorpage.h index 6e8ad38fd6..62399db040 100644 --- a/src/errorpage.h +++ b/src/errorpage.h @@ -115,6 +115,7 @@ private: public: err_type type; int page_id; + char *err_language; http_status httpStatus; AuthUserRequest *auth_user_request; HttpRequest *request;