원시 데이터에서 HTTP 요청을 만드는 방법은 무엇입니까?

원시 데이터에서 HTTP 요청을 만드는 방법은 무엇입니까?

원시 형식의 HTTP 요청이 있습니다.

GET /docs/index.html HTTP/1.1
Host: www.nowhere123.com
Accept: image/gif, image/jpeg, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
(blank line)

이를 테스트하고 디버그해야 하며 이러한 이유로 내 컴퓨터에서 이를 반복할 수 있는 쉬운 방법이 필요합니다. 또는 다른 CLI HTTP 클라이언트를 사용하여 원시 데이터에서 HTTP curl요청을 만들 수 있는 방법은 무엇입니까 httpie?

답변1

나는 텔넷을 제안합니다: telnet www.nowhere123.com 80그리고 당신은 서버와 원시 대화를 나누고 있습니다.

예:

telnet 127.0.0.1 80

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

GET /index.htm

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https:///index.htm">here</a>.</p>
</body></html>
Connection closed by foreign host.

관련 정보