[PR #1766] [MERGED] remove Expect: 100-continue header when requesting an IMDSv2 access t… #2162

Closed
opened 2026-03-04 02:04:05 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1766
Author: @kamilJ96
Created: 9/8/2021
Status: Merged
Merged: 9/8/2021
Merged by: @gaul

Base: masterHead: imdsv2-token-expect-header


📝 Commits (1)

  • 62c8718 remove Expect: 100-continue header when requesting an IMDSv2 access token

📊 Changes

1 file changed (+6 additions, -0 deletions)

View changed files

📝 src/curl.cpp (+6 -0)

📄 Description

Relevant Issue (if applicable)

Fixes #1765 by explicitly setting the Expect header to be empty before making the request to retrieve the IMDSv2 token from /latest/api/token

Potentially fixes #1581 as well. Verified on my ec2-instance that the Expect 100 is removed from the request:

Sep  8 10:28:51:      Get IAM Role name
Sep  8 10:28:51: *   Trying 169.254.169.254:80...
Sep  8 10:28:51: * Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
Sep  8 10:28:51: > PUT /latest/api/token HTTP/1.1
Sep  8 10:28:51: > Host: 169.254.169.254
Sep  8 10:28:51: > User-Agent: s3fs/1.90 (commit hash 9d1552a; OpenSSL)
Sep  8 10:28:51: > Accept: */*
Sep  8 10:28:51: > Transfer-Encoding: chunked
Sep  8 10:28:51: > X-aws-ec2-metadata-token-ttl-seconds: 21600
Sep  8 10:28:51: >
Sep  8 10:28:51: * Signaling end of chunked upload via terminating chunk.
Sep  8 10:28:51: * Mark bundle as not supporting multiuse
Sep  8 10:28:51: * HTTP 1.0, assume close after body
Sep  8 10:28:51: < HTTP/1.0 200 OK
Sep  8 10:28:51: < Content-Length: 56
Sep  8 10:28:51: < Content-Type: text/plain
Sep  8 10:28:51: < Date: Wed, 08 Sep 2021 10:28:51 GMT
Sep  8 10:28:51: < X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
Sep  8 10:28:51: < Connection: close
Sep  8 10:28:51: < Server: EC2ws
Sep  8 10:28:51: <
Sep  8 10:28:51: * Closing connection 0
Sep  8 10:28:51:      HTTP response code 200
Sep  8 10:28:51:      Setting AWS IMDSv2 API token to *********************************

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/1766 **Author:** [@kamilJ96](https://github.com/kamilJ96) **Created:** 9/8/2021 **Status:** ✅ Merged **Merged:** 9/8/2021 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `imdsv2-token-expect-header` --- ### 📝 Commits (1) - [`62c8718`](https://github.com/s3fs-fuse/s3fs-fuse/commit/62c8718e5ce19c580deabbf4714edb954afbb23b) remove Expect: 100-continue header when requesting an IMDSv2 access token ### 📊 Changes **1 file changed** (+6 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/curl.cpp` (+6 -0) </details> ### 📄 Description ### Relevant Issue (if applicable) Fixes #1765 by explicitly setting the `Expect` header to be empty before making the request to retrieve the IMDSv2 token from `/latest/api/token` Potentially fixes #1581 as well. Verified on my ec2-instance that the Expect 100 is removed from the request: ``` Sep 8 10:28:51: Get IAM Role name Sep 8 10:28:51: * Trying 169.254.169.254:80... Sep 8 10:28:51: * Connected to 169.254.169.254 (169.254.169.254) port 80 (#0) Sep 8 10:28:51: > PUT /latest/api/token HTTP/1.1 Sep 8 10:28:51: > Host: 169.254.169.254 Sep 8 10:28:51: > User-Agent: s3fs/1.90 (commit hash 9d1552a; OpenSSL) Sep 8 10:28:51: > Accept: */* Sep 8 10:28:51: > Transfer-Encoding: chunked Sep 8 10:28:51: > X-aws-ec2-metadata-token-ttl-seconds: 21600 Sep 8 10:28:51: > Sep 8 10:28:51: * Signaling end of chunked upload via terminating chunk. Sep 8 10:28:51: * Mark bundle as not supporting multiuse Sep 8 10:28:51: * HTTP 1.0, assume close after body Sep 8 10:28:51: < HTTP/1.0 200 OK Sep 8 10:28:51: < Content-Length: 56 Sep 8 10:28:51: < Content-Type: text/plain Sep 8 10:28:51: < Date: Wed, 08 Sep 2021 10:28:51 GMT Sep 8 10:28:51: < X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600 Sep 8 10:28:51: < Connection: close Sep 8 10:28:51: < Server: EC2ws Sep 8 10:28:51: < Sep 8 10:28:51: * Closing connection 0 Sep 8 10:28:51: HTTP response code 200 Sep 8 10:28:51: Setting AWS IMDSv2 API token to ********************************* ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:04:05 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#2162
No description provided.