Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thank you for your interest in contributing to the HTTP Gateway Protocol monorepo for the Internet Computer.
Thank you for your interest in contributing to the Internet Computer HTTP Gateway Protocol monorepo.
By participating in this project, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md).

As a member of the community, you are invited and encouraged to contribute by submitting issues, offering suggestions for improvements, adding review comments to existing pull requests, or creating new pull requests to fix issues.
Expand All @@ -15,7 +15,7 @@ The contributor guidelines are intended to make the contribution process easy an

Before contributing, consider the following:

- If you want to report an issue, click [issues](https://github.com/dfinity/http-gateway/issues).
- If you want to report an issue, click [issues](https://github.com/dfinity/ic-http-gateway-protocol/issues).
- If you have more general questions related to this package and its use, post a message to the [community forum](https://forum.dfinity.org/).
- If you are reporting a bug, provide as much information about the problem as possible.
- If you want to contribute directly to this repository, typical fixes might include any of the following:
Expand All @@ -40,7 +40,7 @@ This section describes the most common workflow scenarios:

To open a new issue:

1. Click [create a new issue](https://github.com/dfinity/http-gateway/issues/new).
1. Click [create a new issue](https://github.com/dfinity/ic-http-gateway-protocol/issues/new).
2. Type a title and description, then click **Submit new issue**.
- Be as clear and descriptive as possible.
- For any problem, describe it in detail, including details about the crate, the version of the code you are using, the results you expected, and how the actual results differed from your expectations.
Expand All @@ -50,7 +50,7 @@ To open a new issue:
If you want to submit a pull request to fix an issue or add a feature, here's a summary of what you need to do:

1. Make sure you have a GitHub account, an internet connection, and access to a terminal shell or GitHub Desktop application for running commands.
2. Navigate to the [repository's homepage](https://github.com/dfinity/http-gateway) in a web browser.
2. Navigate to the [repository's homepage](https://github.com/dfinity/ic-http-gateway-protocol) in a web browser.
3. Click **Fork** to create a copy of the repository under your GitHub account or organization name.
4. Clone the forked repository to your local machine.
5. Create a new branch for your fix by running a command similar to the following:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
- name: Test Cargo crates
run: cargo test --all-features

# TODO(NODE-1907): Remove once ic-http-gateway is fully deprecated.
- name: Check compatibility shim crate
run: cargo check -p ic-http-gateway --all-features

- name: Build Cargo docs
run: cargo doc --no-deps

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
sed "s/0\\.0\\.0-git/${RELEASE_TAG##*\/v}/" Cargo.toml.orig > Cargo.toml
rm -f Cargo.toml.orig

- run: cargo publish --package ic-http-gateway-protocol --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

# TODO(NODE-1907): Remove once ic-http-gateway is fully deprecated.
- run: cargo publish --package ic-http-gateway --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
9 changes: 8 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ resolver = "2"
members = [
"examples/http-gateway/canister/src/custom_assets",
"examples/http-gateway/rust",
"packages/ic-http-gateway-protocol",
# TODO(NODE-1907): Remove once ic-http-gateway is fully deprecated.
"packages/ic-http-gateway",
]

# https://github.com/rust-lang/cargo/issues/9406
# includes all members except those that must be compiled to WASM
default-members = ["packages/ic-http-gateway"]
default-members = ["packages/ic-http-gateway-protocol"]

[workspace.package]
version = "0.0.0-git"
authors = ["DFINITY Stiftung"]
edition = "2021"
repository = "https://github.com/dfinity/http-gateway"
homepage = "https://github.com/dfinity/http-gateway#readme"
repository = "https://github.com/dfinity/ic-http-gateway-protocol"
homepage = "https://github.com/dfinity/ic-http-gateway-protocol#readme"
license = "Apache-2.0"

[profile.release]
Expand Down Expand Up @@ -57,4 +59,6 @@ ic-certification = ">=3.0.3, <4.0.0"
ic-http-certification = ">=3.0.3, <4.0.0"
ic-asset-certification = ">=3.0.3, <4.0.0"

ic-http-gateway-protocol = { path = "./packages/ic-http-gateway-protocol", version = "0.0.0-git" }
# TODO(NODE-1907): Remove once ic-http-gateway is fully deprecated.
ic-http-gateway = { path = "./packages/ic-http-gateway", version = "0.0.0-git" }
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# HTTP Gateway Protocol
# Internet Computer HTTP Gateway Protocol

## Overview

The HTTP Gateway Protocol is an extension of the Internet Computer Protocol that allows conventional HTTP clients to interact with the Internet Computer network. This is important for software such as web browsers to be able to fetch and render client-side canister code, including HTML, CSS, and JavaScript as well as other static assets such as images or videos. The HTTP Gateway does this by translating between standard HTTP requests and API canister calls that the Internet Computer Protocol will understand.
The Internet Computer HTTP Gateway Protocol (HTTP Gateway Protocol) is an extension of the Internet Computer Protocol that allows conventional HTTP clients to interact with the Internet Computer network. This is important for software such as web browsers to be able to fetch and render client-side canister code, including HTML, CSS, and JavaScript as well as other static assets such as images or videos. The HTTP Gateway does this by translating between standard HTTP requests and API canister calls that the Internet Computer Protocol will understand.

You can read more about this protocol in [the spec](https://github.com/dfinity/interface-spec/blob/master/spec/http-gateway-protocol-spec.md).


## Projects

### HTTP Canister Client
Expand Down
2 changes: 1 addition & 1 deletion examples/http-gateway/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hyper.workspace = true
hyper-util.workspace = true
http-body-util.workspace = true

ic-http-gateway.workspace = true
ic-http-gateway-protocol.workspace = true
ic-agent.workspace = true

pocket-ic.workspace = true
4 changes: 3 additions & 1 deletion examples/http-gateway/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use http_body_util::BodyExt;
use hyper::{body::Incoming, server::conn::http2, service::service_fn, Request, Response};
use hyper_util::rt::TokioIo;
use ic_agent::Agent;
use ic_http_gateway::{HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseBody};
use ic_http_gateway_protocol::{
HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseBody,
};
use pocket_ic::PocketIcBuilder;
use std::{convert::Infallible, net::SocketAddr, path::PathBuf, sync::Arc};
use tokio::{fs::File, io::AsyncReadExt, net::TcpListener, task};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "http-gateway",
"name": "ic-http-gateway-protocol",
"private": true,
"engines": {
"node": "^20",
Expand Down
6 changes: 3 additions & 3 deletions packages/http-canister-client-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"description": "A JavaScript client for Internet Computer canisters that implement the HTTP interface",
"author": "DFINITY Stiftung",
"license": "Apache-2.0",
"homepage": "https://github.com/dfinity/http-gateway#readme",
"homepage": "https://github.com/dfinity/ic-http-gateway-protocol#readme",
"repository": {
"type": "git",
"url": "https://github.com/dfinity/http-gateway.git",
"url": "https://github.com/dfinity/ic-http-gateway-protocol.git",
"directory": "packages/http-canister-client"
},
"bugs": {
"url": "https://github.com/dfinity/http-gateway/issues"
"url": "https://github.com/dfinity/ic-http-gateway-protocol/issues"
},
"keywords": [
"internet",
Expand Down
45 changes: 45 additions & 0 deletions packages/ic-http-gateway-protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "ic-http-gateway-protocol"
description = "An HTTP Gateway implementation for interfacing with the Internet Computer over HTTP"
readme = "README.md"
documentation = "https://docs.rs/ic-http-gateway-protocol"
categories = [
"api-bindings",
"cryptography::cryptocurrencies",
"network-programming",
"wasm",
]
keywords = ["internet-computer", "http", "gateway", "icp", "dfinity"]
include = ["src", "Cargo.toml", "README.md"]

version.workspace = true
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
homepage.workspace = true

[dependencies]
thiserror.workspace = true
futures.workspace = true
http.workspace = true
http-body.workspace = true
http-body-util.workspace = true
bytes.workspace = true

ic-agent.workspace = true
ic-utils.workspace = true
candid.workspace = true

ic-http-certification.workspace = true
ic-response-verification.workspace = true

[dev-dependencies]
assert_matches.workspace = true
pocket-ic.workspace = true
reqwest.workspace = true
testcontainers.workspace = true
tokio.workspace = true
rand_chacha.workspace = true
rstest.workspace = true
sha2.workspace = true
1 change: 1 addition & 0 deletions packages/ic-http-gateway-protocol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# HTTP Gateway Protocol
20 changes: 20 additions & 0 deletions packages/ic-http-gateway-protocol/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*!
# HTTP Gateway Protocol
*/

mod client;
pub use client::*;

mod protocol;

mod request;
pub use request::*;

mod response;
pub use response::*;

mod consts;
pub(crate) use consts::*;

mod error;
pub use error::*;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use bytes::Bytes;
use http::Request;
use http_body_util::BodyExt;
use ic_agent::Agent;
use ic_http_gateway::{HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseMetadata};
use ic_http_gateway_protocol::{
HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseMetadata,
};
use pocket_ic::PocketIcBuilder;

mod utils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bytes::Bytes;
use http::{status::StatusCode, Request};
use ic_agent::{export::Principal, Agent};
use ic_http_gateway::{HttpGatewayClient, HttpGatewayRequestArgs};
use ic_http_gateway_protocol::{HttpGatewayClient, HttpGatewayRequestArgs};
use reqwest::Client;
use std::{env, error::Error, process::Command, str::FromStr};
use testcontainers::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use http::Request;
use http_body_util::BodyExt;
use ic_agent::hash_tree::Hash;
use ic_agent::Agent;
use ic_http_gateway::{HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseMetadata};
use ic_http_gateway_protocol::{
HttpGatewayClient, HttpGatewayRequestArgs, HttpGatewayResponseMetadata,
};
use pocket_ic::PocketIcBuilder;
use rand_chacha::rand_core::{RngCore, SeedableRng};
use rand_chacha::ChaCha20Rng;
Expand Down
26 changes: 2 additions & 24 deletions packages/ic-http-gateway/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-http-gateway"
description = "An HTTP Gateway implementation for interfacing with the Internet Computer over HTTP"
description = "Compatibility crate for ic-http-gateway-protocol"
readme = "README.md"
documentation = "https://docs.rs/ic-http-gateway"
categories = [
Expand All @@ -20,26 +20,4 @@ license.workspace = true
homepage.workspace = true

[dependencies]
thiserror.workspace = true
futures.workspace = true
http.workspace = true
http-body.workspace = true
http-body-util.workspace = true
bytes.workspace = true

ic-agent.workspace = true
ic-utils.workspace = true
candid.workspace = true

ic-http-certification.workspace = true
ic-response-verification.workspace = true

[dev-dependencies]
assert_matches.workspace = true
pocket-ic.workspace = true
reqwest.workspace = true
testcontainers.workspace = true
tokio.workspace = true
rand_chacha.workspace = true
rstest.workspace = true
sha2.workspace = true
ic-http-gateway-protocol.workspace = true
6 changes: 5 additions & 1 deletion packages/ic-http-gateway/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# HTTP Gateway
# HTTP Gateway (Compatibility Crate)

Use `ic-http-gateway-protocol` for new integrations.

# TODO(NODE-1907): Remove once ic-http-gateway is fully deprecated.
19 changes: 2 additions & 17 deletions packages/ic-http-gateway/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
/*!
# HTTP Gateway
# HTTP Gateway (Compatibility Crate)
*/

mod client;
pub use client::*;

mod protocol;

mod request;
pub use request::*;

mod response;
pub use response::*;

mod consts;
pub(crate) use consts::*;

mod error;
pub use error::*;
pub use ic_http_gateway_protocol::*;
Loading