all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Mira Limbeck <m.limbeck@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-openid-rs] fix Open ID with Azure as provider
Date: Thu, 31 Mar 2022 15:33:50 +0200	[thread overview]
Message-ID: <20220331133350.1098680-1-m.limbeck@proxmox.com> (raw)

Azure doesn't accept `Transfer-Encoding: chunked` on their token endpoint,
but with the switch to ureq we always send requests with this set.

Fix by switching to `Content-Length` in the header instead. ureq only
sets `Transfer-Encoding: chunked` when the body length is not known
beforehand, which is the case when using `send`. See 
https://github.com/algesten/ureq/blob/main/README.md#content-length-and-transfer-encoding

See https://forum.proxmox.com/threads/openid-401-with-azure-ad.105892/
for the issue.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
probably also fixes https://bugzilla.proxmox.com/show_bug.cgi?id=3916,
but I could only reproduce this exact error message with Azure until
now.

 src/http_client.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/http_client.rs b/src/http_client.rs
index a2bf6ee..7e63275 100644
--- a/src/http_client.rs
+++ b/src/http_client.rs
@@ -75,7 +75,8 @@ pub fn http_client(request: HttpRequest) -> Result<HttpResponse, Error> {
     }
 
     let response = if let Method::POST = request.method {
-        req.send(&*request.body)
+        let bytes = request.body.as_slice();
+        req.send_bytes(bytes)
     } else {
         req.call()
     }
-- 
2.30.2





             reply	other threads:[~2022-03-31 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 13:33 Mira Limbeck [this message]
2022-04-01  4:21 Dietmar Maurer
2022-04-01  8:57 ` Mira Limbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220331133350.1098680-1-m.limbeck@proxmox.com \
    --to=m.limbeck@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal