Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authneg: add Content-Length:0 while negotiating auth #1242

Closed
wants to merge 1 commit into from

Conversation

@iboukris
Copy link
Contributor

iboukris commented Feb 3, 2017

Even if the user supplied custom content-length header it
should be set to 0 for both HTTPREQ_POST and HTTPREQ_PUT flows.
This is what we do already in HTTPREQ_POST_FORM and what we
did in the HTTPREQ_POST case prior to commit:
afd288b

Otherwise, if the user set custom header we'd end up skipping
the content-length header altogether.

Signed-off-by: Isaac Boukris iboukris@gmail.com
Reported-by: Hölzl, Dominik Dominik.Hoelzl@fabasoft.com

Even if the user supplied custom content-length header it
should be set to 0 for both HTTPREQ_POST and HTTPREQ_PUT flows.
This is what we do already in HTTPREQ_POST_FORM and what we
did in the HTTPREQ_POST case prior to commit:
afd288b

Otherwise, if the user set custom header we'd end up skipping
the content-length header altogether.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
Reported-by: Hölzl, Dominik <Dominik.Hoelzl@fabasoft.com>
@iboukris

This comment has been minimized.

Copy link
Contributor Author

iboukris commented Feb 5, 2017

Hi, here is a small reproducer based on Dominik's example on mailing-list (notice CL missing).

#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_URL, "http://localhost/");
  curl_easy_setopt(hnd, CURLOPT_USERPWD, "x:y");
  curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);

  curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "a=b");

  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "Content-Length: 3");
  curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);

  return ret;
}
@bagder
bagder approved these changes Feb 7, 2017
@jay jay closed this in 13e3a18 Feb 17, 2017
@jay

This comment has been minimized.

Copy link
Member

jay commented Feb 17, 2017

Thanks Isaac I landed this with some tests and a modified commit message.

@iboukris

This comment has been minimized.

Copy link
Contributor Author

iboukris commented Feb 17, 2017

Great, thank you all!

@dhoelzl

This comment has been minimized.

Copy link
Contributor

dhoelzl commented Feb 22, 2017

Thank you for the quick response and fixing the problem!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.