From c0539dfb0e800444de09498b00fb9bc687ff722d Mon Sep 17 00:00:00 2001 From: Jens Baitinger Date: Thu, 6 Jan 2022 16:51:42 +0100 Subject: [PATCH] fixing HTTP/1.1 411 Length Required Somehow our Github enterprise server returns 411 when the "Content-Lenght" header is not set. The complete error message is (using curl -v): ``` HTTP/1.1 411 Length Required < Content-Type: text/html; charset=us-ascii < Server: Microsoft-HTTPAPI/2.0 < Date: Thu, 06 Jan 2022 15:36:55 GMT < Connection: close < Content-Length: 344 < Length Required

Length Required


HTTP Error 411. The request must be chunked or have a content length.

``` By setting this Header explicitely, this error does no longer occur. --- token.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/token.sh b/token.sh index c41f75a7..64d21966 100644 --- a/token.sh +++ b/token.sh @@ -12,6 +12,7 @@ fi API_VERSION=v3 API_HEADER="Accept: application/vnd.github.${API_VERSION}+json" AUTH_HEADER="Authorization: token ${ACCESS_TOKEN}" +CONTENT_LENGTH_HEADER="Content-Length: 0" case ${RUNNER_SCOPE} in org*) @@ -34,6 +35,7 @@ case ${RUNNER_SCOPE} in esac RUNNER_TOKEN="$(curl -XPOST -fsSL \ + -H "${CONTENT_LENGTH_HEADER}" \ -H "${AUTH_HEADER}" \ -H "${API_HEADER}" \ "${_FULL_URL}" \