Software Development Engineer @ Amazon
reniowood at gmail.com resume
--http1.0 옵션으로 비슷하게 재현해본다.<isindex> 태그를 사용해 검색을 하거나 URL에 ? 기호와 +로 구분된 단어를 넣으면 검색 요청을 할 수 있었다.http://localhost:18888/?search+world
$ curl --http1.0 --get --data-urlencode "search word" http://localhost:18888
--data-urlencode는 쿼리 안의 공백이나 URL에 사용할 수 없는 문자가 없으면 치환해 쿼리로 만든다.HTTP의 헤더와 매우 유사한 형식의 헤더가 HTTP가 나오기 이전부터 전자메일에서 사용되었다.
--header="이름: 값" (또는 -H "이름: 값") 옵션을 사용한다.$ curl --http1.0 -H "X-Test: Hello" http://localhost:18888
-v 옵션을 지정하면 응답 헤더를 볼 수 있다.text/html)image/svg_xml)X-Content-Type-Option: nosniff
(참고: MDN X-Content-Type-Options 페이지)
1.1에서 삭제된 메서드: LINK, UNLINK
--request= 혹은 -X 옵션을 사용한다.$ curl --http1.0 -X POST http://localhost:18888
301 Moved Permanently / 302 Found301 Moved Permanently / 308 Moved Permanently
302 Found / 307 Temporary Redirect
303 See Other
-L 옵션을 사용하면 300번대 응답에 Location 헤더가 있을 때 헤더가 가진 URL로 다시 요청을 보낸다.--post301, --post302, --post303)이 존재한다.-max-redirs)도 지정 가능하다.$ curl -L http://localhost:18888
스키마://사용자:패스워드@호스트명:포트/경로#프래그먼트?쿼리
414 URI Too Long 스테이터스 코드가 추가되었다.Content-Length 헤더가 추가된다.바디가 압축되어 있으면 Content-Encoding 헤더에 압축 알고리즘을 지정한다.
-d 옵션을 사용한다.
Content-Type은 application/x-www-form-urlencoded를 사용한다.-d 옵션은 --data, --data-ascii의 줄임말이다. 문자를 변환하지 않는다.--data-urlencode 옵션은 URL 사용 불가 문자를 변환한다.--data-binary 옵션은 바이너리를 전송할 때 사용한다.$ curl -d @test.json -H "Content-Type: application/json" http://localhost:18888