diff --git a/samples/api-management-function-app/python/scripts/query-telemetry.sh b/samples/api-management-function-app/python/scripts/query-telemetry.sh index 38a4747..a5ceb29 100755 --- a/samples/api-management-function-app/python/scripts/query-telemetry.sh +++ b/samples/api-management-function-app/python/scripts/query-telemetry.sh @@ -203,6 +203,17 @@ else exit 1 fi +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Call the gateway with the subscription key, waiting as long as the gateway asks when it answers 429 (the API allows # ten calls a minute per subscription) # $1: the URL @@ -210,7 +221,8 @@ call_api() { local url=$1 local headers_file headers_file=$(mktemp) - STATUS_CODE=$(curl --max-time 30 --silent --output /dev/null --dump-header "$headers_file" --write-out "%{http_code}" \ + STATUS_CODE=$(curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ + --dump-header "$(native_path "$headers_file")" \ --header "Ocp-Apim-Subscription-Key: $KEY" "$url") if [[ $STATUS_CODE == 429 ]]; then RETRY_AFTER=$(grep -i "^retry-after:" "$headers_file" | tr -d '\r' | awk '{print $2}') diff --git a/samples/web-app-app-configuration/dotnet/scripts/query-telemetry.sh b/samples/web-app-app-configuration/dotnet/scripts/query-telemetry.sh index 97b3bd3..0ae9958 100755 --- a/samples/web-app-app-configuration/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-app-configuration/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-app-configuration/python/scripts/query-telemetry.sh b/samples/web-app-app-configuration/python/scripts/query-telemetry.sh index 97b3bd3..0ae9958 100755 --- a/samples/web-app-app-configuration/python/scripts/query-telemetry.sh +++ b/samples/web-app-app-configuration/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-cosmosdb-mongodb-api/dotnet/scripts/query-telemetry.sh b/samples/web-app-cosmosdb-mongodb-api/dotnet/scripts/query-telemetry.sh index e2ac294..a024e66 100755 --- a/samples/web-app-cosmosdb-mongodb-api/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-cosmosdb-mongodb-api/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-cosmosdb-mongodb-api/python/scripts/query-telemetry.sh b/samples/web-app-cosmosdb-mongodb-api/python/scripts/query-telemetry.sh index e2ac294..a024e66 100755 --- a/samples/web-app-cosmosdb-mongodb-api/python/scripts/query-telemetry.sh +++ b/samples/web-app-cosmosdb-mongodb-api/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-cosmosdb-nosql-api/dotnet/scripts/query-telemetry.sh b/samples/web-app-cosmosdb-nosql-api/dotnet/scripts/query-telemetry.sh index b9de83f..7bf1f69 100755 --- a/samples/web-app-cosmosdb-nosql-api/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-cosmosdb-nosql-api/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-cosmosdb-nosql-api/python/scripts/query-telemetry.sh b/samples/web-app-cosmosdb-nosql-api/python/scripts/query-telemetry.sh index b9de83f..7bf1f69 100755 --- a/samples/web-app-cosmosdb-nosql-api/python/scripts/query-telemetry.sh +++ b/samples/web-app-cosmosdb-nosql-api/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-managed-identity/dotnet/scripts/query-telemetry.sh b/samples/web-app-managed-identity/dotnet/scripts/query-telemetry.sh index 29b2cdf..5775ba4 100755 --- a/samples/web-app-managed-identity/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-managed-identity/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-managed-identity/python/scripts/query-telemetry.sh b/samples/web-app-managed-identity/python/scripts/query-telemetry.sh index 29b2cdf..5775ba4 100755 --- a/samples/web-app-managed-identity/python/scripts/query-telemetry.sh +++ b/samples/web-app-managed-identity/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-mysql-flexible-server/dotnet/scripts/query-telemetry.sh b/samples/web-app-mysql-flexible-server/dotnet/scripts/query-telemetry.sh index e104970..f754bb5 100755 --- a/samples/web-app-mysql-flexible-server/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-mysql-flexible-server/dotnet/scripts/query-telemetry.sh @@ -210,6 +210,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -218,12 +229,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-mysql-flexible-server/python/scripts/query-telemetry.sh b/samples/web-app-mysql-flexible-server/python/scripts/query-telemetry.sh index e104970..f754bb5 100755 --- a/samples/web-app-mysql-flexible-server/python/scripts/query-telemetry.sh +++ b/samples/web-app-mysql-flexible-server/python/scripts/query-telemetry.sh @@ -210,6 +210,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -218,12 +229,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-postgresql-flexible-server/dotnet/scripts/query-telemetry.sh b/samples/web-app-postgresql-flexible-server/dotnet/scripts/query-telemetry.sh index 1820f4a..c1fa63c 100755 --- a/samples/web-app-postgresql-flexible-server/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-postgresql-flexible-server/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-postgresql-flexible-server/python/scripts/query-telemetry.sh b/samples/web-app-postgresql-flexible-server/python/scripts/query-telemetry.sh index 1820f4a..c1fa63c 100755 --- a/samples/web-app-postgresql-flexible-server/python/scripts/query-telemetry.sh +++ b/samples/web-app-postgresql-flexible-server/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-sql-database/dotnet/scripts/query-telemetry.sh b/samples/web-app-sql-database/dotnet/scripts/query-telemetry.sh index c272ef2..4893ea5 100755 --- a/samples/web-app-sql-database/dotnet/scripts/query-telemetry.sh +++ b/samples/web-app-sql-database/dotnet/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/" diff --git a/samples/web-app-sql-database/python/scripts/query-telemetry.sh b/samples/web-app-sql-database/python/scripts/query-telemetry.sh index c272ef2..4893ea5 100755 --- a/samples/web-app-sql-database/python/scripts/query-telemetry.sh +++ b/samples/web-app-sql-database/python/scripts/query-telemetry.sh @@ -211,6 +211,17 @@ for CALL in $(seq 1 "$WEB_APP_CALLS"); do echo "Call $CALL of $WEB_APP_CALLS to the [$WEB_APP_NAME] web app answered with status code [$STATUS_CODE]" done +# On Windows, Git Bash and MSYS2 shells pass a path such as /tmp/... unconverted to Windows programs +# (az, curl, jq, python, docker) when MSYS_NO_PATHCONV=1 is set, as the README asks. cygpath, which +# those shells provide, returns the C:/... form those programs can open; elsewhere the path is unchanged. +native_path() { + if command -v cygpath >/dev/null 2>&1; then + cygpath -m "$1" + else + echo "$1" + fi +} + # Post an activity with the web app's form and print the status code of the answer: the app redirects to its page # (302) once it stored the activity. The form of the .NET app carries an antiforgery token, without which ASP.NET Core # refuses the post: the function reads the form first and sends the token back with the cookie that came with it. The @@ -219,12 +230,12 @@ done post_activity() { local cookie_jar form_token cookie_jar=$(mktemp) - form_token=$(curl --max-time 30 --silent --cookie-jar "$cookie_jar" "https://$WEB_APP_HOST_NAME/" | + form_token=$(curl --max-time 30 --silent --cookie-jar "$(native_path "$cookie_jar")" "https://$WEB_APP_HOST_NAME/" | grep -o 'name="__RequestVerificationToken"[^>]*value="[^"]*"' | head -n 1 | sed 's/.*value="//; s/"$//') curl --max-time 30 --silent --output /dev/null --write-out "%{http_code}" \ - --cookie "$cookie_jar" \ + --cookie "$(native_path "$cookie_jar")" \ --data-urlencode "activity=$1" \ --data-urlencode "__RequestVerificationToken=$form_token" \ "https://$WEB_APP_HOST_NAME/"