Skip to content

Commit c0539df

Browse files
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 < <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Length Required</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Length Required</h2> <hr><p>HTTP Error 411. The request must be chunked or have a content length.</p> </BODY></HTML> ``` By setting this Header explicitely, this error does no longer occur.
1 parent a3bfdb6 commit c0539df

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

token.sh

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fi
1212
API_VERSION=v3
1313
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
1414
AUTH_HEADER="Authorization: token ${ACCESS_TOKEN}"
15+
CONTENT_LENGTH_HEADER="Content-Length: 0"
1516

1617
case ${RUNNER_SCOPE} in
1718
org*)
@@ -34,6 +35,7 @@ case ${RUNNER_SCOPE} in
3435
esac
3536

3637
RUNNER_TOKEN="$(curl -XPOST -fsSL \
38+
-H "${CONTENT_LENGTH_HEADER}" \
3739
-H "${AUTH_HEADER}" \
3840
-H "${API_HEADER}" \
3941
"${_FULL_URL}" \

0 commit comments

Comments
 (0)