Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/schema-and-wire-models/concept/concept-adapter-outbound-httpclient-c06.md
T
DongHyeonkaandClaude Fable 5.1 b25357c48a docs(clean-architecture-backend-template): fold analysis into final and re-select one topic
- analysis/·source-index·state.json 을 final/document.md 제2부·제3부로 접었다. SSOT 는 하나다
- 파일럿 — commit-ambiguity-as-a-result 를 새 기준으로 재선별. 후보 14 → 글감 5
  (PROMOTE 5 · MERGE_INTO 3 · KEEP_IN_SSOT 4 · 보류 2). 기록 5건을 다시 썼고 그림 1개를
  techviz 로 만들었다
- 재선별이 잡은 것: 제1부 §6.2·§11.1 이 자기 §13.2 와 어긋나 있었다(레인을 안 돌렸다 vs
  돌렸다) — 정정. 이미 답이 나와 있던 Question 을 HEAD 재실행 질문으로 다시 세웠다.
  Concept 이 인용한 코드가 SSOT 에 없어 뺐다
- candidateScope·sourceRepository 기록. 나머지 43개 주제는 재선별 대기(PENDING 905)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-07 12:39:20 +09:00

52 lines
3.0 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-httpclient-c06
title: 와이어 바이트와 디코드 바이트를 따로 세고, 읽는 도중에 상한을 건다
topic: schema-and-wire-models
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-httpclient-c06
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-httpclient-c06
file: ../../../final/evidence/rendered/adapter-outbound-httpclient-c06.svg
- key: adapter-outbound-httpclient-c06-diagram
file: ../../../final/assets/diagrams/adapter-outbound-httpclient-c06.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-httpclient-c06.txt
source:
- 원본 분석 절은 final/document.md#a11#L403 이다.
module: adapter-outbound-httpclient
---
# 와이어 바이트와 디코드 바이트를 따로 세고, 읽는 도중에 상한을 건다
예산이 둘로 나뉘어 있고 강제 시점이 버퍼링 이후가 아니라 읽는 도중이며, 원격이 준 status는 채택되지 않는다.
## 본문
<!-- body:start -->
`ResponseSizeLimiter`**와이어 바이트와 디코드 바이트를 따로** 센다 — "a compressed payload passes a wire check and then expands, so a single limit either rejects legitimate traffic or lets a **decompression bomb** through."
## 예산이 강제되는 자리
:::evidence key="adapter-outbound-httpclient-c06-diagram" alt="와이어 바이트 예산, 읽는 도중 상한 강제, 디코드 바이트 예산, 오류 본문 제한 읽기가 읽는 순서대로 쌓여 있다" caption="응답 크기 예산이 강제되는 자리" zoom="false"
:::
## 버퍼링이 끝난 뒤에는 늦다
`CountingBoundedInputStream`이 상한을 **읽는 도중에** 적용한다 — "a response that is discovered to be too large only once it is fully buffered has already cost the memory the limit exists to protect." `BoundedErrorBody`는 오류 본문을 RFC 9457 문서를 해독할 만큼만 읽고, "The bytes never reach an exception message or a log." `toString()`은 길이와 truncated 여부만 낸다.
## 원격이 준 status는 버린다
`RemoteProblemDecoder`의 규칙 한 줄이 이 계층의 성격을 요약한다 — "**The wire status wins.** A remote `status` member is read and discarded, because trusting it would let an upstream **relabel a 503 as a 400 and change our retry behaviour from its own body.**" 확장 속성도 allowlist로 걸러 "an upstream cannot inject unbounded attributes into our telemetry." test 넷이 그 갈래를 고정한다(`mapsProblemJsonWithoutTrustingBodyStatus`·`dropsExtensionsThatAreNotAllowlisted`·`treatsANonProblemContentTypeAsAnEmptyProblem`·`survivesAnUnparseableProblemDocument`).
## ResponseSizeLimiter 참조 위치
:::evidence key="adapter-outbound-httpclient-c06" alt="코드베이스에서 ResponseSizeLimiter 를 검색한 출력 20줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="ResponseSizeLimiter 코드베이스 검색 — 20줄 · exit 0" zoom="true"
:::
<!-- body:end -->