[PR #232] [MERGED] Upload: Don't overwrite HTTP headers #326

Closed
opened 2026-02-28 00:41:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Telmate/proxmox-api-go/pull/232
Author: @sebastian-de
Created: 1/27/2023
Status: Merged
Merged: 2/1/2023
Merged by: @mleone87

Base: masterHead: fix-headers


📝 Commits (1)

  • 09f5de9 Upload: Don't overwrite HTTP headers

📊 Changes

1 file changed (+4 additions, -3 deletions)

View changed files

📝 proxmox/client.go (+4 -3)

📄 Description

Upload() currently modifies Client.session.Headers diretly. If the same Client struct is used for another request after Upload() was called, the request will fail.

packer-plugin-proxmox frequently reuses the Client struct to upload an ISO and then create a VM. CreateVm() fails after uploading a file because of wrong headers:

==> proxmox-iso.alpine: Error creating VM: error creating VM: 506 upload 'Content-Type 'multipart/form-data; boundary=6501480e24c86c9304a4ed865c0ca6e803a0ca0ca8b3d34e166dcbed8cb8' not implemented, error status:  (params: map[agent:1 args: boot: cores:2 cpu:kvm64 description:Packer ephemeral build VM hotplug: ide2:local:iso/alpine-virt-3.17.1-x86_64.iso,media=cdrom kvm:true machine: memory:2048 name:alpine-upload-test net0:virtio=A6:77:6D:2C:8C:FE,bridge=vmbr0,firewall=false onboot:false ostype:l26 scsihw:virtio-scsi-single sockets:1 startup: tags: vmid:101])

Fix this by cloning Client.session.Headers instead of overwriting.

Fixes https://github.com/hashicorp/packer-plugin-proxmox/issues/146


🔄 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/Telmate/proxmox-api-go/pull/232 **Author:** [@sebastian-de](https://github.com/sebastian-de) **Created:** 1/27/2023 **Status:** ✅ Merged **Merged:** 2/1/2023 **Merged by:** [@mleone87](https://github.com/mleone87) **Base:** `master` ← **Head:** `fix-headers` --- ### 📝 Commits (1) - [`09f5de9`](https://github.com/Telmate/proxmox-api-go/commit/09f5de9f8489879d9f9dbb5a30cc055aaa4d47c5) Upload: Don't overwrite HTTP headers ### 📊 Changes **1 file changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `proxmox/client.go` (+4 -3) </details> ### 📄 Description `Upload()` currently modifies `Client.session.Headers` diretly. If the same Client struct is used for another request after `Upload()` was called, the request will fail. `packer-plugin-proxmox` frequently reuses the Client struct to upload an ISO and then create a VM. `CreateVm()` fails after uploading a file because of wrong headers: ``` ==> proxmox-iso.alpine: Error creating VM: error creating VM: 506 upload 'Content-Type 'multipart/form-data; boundary=6501480e24c86c9304a4ed865c0ca6e803a0ca0ca8b3d34e166dcbed8cb8' not implemented, error status: (params: map[agent:1 args: boot: cores:2 cpu:kvm64 description:Packer ephemeral build VM hotplug: ide2:local:iso/alpine-virt-3.17.1-x86_64.iso,media=cdrom kvm:true machine: memory:2048 name:alpine-upload-test net0:virtio=A6:77:6D:2C:8C:FE,bridge=vmbr0,firewall=false onboot:false ostype:l26 scsihw:virtio-scsi-single sockets:1 startup: tags: vmid:101]) ``` Fix this by cloning `Client.session.Headers` instead of overwriting. Fixes https://github.com/hashicorp/packer-plugin-proxmox/issues/146 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:41:46 +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/proxmox-api-go#326
No description provided.