Skip to content

Commit

Permalink
Backport use TLS 1.2 to upload files to CDN using FTP (#7307)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsnobip authored Feb 19, 2025
1 parent 7768ad7 commit f0ff319
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fix "rescript format" with many files. https://github.com/rescript-lang/rescript-compiler/pull/7081
- Fix exponential notation syntax. https://github.com/rescript-lang/rescript/pull/7174
- Fix formatter handling of wildcard in pattern matching records with no fields specified. https://github.com/rescript-lang/rescript/pull/7224
- Fix files that were being truncated when sent to the CDN over FTP. https://github.com/rescript-lang/rescript/pull/7307

#### :house: Internal

Expand Down
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" "@rescript/core")

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" \;

0 comments on commit f0ff319

Please sign in to comment.