"curl 이 모든 Mac, 모든 Linux 박스, 모든 container 이미지에. HTTP 모든 버전 말함. 라이브러리가 숨기는 거 보여줌. API 호출 이상하게 굴면 curl 이 첫 수 — 마지막 아님."
매일 쓰는 flag
Flag 한 줌이 debugging 90% 커버:
-v— verbose. Request 줄 (>), response 줄 (<), curl 의 연결/TLS 부연설명 (*) 보여줌. 첫 debugging 수.-i— 출력에 response header 포함. Header 만; 연결 chatter 아님.-I(대문자) — HEAD request 만. Body download 없이 header 받기.-X METHOD— 이 HTTP method 써.-X POST,-X DELETE등.-H 'Name: value'— request header 추가. 여러 개 위해 반복 가능.-d 'body'— body 보냄.-d @file.json가 파일에서 읽음. POST 묵시.--data-binary @file— 파일 byte 글자 그대로 보냄, line-ending 변환 없음. Binary upload 에 써.-u user:pass— HTTP Basic auth (-H 'Authorization: Basic ...'단축).-N— curl 자체 출력 buffering 없음. SSE / streaming 에 필수.--compressed— gzip/br 요청과 decompress. 압축 vs 미압축 크기 비교 가능.-L— redirect 자동 follow. 없으면 3xx response 보고 멈춤.-o file/-O— body 를 파일에 씀 (이름 붙음 혹은 URL 에서).-w '%{http_code}\n'— response 후 specific 전송 정보 (status code, 크기, 시간) print.
X-ray 수
curl -v 가 canonical "왜 안 동작" 도구:
# 보낸 모든 byte 와 받은 모든 byte 봐
curl -v -X POST https://api.example.com/users \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer abc.def.ghi' \
-d '{"name":"Pippa"}'
# 출력 shape:
# * Trying 1.2.3.4:443... (TCP connect)
# * TLSv1.3 (OUT), TLS handshake, ... (TLS handshake)
# > POST /users HTTP/1.1 (request 줄)
# > Host: api.example.com (request header)
# > Authorization: Bearer abc.def.ghi (request header)
# > Content-Type: application/json (request header)
# > Content-Length: 17 (request header)
# >
# > {"name":"Pippa"} (request body)
# < HTTP/1.1 201 Created (status 줄)
# < Location: /users/u_abc (response header)
# < Content-Type: application/json (response header)
# < {"id":"u_abc","name":"Pippa"} (response body)
Wire 위 정확히 뭐 일어났는지 와 정확히 뭐 돌아왔는지 봄. 라이브러리 마법 없음, framework 추상화 없음. "내 httpx 호출이 401 돌려주는데 curl 가 200" 미스터리 절반이 verbose 출력 비교하면 사라짐.
라이브러리 호출 이상하게 굴면 request 를 curl 에 먼저 복사. Curl 가 동작하는데 라이브러리 안 되면, 버그가 라이브러리가 API 호출 방식에 — API 자체 아님. Curl 도 실패하면 API 잘못 (혹은 네 이해 잘못). 분리가 어디 봐야 할지 알려줌.
Power 조합
Timing 분해 — DNS / TCP / TLS / response phase 따로 봐:
curl -w 'dns=%{time_namelookup}s connect=%{time_connect}s tls=%{time_appconnect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' -o /dev/null -s https://api.example.com/
Buffering 없는 SSE stream:
curl -N -H 'Accept: text/event-stream' https://api.example.com/stream
Rate limiting 테스트 — endpoint 100 번 두드림, status 셈:
for i in {1..100}; do
curl -s -o /dev/null -w '%{http_code}\n' https://api.example.com/
done | sort | uniq -c
브라우저 fetch 재현 — Chrome DevTools Network 패널이 "Copy as cURL" 있음 — 터미널에 바로 붙여넣고 로컬에서 버그 재현.
cwkPippa 의 curl 사용
cwkPippa WebUI 가 hang 하거나 500 돌려주면 첫 수가 backend 에 대한 curl:
curl -v http://localhost:8000/api/conversations/{id}. Backend 죽은지 (connection refused), CORS 차단 (브라우저 콘솔만 — curl 가 CORS 안 봄), auth 실패 (401), 실제 content 이슈 (200 + 나쁜 body) 인지 드러냄. Chrome DevTools 에서 Copy-as-cURL 도 셀 수 없이 — 도구 있는 터미널에서 브라우저 전용 버그 재현 위해.