Open-source comment: curl (excellent application layer network protocol Library)

Source: Internet
Author: User

Let's take a look at curl today.

This is an old open-source project that can be used for data transmission (including uploading and downloading) based on a variety of application layer network protocols ). It supports multiple protocols, cross-platform platforms, and multiple programming language interfaces. I will give a brief introduction to these features later.

The curl project actually contains two parts: the command line tool and the library for programming (libcurl

). The two functions are basically the same. Since developers mostly deal with libcurl, I will introduce libcurl later.

★Supports multiple application-layer protocols

Support for multiple network protocols is the main selling point of curl. Currently, 7.19.4 supports the following network protocols: FTP, ftps, HTTP, https, and SCP.

(Secure copy), SFTP

(Ssh ftp), TFTP

(Trivial FTP), telnet, dict

, LDAP

, LDAPS, and file

Is it full?

◇ HTTP

HTTP is the most commonly used protocol. I would like to briefly describe the degree to which curl supports HTTP.

For protocol versions, curl supports HTTP 1.0 and HTTP 1.1.

For request methods: curl supports get, post, put, and file upload post.

For proxy types: including HTTP proxy and socks4

Proxy, SOCKS5

Proxy.

In addition, you can also set the user name and password for HTTP authentication, cookies, Referer URLs, and many other things.

◇ SSL encryption

If you want to support some SSL dependencies

/TLS

OpenSSL protocol (such as HTTPS and ftps)

Library. On the curl Download Page

OpenSSL is built into all the compressed packages labeled with SSL labels.

. In addition, for instructions on configuring SSL certificates in curl, see "here

".

★Cross-platform

Curl supports many platforms. Even some unpopular operating systems (such as DOS and OS/2) support well.

In addition, the download page of the curl Official Website

It provides compiled and binary files based on different platforms for everyone to use directly. For Linux, it also provides binary files based on different vendors and release versions, which is considerate. Compared with some open-source projects that only provide source code (users need to compile it by themselves), curl is very convenient.

★Support for Multiple Programming Languages

And SQLite

Similarly, libcurl supports the binding of multiple programming languages, and the curl integrated programming language is more

More. The following lists some common programming languages and curl interfaces provided by the platform.

◇ C/C ++

Curl itself is written in C, so C and C ++ can directly call its C interface API. There are many examples of C in the source code package of curl.

If you like Oo, you can use curlpp.

Provided C ++ packaging class. This uses the MIT license agreement.

◇ Java

The integration of curl and Java is implemented through JNI. You can click "here

"Download the compressed package and compile the relevant dynamic library and class files. A lazy student can go to "here

"Ready for use.

◇ Python

Pycurl

Is the python packaging library of curl. If you think Python's built-in urllib

Function is not enough. You can use it for consideration. This uses a dual License Agreement: lgpl and MIT/X.

◇ DOTNET

Curl and DOTNET binding libcurl. net

. This item only supports the Win32 operating system. But it doesn't matter. For non-Windows systems, you can use the curl mono

Bind libcurl. Mono

.

◇ Visual Basic

Binding libcurl. VB between curl and VB

. This project and the above libcurl. net

Both are maintained by the same author and use the MIT license agreement.

◇ PHP

It is much easier for PHP to support curl. Official PHP website

Installation/configuration instructions.

◇ Ruby

Bind curb to Ruby of curl

. This uses the ruby license agreement.

◇ Perl

Curl and Perl binding www: curl: Easy

. This uses the MPL or MIT/X license agreement.

★Use Cases

We have mentioned many curl features. Here are some examples of applications.

◇ Transfer files

If you need to upload and download files in the program, it is very convenient to use libcurl. It supports many protocols. Once your application needs to change in the future, you do not need to change your code using other protocols.

◇ Call web interfaces

With the popularity of SOA, many complex systems provide many web API interfaces. If you want to call the web API in a program, you can use libcurl.

◇ Web Testing

Remember to make good use of automation

Does this post mention the benefits of automated testing? Curl supports HTTP. In terms of HTTP protocol, browsers can basically do the same thing. In addition, it can be bound to many scripting languages (in addition to the above mentioned, it can also support Lua, TCL, LISP and other scripts ). Therefore, you can use the scripting language + curl to perform some automated Web tests.

For example, to test the security of a web site (whether there are SQL injection, XSS, and other security vulnerabilities) or test whether a web interface complies with the conventions of the document or the performance of some web interfaces ......

★Other supplementary instructions

If you want to regularly learn about new versions, new features, and new bugs of curl, you can subscribe to the related email list.

.

In addition, curl uses the MIT/X derivative protocol and can be used in commercial software.


Copyright Notice

All original articles in this blog are copyrighted by the author. This statement must be reprinted to keep this article complete, and the author's programming will be noted in the form of hyperlinks
And the original address of this article:

Http://program-think.blogspot.com/2009/03/opensource-review-curl-library.html

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.