1# vi: set ft=conf23# FIXME: don't skip windows4[windows] skip 'curl makes github actions hang'56# convert crlf to lf on windows7[windows] dos2unix http1.txt http2.txt http3.txt goget.txt gitclone.txt89# start soft serve10exec soft serve &11# wait for SSH server to start12ensureserverrunning SSH_PORT1314# create user15soft user create user1 --key "$USER1_AUTHORIZED_KEY"1617# create access token18soft token create --expires-in '1h' 'repo2'19cp stdout tokenfile20envfile TOKEN=tokenfile21soft token create --expires-in '1ns' 'repo2'22cp stdout etokenfile23envfile ETOKEN=etokenfile24usoft token create 'repo2'25cp stdout utokenfile26envfile UTOKEN=utokenfile2728# push & create repo with some files, commits, tags...29mkdir ./repo230git -c init.defaultBranch=master -C repo2 init31mkfile ./repo2/README.md '# Project\nfoo'32mkfile ./repo2/foo.png 'foo'33mkfile ./repo2/bar.png 'bar'34git -C repo2 remote add origin http://$TOKEN@localhost:$HTTP_PORT/repo235git -C repo2 lfs install --local36git -C repo2 lfs track '*.png'37git -C repo2 add -A38git -C repo2 commit -m 'first'39git -C repo2 tag v0.1.040git -C repo2 push origin HEAD41git -C repo2 push origin HEAD --tags4243-- test 1 --44# default public url is always allowed45curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2/git-upload-pack -H 'Origin: http://localhost:23232' -H 'Access-Control-Request-Method: POST'46stderr '.*200 OK.*'4748# stop the server49stopserver5051-- test 2 --52# by default the server does not allow example.com, so the response does not have the "Access-Control-Allow-Origin" header and cors will fail.5354# restart soft serve55exec soft serve &56# wait for SSH server to start57ensureserverrunning SSH_PORT5859curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2/git-upload-pack -H 'Origin: https://example.com' -H 'Access-Control-Request-Method: POST'60! stderr '.*Access-Control-Allow-Origin.*'6162# stop the server63stopserver6465-- test 3 --66# allow cross-origin OPTIONS requests for example.com67env SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS="https://example.com"68env SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS="GET,OPTIONS"69env SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS="Origin,Access-Control-Request-Method"7071# restart soft serve72exec soft serve &73# wait for SSH server to start74ensureserverrunning SSH_PORT7576curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2.git/info/refs -H 'Origin: https://example.com' -H 'Access-Control-Request-Method: GET'77stderr '.*200 OK.*'7879# stop the server80[windows] stopserver81[windows] ! stderr .