GNURLOPT_HTTPPOST(3)
β¨ NAME β¨
okay so bestie, welcome to GNURLOPT_HTTPPOST(3) from the curl_easy_setopt options manual β this is literally all about CURLOPT_HTTPPOST, aka the option that lets you specify the multipart formpost content. no cap, that's the vibe. π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
struct curl_httppost *formpost);
that's the signature, bestie β exact and iconic. π«Ά
πΈ DESCRIPTION πΈ
so here's the tea: this tells libcurl you want a multipart/formdata HTTP POST to be made, and you instruct what data to pass on to the server in the formpost argument. pass a pointer to a linked list of curl_httppost structs as the parameter. the easiest way to create such a list is to use curl_formadd(3) as documented. the data in this list must remain intact as long as the curl transfer is alive and is using it β fr fr, do not let that data ghost the transfer. π
using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. you can disable this header with CURLOPT_HTTPHEADER(3).
when setting CURLOPT_HTTPPOST(3), it will automatically set CURLOPT_NOBODY(3) to 0.
π¨ This option is deprecated! Do not use it. use CURLOPT_MIMEPOST(3) instead after having prepared mime data. that's the whole warning, bestie β it's giving vintage, not current. π
π DEFAULT π
NULL
literally the default is NULL β empty, quiet, no formpost drama. π«Ά
π PROTOCOLS π
HTTP
that's the only protocol on the guest list, periodt. π
π₯ EXAMPLE π₯
here's the example, copied exactly so you can see the whole formpost situation:
/* Fill in the file upload field. This makes libcurl load data from
the given file name when curl_easy_perform() is called. */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "sendfile",
CURLFORM_FILE, "postit2.c",
CURLFORM_END);
/* Fill in the filename field */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "filename",
CURLFORM_COPYCONTENTS, "postit2.c",
CURLFORM_END);
/* Fill in the submit field too, even if this is rarely needed */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "submit",
CURLFORM_COPYCONTENTS, "send",
CURLFORM_END);
π AVAILABILITY π
as long as HTTP is enabled. deprecated in 7.56.0.
β RETURN VALUE β
returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
π SEE ALSO π
go read these next, bestie:
CURLOPT_POSTFIELDS(3)CURLOPT_POST(3)CURLOPT_MIMEPOST(3)curl_formadd(3)curl_formfree(3)curl_mime_init(3)
okay that's the page π it's from libcurl 7.37.0, dated 17 Jun 2014, and it's giving GNURLOPT_HTTPPOST(3) energy from the curl_easy_setopt options manual. slay, periodt, bye bestie β¨π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms