curl, wget
更新記錄
item | note |
---|---|
20151109 | 第一版 |
目錄
curl , wget 說明
wget
- GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols
- wget 只支援下載(using HTTP, HTTPS and FTP)且無法上傳資料
curl
- curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP)
- curl is used in command lines or scripts to transfer dat
- curl支援上傳及下載
兩者差異
- library. curl is powered by libcurl - a cross-platform library with a stable API that can be used by each and everyone.
- Wget is command line only. There’s no library.
- HTTP auth. curl supports more HTTP authentication methods, especially over HTTP proxies: Basic, Digest, NTLM and Negotiate
- Wget supports only Basic auth as the only auth type over HTTP proxy
使用範例
1 | -T, --upload-file <file> |
1 | curl -T "img[1-1000].png" ftp://ftp.picturemania.com/upload/ |
curl cross compile 不包含ssl及zlib
參考 How to cross compile CURL library with SSL and ZLIB support
下載 curl-7.37.1版本
1 | wget http://curl.haxx.se/download/curl-7.37.1.tar.gz |
設定環境
make
make install
1 | export CROSS_COMPILE="arm-hisiv200-linux" |
- 產生bin及so如下
curl 為119Kbyte
libcurl.so.4.3.0 為354Kbyte
1 | /opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/build# tree -L 3 |
1 | root@d293138e4faa:/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/build# ls -lh bin/curl |
curl cross compile 包含ssl及zlib
cross compile openssl
參考 How To Build OpenSSL for ARM
- 下載openssl-1.0.1e.tar.gz 及patch file如下
1 | wget http://www.linuxfromscratch.org/patches/downloads/openssl/openssl-1.0.1e-fix_parallel_build-1.patch |
- 環境設定如下
1 | export INSTALLDIR=/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/openssl/final |
- configure
1 | ./Configure -DOPENSSL_NO_HEARTBEATS --openssldir=/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/openssl/final shared os/compiler:arm-hisiv200-linux- |
- 手動制作.so
1 | $ cd ../../final/lib/ |
- 產生結果如下
openssl 為 3Mbyte
libssl.so 為522K
libcrypto.so為 2.5M
1 | root@d293138e4faa:/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/openssl/final# tree -L 2 |
zlib compile openssl
設定compile環境
1 | export INSTALLDIR=/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/zlib-test/build/final |
- configure & make
1 | ./configure --prefix=/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/zlib-test/build/final |
- 產生結果如下
1 | root@d293138e4faa:/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/zlib-test/build/final# tree -L 2 |
curl compile openssl 開啟ssl及zlib
- 先設定prebuild final目錄如下(將剛剛產生的.so及.h)整理如下
build-curl-ssl/openssl/include/openssl放置openssl的include檔案
1 | root@d293138e4faa:/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/build-curl-ssl# tree -L 3 |
- copmile環境設定如下
1 | #!/bin/sh |
- configure & make
1 | ./configure --prefix=/opt/DOCKER-erwin-build-hiv200/work/cross-compile/curl/build-curl-ssl --target=${CROSS_COMPILE} --host=${CROSS_COMPILE} --build=i586-pc-linux-gnu --with-ssl --with-zlib |
- 產生結果如下:
curl 為 119K
libcurl.so.4.3.0為 413K
與原本的大小差不多,但需要ssl、cypto及zlib的lib (至少要3Mbyte)
1 | . |