首页 > 代码库 > CURLcode curl_easy_setopt(原创)

CURLcode curl_easy_setopt(原创)

中文翻译:

  1 curl_easy_setopt(3)             libcurl 手册             curl_easy_setopt(3)
  2 
  3 名称
  4        curl_easy_setopt -curl的设置选项
  5 
  6 概要
  7        #include <curl/curl.h>
  8 
  9        CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
 10 
 11 描述
 12        curl_easy_setopt(3)是用来告诉libcurl如何表现.通过设置适当的选项,应用程序可以改变libcurl的行为。所有选项都设置一个选项,然后由一个参数.
 13        这个比较长:一个函数指针,一个对象的指针或curl_off_t,取决于具体方案预计。如果参数的值不符合要求,可能导致libcurl达到理想效果,请仔细阅读本手册。一个典型的应用程序中会使用许多‐curl_easy_setopt(3)来对环境进行设置。此函数调用的选项设置对下面程序进行传输执行的参数设置,这个函数不能对已经设置的函数进行恢复,如果你想回到内部默认的状态,你可以调用curl_easy_reset(3)。
 14        
 15        字符串传递给libcurl作为字符串参数,由图书馆复制,从而对指针参数的字符串储存空间可能会被curl_easy_setopt(3)的返回值覆盖。
 16        
 17        字符串传递给libcurl作为字符串参数,由文件管理系统复制,从而对指针参数关联的字符串存储空间可能会被curl_easy_setopt(3)的返回值覆盖。这个规则的唯一例外是 really 的curlopt_postfields(3),但选择拷贝的字符串curlopt_copypostfields(3)有一定的使用特点需要你读了。
 18        
 19        选项设置的顺序不重要。
 20        
 21        以前的版本7.17.0,字符串不复制。相反,保持用户促使有效直到libcurl不再需要他们。
 22        
 23        处理是从curl_easy_init返回代码(3)或(3)curl_easy_duphandle调用。
 24 
 25 行为选择
 26        CURLOPT_VERBOSE
 27               如果你想CURL报告每一件意外的事情,设置这个选项为一个非零值。See CURLOPT_VERBOSE(3)
 28 
 29        CURLOPT_HEADER
 30               如果你想把一个头包含在输出中,设置这个选项为一个非零值. See CURLOPT_HEADER(3)
 31 
 32        CURLOPT_NOPROGRESS
 33               关闭进度表. See CURLOPT_NOPROGRESS(3)
 34 
 35        CURLOPT_NOSIGNAL
 36               不要安装信号处理程序. See CURLOPT_NOSIGNAL(3)
 37 
 38        CURLOPT_WILDCARDMATCH
 39               根据文件名模式传输多个文件.  See CURLOPT_WILDCARDMATCH(3)
 40 
 41 回调函数的选择
 42        CURLOPT_WRITEFUNCTION
 43               写入数据的回调. See CURLOPT_WRITEFUNCTION(3)
 44        CURLOPT_WRITEDATA
 45               数据指针传递给写回调. See CURLOPT_WRITE‐DATA(3)
 46        CURLOPT_READFUNCTION
 47               读取数据回调. See CURLOPT_READFUNCTION(3)
 48        CURLOPT_READDATA
 49               数据指针传递给读回调. See CURLOPT_READ‐DATA(3)
 50        CURLOPT_IOCTLFUNCTION
 51               回调的I/O操作. See CURLOPT_IOCTLFUNCTION(3)
 52        CURLOPT_IOCTLDATA
 53               数据指针传递给I/O回调. See CURLOPT_IOCTL‐DATA(3)
 54        CURLOPT_SEEKFUNCTION
 55               寻求操作的回调. See CURLOPT_SEEKFUNCTION(3)
 56        CURLOPT_SEEKDATA
 57               数据指针传递给寻求回调.  See  CURLOPT_SEEK‐ DATA(3)
 58        CURLOPT_SOCKOPTFUNCTION
 59               套接字创建的回调. See CURLOPT_SOCKOPTFUNCTION(3)
 60        CURLOPT_SOCKOPTDATA
 61               数据指针传递给sockopt回调. See CURLOPT_SOCK‐OPTDATA(3)
 62        CURLOPT_OPENSOCKETFUNCTION
 63               创建套接字(socket)的回调. See CURLOPT_OPENSOCKETFUNCTION(3)
 64        CURLOPT_OPENSOCKETDATA
 65               数据指针传递给打开的套接字(socket)回调.See CUR‐LOPT_OPENSOCKETDATA(3)
 66        CURLOPT_CLOSESOCKETFUNCTION
 67               关闭套接字(socket)的回调. See CURLOPT_CLOSESOCKETFUNCTION(3)
 68        CURLOPT_CLOSESOCKETDATA
 69               数据指针传递给 关闭套接字回调
 70               数据指针传递给关闭套接字(socket)回调. See CUR‐LOPT_CLOSESOCKETDATA(3)
 71        CURLOPT_PROGRESSFUNCTION
 72               过时的回调进度表(meter). See  CURLOPT_PROGRESSFUNC‐TION(3)
 73        CURLOPT_PROGRESSDATA
 74               数据指针传递给进度表(meter)回调. See CUR‐LOPT_PROGRESSDATA(3)
 75        CURLOPT_XFERINFOFUNCTION
 76               进度表的回调. See CURLOPT_XFERINFOFUNCTION(3)
 77        CURLOPT_XFERINFODATA
 78               数据指针传递给进度表回调.See  CUR‐LOPT_XFERINFODATA(3)
 79        CURLOPT_HEADERFUNCTION
 80               写入接收头的回调. See CURLOPT_HEADERFUNC‐TION(3)
 81        CURLOPT_HEADERDATA
 82               数据指针指向头(header)回调. See CURLOPT_HEADER‐DATA(3)
 83        CURLOPT_DEBUGFUNCTION
 84               调试信息的回调. See CURLOPT_DEBUGFUNCTION(3)
 85        CURLOPT_DEBUGDATA
 86               数据指传递向调试回调. See CURLOPT_DEBUG‐DATA(3)
 87        CURLOPT_SSL_CTX_FUNCTION
 88               ssl上线文逻辑回调. See CURLOPT_SSL_CTX_FUNCTION(3)
 89        CURLOPT_SSL_CTX_DATA
 90               数据指针传递给SSL上下文回调.  See  CUR‐LOPT_SSL_CTX_DATA(3)
 91        CURLOPT_CONV_TO_NETWORK_FUNCTION
 92               代码库转换的回调.  See CURLOPT_CONV_TO_NET‐WORK_FUNCTION(3)
 93        CURLOPT_CONV_FROM_NETWORK_FUNCTION
 94               代码库转换的回调.  See  CURLOPT_CONV_FROM_NET‐WORK_FUNCTION(3)
 95        CURLOPT_CONV_FROM_UTF8_FUNCTION
 96               代码库转换的回调.  See CUR‐LOPT_CONV_FROM_UTF8_FUNCTION(3)
 97        CURLOPT_INTERLEAVEFUNCTION
 98               回调RTSP交错的数据. See  CURLOPT_INTERLEAVEFUNC‐TION(3)
 99        CURLOPT_INTERLEAVEDATA
100               数据指针通过RTSP交织回调. See CUR‐LOPT_INTERLEAVEDATA(3)
101        CURLOPT_CHUNK_BGN_FUNCTION
102               通配符下载启动块回调.  See CUR‐LOPT_CHUNK_BGN_FUNCTION(3)
103        CURLOPT_CHUNK_END_FUNCTION
104               对于大块通配符下载结束回调. See CUR‐LOPT_CHUNK_END_FUNCTION(3)
105        CURLOPT_CHUNK_DATA
106               数据指针传递给块回调.See CUR‐LOPT_CHUNK_DATA(3)
107        CURLOPT_FNMATCH_FUNCTION
108               通配符匹配回调. See CURLOPT_FNMATCH_FUNCTION(3)
109        CURLOPT_FNMATCH_DATA
110               数据指针通过通配符匹配回调. See CUR‐LOPT_FNMATCH_DATA(3)
111 错误选择
112        CURLOPT_ERRORBUFFER
113               错误消息缓冲区. See CURLOPT_ERRORBUFFER(3)
114 
115        CURLOPT_STDERR
116               标准错误置换流. See CURLOPT_STDERR(3)
117 
118        CURLOPT_FAILONERROR
119               在HTTP 4xx 错误失败. CURLOPT_FAILONERROR(3)
120 
121 网络选项
122        CURLOPT_URL
123               URL工作. See CURLOPT_URL(3)
124        CURLOPT_PATH_AS_IS
125               禁用挤压/../ 和/../在路径序列.  See  CUR‐LOPT_PATH_AS_IS(3)
126        CURLOPT_PROTOCOLS
127               协议允许. See CURLOPT_PROTOCOLS(3)
128        CURLOPT_REDIR_PROTOCOLS
129               协议允许重定向到. See CURLOPT_REDIR_PROTOCOLS(3)
130        CURLOPT_DEFAULT_PROTOCOL
131               默认协议. See CURLOPT_DEFAULT_PROTOCOL(3)
132        CURLOPT_PROXY
133               使用代理. See CURLOPT_PROXY(3)
134        CURLOPT_PROXYPORT
135               代理端口使用. See CURLOPT_PROXYPORT(3)
136        CURLOPT_PROXYTYPE
137               代理类型. See CURLOPT_PROXYTYPE(3)
138        CURLOPT_NOPROXY
139               从代理使用筛选主机. CURLOPT_NOPROXY(3)
140        CURLOPT_HTTPPROXYTUNNEL
141               通过HTTP代理隧道. CURLOPT_HTTPPROXYTUNNEL(3)
142        CURLOPT_SOCKS5_GSSAPI_SERVICE
143               Socks5 GSSAPI服务名字. CURLOPT_SOCKS5_GSSAPI_SERVICE(3)
144        CURLOPT_SOCKS5_GSSAPI_NEC
145               Socks5 GSSAPI 无差错校验模式. See CURLOPT_SOCKS5_GSSAPI_NEC(3)
146        CURLOPT_PROXY_SERVICE_NAME
147               代理服务名字. CURLOPT_PROXY_SERVICE_NAME(3)
148        CURLOPT_SERVICE_NAME
149               SPNEGO服务名字. CURLOPT_SERVICE_NAME(3)
150        CURLOPT_INTERFACE
151               绑定本地连接. See CURLOPT_INTERFACE(3)
152        CURLOPT_LOCALPORT
153               绑定本地连接到端口. See CURLOPT_LOCALPORT(3)
154        CURLOPT_LOCALPORTRANGE
155               绑定本地连接绑定到范围端口. See CURLOPT_LOCALPOR‐TRANGE(3)
156        CURLOPT_DNS_CACHE_TIMEOUT
157               DNS缓存超时. See CURLOPT_DNS_CACHE_TIMEOUT(3)
158        CURLOPT_DNS_USE_GLOBAL_CACHE
159              过时的使全局DNS缓存。See CUR‐LOPT_DNS_USE_GLOBAL_CACHE(3)
160        CURLOPT_BUFFERSIZE
161               要求较小的缓冲区大小. See CURLOPT_BUFFERSIZE(3)
162        CURLOPT_PORT
163              端口号连接到. See CURLOPT_PORT(3)
164        CURLOPT_TCP_NODELAY
165               禁用Nagle算法. See CURLOPT_TCP_NODELAY(3)
166        CURLOPT_ADDRESS_SCOPE
167               对于本地地址IPv6范围. See CURLOPT_ADDRESS_SCOPE(3)
168        CURLOPT_TCP_KEEPALIVE
169               启动持久连接(TCP keep-alive). See CURLOPT_TCP_KEEPALIVE(3)
170        CURLOPT_TCP_KEEPIDLE
171               发送前的空闲时间. See CURLOPT_TCP_KEEPIDLE(3)
172        CURLOPT_TCP_KEEPINTVL
173               保持活探针之间的间隔. See CURLOPT_TCP_KEEPINTVL(3)
174        CURLOPT_UNIX_SOCKET_PATH
175               一个Unix域套接字(socket)的路径. See CURLOPT_UNIX_SOCKET_PATH(3)
176 名称和密码选项(身份验证)
177        CURLOPT_NETRC
178               使用.户配置脚本文件解析. See CURLOPT_NETRC(3)
179        CURLOPT_NETRC_FILE
180               .配置脚本文件名. See CURLOPT_NETRC_FILE(3)
181        CURLOPT_USERPWD
182               用户名和密码. See CURLOPT_USERPWD(3)
183        CURLOPT_PROXYUSERPWD
184               代理用户名和密码.See CURLOPT_PROXYUSERPWD(3)
185        CURLOPT_USERNAME
186               用户名. See CURLOPT_USERNAME(3)
187        CURLOPT_PASSWORD
188               密码. See CURLOPT_PASSWORD(3)
189        CURLOPT_LOGIN_OPTIONS
190               登陆选项. See CURLOPT_LOGIN_OPTIONS(3)
191        CURLOPT_PROXYUSERNAME
192               代理用户名. See CURLOPT_PROXYUSERNAME(3)
193        CURLOPT_PROXYPASSWORD
194               代理密码. See CURLOPT_PROXYPASSWORD(3)
195        CURLOPT_HTTPAUTH
196               HTTP服务器的身份验证方法. See CURLOPT_HTTPAUTH(3)
197        CURLOPT_TLSAUTH_USERNAME
198               TLS 验证用户名. See CURLOPT_TLSAUTH_USERNAME(3)
199        CURLOPT_TLSAUTH_PASSWORD
200               TLS 验证密码. See CURLOPT_TLSAUTH_PASSWORD(3)
201        CURLOPT_TLSAUTH_TYPE
202               TLS 身份验证方法. See CURLOPT_TLSAUTH_TYPE(3)
203        CURLOPT_PROXYAUTH
204               HTTP代理验证方法. See CURLOPT_PROXYAUTH(3)
205        CURLOPT_SASL_IR
206               使SASL的初始响应. See CURLOPT_SASL_IR(3)
207        CURLOPT_XOAUTH2_BEARER
208               OAuth2不记名令牌. See CURLOPT_XOAUTH2_BEARER(3)
209 
210 HTTP选项
211        CURLOPT_AUTOREFERER
212               自动设置参考;标题. See CURLOPT_AUTOREFERER(3)
213        CURLOPT_ACCEPT_ENCODING
214               接受编码和自动解压缩数据. See CUR‐LOPT_ACCEPT_ENCODING(3)
215        CURLOPT_TRANSFER_ENCODING
216               请求传输编码. See CURLOPT_TRANSFER_ENCODING(3)
217        CURLOPT_FOLLOWLOCATION
218               遵循HTTP重定向. See CURLOPT_FOLLOWLOCATION(3)
219        CURLOPT_UNRESTRICTED_AUTH
220               不限制对原始主机的身份验证.  CURLOPT_UNRE‐STRICTED_AUTH(3)
221        CURLOPT_MAXREDIRS
222               跟随重定向的最大数量. See CURLOPT_MAXREDIRS(3)
223        CURLOPT_POSTREDIR
224               如何采取行动后的重定向POST. See CURLOPT_POSTREDIR(3)
225        CURLOPT_PUT
226               发出一个HTTP PUT请求. See CURLOPT_PUT(3)
227        CURLOPT_POST
228               发送一个HTTP POST要求. See CURLOPT_POST(3)
229        CURLOPT_POSTFIELDS
230               用这个数据发送一个POST. See CURLOPT_POSTFIELDS(3)
231        CURLOPT_POSTFIELDSIZE
232               如果你想发送数据POST到服务器没有libcurl做strlen()测量数据的大小,必须使用此选项。使用此选项时你可以把完全的二进制数据,否则可能会失败。如果这个大小设置为1,图书馆将使用strlen()得到尺寸. See CURLOPT_POSTFIELDSIZE(3)
233        CURLOPT_POSTFIELDSIZE_LARGE
234               如果你想发送数据POST到服务器没有libcurl做strlen()测量数据的大小,必须使用此选项。使用此选项时你可以把完全的二进制数据,否则可能会失败。如果这个大小设置为1,图书馆将使用strlen()得到尺寸. See CURLOPT_POSTFIELDSIZE_LARGE(3)
235        CURLOPT_COPYPOSTFIELDS
236               以POST的方式发送一段内容.See CURLOPT_COPYPOST‐FIELDS(3)
237        CURLOPT_HTTPPOST
238               多窗体发送HTTP POST. See CURLOPT_HTTPPOST(3)
239        CURLOPT_REFERER
240               引用:标头. See CURLOPT_REFERER(3)
241        CURLOPT_USERAGENT
242               用户代理:标头. See CURLOPT_USERAGENT(3)
243        CURLOPT_HTTPHEADER
244               自定义HTTP头.See CURLOPT_HTTPHEADER(3)
245        CURLOPT_HEADEROPT
246               控件自定义HTTP头. See CURLOPT_HEADEROPT(3)
247        CURLOPT_PROXYHEADER
248               自定义发送到代理的HTTP头. See CURLOPT_PROXYHEADER(3)
249        CURLOPT_HTTP200ALIASES
250              指定HTTP 200 OK备选匹配.See CURLOPT_HTTP200ALIASES(3)
251        CURLOPT_COOKIE
252               发送小文件. See CURLOPT_COOKIE(3)
253        CURLOPT_COOKIEFILE
254               从文件读取. See CURLOPT_COOKIEFILE(3)
255        CURLOPT_COOKIEJAR
256               向文件写入. See CURLOPT_COOKIEJAR(3)
257        CURLOPT_COOKIESESSION
258               开始一个新的cookie会话. See CURLOPT_COOKIESESSION(3)
259        CURLOPT_COOKIELIST
260               添加或控制cookies. See CURLOPT_COOKIELIST(3)
261        CURLOPT_HTTPGET
262              做一个HTTP GET请求.See CURLOPT_HTTPGET(3)
263        CURLOPT_HTTP_VERSION
264               HTTP版本的使用.CURLOPT_HTTP_VERSION(3)
265        CURLOPT_IGNORE_CONTENT_LENGTH
266               忽略内容长度(Content-Length). See CURLOPT_IGNORE_CONTENT_LENGTH(3)
267        CURLOPT_HTTP_CONTENT_DECODING
268               禁用Content(CSS的一种属性)译码. See CURLOPT_HTTP_CONTENT_DECODING(3)
269        CURLOPT_HTTP_TRANSFER_DECODING
270               禁用传输解码.See CURLOPT_HTTP_TRANSFER_DECODING(3)
271        CURLOPT_EXPECT_100_TIMEOUT_MS
272               100-continue timeout. See CURLOPT_EXPECT_100_TIMEOUT_MS(3)
273 
274        CURLOPT_PIPEWAIT
275               Wait on connection to pipeline on it. See CURLOPT_PIPEWAIT(3)
276 
277        CURLOPT_STREAM_DEPENDS
278               This   HTTP/2   stream   depends   on    another.    See    CUR‐
279               LOPT_STREAM_DEPENDS(3)
280 
281        CURLOPT_STREAM_DEPENDS_E
282               This  HTTP/2  stream  depends  on  another exclusively. See CUR‐
283               LOPT_STREAM_DEPENDS_E(3)
284 
285        CURLOPT_STREAM_WEIGHT
286               Set this HTTP/2 streams weight. See CURLOPT_STREAM_WEIGHT(3)
287 
288 SMTP OPTIONS
289        CURLOPT_MAIL_FROM
290               Address of the sender. See CURLOPT_MAIL_FROM(3)
291 
292        CURLOPT_MAIL_RCPT
293               Address of the recipients. See CURLOPT_MAIL_RCPT(3)
294 
295        CURLOPT_MAIL_AUTH
296               Authentication address. See CURLOPT_MAIL_AUTH(3)
297 
298 TFTP OPTIONS
299        CURLOPT_TFTP_BLKSIZE
300               TFTP block size. See CURLOPT_TFTP_BLKSIZE(3)
301 
302 FTP OPTIONS
303        CURLOPT_FTPPORT
304               Use active FTP. See CURLOPT_FTPPORT(3)
305 
306        CURLOPT_QUOTE
307               Commands to run before transfer. See CURLOPT_QUOTE(3)
308 
309        CURLOPT_POSTQUOTE
310               Commands to run after transfer. See CURLOPT_POSTQUOTE(3)
311 
312        CURLOPT_PREQUOTE
313               Commands to run just before transfer. See CURLOPT_PREQUOTE(3)
314 
315        CURLOPT_APPEND
316               Append to remote file. See CURLOPT_APPEND(3)
317 
318        CURLOPT_FTP_USE_EPRT
319               Use EPTR. See CURLOPT_FTP_USE_EPRT(3)
320 
321        CURLOPT_FTP_USE_EPSV
322               Use EPSV. See CURLOPT_FTP_USE_EPSV(3)
323 
324        CURLOPT_FTP_USE_PRET
325               Use PRET. See CURLOPT_FTP_USE_PRET(3)
326 
327        CURLOPT_FTP_CREATE_MISSING_DIRS
328               Create missing  directories  on  the  remote  server.  See  CUR‐
329               LOPT_FTP_CREATE_MISSING_DIRS(3)
330 
331        CURLOPT_FTP_RESPONSE_TIMEOUT
332               Timeout for FTP responses. See CURLOPT_FTP_RESPONSE_TIMEOUT(3)
333 
334        CURLOPT_FTP_ALTERNATIVE_TO_USER
335               Alternative to USER. See CURLOPT_FTP_ALTERNATIVE_TO_USER(3)
336 
337        CURLOPT_FTP_SKIP_PASV_IP
338               Ignore   the   IP   address  in  the  PASV  response.  See  CUR‐
339               LOPT_FTP_SKIP_PASV_IP(3)
340 
341        CURLOPT_FTPSSLAUTH
342               Control how to do TLS. See CURLOPT_FTPSSLAUTH(3)
343 
344        CURLOPT_FTP_SSL_CCC
345               Back  to  non-TLS   again   after   authentication.   See   CUR‐
346               LOPT_FTP_SSL_CCC(3)
347 
348        CURLOPT_FTP_ACCOUNT
349               Send ACCT command. See CURLOPT_FTP_ACCOUNT(3)
350 
351        CURLOPT_FTP_FILEMETHOD
352               Specify how to reach files. See CURLOPT_FTP_FILEMETHOD(3)
353 
354 RTSP OPTIONS
355        CURLOPT_RTSP_REQUEST
356               RTSP request. See CURLOPT_RTSP_REQUEST(3)
357 
358        CURLOPT_RTSP_SESSION_ID
359               RTSP session-id. See CURLOPT_RTSP_SESSION_ID(3)
360 
361        CURLOPT_RTSP_STREAM_URI
362               RTSP stream URI. See CURLOPT_RTSP_STREAM_URI(3)
363 
364        CURLOPT_RTSP_TRANSPORT
365               RTSP Transport: header. See CURLOPT_RTSP_TRANSPORT(3)
366 
367        CURLOPT_RTSP_CLIENT_CSEQ
368               Client CSEQ number. See CURLOPT_RTSP_CLIENT_CSEQ(3)
369 
370        CURLOPT_RTSP_SERVER_CSEQ
371               CSEQ   number   for   RTSP   Server->Client  request.  See  CUR‐
372               LOPT_RTSP_SERVER_CSEQ(3)
373 
374 PROTOCOL OPTIONS
375        CURLOPT_TRANSFERTEXT
376               Use text transfer. See CURLOPT_TRANSFERTEXT(3)
377 
378        CURLOPT_PROXY_TRANSFER_MODE
379               Add transfer mode to URL over  proxy.  See  CURLOPT_PROXY_TRANS‐
380               FER_MODE(3)
381 
382        CURLOPT_CRLF
383               Convert newlines. See CURLOPT_CRLF(3)
384 
385        CURLOPT_RANGE
386               Range requests. See CURLOPT_RANGE(3)
387 
388        CURLOPT_RESUME_FROM
389               Resume a transfer. See CURLOPT_RESUME_FROM(3)
390 
391        CURLOPT_RESUME_FROM_LARGE
392               Resume a transfer. See CURLOPT_RESUME_FROM_LARGE(3)
393 
394        CURLOPT_CUSTOMREQUEST
395               Custom request/method. See CURLOPT_CUSTOMREQUEST(3)
396 
397        CURLOPT_FILETIME
398               Request file modification date and time. See CURLOPT_FILETIME(3)
399 
400        CURLOPT_DIRLISTONLY
401               List only. See CURLOPT_DIRLISTONLY(3)
402 
403        CURLOPT_NOBODY
404               Do not get the body contents. See CURLOPT_NOBODY(3)
405 
406        CURLOPT_INFILESIZE
407               Size of file to send. CURLOPT_INFILESIZE(3)
408 
409        CURLOPT_INFILESIZE_LARGE
410               Size of file to send. CURLOPT_INFILESIZE_LARGE(3)
411 
412        CURLOPT_UPLOAD
413               Upload data. See CURLOPT_UPLOAD(3)
414 
415        CURLOPT_MAXFILESIZE
416               Maximum file size to get. See CURLOPT_MAXFILESIZE(3)
417 
418        CURLOPT_MAXFILESIZE_LARGE
419               Maximum file size to get. See CURLOPT_MAXFILESIZE_LARGE(3)
420 
421        CURLOPT_TIMECONDITION
422               Make a time conditional request. See CURLOPT_TIMECONDITION(3)
423 
424        CURLOPT_TIMEVALUE
425               Time   value   for   the  time  conditional  request.  See  CUR‐
426               LOPT_TIMEVALUE(3)
427 
428 连接选项
429        CURLOPT_TIMEOUT
430               整个请求的超时时间(s).See CURLOPT_TIMEOUT(3)
431        CURLOPT_TIMEOUT_MS
432               整个请求的超时时间(ms).See CURLOPT_TIME‐OUT_MS(3)
433        CURLOPT_LOW_SPEED_LIMIT
434               低限速中止传输.See CUR‐LOPT_LOW_SPEED_LIMIT(3)
435        CURLOPT_LOW_SPEED_TIME
436               时间低于速度触发低速中止. See  CUR‐LOPT_LOW_SPEED_TIME(3)
437        CURLOPT_MAX_SEND_SPEED_LARGE
438               上限上传速度. See CUR‐LOPT_MAX_SEND_SPEED_LARGE(3)
439        CURLOPT_MAX_RECV_SPEED_LARGE
440               下载速度上限. See CUR‐LOPT_MAX_RECV_SPEED_LARGE(3)
441        CURLOPT_MAXCONNECTS
442               连接池中的最大连接数. See CUR‐LOPT_MAXCONNECTS(3)
443        CURLOPT_FRESH_CONNECT
444               使用一个新的连接. CURLOPT_FRESH_CONNECT(3)
445        CURLOPT_FORBID_REUSE
446               防止随后重新连接.  See  CUR‐LOPT_FORBID_REUSE(3)
447        CURLOPT_CONNECTTIMEOUT    
448               连接阶段的超时(m). See CURLOPT_CONNECTTIMEOUT(3)
449        CURLOPT_CONNECTTIMEOUT_MS
450               连接阶段的超时(ms). See CURLOPT_CON‐NECTTIMEOUT_MS(3)
451        CURLOPT_IPRESOLVE
452               IP版本解决. See CURLOPT_IPRESOLVE(3)
453        CURLOPT_CONNECT_ONLY
454               只有连接,没有别的. See CURLOPT_CONNECT_ONLY(3)
455        CURLOPT_USE_SSL
456               使用TLS / SSL. See CURLOPT_USE_SSL(3)
457        CURLOPT_RESOLVE
458               提供自定义主机名到IP地址的解析. See CURLOPT_RESOLVE(3)
459        CURLOPT_DNS_INTERFACE
460               绑定名称解析到这个接口. See CURLOPT_DNS_INTER‐FACE(3)
461        CURLOPT_DNS_LOCAL_IP4
462               绑定名称解析到这个IP4地址. See CUR‐LOPT_DNS_LOCAL_IP4(3)
463        CURLOPT_DNS_LOCAL_IP6
464               绑定名称解析到这个IP6地址. See CUR‐LOPT_DNS_LOCAL_IP6(3)
465        CURLOPT_DNS_SERVERS
466               首选DNS服务器. See CURLOPT_DNS_SERVERS(3)
467        CURLOPT_ACCEPTTIMEOUT_MS
468               等待服务器的连接被接受的超时(ms). See CURLOPT_ACCEPTTIMEOUT_MS(3)
469 SSL和安全选项
470        CURLOPT_SSLCERT
471               客户端证书. See CURLOPT_SSLCERT(3)
472        CURLOPT_SSLCERTTYPE
473               客户端证书类型.  See CURLOPT_SSLCERTTYPE(3)
474        CURLOPT_SSLKEY
475               客户端钥匙. See CURLOPT_SSLKEY(3)
476        CURLOPT_SSLKEYTYPE
477               客户端钥匙类型. See CURLOPT_SSLKEYTYPE(3)
478        CURLOPT_KEYPASSWD
479               客户端钥匙密码. See CURLOPT_KEYPASSWD(3)
480        CURLOPT_SSL_ENABLE_ALPN
481               启用ALPN. See CURLOPT_SSL_ENABLE_ALPN(3)
482        CURLOPT_SSL_ENABLE_NPN
483               启用NPN. See CURLOPT_SSL_ENABLE_NPN(3)
484        CURLOPT_SSLENGINE
485               使用SSL引擎标识符. See CURLOPT_SSLENGINE(3)
486        CURLOPT_SSLENGINE_DEFAULT
487               默认的SSL引擎. See CURLOPT_SSLENGINE_DEFAULT(3)
488        CURLOPT_SSL_FALSESTART
489              启用TLS抢跑.See CURLOPT_SSL_FALSESTART(3)
490        CURLOPT_SSLVERSION
491               SSL版本使用.See CURLOPT_SSLVERSION(3)
492        CURLOPT_SSL_VERIFYHOST
493               验证的主机名SSL证书.See CUR‐LOPT_SSL_VERIFYHOST(3)
494        CURLOPT_SSL_VERIFYPEER
495               验证SSL证书. See CURLOPT_SSL_VERIFYPEER(3)
496        CURLOPT_SSL_VERIFYSTATUS
497               验证SSL证书的状态.See CURLOPT_SSL_VERIFYSTA‐TUS(3)
498        CURLOPT_CAINFO
499               捆绑的CA证书. See CURLOPT_CAINFO(3)
500        CURLOPT_ISSUERCERT
501               发行者证书. See CURLOPT_ISSUERCERT(3)
502        CURLOPT_CAPATH
503               捆绑的CA证书路径. See CURLOPT_CAPATH(3)
504        CURLOPT_CRLFILE
505               证书吊销列表. See CURLOPT_CRLFILE(3)
506        CURLOPT_CERTINFO
507               提取证书信息. See CURLOPT_CERTINFO(3)
508        CURLOPT_PINNEDPUBLICKEY
509               设置固定的SSL密钥. See CURLOPT_PINNEDPUBLICKEY(3)
510        CURLOPT_RANDOM_FILE
511               指定一个随机的数据源.See CURLOPT_RAN‐DOM_FILE(3)
512        CURLOPT_EGDSOCKET
513               点对点(EGD)套接字(socket)的路径. See CURLOPT_EGDSOCKET(3)
514        CURLOPT_SSL_CIPHER_LIST
515               使用密码. See CURLOPT_SSL_CIPHER_LIST(3)
516        CURLOPT_SSL_SESSIONID_CACHE
517               禁用SSL会话ID缓存.See CURLOPT_SSL_SESSIONID_CACHE(3)
518        CURLOPT_SSL_OPTIONS
519               SSL行为控制.See CURLOPT_SSL_OPTIONS(3)
520        CURLOPT_KRBLEVEL
521               Kerberos安全水平.See CURLOPT_KRBLEVEL(3)
522        CURLOPT_GSSAPI_DELEGATION
523               禁用GSS-API授权.See CURLOPT_GSSAPI_DELEGATION(3)
524 SSH选择
525        CURLOPT_SSH_AUTH_TYPES
526               SSH认证类型. See CURLOPT_SSH_AUTH_TYPES(3)
527        CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
528               MD5的主机的公钥.See CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)
529        CURLOPT_SSH_PUBLIC_KEYFILE
530               公共密钥的文件名. See CURLOPT_SSH_PUBLIC_KEYFILE(3)
531        CURLOPT_SSH_PRIVATE_KEYFILE
532               私有密匙的文件名. See CURLOPT_SSH_PRIVATE_KEYFILE(3)
533        CURLOPT_SSH_KNOWNHOSTS
534               已知主机的文件名. See CURLOPT_SSH_KNOWNHOSTS(3)
535        CURLOPT_SSH_KEYFUNCTION
536               回调已知主机处理.  See CURLOPT_SSH_KEYFUNC‐TION(3)
537        CURLOPT_SSH_KEYDATA
538               自定义指针通过ssh钥匙的回调. See CURLOPT_SSH_KEY‐DATA(3)
539 其他选项
540        CURLOPT_PRIVATE
541               专用指针存储. See CURLOPT_PRIVATE(3)
542        CURLOPT_SHARE
543               共享对象使用. See CURLOPT_SHARE(3)
544        CURLOPT_NEW_FILE_PERMS
545               创建新远程文件的模式. See CUR‐LOPT_NEW_FILE_PERMS(3)
546        CURLOPT_NEW_DIRECTORY_PERMS
547               创建新的远程目录的模式. See CURLOPT_NEW_DIREC‐TORY_PERMS(3)
548 
549 远程登录选项
550        CURLOPT_TELNETOPTIONS
551               远程登录选项. See CURLOPT_TELNETOPTIONS(3)
552 
553 返回值
554        CURLE_OK (零)意味着选择了正确的选项, 非零意味着错误发生是<curl/curl.h>定义.详情请见libcurl-errors(3) 操作说明有完整的列表.
555        如果你试图设置一个libcurl的不知道的选项,也许是因为说明手册太老的支持或选择在最近的版本中删除,该函数将返回curle_unknown_option。如果参数不真确在编译时,它将返回curle_not_built_in。
556 
557 范例
558        CURL *curl = curl_easy_init();
559        if(curl) {
560          CURLcode res;
561          curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
562          res = curl_easy_perform(curl);
563          curl_easy_cleanup(curl);
564        }
565 
566 请参阅
567        curl_easy_init(3),       curl_easy_cleanup(3),      curl_easy_reset(3),
568        curl_easy_getinfo(3), curl_multi_setopt(3),
569 
570 libcurl 7.38.0                    25 Jun 2014              curl_easy_setopt(3)

 

原文:

  1 curl_easy_setopt(3)             libcurl Manual             curl_easy_setopt(3)
  2 
  3 NAME
  4        curl_easy_setopt - set options for a curl easy handle
  5 
  6 SYNOPSIS
  7        #include <curl/curl.h>
  8 
  9        CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter);
 10 
 11 DESCRIPTION
 12        curl_easy_setopt(3)  is  used to tell libcurl how to behave. By setting
 13        the appropriate options, the application can change libcurls behavior.
 14        All options are set with an option followed by a parameter. That param‐
 15        eter can be a  long,  a  function  pointer,  an  object  pointer  or  a
 16        curl_off_t,  depending  on  what the specific option expects. Read this
 17        manual carefully as bad input values may cause libcurl to behave badly!
 18        You  can  only set one option in each function call. A typical applica‐
 19        tion uses many curl_easy_setopt(3) calls in the setup phase.
 20 
 21        Options set with this function  call  are  valid  for  all  forthcoming
 22        transfers  performed using this handle.  The options are not in any way
 23        reset between transfers, so if you want subsequent transfers with  dif‐
 24        ferent  options,  you  must  change them between the transfers. You can
 25        optionally  reset  all  options   back   to   internal   default   with
 26        curl_easy_reset(3).
 27 
 28        Strings  passed  to  libcurl  as  char * arguments, are copied by the
 29        library; thus the string storage associated to the pointer argument may
 30        be overwritten after curl_easy_setopt(3) returns. The only exception to
 31        this rule is really CURLOPT_POSTFIELDS(3),  but  the  alternative  that
 32        copies the string CURLOPT_COPYPOSTFIELDS(3) has some usage characteris‐
 33        tics you need to read up on.
 34 
 35        The order in which the options are set does not matter.
 36 
 37        Before version 7.17.0, strings were not copied. Instead  the  user  was
 38        forced keep them available until libcurl no longer needed them.
 39 
 40        The   handle   is   the   return   code  from  a  curl_easy_init(3)  or
 41        curl_easy_duphandle(3) call.
 42 
 43 BEHAVIOR OPTIONS
 44        CURLOPT_VERBOSE
 45               Display verbose information. See CURLOPT_VERBOSE(3)
 46 
 47        CURLOPT_HEADER
 48               Include the header in the body output. See CURLOPT_HEADER(3)
 49 
 50        CURLOPT_NOPROGRESS
 51               Shut off the progress meter. See CURLOPT_NOPROGRESS(3)
 52 
 53        CURLOPT_NOSIGNAL
 54               Do not install signal handlers. See CURLOPT_NOSIGNAL(3)
 55 
 56        CURLOPT_WILDCARDMATCH
 57               Transfer multiple files according to a file  name  pattern.  See
 58               CURLOPT_WILDCARDMATCH(3)
 59 
 60 CALLBACK OPTIONS
 61        CURLOPT_WRITEFUNCTION
 62               Callback for writing data. See CURLOPT_WRITEFUNCTION(3)
 63 
 64        CURLOPT_WRITEDATA
 65               Data  pointer  to pass to the write callback. See CURLOPT_WRITE‐
 66               DATA(3)
 67 
 68        CURLOPT_READFUNCTION
 69               Callback for reading data. See CURLOPT_READFUNCTION(3)
 70 
 71        CURLOPT_READDATA
 72               Data pointer to pass to the  read  callback.  See  CURLOPT_READ‐
 73               DATA(3)
 74 
 75        CURLOPT_IOCTLFUNCTION
 76               Callback for I/O operations. See CURLOPT_IOCTLFUNCTION(3)
 77 
 78        CURLOPT_IOCTLDATA
 79               Data  pointer  to  pass  to the I/O callback. See CURLOPT_IOCTL‐
 80               DATA(3)
 81 
 82        CURLOPT_SEEKFUNCTION
 83               Callback for seek operations. See CURLOPT_SEEKFUNCTION(3)
 84 
 85        CURLOPT_SEEKDATA
 86               Data pointer to pass to the  seek  callback.  See  CURLOPT_SEEK‐
 87               DATA(3)
 88 
 89        CURLOPT_SOCKOPTFUNCTION
 90               Callback for sockopt operations. See CURLOPT_SOCKOPTFUNCTION(3)
 91 
 92        CURLOPT_SOCKOPTDATA
 93               Data  pointer to pass to the sockopt callback. See CURLOPT_SOCK‐
 94               OPTDATA(3)
 95 
 96        CURLOPT_OPENSOCKETFUNCTION
 97               Callback for socket creation. See CURLOPT_OPENSOCKETFUNCTION(3)
 98 
 99        CURLOPT_OPENSOCKETDATA
100               Data pointer to pass to  the  open  socket  callback.  See  CUR‐
101               LOPT_OPENSOCKETDATA(3)
102 
103        CURLOPT_CLOSESOCKETFUNCTION
104               Callback for closing socket. See CURLOPT_CLOSESOCKETFUNCTION(3)
105 
106        CURLOPT_CLOSESOCKETDATA
107               Data  pointer  to  pass  to  the close socket callback. See CUR‐
108               LOPT_CLOSESOCKETDATA(3)
109 
110        CURLOPT_PROGRESSFUNCTION
111               OBSOLETE callback for progress meter. See  CURLOPT_PROGRESSFUNC‐
112               TION(3)
113 
114        CURLOPT_PROGRESSDATA
115               Data  pointer  to  pass to the progress meter callback. See CUR‐
116               LOPT_PROGRESSDATA(3)
117 
118        CURLOPT_XFERINFOFUNCTION
119               Callback for progress meter. See CURLOPT_XFERINFOFUNCTION(3)
120 
121        CURLOPT_XFERINFODATA
122               Data pointer to pass to the progress meter  callback.  See  CUR‐
123               LOPT_XFERINFODATA(3)
124 
125        CURLOPT_HEADERFUNCTION
126               Callback  for  writing received headers. See CURLOPT_HEADERFUNC‐
127               TION(3)
128 
129        CURLOPT_HEADERDATA
130               Data pointer to pass to the header callback. See CURLOPT_HEADER‐
131               DATA(3)
132 
133        CURLOPT_DEBUGFUNCTION
134               Callback for debug information. See CURLOPT_DEBUGFUNCTION(3)
135 
136        CURLOPT_DEBUGDATA
137               Data  pointer  to pass to the debug callback. See CURLOPT_DEBUG‐
138               DATA(3)
139 
140        CURLOPT_SSL_CTX_FUNCTION
141               Callback for SSL context logic. See CURLOPT_SSL_CTX_FUNCTION(3)
142 
143        CURLOPT_SSL_CTX_DATA
144               Data pointer to pass to  the  SSL  context  callback.  See  CUR‐
145               LOPT_SSL_CTX_DATA(3)
146 
147        CURLOPT_CONV_TO_NETWORK_FUNCTION
148               Callback  for  code  base  conversion.  See CURLOPT_CONV_TO_NET‐
149               WORK_FUNCTION(3)
150 
151        CURLOPT_CONV_FROM_NETWORK_FUNCTION
152               Callback for code base  conversion.  See  CURLOPT_CONV_FROM_NET‐
153               WORK_FUNCTION(3)
154 
155        CURLOPT_CONV_FROM_UTF8_FUNCTION
156               Callback     for     code     base    conversion.    See    CUR‐
157               LOPT_CONV_FROM_UTF8_FUNCTION(3)
158 
159        CURLOPT_INTERLEAVEFUNCTION
160               Callback for RTSP interleaved data. See  CURLOPT_INTERLEAVEFUNC‐
161               TION(3)
162 
163        CURLOPT_INTERLEAVEDATA
164               Data  pointer  to pass to the RTSP interleave callback. See CUR‐
165               LOPT_INTERLEAVEDATA(3)
166 
167        CURLOPT_CHUNK_BGN_FUNCTION
168               Callback  for  wildcard  download  start  of  chunk.  See   CUR‐
169               LOPT_CHUNK_BGN_FUNCTION(3)
170 
171        CURLOPT_CHUNK_END_FUNCTION
172               Callback   for   wildcard   download  end  of  chunk.  See  CUR‐
173               LOPT_CHUNK_END_FUNCTION(3)
174 
175        CURLOPT_CHUNK_DATA
176               Data  pointer  to  pass  to  the  chunk  callbacks.   See   CUR‐
177               LOPT_CHUNK_DATA(3)
178 
179        CURLOPT_FNMATCH_FUNCTION
180               Callback for wildcard matching. See CURLOPT_FNMATCH_FUNCTION(3)
181 
182        CURLOPT_FNMATCH_DATA
183               Data pointer to pass to the wildcard matching callback. See CUR‐
184               LOPT_FNMATCH_DATA(3)
185 
186 ERROR OPTIONS
187        CURLOPT_ERRORBUFFER
188               Error message buffer. See CURLOPT_ERRORBUFFER(3)
189 
190        CURLOPT_STDERR
191               stderr replacement stream. See CURLOPT_STDERR(3)
192 
193        CURLOPT_FAILONERROR
194               Fail on HTTP 4xx errors. CURLOPT_FAILONERROR(3)
195 
196 NETWORK OPTIONS
197        CURLOPT_URL
198               URL to work on. See CURLOPT_URL(3)
199 
200        CURLOPT_PATH_AS_IS
201               Disable squashing /../ and /./ sequences in the path.  See  CUR‐
202               LOPT_PATH_AS_IS(3)
203 
204        CURLOPT_PROTOCOLS
205               Allowed protocols. See CURLOPT_PROTOCOLS(3)
206 
207        CURLOPT_REDIR_PROTOCOLS
208               Protocols to allow redirects to. See CURLOPT_REDIR_PROTOCOLS(3)
209 
210        CURLOPT_DEFAULT_PROTOCOL
211               Default protocol. See CURLOPT_DEFAULT_PROTOCOL(3)
212 
213        CURLOPT_PROXY
214               Proxy to use. See CURLOPT_PROXY(3)
215 
216        CURLOPT_PROXYPORT
217               Proxy port to use. See CURLOPT_PROXYPORT(3)
218 
219        CURLOPT_PROXYTYPE
220               Proxy type. See CURLOPT_PROXYTYPE(3)
221 
222        CURLOPT_NOPROXY
223               Filter out hosts from proxy use. CURLOPT_NOPROXY(3)
224 
225        CURLOPT_HTTPPROXYTUNNEL
226               Tunnel through the HTTP proxy. CURLOPT_HTTPPROXYTUNNEL(3)
227 
228        CURLOPT_SOCKS5_GSSAPI_SERVICE
229               Socks5 GSSAPI service name. CURLOPT_SOCKS5_GSSAPI_SERVICE(3)
230 
231        CURLOPT_SOCKS5_GSSAPI_NEC
232               Socks5 GSSAPI NEC mode. See CURLOPT_SOCKS5_GSSAPI_NEC(3)
233 
234        CURLOPT_PROXY_SERVICE_NAME
235               Proxy service name. CURLOPT_PROXY_SERVICE_NAME(3)
236 
237        CURLOPT_SERVICE_NAME
238               SPNEGO service name. CURLOPT_SERVICE_NAME(3)
239 
240        CURLOPT_INTERFACE
241               Bind connection locally to this. See CURLOPT_INTERFACE(3)
242 
243        CURLOPT_LOCALPORT
244               Bind connection locally to this port. See CURLOPT_LOCALPORT(3)
245 
246        CURLOPT_LOCALPORTRANGE
247               Bind  connection  locally  to  port range. See CURLOPT_LOCALPOR‐
248               TRANGE(3)
249 
250        CURLOPT_DNS_CACHE_TIMEOUT
251               Timeout for DNS cache. See CURLOPT_DNS_CACHE_TIMEOUT(3)
252 
253        CURLOPT_DNS_USE_GLOBAL_CACHE
254               OBSOLETE    Enable    global     DNS     cache.     See     CUR‐
255               LOPT_DNS_USE_GLOBAL_CACHE(3)
256 
257        CURLOPT_BUFFERSIZE
258               Ask for smaller buffer size. See CURLOPT_BUFFERSIZE(3)
259 
260        CURLOPT_PORT
261               Port number to connect to. See CURLOPT_PORT(3)
262 
263        CURLOPT_TCP_NODELAY
264               Disable the Nagle algorithm. See CURLOPT_TCP_NODELAY(3)
265 
266        CURLOPT_ADDRESS_SCOPE
267               IPv6 scope for local addresses. See CURLOPT_ADDRESS_SCOPE(3)
268 
269        CURLOPT_TCP_KEEPALIVE
270               Enable TCP keep-alive. See CURLOPT_TCP_KEEPALIVE(3)
271 
272        CURLOPT_TCP_KEEPIDLE
273               Idle time before sending keep-alive. See CURLOPT_TCP_KEEPIDLE(3)
274 
275        CURLOPT_TCP_KEEPINTVL
276               Interval between keep-alive probes. See CURLOPT_TCP_KEEPINTVL(3)
277 
278        CURLOPT_UNIX_SOCKET_PATH
279               Path to a Unix domain socket. See CURLOPT_UNIX_SOCKET_PATH(3)
280 
281 NAMES and PASSWORDS OPTIONS (Authentication)
282        CURLOPT_NETRC
283               Enable .netrc parsing. See CURLOPT_NETRC(3)
284 
285        CURLOPT_NETRC_FILE
286               .netrc file name. See CURLOPT_NETRC_FILE(3)
287 
288        CURLOPT_USERPWD
289               User name and password. See CURLOPT_USERPWD(3)
290 
291        CURLOPT_PROXYUSERPWD
292               Proxy user name and password. See CURLOPT_PROXYUSERPWD(3)
293 
294        CURLOPT_USERNAME
295               User name. See CURLOPT_USERNAME(3)
296 
297        CURLOPT_PASSWORD
298               Password. See CURLOPT_PASSWORD(3)
299 
300        CURLOPT_LOGIN_OPTIONS
301               Login options. See CURLOPT_LOGIN_OPTIONS(3)
302 
303        CURLOPT_PROXYUSERNAME
304               Proxy user name. See CURLOPT_PROXYUSERNAME(3)
305 
306        CURLOPT_PROXYPASSWORD
307               Proxy password. See CURLOPT_PROXYPASSWORD(3)
308 
309        CURLOPT_HTTPAUTH
310               HTTP server authentication methods. See CURLOPT_HTTPAUTH(3)
311 
312        CURLOPT_TLSAUTH_USERNAME
313               TLS authentication user name. See CURLOPT_TLSAUTH_USERNAME(3)
314 
315        CURLOPT_TLSAUTH_PASSWORD
316               TLS authentication password. See CURLOPT_TLSAUTH_PASSWORD(3)
317 
318        CURLOPT_TLSAUTH_TYPE
319               TLS authentication methods. See CURLOPT_TLSAUTH_TYPE(3)
320 
321        CURLOPT_PROXYAUTH
322               HTTP proxy authentication methods. See CURLOPT_PROXYAUTH(3)
323 
324        CURLOPT_SASL_IR
325               Enable SASL initial response. See CURLOPT_SASL_IR(3)
326 
327        CURLOPT_XOAUTH2_BEARER
328               OAuth2 bearer token. See CURLOPT_XOAUTH2_BEARER(3)
329 
330 HTTP OPTIONS
331        CURLOPT_AUTOREFERER
332               Automatically set Referer: header. See CURLOPT_AUTOREFERER(3)
333 
334        CURLOPT_ACCEPT_ENCODING
335               Accept-Encoding  and  automatic  decompressing  data.  See  CUR‐
336               LOPT_ACCEPT_ENCODING(3)
337 
338        CURLOPT_TRANSFER_ENCODING
339               Request Transfer-Encoding. See CURLOPT_TRANSFER_ENCODING(3)
340 
341        CURLOPT_FOLLOWLOCATION
342               Follow HTTP redirects. See CURLOPT_FOLLOWLOCATION(3)
343 
344        CURLOPT_UNRESTRICTED_AUTH
345               Do not restrict authentication to original  host.  CURLOPT_UNRE‐
346               STRICTED_AUTH(3)
347 
348        CURLOPT_MAXREDIRS
349               Maximum number of redirects to follow. See CURLOPT_MAXREDIRS(3)
350 
351        CURLOPT_POSTREDIR
352               How to act on redirects after POST. See CURLOPT_POSTREDIR(3)
353 
354        CURLOPT_PUT
355               Issue a HTTP PUT request. See CURLOPT_PUT(3)
356 
357        CURLOPT_POST
358               Issue a HTTP POST request. See CURLOPT_POST(3)
359 
360        CURLOPT_POSTFIELDS
361               Send a POST with this data. See CURLOPT_POSTFIELDS(3)
362 
363        CURLOPT_POSTFIELDSIZE
364               The POST data is this big. See CURLOPT_POSTFIELDSIZE(3)
365 
366        CURLOPT_POSTFIELDSIZE_LARGE
367               The POST data is this big. See CURLOPT_POSTFIELDSIZE_LARGE(3)
368 
369        CURLOPT_COPYPOSTFIELDS
370               Send  a POST with this data - and copy it. See CURLOPT_COPYPOST‐
371               FIELDS(3)
372 
373        CURLOPT_HTTPPOST
374               Multipart formpost HTTP POST. See CURLOPT_HTTPPOST(3)
375 
376        CURLOPT_REFERER
377               Referer: header. See CURLOPT_REFERER(3)
378 
379        CURLOPT_USERAGENT
380               User-Agent: header. See CURLOPT_USERAGENT(3)
381 
382        CURLOPT_HTTPHEADER
383               Custom HTTP headers. See CURLOPT_HTTPHEADER(3)
384 
385        CURLOPT_HEADEROPT
386               Control custom headers. See CURLOPT_HEADEROPT(3)
387 
388        CURLOPT_PROXYHEADER
389               Custom HTTP headers sent to proxy. See CURLOPT_PROXYHEADER(3)
390 
391        CURLOPT_HTTP200ALIASES
392               Alternative versions of 200 OK. See CURLOPT_HTTP200ALIASES(3)
393 
394        CURLOPT_COOKIE
395               Cookie(s) to send. See CURLOPT_COOKIE(3)
396 
397        CURLOPT_COOKIEFILE
398               File to read cookies from. See CURLOPT_COOKIEFILE(3)
399 
400        CURLOPT_COOKIEJAR
401               File to write cookies to. See CURLOPT_COOKIEJAR(3)
402 
403        CURLOPT_COOKIESESSION
404               Start a new cookie session. See CURLOPT_COOKIESESSION(3)
405 
406        CURLOPT_COOKIELIST
407               Add or control cookies. See CURLOPT_COOKIELIST(3)
408 
409        CURLOPT_HTTPGET
410               Do a HTTP GET request. See CURLOPT_HTTPGET(3)
411 
412        CURLOPT_HTTP_VERSION
413               HTTP version to use. CURLOPT_HTTP_VERSION(3)
414 
415        CURLOPT_IGNORE_CONTENT_LENGTH
416               Ignore Content-Length. See CURLOPT_IGNORE_CONTENT_LENGTH(3)
417 
418        CURLOPT_HTTP_CONTENT_DECODING
419               Disable Content decoding. See CURLOPT_HTTP_CONTENT_DECODING(3)
420 
421        CURLOPT_HTTP_TRANSFER_DECODING
422               Disable Transfer decoding. See CURLOPT_HTTP_TRANSFER_DECODING(3)
423 
424        CURLOPT_EXPECT_100_TIMEOUT_MS
425               100-continue timeout. See CURLOPT_EXPECT_100_TIMEOUT_MS(3)
426 
427        CURLOPT_PIPEWAIT
428               Wait on connection to pipeline on it. See CURLOPT_PIPEWAIT(3)
429 
430        CURLOPT_STREAM_DEPENDS
431               This   HTTP/2   stream   depends   on    another.    See    CUR‐
432               LOPT_STREAM_DEPENDS(3)
433 
434        CURLOPT_STREAM_DEPENDS_E
435               This  HTTP/2  stream  depends  on  another exclusively. See CUR‐
436               LOPT_STREAM_DEPENDS_E(3)
437 
438        CURLOPT_STREAM_WEIGHT
439               Set this HTTP/2 streams weight. See CURLOPT_STREAM_WEIGHT(3)
440 
441 SMTP OPTIONS
442        CURLOPT_MAIL_FROM
443               Address of the sender. See CURLOPT_MAIL_FROM(3)
444 
445        CURLOPT_MAIL_RCPT
446               Address of the recipients. See CURLOPT_MAIL_RCPT(3)
447 
448        CURLOPT_MAIL_AUTH
449               Authentication address. See CURLOPT_MAIL_AUTH(3)
450 
451 TFTP OPTIONS
452        CURLOPT_TFTP_BLKSIZE
453               TFTP block size. See CURLOPT_TFTP_BLKSIZE(3)
454 
455 FTP OPTIONS
456        CURLOPT_FTPPORT
457               Use active FTP. See CURLOPT_FTPPORT(3)
458 
459        CURLOPT_QUOTE
460               Commands to run before transfer. See CURLOPT_QUOTE(3)
461 
462        CURLOPT_POSTQUOTE
463               Commands to run after transfer. See CURLOPT_POSTQUOTE(3)
464 
465        CURLOPT_PREQUOTE
466               Commands to run just before transfer. See CURLOPT_PREQUOTE(3)
467 
468        CURLOPT_APPEND
469               Append to remote file. See CURLOPT_APPEND(3)
470 
471        CURLOPT_FTP_USE_EPRT
472               Use EPTR. See CURLOPT_FTP_USE_EPRT(3)
473 
474        CURLOPT_FTP_USE_EPSV
475               Use EPSV. See CURLOPT_FTP_USE_EPSV(3)
476 
477        CURLOPT_FTP_USE_PRET
478               Use PRET. See CURLOPT_FTP_USE_PRET(3)
479 
480        CURLOPT_FTP_CREATE_MISSING_DIRS
481               Create missing  directories  on  the  remote  server.  See  CUR‐
482               LOPT_FTP_CREATE_MISSING_DIRS(3)
483 
484        CURLOPT_FTP_RESPONSE_TIMEOUT
485               Timeout for FTP responses. See CURLOPT_FTP_RESPONSE_TIMEOUT(3)
486 
487        CURLOPT_FTP_ALTERNATIVE_TO_USER
488               Alternative to USER. See CURLOPT_FTP_ALTERNATIVE_TO_USER(3)
489 
490        CURLOPT_FTP_SKIP_PASV_IP
491               Ignore   the   IP   address  in  the  PASV  response.  See  CUR‐
492               LOPT_FTP_SKIP_PASV_IP(3)
493 
494        CURLOPT_FTPSSLAUTH
495               Control how to do TLS. See CURLOPT_FTPSSLAUTH(3)
496 
497        CURLOPT_FTP_SSL_CCC
498               Back  to  non-TLS   again   after   authentication.   See   CUR‐
499               LOPT_FTP_SSL_CCC(3)
500 
501        CURLOPT_FTP_ACCOUNT
502               Send ACCT command. See CURLOPT_FTP_ACCOUNT(3)
503 
504        CURLOPT_FTP_FILEMETHOD
505               Specify how to reach files. See CURLOPT_FTP_FILEMETHOD(3)
506 
507 RTSP OPTIONS
508        CURLOPT_RTSP_REQUEST
509               RTSP request. See CURLOPT_RTSP_REQUEST(3)
510 
511        CURLOPT_RTSP_SESSION_ID
512               RTSP session-id. See CURLOPT_RTSP_SESSION_ID(3)
513 
514        CURLOPT_RTSP_STREAM_URI
515               RTSP stream URI. See CURLOPT_RTSP_STREAM_URI(3)
516 
517        CURLOPT_RTSP_TRANSPORT
518               RTSP Transport: header. See CURLOPT_RTSP_TRANSPORT(3)
519 
520        CURLOPT_RTSP_CLIENT_CSEQ
521               Client CSEQ number. See CURLOPT_RTSP_CLIENT_CSEQ(3)
522 
523        CURLOPT_RTSP_SERVER_CSEQ
524               CSEQ   number   for   RTSP   Server->Client  request.  See  CUR‐
525               LOPT_RTSP_SERVER_CSEQ(3)
526 
527 PROTOCOL OPTIONS
528        CURLOPT_TRANSFERTEXT
529               Use text transfer. See CURLOPT_TRANSFERTEXT(3)
530 
531        CURLOPT_PROXY_TRANSFER_MODE
532               Add transfer mode to URL over  proxy.  See  CURLOPT_PROXY_TRANS‐
533               FER_MODE(3)
534 
535        CURLOPT_CRLF
536               Convert newlines. See CURLOPT_CRLF(3)
537 
538        CURLOPT_RANGE
539               Range requests. See CURLOPT_RANGE(3)
540 
541        CURLOPT_RESUME_FROM
542               Resume a transfer. See CURLOPT_RESUME_FROM(3)
543 
544        CURLOPT_RESUME_FROM_LARGE
545               Resume a transfer. See CURLOPT_RESUME_FROM_LARGE(3)
546 
547        CURLOPT_CUSTOMREQUEST
548               Custom request/method. See CURLOPT_CUSTOMREQUEST(3)
549 
550        CURLOPT_FILETIME
551               Request file modification date and time. See CURLOPT_FILETIME(3)
552 
553        CURLOPT_DIRLISTONLY
554               List only. See CURLOPT_DIRLISTONLY(3)
555 
556        CURLOPT_NOBODY
557               Do not get the body contents. See CURLOPT_NOBODY(3)
558 
559        CURLOPT_INFILESIZE
560               Size of file to send. CURLOPT_INFILESIZE(3)
561 
562        CURLOPT_INFILESIZE_LARGE
563               Size of file to send. CURLOPT_INFILESIZE_LARGE(3)
564 
565        CURLOPT_UPLOAD
566               Upload data. See CURLOPT_UPLOAD(3)
567 
568        CURLOPT_MAXFILESIZE
569               Maximum file size to get. See CURLOPT_MAXFILESIZE(3)
570 
571        CURLOPT_MAXFILESIZE_LARGE
572               Maximum file size to get. See CURLOPT_MAXFILESIZE_LARGE(3)
573 
574        CURLOPT_TIMECONDITION
575               Make a time conditional request. See CURLOPT_TIMECONDITION(3)
576 
577        CURLOPT_TIMEVALUE
578               Time   value   for   the  time  conditional  request.  See  CUR‐
579               LOPT_TIMEVALUE(3)
580 
581 CONNECTION OPTIONS
582        CURLOPT_TIMEOUT
583               Timeout for the entire request. See CURLOPT_TIMEOUT(3)
584 
585        CURLOPT_TIMEOUT_MS
586               Millisecond timeout for the entire  request.  See  CURLOPT_TIME‐
587               OUT_MS(3)
588 
589        CURLOPT_LOW_SPEED_LIMIT
590               Low    speed    limit    to    abort    transfer.    See    CUR‐
591               LOPT_LOW_SPEED_LIMIT(3)
592 
593        CURLOPT_LOW_SPEED_TIME
594               Time to be below the speed to trigger low speed abort. See  CUR‐
595               LOPT_LOW_SPEED_TIME(3)
596 
597        CURLOPT_MAX_SEND_SPEED_LARGE
598               Cap     the     upload     speed     to     this.    See    CUR‐
599               LOPT_MAX_SEND_SPEED_LARGE(3)
600 
601        CURLOPT_MAX_RECV_SPEED_LARGE
602               Cap    the    download    speed    to     this.     See     CUR‐
603               LOPT_MAX_RECV_SPEED_LARGE(3)
604 
605        CURLOPT_MAXCONNECTS
606               Maximum  number  of connections in the connection pool. See CUR‐
607               LOPT_MAXCONNECTS(3)
608 
609        CURLOPT_FRESH_CONNECT
610               Use a new connection. CURLOPT_FRESH_CONNECT(3)
611 
612        CURLOPT_FORBID_REUSE
613               Prevent subsequent connections  from  re-using  this.  See  CUR‐
614               LOPT_FORBID_REUSE(3)
615 
616        CURLOPT_CONNECTTIMEOUT
617               Timeout for the connection phase. See CURLOPT_CONNECTTIMEOUT(3)
618 
619        CURLOPT_CONNECTTIMEOUT_MS
620               Millisecond  timeout  for the connection phase. See CURLOPT_CON‐
621               NECTTIMEOUT_MS(3)
622 
623        CURLOPT_IPRESOLVE
624               IP version to resolve to. See CURLOPT_IPRESOLVE(3)
625 
626        CURLOPT_CONNECT_ONLY
627               Only connect, nothing else. See CURLOPT_CONNECT_ONLY(3)
628 
629        CURLOPT_USE_SSL
630               Use TLS/SSL. See CURLOPT_USE_SSL(3)
631 
632        CURLOPT_RESOLVE
633               Provide fixed/fake name resolves. See CURLOPT_RESOLVE(3)
634 
635        CURLOPT_DNS_INTERFACE
636               Bind name resolves to  this  interface.  See  CURLOPT_DNS_INTER‐
637               FACE(3)
638 
639        CURLOPT_DNS_LOCAL_IP4
640               Bind   name   resolves   to   this   IP4   address.   See   CUR‐
641               LOPT_DNS_LOCAL_IP4(3)
642 
643        CURLOPT_DNS_LOCAL_IP6
644               Bind   name   resolves   to   this   IP6   address.   See   CUR‐
645               LOPT_DNS_LOCAL_IP6(3)
646 
647        CURLOPT_DNS_SERVERS
648               Preferred DNS servers. See CURLOPT_DNS_SERVERS(3)
649 
650        CURLOPT_ACCEPTTIMEOUT_MS
651               Timeout  for  waiting  for  the  servers  connect  back  to  be
652               accepted. See CURLOPT_ACCEPTTIMEOUT_MS(3)
653 
654 SSL and SECURITY OPTIONS
655        CURLOPT_SSLCERT
656               Client cert. See CURLOPT_SSLCERT(3)
657 
658        CURLOPT_SSLCERTTYPE
659               Client cert type.  See CURLOPT_SSLCERTTYPE(3)
660 
661        CURLOPT_SSLKEY
662               Client key. See CURLOPT_SSLKEY(3)
663 
664        CURLOPT_SSLKEYTYPE
665               Client key type. See CURLOPT_SSLKEYTYPE(3)
666 
667        CURLOPT_KEYPASSWD
668               Client key password. See CURLOPT_KEYPASSWD(3)
669 
670        CURLOPT_SSL_ENABLE_ALPN
671               Enable use of ALPN. See CURLOPT_SSL_ENABLE_ALPN(3)
672 
673        CURLOPT_SSL_ENABLE_NPN
674               Enable use of NPN. See CURLOPT_SSL_ENABLE_NPN(3)
675 
676        CURLOPT_SSLENGINE
677               Use identifier with SSL engine. See CURLOPT_SSLENGINE(3)
678 
679        CURLOPT_SSLENGINE_DEFAULT
680               Default SSL engine. See CURLOPT_SSLENGINE_DEFAULT(3)
681 
682        CURLOPT_SSL_FALSESTART
683               Enable TLS False Start. See CURLOPT_SSL_FALSESTART(3)
684 
685        CURLOPT_SSLVERSION
686               SSL version to use. See CURLOPT_SSLVERSION(3)
687 
688        CURLOPT_SSL_VERIFYHOST
689               Verify  the  host  name  in  the  SSL  certificate.   See   CUR‐
690               LOPT_SSL_VERIFYHOST(3)
691 
692        CURLOPT_SSL_VERIFYPEER
693               Verify the SSL certificate. See CURLOPT_SSL_VERIFYPEER(3)
694 
695        CURLOPT_SSL_VERIFYSTATUS
696               Verify  the SSL certificates status. See CURLOPT_SSL_VERIFYSTA‐
697               TUS(3)
698 
699        CURLOPT_CAINFO
700               CA cert bundle. See CURLOPT_CAINFO(3)
701 
702        CURLOPT_ISSUERCERT
703               Issuer certificate. See CURLOPT_ISSUERCERT(3)
704 
705        CURLOPT_CAPATH
706               Path to CA cert bundle. See CURLOPT_CAPATH(3)
707 
708        CURLOPT_CRLFILE
709               Certificate Revocation List. See CURLOPT_CRLFILE(3)
710 
711        CURLOPT_CERTINFO
712               Extract certificate info. See CURLOPT_CERTINFO(3)
713 
714        CURLOPT_PINNEDPUBLICKEY
715               Set pinned SSL public key . See CURLOPT_PINNEDPUBLICKEY(3)
716 
717        CURLOPT_RANDOM_FILE
718               Provide  source  for  entropy  random  data.  See   CURLOPT_RAN‐
719               DOM_FILE(3)
720 
721        CURLOPT_EGDSOCKET
722               Identify EGD socket for entropy. See CURLOPT_EGDSOCKET(3)
723 
724        CURLOPT_SSL_CIPHER_LIST
725               Ciphers to use. See CURLOPT_SSL_CIPHER_LIST(3)
726 
727        CURLOPT_SSL_SESSIONID_CACHE
728               Disable SSL session-id cache. See CURLOPT_SSL_SESSIONID_CACHE(3)
729 
730        CURLOPT_SSL_OPTIONS
731               Control SSL behavior. See CURLOPT_SSL_OPTIONS(3)
732 
733        CURLOPT_KRBLEVEL
734               Kerberos security level. See CURLOPT_KRBLEVEL(3)
735 
736        CURLOPT_GSSAPI_DELEGATION
737               Disable GSS-API delegation. See CURLOPT_GSSAPI_DELEGATION(3)
738 
739 SSH OPTIONS
740        CURLOPT_SSH_AUTH_TYPES
741               SSH authentication types. See CURLOPT_SSH_AUTH_TYPES(3)
742 
743        CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
744               MD5 of hosts public key. See CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)
745 
746        CURLOPT_SSH_PUBLIC_KEYFILE
747               File name of public key. See CURLOPT_SSH_PUBLIC_KEYFILE(3)
748 
749        CURLOPT_SSH_PRIVATE_KEYFILE
750               File name of private key. See CURLOPT_SSH_PRIVATE_KEYFILE(3)
751 
752        CURLOPT_SSH_KNOWNHOSTS
753               File name with known hosts. See CURLOPT_SSH_KNOWNHOSTS(3)
754 
755        CURLOPT_SSH_KEYFUNCTION
756               Callback  for  known  hosts  handling.  See CURLOPT_SSH_KEYFUNC‐
757               TION(3)
758 
759        CURLOPT_SSH_KEYDATA
760               Custom pointer to pass to ssh key callback. See CURLOPT_SSH_KEY‐
761               DATA(3)
762 
763 OTHER OPTIONS
764        CURLOPT_PRIVATE
765               Private pointer to store. See CURLOPT_PRIVATE(3)
766 
767        CURLOPT_SHARE
768               Share object to use. See CURLOPT_SHARE(3)
769 
770        CURLOPT_NEW_FILE_PERMS
771               Mode    for    creating    new    remote    files.    See   CUR‐
772               LOPT_NEW_FILE_PERMS(3)
773 
774        CURLOPT_NEW_DIRECTORY_PERMS
775               Mode for creating new remote directories. See CURLOPT_NEW_DIREC‐
776               TORY_PERMS(3)
777 
778 TELNET OPTIONS
779        CURLOPT_TELNETOPTIONS
780               TELNET options. See CURLOPT_TELNETOPTIONS(3)
781 
782 RETURN VALUE
783        CURLE_OK  (zero) means that the option was set properly, non-zero means
784        an error occurred as <curl/curl.h> defines. See  the  libcurl-errors(3)
785        man page for the full list with descriptions.
786 
787        If  you  try  to set an option that libcurl doesnt know about, perhaps
788        because the library is too old to support it or the option was  removed
789        in a recent version, this function will return CURLE_UNKNOWN_OPTION. If
790        support for the option was disabled at  compile-time,  it  will  return
791        CURLE_NOT_BUILT_IN.
792 
793 EXAMPLE
794        CURL *curl = curl_easy_init();
795        if(curl) {
796          CURLcode res;
797          curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
798          res = curl_easy_perform(curl);
799          curl_easy_cleanup(curl);
800        }
801 
802 SEE ALSO
803        curl_easy_init(3),       curl_easy_cleanup(3),      curl_easy_reset(3),
804        curl_easy_getinfo(3), curl_multi_setopt(3),
805 
806 libcurl 7.38.0                    25 Jun 2014              curl_easy_setopt(3)

 

CURLcode curl_easy_setopt(原创)