Skip to content

Commit bb8ff9e

Browse files
notrojclaude
andcommitted
* modules/metadata/mod_remoteip.c (remoteip_input_filter): Log EOF while
reading the PROXY protocol header at info level, as the peer going away; other read errors are still logged as errors. PR 63893. * test/modules/metadata/test_004_remoteip.py (test_metadata_004_06): No longer an expected failure. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 70376eb commit bb8ff9e

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*) mod_remoteip: Log a connection closed before a complete PROXY protocol
2+
header was received at info level rather than as an error. PR 63893.
3+
[Joe Orton]

‎modules/metadata/mod_remoteip.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,14 @@ static apr_status_t remoteip_input_filter(ap_filter_t *f,
11341134
apr_off_t got, want = ctx->need - ctx->rcvd;
11351135

11361136
ret = ap_get_brigade(f->next, ctx->bb, ctx->mode, block, want);
1137+
if (APR_STATUS_IS_EOF(ret)) {
1138+
/* The peer went away before sending a whole header, as a
1139+
* health check may. */
1140+
ap_log_cerror(APLOG_MARK, APLOG_INFO, ret, f->c, APLOGNO()
1141+
"RemoteIPProxyProtocol: connection closed "
1142+
"before a complete header was received");
1143+
return ret;
1144+
}
11371145
if (ret != APR_SUCCESS) {
11381146
ap_log_cerror(APLOG_MARK, APLOG_ERR, ret, f->c, APLOGNO(10184)
11391147
"failed reading input");

‎test/modules/metadata/test_004_remoteip.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,11 @@ def test_metadata_004_05(self, env):
206206
assert self.pp_request(env, hdr) == (200, self.PEER)
207207

208208
# A health check which connects, sends an incomplete header and goes
209-
# away is not an error worth logging (bug 63893 comment 12); today it
210-
# is logged as one, AH10184 "failed reading input" with APR_EOF.
211-
@pytest.mark.xfail(strict=True,
212-
reason="EOF while reading the PROXY header is logged "
213-
"at error level, AH10184")
209+
# away is not an error worth logging (bug 63893 comment 12).
214210
def test_metadata_004_06(self, env):
215211
self.pp_install(env)
216212
pos = env.httpd_error_log.current_pos()
217213
assert self.pp_request(env, self.PP2_SIG, request=False) == (None, None)
218214
logged = env.httpd_error_log.wait_for(re.compile(r".*AH10184"), pos,
219215
timeout=1)
220-
env.httpd_error_log.ignore_recent(lognos=["AH10184"])
221216
assert not logged, "peer going away mid-header was logged as an error"

0 commit comments

Comments
 (0)