diff options
Diffstat (limited to 'demos/http3')
-rw-r--r-- | demos/http3/build.info | 16 | ||||
-rwxr-xr-x | demos/http3/gen_nghttp3.pl | 37 | ||||
-rw-r--r-- | demos/http3/ossl-nghttp3-demo.c | 4 |
3 files changed, 55 insertions, 2 deletions
diff --git a/demos/http3/build.info b/demos/http3/build.info new file mode 100644 index 0000000000..99a3e3f1a6 --- /dev/null +++ b/demos/http3/build.info @@ -0,0 +1,16 @@ +# +# To run the demo when linked with a shared library (default) ensure that +# libcrypto and libssl are on the library path. For example: +# +# LD_LIBRARY_PATH=../.. ./ossl-nghttp3-demo www.example.com:443 + + +PROGRAMS{noinst} = ossl-nghttp3-demo + +GENERATE[libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll]=gen_nghttp3.pl +DEPEND[ossl-nghttp3-demo.o]=libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll +DEPEND[ossl-nghttp3.o]=libnghttp3.so libnghttp3.a libnghttp3.dylib libnghttp3.lib libnghttp3.dll +INCLUDE[ossl-nghttp3-demo]=../../include nghttp3/lib/includes nghttp3/build/lib/includes +INCLUDE[ossl-nghttp3]=../../include nghttp3/lib/includes nghttp3/build/lib/includes +SOURCE[ossl-nghttp3-demo]=ossl-nghttp3.c ossl-nghttp3-demo.c +DEPEND[ossl-nghttp3-demo]=../../libcrypto ../../libssl ./libnghttp3 diff --git a/demos/http3/gen_nghttp3.pl b/demos/http3/gen_nghttp3.pl new file mode 100755 index 0000000000..55fd8b76f3 --- /dev/null +++ b/demos/http3/gen_nghttp3.pl @@ -0,0 +1,37 @@ +#!/usr/bin/env perl +# + +use File::Copy; +use File::Path; +use Fcntl ':flock'; +use strict; +use warnings; + +#open STDOUT, '>&STDERR'; + +chdir "demos/http3"; +open(my $fh, '>>', './build.info') or die "Could not open build.info - $!"; +flock($fh, LOCK_EX) or die "Could not lock build.info - $!"; + +if (-d "./nghttp3") { + rmtree("./nghttp3") or die "Cannot remove nghttp3: $!"; +} +system("git clone https://github.com/ngtcp2/nghttp3.git"); + +chdir "nghttp3"; +mkdir "build"; +system("git submodule init ./lib/sfparse ./tests/munit"); +system("git submodule update"); +system("cmake -DENABLE_LIB_ONLY=1 -S . -B build"); +system("cmake --build build"); + +my $libs="./build/lib/libnghttp*"; + +for my $file (glob $libs) { + copy($file, ".."); +} + +chdir "../../.."; +close($fh); + +exit(0); diff --git a/demos/http3/ossl-nghttp3-demo.c b/demos/http3/ossl-nghttp3-demo.c index b1cbd1abf9..e74dc565a2 100644 --- a/demos/http3/ossl-nghttp3-demo.c +++ b/demos/http3/ossl-nghttp3-demo.c @@ -53,12 +53,12 @@ static int on_recv_data(nghttp3_conn *h3conn, int64_t stream_id, const uint8_t *data, size_t datalen, void *conn_user_data, void *stream_user_data) { - ssize_t wr; + size_t wr; /* HTTP response body data - write it to stdout. */ while (datalen > 0) { wr = fwrite(data, 1, datalen, stdout); - if (wr < 0) + if (ferror(stdout)) return 1; data += wr; |