You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2026/09/29 08:45:13 UTC

svn commit: r1938677 - httpd/httpd/trunk/modules/filters

Author: covener
Date: Tue Sep 29 08:45:13 2026
New Revision: 1938677

Log:
handle incomplete input

Modified:
   httpd/httpd/trunk/modules/filters/mod_xml2enc.c

Modified: httpd/httpd/trunk/modules/filters/mod_xml2enc.c
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_xml2enc.c	Tue Sep 29 08:44:30 2026	(r1938676)
+++ httpd/httpd/trunk/modules/filters/mod_xml2enc.c	Tue Sep 29 08:45:13 2026	(r1938677)
@@ -532,9 +532,10 @@ static apr_status_t xml2enc_ffunc(ap_fil
                     switch (rv) {
                     case APR_SUCCESS:
                         continue;
-                    case APR_EINCOMPLETE:
+                    case APR_INCOMPLETE:
                         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, APLOGNO(01443)
-                                      "INCOMPLETE");
+                                      "Incomplete byte sequence: %" APR_SIZE_T_FMT
+                                      " bytes unconverted", insz);
                         continue;     /* If outbuf too small, go round again.
                                        * If it was inbuf, we'll break out when
                                        * we test ctx->bytes == ctx->bblen
@@ -545,9 +546,7 @@ static apr_status_t xml2enc_ffunc(ap_fil
                         --insz;
                         continue;
                     default:
-                        /* Erk!  What's this?
-                         * Bail out, flush, and hope to eat the buf raw
-                         */
+                        /* Bail out, flush, and pass remaining data raw. */
                         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, APLOGNO(01445)
                                       "Failed to convert input; trying it raw") ;
                         ctx->convset = NULL;
@@ -556,6 +555,14 @@ static apr_status_t xml2enc_ffunc(ap_fil
                             ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, f->r, APLOGNO(01446)
                                           "ap_fflush failed");
                         apr_brigade_cleanup(ctx->bbnext);
+                        if (insz) {
+                            b = apr_bucket_transient_create(
+                                    buf + (bytes - insz), insz,
+                                    bb->bucket_alloc);
+                            APR_BRIGADE_INSERT_HEAD(bb, b);
+                        }
+                        ap_remove_output_filter(f);
+                        return ap_pass_brigade(f->next, bb);
                     }
                 }
             } else {
@@ -564,7 +571,7 @@ static apr_status_t xml2enc_ffunc(ap_fil
             }
             if (bdestroy)
                 apr_bucket_destroy(bdestroy);
-            if (rv != APR_SUCCESS)
+            if (rv != APR_SUCCESS && rv != APR_INCOMPLETE)
                 return rv;
         }
     }