Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 17:15 UTC
refactor(cli): dedupe curl proto flags in install.sh
jkomyno committed
Aug 1, 2026 at 17:45 UTC
c53215f8b357b4da73286b13d16e13baf0315b4c
1 file changed
+12
-18
install.sh
+12
-18
@@ -90,18 +90,20 @@ validate_url() {
90
esac
91
}
92
93
+# Callers must validate_url first, so the scheme is https, or http on an allowed host.
94
+curl_proto_flags() {
95
+ case $1 in
96
+ https://*) printf '%s\n' '=https' ;;
97
+ *) printf '%s\n' '=http,https' ;;
98
+ esac
99
+}
100
+
101
curl_fetch() {
102
curl_fetch_url=$1
103
validate_url "$curl_fetch_url" || error "Refusing unsafe URL \"$curl_fetch_url\""
104
debug "curl GET $curl_fetch_url"
97
- case $curl_fetch_url in
98
- https://*)
99
- curl --fail --silent --location --proto '=https' --proto-redir '=https' "$curl_fetch_url"
100
- ;;
101
- http://*)
102
- curl --fail --silent --location --proto '=http,https' --proto-redir '=https' "$curl_fetch_url"
103
- ;;
104
- esac
105
+ curl --fail --silent --location --proto "$(curl_proto_flags "$curl_fetch_url")" \
106
+ --proto-redir '=https' "$curl_fetch_url"
107
}
108
109
curl_download() {
@@ -117,16 +119,8 @@ curl_download() {
119
curl_download_ui=--progress-bar
120
fi
121
120
- case $curl_download_url in
121
- https://*)
122
- curl --fail --location "$curl_download_ui" --proto '=https' --proto-redir '=https' \
123
- --output "$curl_download_output" "$curl_download_url"
124
- ;;
125
- http://*)
126
- curl --fail --location "$curl_download_ui" --proto '=http,https' --proto-redir '=https' \
127
- --output "$curl_download_output" "$curl_download_url"
128
- ;;
129
- esac
122
+ curl --fail --location "$curl_download_ui" --proto "$(curl_proto_flags "$curl_download_url")" \
123
+ --proto-redir '=https' --output "$curl_download_output" "$curl_download_url"
124
}
125
126
normalize_version() {