Azure / Azure/azure-powershell
Bug in HttpClientWithRetry Logic - referencing invalid HttpContent after Request is disposed
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### Description
Here you are referencing an invalid HttpContent after Request is disposed (HTTPClient always disposes upon sending)
https://github.com/Azure/azure-powershell/blob/8b467df53bf1b79144afb1250221ec7e6b3a8b44/src/Common/Commands.Common.Authentication/Utilities/HttpClientWithRetry.cs#L77
You are currently not seeing the issue since only GETs are performed against MSI endpoint (no Content in the message)
This bug will surface when using POST against MSI endpoint
### Script/Steps for Reproduction
Use POST against MSI Endpoint
```powershell
```
### Module Version
AzureRM 6.0.0.0
### Environment Data
```powershell
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
Contributor guide
Research direction
Read src/Common/Commands.Common.Authentication/Utilities/HttpClientWithRetry.cs at line 77 and inspect how the request and its HttpContent are handled after sending. Reproduce the behavior with a POST to the MSI endpoint; done means the retry logic no longer references invalid content after the request is disposed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100