码迷,mamicode.com
首页 > Web开发 > 详细

curl http3

时间:2021-03-29 11:40:19      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:rtmp   fun   depend   share   rgb   smb   nsf   a20   library   

 

Build quiche and BoringSSL:

 % git clone --recursive https://github.com/cloudflare/quiche
 % cd quiche
 % cargo build --release --features ffi,pkg-config-meta,qlog
 % mkdir deps/boringssl/src/lib
 % ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/

Build curl:

 % cd ..
 % git clone https://github.com/curl/curl
 % cd curl
 % ./buildconf
 % ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release
 % make

 

 

Run

Use HTTP/3 directly:

curl --http3 https://nghttp2.org:8443/

Upgrade via Alt-Svc:

curl --alt-svc altsvc.cache https://quic.aiortc.org/

See this list of public HTTP/3 servers

 

root@ubuntu:~/curl# ls
acinclude.m4 buildconf CHANGES CMakeLists.txt COPYING docs include libcurl.pc.in MacOSX-Framework Makefile.dist packages projects README.md scripts src winbuild
appveyor.yml buildconf.bat CMake configure.ac curl-config.in GIT-INFO lib m4 Makefile.am maketgz plan9 README RELEASE-NOTES SECURITY.md tests
root@ubuntu:~/curl# ./buildconf
*** Do not use buildconf. Instead, just use: autoreconf -fi
./buildconf: 4: exec: autoreconf: not found
root@ubuntu:~/curl# autoreconf -fi

 

root@ubuntu:~/curl# apt install autoconf -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  golang-1.10-go golang-1.10-src golang-src
Use apt autoremove to remove them.
The following additional packages will be installed:
  automake
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc gettext
The following NEW packages will be installed:
  autoconf automake

 

root@ubuntu:~/curl# autoreconf -fi
libtoolize: putting auxiliary files in ..
libtoolize: copying file ./ltmain.sh
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, m4.
libtoolize: copying file m4/libtool.m4
libtoolize: copying file m4/ltoptions.m4
libtoolize: copying file m4/ltsugar.m4
libtoolize: copying file m4/ltversion.m4
libtoolize: copying file m4/lt~obsolete.m4

 

./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release

 

root@ubuntu:~/curl# ./configure LDFLAGS="-Wl,-rpath,../quiche/target/release" --with-ssl=../quiche/deps/boringssl/src --with-quiche=../quiche/target/release

 

configure: WARNING: Cannot find libraries for IDN support: IDN disabled
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libnghttp2 options with pkg-config... no
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libngtcp2 options with pkg-config... no
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for quiche options with pkg-config... no
configure: error: --with-quiche was specified but could not find quiche pkg-config file.

 

没有执行

cargo build --release --features ffi,pkg-config-meta,qlog
root@ubuntu:~/quiche# cargo build --release --features ffi,pkg-config-meta,qlog
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.64
   Compiling fnv v1.0.7
   Compiling ident_case v1.0.1
   Compiling strsim v0.10.0
   Compiling serde_derive v1.0.124
   Compiling serde v1.0.124
   Compiling autocfg v1.0.1
   Compiling ryu v1.0.5
   Compiling serde_json v1.0.64
   Compiling hashbrown v0.9.1
   Compiling itoa v0.4.7
   Compiling quiche v0.7.0 (/root/quiche)
   Compiling indexmap v1.6.2
   Compiling quote v1.0.9
   Compiling darling_core v0.12.2
   Compiling darling_macro v0.12.2
   Compiling darling v0.12.2
   Compiling serde_with_macros v1.4.1
   Compiling serde_with v1.6.4
   Compiling qlog v0.4.0 (/root/quiche/tools/qlog)
    Finished release [optimized + debuginfo] target(s) in 1m 10s
root@ubuntu:~/quiche# mkdir deps/boringssl/src/lib
root@ubuntu:~/quiche# ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/
deps/boringssl/src/lib/libcrypto.a => target/release/build/quiche-745ad2f3b756a444/out/build/libcrypto.a
deps/boringssl/src/lib/libssl.a => target/release/build/quiche-745ad2f3b756a444/out/build/libssl.a
root@ubuntu:~/quiche# 

 

 

