Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
.libs
.project
.settings
.idea
/.vs
/bld/
/build/
Expand Down Expand Up @@ -73,3 +74,4 @@ libstandaloneengine.a
tests/string
tests/config
tests/ech-log/
csnet-dist
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,22 @@ if(USE_OPENSSL_QUIC)
endif()
endif()

option(USE_SCION "Use QUIC over SCION" OFF)
if (USE_SCION)
option(SCION_INCLUDE_DIR "Path to the SCION include directory" OFF)
option(SCION_LIBRARY_DIR "Path to the SCION lib directory" OFF)

if (SCION_INCLUDE_DIR AND SCION_LIBRARY_DIR)
list(APPEND CURL_LIBS "scion" "nghttp2" "protobuf-c")
list(APPEND CURL_LIBDIRS ${SCION_LIBRARY_DIR})

include_directories(SYSTEM ${SCION_INCLUDE_DIR})
link_directories("${SCION_LIBRARY_DIR}")
else()
message(FATAL_ERROR "If SCION is enabled both SCION_INCLUDE_DIR and SCION_LIBRARY_DIR need to be set")
endif()
endif ()

if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC))
message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
endif()
Expand Down
162 changes: 94 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,94 @@
<!--
Copyright (C) Daniel Stenberg, <[email protected]>, et al.

SPDX-License-Identifier: curl
-->

# [![curl logo](https://curl.se/logo/curl-logo.svg)](https://curl.se/)

