]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Localize the HTTP response using the Content-Language value (Issue #426)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Sun, 10 Jul 2022 15:53:41 +0000 (11:53 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Sun, 10 Jul 2022 15:53:41 +0000 (11:53 -0400)
CHANGES.md
cups/http.c

index bf844e491d63a17044d163c2619c25b1b5f7fa47..11b5fd0732ca0487ff9f00a6328c0f304ce429df 100644 (file)
@@ -6,9 +6,11 @@ Changes in CUPS v2.4.3 (TBA)
 
 - Added a title with device uri for found network printers (Issues #402, #393)
 - Fixed configuration on RISC-V machines (Issue #404)
-- Fixed the `device_uri` invalid pointer for driverless printers with `.local` hostname (Issue #419)
+- Fixed the `device_uri` invalid pointer for driverless printers with `.local`
+  hostname (Issue #419)
 - Fixed an OpenSSL crash bug (Issue #409)
 - Use localhost when printing via printer application (Issue #353)
+- Now localize HTTP responses using the Content-Language value (Issue #426)
 
 
 Changes in CUPS v2.4.2 (26th May 2022)
index ecc3dab8ee4fc21e1c5bf0200e3059925dbab7a8..8a06daf676cdc52b8f90b5a08d3f38394b00805b 100644 (file)
@@ -3349,6 +3349,7 @@ httpWriteResponse(http_t        *http,    /* I - HTTP connection */
 {
   http_encoding_t      old_encoding;   /* Old data_encoding value */
   off_t                        old_remaining;  /* Old data_remaining value */
+  cups_lang_t          *lang;          /* Response language */
 
 
  /*
@@ -3420,6 +3421,12 @@ httpWriteResponse(http_t        *http,   /* I - HTTP connection */
                                                  "identity");
 #endif /* HAVE_LIBZ */
 
+ /*
+  * Get the response language, if any...
+  */
+
+  lang = cupsLangGet(http->fields[HTTP_FIELD_CONTENT_LANGUAGE]);
+
  /*
   * Send the response header...
   */
@@ -3428,7 +3435,7 @@ httpWriteResponse(http_t        *http,    /* I - HTTP connection */
   old_remaining       = http->data_remaining;
   http->data_encoding = HTTP_ENCODING_FIELDS;
 
-  if (httpPrintf(http, "HTTP/%d.%d %d %s\r\n", http->version / 100, http->version % 100, (int)status, httpStatus(status)) < 0)
+  if (httpPrintf(http, "HTTP/%d.%d %d %s\r\n", http->version / 100, http->version % 100, (int)status, _httpStatus(lang, status)) < 0)
   {
     http->status = HTTP_STATUS_ERROR;
     return (-1);