tls/openssl.c: In function ‘ossl_seed’:
vtls/openssl.c:471:15: error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
     int ret = RAND_egd(data->set.str[STRING_SSL_EGDSOCKET]?
               ^
cc1: some warnings being treated as errors
Makefile:2634: recipe for target vtls/libcurl_la-openssl.lo failed
make[2]: *** [vtls/libcurl_la-openssl.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory /root/curl/lib
Makefile:1044: recipe for target all failed
make[1]: *** [all] Error 2
make[1]: Leaving directory /root/curl/lib
Makefile:1253: recipe for target all-recursive failed
make: *** [all-recursive] Error 1
root@ubuntu:~/curl# make -j $(nproc)

 

配置 命令少了$PWD改成

root@ubuntu:~/curl# ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release

 

编译成功

技术图片

 

 

root@ubuntu:~/curl# find ./ -name curl
./src/.libs/curl
./src/curl
./include/curl
root@ubuntu:~/curl# ./src/.libs/curl -h
./src/.libs/curl: symbol lookup error: ./src/.libs/curl: undefined symbol: curl_multi_poll
root@ubuntu:~/curl# file ./src/.libs/curl 
./src/.libs/curl: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.7.0, BuildID[sha1]=a508623fb1cf562e9fa2066e74177c661549d7de, not stripped
root@ubuntu:~/curl# 

 

root@ubuntu:~/curl# find -name libcurl.so
./lib/.libs/libcurl.so
root@ubuntu:~/curl# pwd
/root/curl
root@ubuntu:~/curl# 

 

 

root@ubuntu:~/curl# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/root/curl/lib/.libs/
root@ubuntu:~/curl# ls /root/curl/lib/.libs/
libcurl.a                      libcurl_la-curl_des.o          libcurl_la-curl_threads.o   libcurl_la-getinfo.o         libcurl_la-http_negotiate.o  libcurl_la-memdebug.o   libcurl_la-rename.o        libcurl_la-splay.o          libcurl_la-warnless.o
libcurl.exp                    libcurl_la-curl_endian.o       libcurl_la-dict.o           libcurl_la-gopher.o          libcurl_la-http_ntlm.o       libcurl_la-mime.o       libcurl_la-rtsp.o          libcurl_la-strcase.o        libcurl_la-wildcard.o
libcurl.la                     libcurl_la-curl_fnmatch.o      libcurl_la-doh.o            libcurl_la-hash.o            libcurl_la-http.o            libcurl_la-mprintf.o    libcurl_la-select.o        libcurl_la-strdup.o         libcurl_la-x509asn1.o
libcurl_la-altsvc.o            libcurl_la-curl_gethostname.o  libcurl_la-dotdot.o         libcurl_la-hmac.o            libcurl_la-http_proxy.o      libcurl_la-mqtt.o       libcurl_la-sendf.o         libcurl_la-strerror.o       libcurl.so
libcurl_la-amigaos.o           libcurl_la-curl_get_line.o     libcurl_la-dynbuf.o         libcurl_la-hostasyn.o        libcurl.lai                  libcurl_la-multi.o      libcurl_la-setopt.o        libcurl_la-strtok.o         libcurl.so.4
libcurl_la-asyn-ares.o         libcurl_la-curl_gssapi.o       libcurl_la-easygetopt.o     libcurl_la-hostcheck.o       libcurl_la-idn_win32.o       libcurl_la-netrc.o      libcurl_la-sha256.o        libcurl_la-strtoofft.o      libcurl.so.4.7.0
libcurl_la-asyn-thread.o       libcurl_la-curl_memrchr.o      libcurl_la-easy.o           libcurl_la-hostip4.o         libcurl_la-if2ip.o           libcurl_la-non-ascii.o  libcurl_la-share.o         libcurl_la-system_win32.o   libcurl.ver
libcurl_la-base64.o            libcurl_la-curl_multibyte.o    libcurl_la-easyoptions.o    libcurl_la-hostip6.o         libcurl_la-imap.o            libcurl_la-nonblock.o   libcurl_la-slist.o         libcurl_la-telnet.o
libcurl_la-c-hyper.o           libcurl_la-curl_ntlm_core.o    libcurl_la-escape.o         libcurl_la-hostip.o          libcurl_la-inet_ntop.o       libcurl_la-openldap.o   libcurl_la-smb.o           libcurl_la-tftp.o
libcurl_la-conncache.o         libcurl_la-curl_ntlm_wb.o      libcurl_la-fileinfo.o       libcurl_la-hostsyn.o         libcurl_la-inet_pton.o       libcurl_la-parsedate.o  libcurl_la-smtp.o          libcurl_la-timeval.o
libcurl_la-connect.o           libcurl_la-curl_path.o         libcurl_la-file.o           libcurl_la-hsts.o            libcurl_la-krb5.o            libcurl_la-pingpong.o   libcurl_la-socketpair.o    libcurl_la-transfer.o
libcurl_la-content_encoding.o  libcurl_la-curl_range.o        libcurl_la-formdata.o       libcurl_la-http2.o           libcurl_la-ldap.o            libcurl_la-pop3.o       libcurl_la-socks_gssapi.o  libcurl_la-urlapi.o
libcurl_la-cookie.o            libcurl_la-curl_rtmp.o         libcurl_la-ftplistparser.o  libcurl_la-http_aws_sigv4.o  libcurl_la-llist.o           libcurl_la-progress.o   libcurl_la-socks.o         libcurl_la-url.o
libcurl_la-curl_addrinfo.o     libcurl_la-curl_sasl.o         libcurl_la-ftp.o            libcurl_la-http_chunks.o     libcurl_la-md4.o             libcurl_la-psl.o        libcurl_la-socks_sspi.o    libcurl_la-version.o
libcurl_la-curl_ctype.o        libcurl_la-curl_sspi.o         libcurl_la-getenv.o         libcurl_la-http_digest.o     libcurl_la-md5.o             libcurl_la-rand.o       libcurl_la-speedcheck.o    libcurl_la-version_win32.o
root@ubuntu:~/curl# 

 

root@ubuntu:~/curl# ldconfig -v &&  ldconfig /etc/ld.so.conf

 

还是失败

 

LD_LIBRARY_PATH=/root/curl/lib/.libs/  ./src/.libs/curl  --http3 https://www.cloudflare.com

技术图片

 

 

root@ubuntu:~/curl# LD_LIBRARY_PATH=/root/curl/lib/.libs/  ./src/.libs/curl  --http3 https://localhost:443
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
root@ubuntu:~/curl# 

 

root@ubuntu:~/curl# LD_LIBRARY_PATH=/root/curl/lib/.libs/  ./src/.libs/curl  --alt-svc altsvc.cache https://quic.aiortc.org/
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title>aioquic</title>
        <link rel="stylesheet" href="/style.css"/>
    </head>
    <body>
        <h1>Welcome to aioquic</h1>
        <p>
            This is a test page for <a href="https://github.com/aiortc/aioquic/">aioquic</a>,
            a QUIC and HTTP/3 implementation written in Python.
        </p>

        <h2>Available endpoints</h2>
        <ul>
            <li><strong>GET /</strong> returns the homepage</li>
            <li><strong>GET /NNNNN</strong> returns NNNNN bytes of plain text</li>
            <li><strong>POST /echo</strong> returns the request data</li>
            <li>
                <strong>CONNECT /ws</strong> runs a WebSocket echo service.
                You must set the <em>:protocol</em> pseudo-header to <em>"websocket"</em>.
            </li>
            <li>There is also an <a href="/httpbin/">httpbin instance</a>.</li>
        </ul>
    </body>
</html>root@ubuntu:~/curl# 

 

curl http3

标签:rtmp   fun   depend   share   rgb   smb   nsf   a20   library   

原文地址:https://www.cnblogs.com/dream397/p/14582861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!