Skip to content

Commit 2ca03be

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix phpGH-9949: Partial content on incomplete POST request
2 parents 3ab18d4 + 87c2f5b commit 2ca03be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sapi/apache2handler/sapi_apache2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
182182
php_struct *ctx = SG(server_context);
183183
request_rec *r;
184184
apr_bucket_brigade *brigade;
185+
apr_status_t status;
185186

186187
r = ctx->r;
187188
brigade = ctx->brigade;
@@ -193,7 +194,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
193194
* need to make sure that if data is available we fill the buffer completely.
194195
*/
195196

196-
while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len) == APR_SUCCESS) {
197+
while ((status = ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES, APR_BLOCK_READ, len)) == APR_SUCCESS) {
197198
apr_brigade_flatten(brigade, buf, &len);
198199
apr_brigade_cleanup(brigade);
199200
tlen += len;
@@ -204,6 +205,10 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes)
204205
len = count_bytes - tlen;
205206
}
206207

208+
if (status != APR_SUCCESS) {
209+
return 0;
210+
}
211+
207212
return tlen;
208213
}
209214

0 commit comments

Comments
 (0)