curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

RE: How to authenticate when using “CURLOPT_CONNECT_ONLY” so I can use non-blocking curl_easy_send() and curl_easy_recv()

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 19 Jul 2021 23:26:04 +0200 (CEST)

On Mon, 19 Jul 2021, Venkat Maddisetti via curl-library wrote:

> Before coming here I realized curl_easy_setopt has no effect setting
> username and password

CURLOPT_USERPWD, CURLOPT_USERNAME and CURLOPT_PASSWORD included ?

> "POST /emp/ HTTP/1.1

If you want HTTP, then using CONNECT_ONLY + send/recv is *extremely* rarely
the right answer.

You seem to want a plain POST with Basic auth and libcurl does that pretty
well and simply with the regular easy API.

First, get the http-post.c example
Then set CURLOPT_USERNAME and CURLOPT_PASSWORD
Then set the right Content-type and make sure the right request body is sent.

Doesn't that cover it?

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2021-07-19