
Tenho algumas solicitações HTTP em formato bruto, como
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)
Tenho que testá-los e depurá-los, por esse motivo, preciso de uma maneira fácil de repeti-los no meu computador. Como posso fazer uma solicitação HTTP a partir de dados brutos usando curl
ou httpie
outro cliente HTTP CLI?
Responder1
Sugiro telnet: telnet www.nowhere123.com 80
e você está falando cru com o servidor.
Exemplo:
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.