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
base: master
from

Conversation

Projects
None yet
5 participants
@frenche
Contributor

frenche 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

authneg: add Content-Length:0 while negotiating auth
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>
@frenche

This comment has been minimized.

Show comment
Hide comment
@frenche

frenche Feb 5, 2017

Contributor

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;
}
Contributor

frenche 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.

Show comment
Hide comment
@jay

jay Feb 17, 2017

Member

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

Member

jay commented Feb 17, 2017

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

@frenche

This comment has been minimized.

Show comment
Hide comment
@frenche

frenche Feb 17, 2017

Contributor

Great, thank you all!

Contributor

frenche commented Feb 17, 2017

Great, thank you all!

@dhoelzl

This comment has been minimized.

Show comment
Hide comment
@dhoelzl

dhoelzl Feb 22, 2017

Thank you for the quick response and fixing the problem!

dhoelzl commented Feb 22, 2017

Thank you for the quick response and fixing the problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment