HTTP 相关

命令行rest 请求

$ curl -i http://www.baidu.com
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 2381
Content-Type: text/html
Date: Wed, 06 Sep 2023 12:51:18 GMT
Etag: "588604c8-94d"
Last-Modified: Mon, 23 Jan 2017 13:27:36 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/


 百度一下,你就知道  

关于百度 About Baidu

©2017 Baidu 使用百度前必读  意见反馈 京ICP证030173号 

$ curl -l http://www.baidu.com

 百度一下,你就知道  

关于百度 About Baidu

©2017 Baidu 使用百度前必读  意见反馈 京ICP证030173号 

$ curl -v http://www.baidu.com
*   Trying 180.101.50.188:80...
* Connected to www.baidu.com (180.101.50.188) port 80 (#0)
> GET / HTTP/1.1
> Host: www.baidu.com
> User-Agent: curl/7.79.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Connection: keep-alive
< Content-Length: 2381
< Content-Type: text/html
< Date: Wed, 06 Sep 2023 12:54:21 GMT
< Etag: "588604c8-94d"
< Last-Modified: Mon, 23 Jan 2017 13:27:36 GMT
< Pragma: no-cache
< Server: bfe/1.0.8.18
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
< 

 百度一下,你就知道  

关于百度 About Baidu

©2017 Baidu 使用百度前必读  意见反馈 京ICP证030173号 

* Connection #0 to host www.baidu.com left intact

判断端口是否连通

$ telnet 172.16.114.254 10009
Trying 172.16.114.254...
Connected to 172.16.114.254.
Escape character is '^]'.

curl 测试
$ wget 172.16.114.25:10999/api/v1/sessions
--2023-09-07 10:26:01--  http://172.16.114.25:10999/api/v1/sessions
Connecting to 172.16.114.25:10999... failed: Connection refused.
$ curl -i 172.16.114.25:10099/api/v1/sessions
curl: (7) Failed connect to 172.16.114.25:10099; Connection refused


$ curl -i http://172.16.114.254:10099/api/v1/sessions
HTTP/1.1 200 OK
Date: Thu, 07 Sep 2023 02:37:27 GMT
Content-Type: application/json
Content-Length: 2
Server: Jetty(9.4.48.v20220622)

$ curl -i http://172.16.114.254:10099/api/v1/sess
HTTP/1.1 404 Not Found
Date: Thu, 07 Sep 2023 02:37:38 GMT
Content-Length: 18
Server: Jetty(9.4.48.v20220622)


你可能感兴趣的:(http,网络协议,网络)