]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Updates auto-save
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 13 Sep 2008 06:00:54 +0000 (18:00 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 13 Sep 2008 06:00:54 +0000 (18:00 +1200)
src/errorpage.cc
src/errorpage.h

index dc861135f405d6b25fe36758be2254e6e31f7553..4598566f7b71de9e7eca9467898772056ed5fa0f 100644 (file)
@@ -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) {
index 6e8ad38fd6e4f8857509f9bf7d3e426acbc8f0ed..62399db0401f8eca269fae8086cb195836e397fc 100644 (file)
@@ -115,6 +115,7 @@ private:
 public:
     err_type type;
     int page_id;
+    char *err_language;
     http_status httpStatus;
     AuthUserRequest *auth_user_request;
     HttpRequest *request;