Skip to content

use TLS 1.2 to upload files to CDN using FTP #7306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Changes from 1 commit
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
Next Next commit
use TLS 1.2 to upload files to CDN using FTP
  • Loading branch information
tsnobip committed Feb 19, 2025
commit eac8f3c2cb5935a1780cc1f362dbeb4a89776499
8 changes: 5 additions & 3 deletions playground/upload_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
PACKAGES=("compiler-builtins" "@rescript/react")

echo "Uploading compiler.js file..."
curl --ftp-create-dirs -T "${SCRIPT_DIR}/compiler.js" --ssl --netrc-file $NETRC_FILE ftp://${KEYCDN_SRV}/v${VERSION}/compiler.js
curl --ftp-create-dirs -T "${SCRIPT_DIR}/compiler.js" --ssl --tls-max 1.2 --netrc-file $NETRC_FILE ftp://${KEYCDN_SRV}/v${VERSION}/compiler.js

echo "---"
echo "Uploading packages cmij files..."
Expand All @@ -43,7 +43,7 @@ do

echo "Uploading '$SOURCE/cmij.js' to '$TARGET/cmij.js'..."

curl --ftp-create-dirs -T "${SOURCE}/cmij.js" --ssl --netrc-file $NETRC_FILE "${TARGET}/cmij.js"
curl --ftp-create-dirs -T "${SOURCE}/cmij.js" --ssl --tls-max 1.2 --netrc-file $NETRC_FILE "${TARGET}/cmij.js"
done

# we now upload the bundled stdlib runtime files
Expand All @@ -54,4 +54,6 @@ TARGET="ftp://${KEYCDN_SRV}/v${VERSION}/${DIR}"

echo "Uploading '$SOURCE/*.js' to '$TARGET/*.js'..."

find "${SOURCE}" -type f -name "*.js" -exec sh -c 'curl --ftp-create-dirs --ssl --netrc-file "$0" -T "$1" "${2}/$(basename "$1")"' "$NETRC_FILE" {} "$TARGET" \;
# we use TLS 1.2 because 1.3 sometimes causes data losses (files capped at 16384B)
# https://github.com/curl/curl/issues/6149#issuecomment-1618591420
find "${SOURCE}" -type f -name "*.js" -exec sh -c 'curl --ftp-create-dirs --ssl --tls-max 1.2 --netrc-file "$0" -T "$1" "${2}/$(basename "$1")"' "$NETRC_FILE" {} "$TARGET" \;
Loading