Server Load balancer troubleshooting guide (3)

Source: Internet
Author: User

2.3 wget and curl
Wget and curl are two common file transfer tool software based on command line. These two tools are similar but different. Both tools can download content through FTP, HTTP, or HTTPS. With these tools, we can simulate the client to send various TCP requests to Server Load balancer, to study how Server Load balancer processes data packets. However, the two tools are actually different:
• Curl supports more protocols, such as FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP and RTSP, while wget only supports FTP, HTTP, and HTTPS.
• Curl supports HTTP1.1 (or HTTP1.0) by default, while wget only supports HTTP1.0 (it is said that the latest wget has supported HTTP1.1 and we will verify it in subsequent tests ).
• There are many articles on the internet saying that the key difference between the two is that curl supports the libcurl library, while wget is purely a command line tool. We don't care about this.
The usage of these command line tools is very simple, but it is not that easy to fully grasp the use of these two commands. Let's start with the simplest command:
 
1. [root @ linux-test ~] # Curl http://www.baidu.com
2.
3. <! Doctype html> 4. //... the XXX character is omitted here...
5.
6. [root @ linux-test ~] #
7.
8. [root @ linux-test ~] # Wget http://www.baidu.com
9.
10. -- 23:05:51 -- http://www.baidu.com/
11.
12. Resolving www.baidu.com... 119.75.217.56, 119.75.218.45
13.
14. Connecting to www.baidu.com | 119.75.217.56 |: 80... connected.
15.
16. HTTP request sent, awaiting response... 200 OK
17.
18. Length: 8403 (8.2 K) [text/html]
19.
20. Saving to: 'index.html'
21.
22.
23. 100% [============================================== ========================================================== ============================>] 8,403 --. -K/s in 0 s
24.
25.
26. 23:05:51 (296 MB/s)-'index.html 'saved [8403/8403]
27.
28.
29. [root @ linux-test ~] #
The contents of the token are identical ):
 
1. [root @ linux-test ~] # Curl http://www.baidu.com> baidu.html
2.
3.% Total % Received % Xferd Average Speed Time Current
4.
5. Dload Upload Total Spent Left Speed
6.
7. 100 8403 100 8403 0 0 49023 0 --: -- 141 k
8.
9. [root @ linux-test ~] # Ll
10. total 68
11.
12.-rw ------- 1 root 1608 Sep 16 anaconda-ks.cfg
13.
14.-rw-r -- 1 root 8403 Sep 16 23:06 baidu.html
15.
16.-rw-r -- 1 root 8403 Sep 16 23:05 index.html
17.
18.-rw-r -- 1 root 15780 Sep 16 10:16 install. log
19.
20.-rw-r -- 1 root 3779 Sep 16 10:16 install. log. syslog
21.
22. [root @ linux-test ~] #
But are the request processes of these two commands the same for the server? Let's look at the process of accessing the same website using wireshark. The following two figures decode the HTTP requests of wget and curl respectively.
 




From the above Wireshark decoding, we can obviously find that there is a big difference between the two commands to request the header of the HTTP request for the http://www.baidu.com.
1) wget uses HTTP/1.0 standard to send requests by default, while curl uses HTTP/1.1 to send requests by default.
2) the Default User-Agent is different.
3) wget has an additional Connection: Keep-Alive header.
We will introduce the differences in detail in subsequent articles.
For the specific usage of wget and curl, please refer to other articles on the Internet or their help files. This article will not go into details. For some parameters used in subsequent articles, we will introduce its meaning when using it.
E.S.
 
This article is from the "ADC technology blog ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.