TheWaWaR / simple-http-server

Simple http server in Rust (Windows/Mac/Linux)
MIT License
2.63k stars 175 forks source link

feat: add headers useful to allow use of threads with webassembly #70

Closed s-d-m closed 2 years ago

s-d-m commented 2 years ago

This adds two options to the server controlling two http headers which end up being required to let browser use threads with webassembly.

The use case here, is to have an html page with webassembly code in it, where the wasm uses threads, and allow firefox to run that code when opening the file via simple-http-server.

Maybe having only one option controlling both headers would make sense.

TheWaWaR commented 2 years ago

@s-d-m Please fix CI, just run make ci in your local machine will do the check.

s-d-m commented 2 years ago

I formatted the code using rustftmt.

make CI gave me this:

> make ci 
cargo fmt --all -- --check
cargo clippy --all --tests --all-features -- -F warnings
RUSTFLAGS='-F warnings'  cargo test --all --all-features
make: *** No rule to make target 'example', needed by 'ci'.
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
   Compiling libc v0.2.72
   Compiling rand_core v0.4.2
   Compiling autocfg v0.1.7
....
   Compiling hyper-native-tls v0.3.0
   Compiling simple-http-server v0.6.1 (/home/sam/code/simple-http-server)
    Finished test [unoptimized + debuginfo] target(s) in 41.48s
     Running target/debug/deps/simple_http_server-65146662e6249597

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

make: Target 'ci' not remade because of errors.

and return code was 2. I take it that make ci failed

EDIT: I made a fix for Makefile, which is in a different PR now

TheWaWaR commented 2 years ago

Thanks!