curl is a command-line tool for transferring data specified with URL syntax.
Learn how to use curl by reading [the
manpage](https://curl.se/docs/manpage.html) or [everything
curl](https://everything.curl.dev/).

Find out how to install curl by reading [the INSTALL
document](https://curl.se/docs/install.html).

libcurl is the library curl is using to do its job. It is readily available to
be used by your software. Read [the libcurl
manpage](https://curl.se/libcurl/c/libcurl.html) to learn how.

## Open Source

curl is Open Source and is distributed under an MIT-like
[license](https://curl.se/docs/copyright.html).

## Contact

Contact us on a suitable [mailing list](https://curl.se/mail/) or
use GitHub [issues](https://github.com/curl/curl/issues)/
[pull requests](https://github.com/curl/curl/pulls)/
[discussions](https://github.com/curl/curl/discussions).

All contributors to the project are listed in [the THANKS
document](https://curl.se/docs/thanks.html).

## Commercial support

For commercial support, maybe private and dedicated help with your problems or
applications using (lib)curl visit [the support page](https://curl.se/support.html).

## Website

Visit the [curl website](https://curl.se/) for the latest news and downloads.

## Source code

Download the latest source from the Git server:

git clone https://github.com/curl/curl.git

## Security problems

Report suspected security problems via [our HackerOne
page](https://hackerone.com/curl) and not in public.

## Notice

curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga
Tekniska Högskolan. This notice is included here to comply with the
distribution terms.

## Backers

Thank you to all our backers :pray: [Become a backer](https://opencollective.com/curl#section-contribute).

## Sponsors

Support this project by becoming a [sponsor](https://curl.se/sponsors.html).
# csnet-curl

This a fork of [curl](https://github.com/curl/curl) that enables HTTP/3 over SCION using [csnet](https://github.com/scionproto-contrib/csnet).

## Requirements

1. Install a release build of csnet: [csnet - Building and Installation](https://github.com/scionproto-contrib/csnet?tab=readme-ov-file#building-and-installation)
2. Install an SSL backend that works with ngtcp2/curl (e.g, [quictls](https://github.com/quictls/openssl/tree/OpenSSL_1_1_1w+quic))
3. Install ngtcp2 with:
```bash
git clone --recursive https://github.com/ngtcp2/ngtcp2.git
cd ngtcp2
cmake -DBUILD_TESTING=OFF -DENABLE_LIB_ONLY=ON -DOPENSSL_ROOT_DIR=<QUICTLS_INSTALL_DIR> -B cmake-build
cmake --build cmake-build
sudo cmake --install cmake-build/
```
4. Install nghttp3 with:
```bash
git clone --recursive https://github.com/ngtcp2/nghttp3
cd nghttp3
cmake -DENABLE_LIB_ONLY=ON -B cmake-build
cmake --build cmake-build
sudo cmake --install cmake-build/
```
5. Install libpsl with:
```bash
sudo apt install libpsl-dev
```
6. Install the [SCION example HTTP/3 server](https://github.com/netsec-ethz/scion-apps/pull/277) with:
```bash
sudo apt-get install -y libpam0g-dev
git clone https://github.com/koflin/scion-apps.git
cd scion-apps
git checkout shttp3-server-example
make setup_lint
make example-shttp3-server
openssl req -x509 -newkey rsa -nodes -keyout server.key -out server.cert
```

## Building

To build the curl fork run:
```bash
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_RPATH=$ORIGIN/../lib \
-DBUILD_STATIC_CURL=ON \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DUSE_NGTCP2=ON \
-DUSE_SCION=ON \
-DSCION_INCLUDE_DIR=<CSNET_INSTALL_DIR>/include \
-DSCION_LIBRARY_DIR=<CSNET_INSTALL_DIR>/lib \
-DOPENSSL_ROOT_DIR=<QUICTLS_INSTALL_DIR> \
-B cmake-build

cmake --build cmake-build
```

## Running the Example

1. **Start the local SCION network**
In the cloned `csnet` repository:
```bash
sudo ./scripts/run-testnet.sh
```

2. **Start the SCION example HTTP/3 server**
In the cloned `scion-apps` repository:
```bash
sudo SCION_DAEMON_ADDRESS="127.0.0.133:30255" \
./bin/example-shttp3-server -cert server.cert -key server.key
```
> Note: The warnings `connection doesn't allow setting of receive buffer size` and `ERROR Unable to extract port from listener` are expected and can be ignored.

3. **Custom Topology**
If you are not using the default topology, overwrite the `topology.json` file in this repository with your modified version.

4. **Make an HTTP/3 SCION request**

- **Using the example program**
```bash
cmake --build cmake-build --target curl-example-http3-scion
./cmake-build/docs/examples/http3-scion
```

- **Using the command-line curl tool**
```bash
./cmake-build/src/curl \
--scion-dst-ia "2-ff00:0:221" \
--scion-topology-path "topology.json" \
--http3-only \
--insecure \
https://127.0.0.132/json
```
2 changes: 2 additions & 0 deletions docs/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ add_custom_target(curl-examples)
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")

configure_file("../../topology.json" "${CMAKE_CURRENT_BINARY_DIR}/topology.json" COPYONLY)

foreach(_target IN LISTS check_PROGRAMS)
set(_target_name "curl-example-${_target}")
add_executable(${_target_name} EXCLUDE_FROM_ALL "${_target}.c")
Expand Down
1 change: 1 addition & 0 deletions docs/examples/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ check_PROGRAMS = \
http2-serverpush \
http2-upload \
http3 \
http3-scion \
http3-present \
httpcustomheader \
httpput \
Expand Down
68 changes: 68 additions & 0 deletions docs/examples/http3-scion.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* <DESC>
* Very simple HTTP/3 GET over SCION
* </DESC>
*/
#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
CURL *curl;
CURLcode res;

curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://127.0.0.132/json");

curl_easy_setopt(curl, CURLOPT_SCION_DST_IA, 0x2ff0000000221);

curl_easy_setopt(curl, CURLOPT_SCION_TOPOLOGY_PATH, "topology.json");

curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
(long)CURL_HTTP_VERSION_3ONLY);

curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 0L);

curl_global_trace("all");

/* Perform the request, res gets the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));

/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
4 changes: 4 additions & 0 deletions include/curl/curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,10 @@ typedef enum {
/* set TLS supported signature algorithms */
CURLOPT(CURLOPT_SSL_SIGNATURE_ALGORITHMS, CURLOPTTYPE_STRINGPOINT, 328),

CURLOPT(CURLOPT_SCION_DST_IA, CURLOPTTYPE_LONG, 329),

CURLOPT(CURLOPT_SCION_TOPOLOGY_PATH, CURLOPTTYPE_CBPOINT, 330),

CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

Expand Down
Loading