1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Binding of C libCurl which allow us to interact with network.
18 module native_curl
is pkgconfig
"libcurl"
20 intrude import core
::file
24 #include <curl/curl.h>
30 } CURLCallbackReadDatas;
38 // Callback method to read datas from buffer.
39 size_t nit_curl_callback_read_func(void *buffer, size_t size, size_t count, CURLCallbackReadDatas *datas){
40 int len = datas->len - datas->pos;
41 if(len > size * count) len = size * count;
42 memcpy(buffer, datas->data + datas->pos, len);
48 redef extern class NativeString
49 private fun native_callback_header
(size
, count
: Int, target
: NativeCurlCallbacks): Int
51 target
.header_callback to_s_with_length
(size
*count
)
53 # FIXME we probably should return a value from the user
57 private fun native_callback_body
(size
, count
: Int, target
: NativeCurlCallbacks): Int
59 target
.body_callback to_s_with_length
(size
*count
)
64 private fun native_callback_stream
(size
, count
: Int, target
: NativeCurlCallbacks): Int
66 target
.stream_callback to_s_with_length
(size
*count
)
72 # CURL Extern Type, reproduce CURL low level behaviors
73 extern class NativeCurl `{ CURL * `}
74 # Constructor, CURL low level initializer
75 new easy_init `{ return curl_easy_init(); `}
77 # Check for correct initialization
78 fun is_init
: Bool `{ return (self != NULL); `}
80 # Easy Clean / Release CURL instance
81 fun easy_clean `{ curl_easy_cleanup( self ); `}
83 # Perform the transfer described by setted options
84 fun easy_perform
: CURLCode `{ return curl_easy_perform( self ); `}
86 # Set options to tell CURL how to behave. Obj parameter type can be Int, Bool, String, FileWriter, CURLSList.
87 fun easy_setopt(opt: CURLOption, obj: Object): CURLCode
89 if obj isa Int then return native_setopt_int(opt, obj)
90 if obj isa Bool and obj == true then return native_setopt_int(opt, 1)
91 if obj isa Bool and obj == false then return native_setopt_int(opt, 0)
92 if obj isa String then return native_setopt_string(opt, obj)
93 if obj isa FileWriter then return native_setopt_file(opt, obj._file.as(not null))
94 if obj isa CURLSList then return native_setopt_slist(opt, obj)
95 return once new CURLCode.unknown_option
98 # Internal method to set options to CURL using NativeFile parameter.
99 private fun native_setopt_file(opt: CURLOption, file: NativeFile): CURLCode `{
100 return curl_easy_setopt
( self, opt
, file
);
103 # Internal method to set options to CURL using Int parameter.
104 private fun native_setopt_int(opt: CURLOption, num: Int): CURLCode `{ return curl_easy_setopt( self, opt, num); `}
106 # Internal method to set options to CURL using CURLSList parameter.
107 private fun native_setopt_slist
(opt
: CURLOption, list
: CURLSList): CURLCode `{ return curl_easy_setopt( self, opt, list); `}
109 # Internal method to set options to CURL using String parameter.
110 private fun native_setopt_string(opt: CURLOption, str: String): CURLCode import String.to_cstring `{
111 char
*rStr
= String_to_cstring(str
);
112 return curl_easy_setopt
( self, opt
, rStr
);
115 # Request Chars internal information from the CURL session
116 fun easy_getinfo_chars(opt: CURLInfoChars): nullable String
118 var answ = new Ref[NativeString]("".to_cstring)
119 if not native_getinfo_chars(opt, answ).is_ok then return null
120 if answ.item.address_is_null then return null
121 return answ.item.to_s
124 # Internal method used to get String object information initially knowns as C Chars type
125 private fun native_getinfo_chars(opt: CURLInfoChars, res: Ref[NativeString]): CURLCode
126 import Ref[NativeString].item= `{
128 CURLcode c
= curl_easy_getinfo
( self, opt
, &r
);
129 if (c
== CURLE_OK) Ref_of_NativeString_item__assign(res
, r
);
133 # Request Long internal information from the CURL session
134 fun easy_getinfo_long(opt: CURLInfoLong): nullable Int
136 var answ = new Ref[Int](0)
137 if not native_getinfo_long(opt, answ).is_ok then return null
141 # Internal method used to get Int object information initially knowns as C Long type
142 private fun native_getinfo_long(opt: CURLInfoLong, res: Ref[Int]): CURLCode
143 import Ref[Int].item= `{
145 CURLcode c
= curl_easy_getinfo
( self, opt
, &r
);
146 if (c
== CURLE_OK) Ref_of_Int_item__assign(res
, r
);
150 # Request Double internal information from the CURL session
151 fun easy_getinfo_double(opt: CURLInfoDouble): nullable Float
153 var answ = new Ref[Float](0.0)
154 if not native_getinfo_double(opt, answ).is_ok then return null
158 # Internal method used to get Int object information initially knowns as C Double type
159 private fun native_getinfo_double(opt: CURLInfoDouble, res: Ref[Float]): CURLCode
160 import Ref[Float].item= `{
162 CURLcode c
= curl_easy_getinfo
(self, opt
, &r
);
163 if (c
== CURLE_OK) Ref_of_Float_item__assign(res
, r
);
167 # Request SList internal information from the CURL session
168 fun easy_getinfo_slist(opt: CURLInfoSList): nullable Array[String]
170 var answ = new Ref[CURLSList](new CURLSList)
171 if not native_getinfo_slist(opt, answ).is_ok then return null
173 var native = answ.item
174 var nity = native.to_a
179 # Internal method used to get Array[String] object information initially knowns as C SList type
180 private fun native_getinfo_slist(opt: CURLInfoSList, res: Ref[CURLSList]): CURLCode
181 import Ref[CURLSList].item= `{
182 struct curl_slist
* csl
;
183 CURLcode c
= curl_easy_getinfo
(self, opt
, &csl
);
184 if (c
== CURLE_OK) Ref_of_CURLSList_item__assign(res
, csl
);
188 # Register delegate to read datas from given buffer
189 fun register_read_datas_callback(delegate: NativeCurlCallbacks, datas: String): CURLCode
191 if datas.length > 0 then return native_register_read_datas_callback(delegate, datas, datas.length)
192 return once new CURLCode.unknown_option
195 # Internal method used to configure read callback
196 private fun native_register_read_datas_callback(delegate: NativeCurlCallbacks, datas: String, size: Int): CURLCode import String.to_cstring `{
197 CURLCallbackReadDatas *d
= NULL;
198 d
= malloc
(sizeof
(CURLCallbackReadDatas));
199 d-
>data
= (char
*)String_to_cstring(datas
);
202 return curl_easy_setopt
( self, CURLOPT_READDATA, d
);
205 # Register `delegate
` to get callbacks about the CURL transfer
206 fun register_callback_header(delegate: NativeCurlCallbacks): CURLCode
207 import NativeString.native_callback_header `{
209 NativeCurlCallbacks_incr_ref(delegate
); // FIXME deallocated these when download completes
?
211 e
= curl_easy_setopt
(self, CURLOPT_HEADERFUNCTION, (curl_write_callback
)&NativeString_native_callback_header);
212 if(e
!= CURLE_OK) return e
;
214 e
= curl_easy_setopt
(self, CURLOPT_WRITEHEADER, delegate
);
218 # Register `delegate
` to get callbacks about the CURL transfer
219 fun register_callback_body(delegate: NativeCurlCallbacks): CURLCode
220 import NativeString.native_callback_body `{
222 NativeCurlCallbacks_incr_ref(delegate
);
224 e
= curl_easy_setopt
(self, CURLOPT_WRITEFUNCTION, (curl_write_callback
)&NativeString_native_callback_body);
225 if(e
!= CURLE_OK) return e
;
227 e
= curl_easy_setopt
(self, CURLOPT_WRITEDATA, delegate
);
231 # Register `delegate
` to get callbacks about the CURL transfer
232 fun register_callback_stream(delegate: NativeCurlCallbacks): CURLCode
233 import NativeString.native_callback_stream `{
235 NativeCurlCallbacks_incr_ref(delegate
);
237 e
= curl_easy_setopt
(self, CURLOPT_WRITEFUNCTION, (curl_write_callback
)&NativeString_native_callback_stream);
238 if(e
!= CURLE_OK) return e
;
240 e
= curl_easy_setopt
(self, CURLOPT_WRITEDATA, delegate
);
244 # Register `delegate
` to get callbacks about the CURL transfer
245 fun register_callback_read(delegate: NativeCurlCallbacks): CURLCode
246 import NativeString.native_callback_stream `{
247 NativeCurlCallbacks_incr_ref(delegate
);
249 return curl_easy_setopt
(self, CURLOPT_READFUNCTION, (curl_write_callback
)&nit_curl_callback_read_func
);
252 # Convert given string to URL encoded string
253 fun escape(url: String): String import String.to_cstring, NativeString.to_s_with_copy `{
254 char
*orig_url
, *encoded_url
= NULL;
255 orig_url
= String_to_cstring(url
);
256 encoded_url
= curl_easy_escape
( self, orig_url
, strlen
(orig_url
));
257 String b_url
= NativeString_to_s_with_copy(encoded_url
);
258 curl_free
(encoded_url
);
263 # Interface for internal information callbacks methods
264 interface NativeCurlCallbacks
265 fun header_callback(buffer: String) do end
266 fun body_callback(buffer: String) do end
267 fun stream_callback(buffer: String) do end
270 # CURL Code binding and helpers
271 extern class CURLCode `{ CURLcode `}
272 new unknown_option
`{ return CURLE_UNKNOWN_OPTION; `}
273 new unsupported_protocol `{ return CURLE_UNSUPPORTED_PROTOCOL; `}
274 new ok
`{ return CURLE_OK; `}
275 new failed_init `{ return CURLE_FAILED_INIT; `}
277 fun code
: Int `{ return self; `}
278 fun is_ok: Bool `{ return self == CURLE_OK; `}
279 fun is_valid_protocol
: Bool `{ return self == CURLE_UNSUPPORTED_PROTOCOL; `}
280 fun is_valid_init: Bool `{ return self == CURLE_FAILED_INIT; `}
281 fun to_i
: Int do return code
end
282 redef fun to_s
import NativeString.to_s_with_copy
`{
283 char *c = (char*)curl_easy_strerror(self);
284 return NativeString_to_s_with_copy(c);
288 # Extern Type of the Linked list type of CURL
289 extern class CURLSList `{ struct curl_slist * `}
290 # Empty constructor which allow us to avoid the use of Nit NULLABLE type
291 private new `{ return NULL; `}
293 # Constructor allow us to get list instancied by appending an element inside.
294 new with_str
(s
: String) import String.to_cstring
`{
295 struct curl_slist *l = NULL;
296 l = curl_slist_append(l, String_to_cstring(s));
300 # Check for initialization
301 fun is_init
: Bool `{ return (self != NULL); `}
303 # Append an element in the linked list
304 fun append(key: String) import String.to_cstring `{
305 char
*k
= String_to_cstring(key
);
306 curl_slist_append
(self, (char
*)k
);
309 # Internal method to check for reachability of current data
310 private fun native_data_reachable(c: CURLSList): Bool `{ return (c != NULL && c->data != NULL); `}
312 # Internal method to check for reachability of next element
313 private fun native_next_reachable
(c
: CURLSList): Bool `{ return (c != NULL && c->next != NULL); `}
315 # Internal method to get current data
316 private fun native_data(c: CURLSList): String import NativeString.to_s `{ return NativeString_to_s(c->data); `}
318 # Internal method to get next element
319 private fun native_next
(c
: CURLSList): CURLSList `{ return c->next; `}
321 # Convert current low level List to an Array[String] object
322 fun to_a: Array[String]
324 var r = new Array[String]
327 if native_data_reachable(cursor) != true then break
328 r.add(native_data(cursor))
329 cursor = native_next(cursor)
334 # Release allocated memory
335 fun destroy `{ curl_slist_free_all(self); `}
338 redef class Collection[E
]
339 # Convert Collection[String] to CURLSList
340 fun to_curlslist
: CURLSList
342 assert collectionItemType
: self isa Collection[String] else
343 print
"Collection item must be strings."
345 if is_empty
then return new CURLSList
346 var primList
= new CURLSList.with_str
(self.first
)
349 if not is_first
then primList
.append
(s
)
356 # Reproduce Enum of available CURL SList information, used for NativeCurl.easy_getinfo
357 extern class CURLInfoSList `{ CURLINFO `}
358 new ssl_engines `{ return CURLINFO_SSL_ENGINES; `}
359 new cookielist
`{ return CURLINFO_COOKIELIST; `}
362 # Reproduce Enum of available CURL Long information, used for NativeCurl.easy_getinfo
363 extern class CURLInfoLong `{ CURLINFO `}
364 new response_code
`{ return CURLINFO_RESPONSE_CODE; `}
365 new header_size `{ return CURLINFO_HEADER_SIZE; `}
366 new http_connectcode
`{ return CURLINFO_HTTP_CONNECTCODE; `}
367 new filetime `{ return CURLINFO_FILETIME; `}
368 new redirect_count
`{ return CURLINFO_REDIRECT_COUNT; `}
369 new request_size `{ return CURLINFO_REQUEST_SIZE; `}
370 new ssl_verifyresult
`{ return CURLINFO_SSL_VERIFYRESULT; `}
371 new httpauth_avail `{ return CURLINFO_HTTPAUTH_AVAIL; `}
372 new proxyauth_avail
`{ return CURLINFO_PROXYAUTH_AVAIL; `}
373 new os_errno `{ return CURLINFO_OS_ERRNO; `}
374 new num_connects
`{ return CURLINFO_NUM_CONNECTS; `}
375 new primary_port `{ return CURLINFO_PRIMARY_PORT; `}
376 new local_port
`{ return CURLINFO_LOCAL_PORT; `}
377 new lastsocket `{ return CURLINFO_LASTSOCKET; `}
378 new condition_unmet
`{ return CURLINFO_CONDITION_UNMET; `}
379 new rtsp_client_cseq `{ return CURLINFO_RTSP_CLIENT_CSEQ; `}
380 new rtsp_server_cseq
`{ return CURLINFO_RTSP_SERVER_CSEQ; `}
381 new rtsp_cseq_self `{ return CURLINFO_RTSP_CSEQ_RECV; `}
384 # Reproduce Enum of available CURL Double information, used for NativeCurl.easy_getinfo
385 extern class CURLInfoDouble `{ CURLINFO `}
386 new total_time `{ return CURLINFO_TOTAL_TIME; `}
387 new namelookup_time
`{ return CURLINFO_NAMELOOKUP_TIME; `}
388 new connect_time `{ return CURLINFO_CONNECT_TIME; `}
389 new appconnect_time
`{ return CURLINFO_APPCONNECT_TIME; `}
390 new pretransfer_time `{ return CURLINFO_PRETRANSFER_TIME; `}
391 new starttransfer_time
`{ return CURLINFO_STARTTRANSFER_TIME; `}
392 new redirect_time `{ return CURLINFO_REDIRECT_TIME; `}
393 new size_upload
`{ return CURLINFO_SIZE_UPLOAD; `}
394 new size_download `{ return CURLINFO_SIZE_DOWNLOAD; `}
395 new speed_download
`{ return CURLINFO_SPEED_DOWNLOAD; `}
396 new speed_upload `{ return CURLINFO_SPEED_UPLOAD; `}
397 new content_length_download
`{ return CURLINFO_CONTENT_LENGTH_DOWNLOAD; `}
398 new content_length_upload `{ return CURLINFO_CONTENT_LENGTH_UPLOAD; `}
401 # Reproduce Enum of available CURL Chars information, used for NativeCurl.easy_getinfo
402 extern class CURLInfoChars `{ CURLINFO `}
403 new content_type `{ return CURLINFO_CONTENT_TYPE; `}
404 new effective_url
`{ return CURLINFO_EFFECTIVE_URL; `}
405 new redirect_url `{ return CURLINFO_REDIRECT_URL; `}
406 new primary_ip
`{ return CURLINFO_PRIMARY_IP; `}
407 new local_ip `{ return CURLINFO_LOCAL_IP; `}
408 new ftp_entry_path
`{ return CURLINFO_FTP_ENTRY_PATH; `}
409 new rtsp_session_id `{ return CURLINFO_RTSP_SESSION_ID; `}
410 new private_data
`{ return CURLINFO_PRIVATE; `}
413 # Reproduce Enum of HTTP Status Code
414 extern class CURLStatusCode `{ int `}
415 new proceed
`{ return 100; `}
416 new switching_protocols `{ return 101; `}
417 new ok
`{ return 200; `}
418 new created `{ return 201; `}
419 new accepted
`{ return 202; `}
420 new non_authoritative_information `{ return 203; `}
421 new no_content
`{ return 204; `}
422 new reset_content `{ return 205; `}
423 new partial_content
`{ return 206; `}
424 new multiple_choices `{ return 300; `}
425 new moved_permanently
`{ return 301; `}
426 new moved_temporarily `{ return 302; `}
427 new see_other
`{ return 303; `}
428 new not_modified `{ return 304; `}
429 new use_proxy
`{ return 305; `}
430 new bad_request `{ return 400; `}
431 new unauthorized
`{ return 401; `}
432 new payment_required `{ return 402; `}
433 new forbidden
`{ return 403; `}
434 new not_found `{ return 404; `}
435 new method_not_allowed
`{ return 405; `}
436 new not_acceptable `{ return 406; `}
437 new proxy_authentication_required
`{ return 407; `}
438 new request_timeout `{ return 408; `}
439 new conflict
`{ return 409; `}
440 new gone `{ return 410; `}
441 new length_required
`{ return 411; `}
442 new precondition_failed `{ return 412; `}
443 new request_entity_too_large
`{ return 413; `}
444 new request_uri_too_large `{ return 414; `}
445 new unsupported_media_type
`{ return 415; `}
446 new internal_server_error `{ return 500; `}
447 new not_implemented
`{ return 501; `}
448 new bad_gateway `{ return 502; `}
449 new service_unavailable
`{ return 503; `}
450 new gateway_timeout `{ return 504; `}
451 new http_version_not_supported
`{ return 505; `}
452 fun to_i: Int `{ return self; `}
455 # Reproduce Enum of CURL Options usable, used for NativeCurl.easy_setopt
456 extern class CURLOption `{ CURLoption `}
460 # Display verbose information.
461 new verbose `{ return CURLOPT_VERBOSE; `}
463 # Include the header in the body output.
464 new header
`{ return CURLOPT_HEADER; `}
466 # Shut off the progress meter.
467 new no_progress `{ return CURLOPT_NOPROGRESS; `}
469 # Do not install signal handlers.
470 new no_signal
`{ return CURLOPT_NOSIGNAL; `}
472 # Transfer multiple files according to a file name pattern.
473 new wild_card_match `{ return CURLOPT_WILDCARDMATCH; `}
477 # Callback for writing data.
478 new write_function
`{ return CURLOPT_WRITEFUNCTION; `}
480 # Data pointer to pass to the write callback.
481 new write_data `{ return CURLOPT_WRITEDATA; `}
483 # new `{ return CURLOPT_READFUNCTION; `}
484 # new `{ return CURLOPT_READDATA; `}
485 # new `{ return CURLOPT_IOCTLFUNCTION; `}
486 # new `{ return CURLOPT_IOCTLDATA; `}
487 # new `{ return CURLOPT_SEEKFUNCTION; `}
488 # new `{ return CURLOPT_SEEKDATA; `}
489 # new `{ return CURLOPT_SOCKOPTFUNCTION; `}
490 # new `{ return CURLOPT_SOCKOPTDATA; `}
491 # new `{ return CURLOPT_OPENSOCKETFUNCTION; `}
492 # new `{ return CURLOPT_OPENSOCKETDATA; `}
493 # new `{ return CURLOPT_CLOSESOCKETFUNCTION; `}
494 # new `{ return CURLOPT_CLOSESOCKETDATA; `}
495 # new `{ return CURLOPT_PROGRESSFUNCTION; `}
496 # new `{ return CURLOPT_PROGRESSDATA; `}
497 # new `{ return CURLOPT_HEADERFUNCTION; `}
498 # new `{ return CURLOPT_DEBUGFUNCTION; `}
499 # new `{ return CURLOPT_DEBUGDATA; `}
500 # new `{ return CURLOPT_SSL_CTX_FUNCTION; `}
501 # new `{ return CURLOPT_SSL_CTX_DATA; `}
502 # new `{ return CURLOPT_CONV_TO_NETWORK_FUNCTION; `}
503 # new `{ return CURLOPT_CONV_FROM_NETWORK_FUNCTION; `}
504 # new `{ return CURLOPT_CONV_FROM_UTF8_FUNCTION; `}
505 # new `{ return CURLOPT_INTERLEAVEFUNCTION; `}
506 # new `{ return CURLOPT_INTERLEAVEDATA; `}
507 # new `{ return CURLOPT_CHUNK_BGN_FUNCTION; `}
508 # new `{ return CURLOPT_CHUNK_END_FUNCTION; `}
509 # new `{ return CURLOPT_CHUNK_DATA; `}
510 # new `{ return CURLOPT_FNMATCH_FUNCTION; `}
511 # new `{ return CURLOPT_FNMATCH_DATA; `}
515 # new `{ return CURLOPT_ERRORBUFFER; `}
516 # new `{ return CURLOPT_STDERR; `}
518 # Fail on HTTP 4xx errors.
519 new fail_on_error
`{ return CURLOPT_FAILONERROR; `}
524 new url `{ return CURLOPT_URL; `}
526 # new `{ return CURLOPT_PROTOCOLS; `}
527 # new `{ return CURLOPT_REDIR_PROTOCOLS; `}
528 # new `{ return CURLOPT_PROXY; `}
529 # new `{ return CURLOPT_PROXYPORT; `}
530 # new `{ return CURLOPT_PROXYTYPE; `}
531 # new `{ return CURLOPT_NOPROXY; `}
532 # new `{ return CURLOPT_HTTPPROXYTUNNEL; `}
533 # new `{ return CURLOPT_SOCKS5_GSSAPI_SERVICE; `}
534 # new `{ return CURLOPT_SOCKS5_GSSAPI_NEC; `}
535 # new `{ return CURLOPT_INTERFACE; `}
536 # new `{ return CURLOPT_LOCALPORT; `}
537 # new `{ return CURLOPT_LOCALPORTRANGE; `}
538 # new `{ return CURLOPT_DNS_CACHE_TIMEOUT; `}
539 # new `{ return CURLOPT_DNS_USE_GLOBAL_CACHE; `} /* DEPRECATED, do not use! */
540 # new `{ return CURLOPT_BUFFERSIZE; `}
541 # new `{ return CURLOPT_PORT; `}
542 # new `{ return CURLOPT_TCP_NODELAY; `}
543 # new `{ return CURLOPT_ADDRESS_SCOPE; `}
544 # new `{ return CURLOPT_TCP_KEEPALIVE; `}
545 # new `{ return CURLOPT_TCP_KEEPIDLE; `}
546 # new `{ return CURLOPT_TCP_KEEPINTVL; `}
548 # Names and Passwords Options
550 # new `{ return CURLOPT_NETRC; `}
551 # new `{ return CURLOPT_NETRC_FILE; `}
552 # new `{ return CURLOPT_USERPWD; `}
553 # new `{ return CURLOPT_PROXYUSERPWD; `}
555 new username
`{ return CURLOPT_USERNAME; `}
556 new password `{ return CURLOPT_PASSWORD; `}
558 # new `{ return CURLOPT_PROXYUSERNAME; `}
559 # new `{ return CURLOPT_PROXYPASSWORD; `}
560 # new `{ return CURLOPT_HTTPAUTH; `}
561 # new `{ return CURLOPT_TLSAUTH_USERNAME; `}
562 # new `{ return CURLOPT_TLSAUTH_PASSWORD; `}
563 # new `{ return CURLOPT_PROXYAUTH; `}
567 # new `{ return CURLOPT_AUTOREFERER; `}
569 # Accept-Encoding and automatic decompressing data.
570 new accept_encoding
`{ return CURLOPT_ACCEPT_ENCODING; `}
572 # Request Transfer-Encoding.
573 new transfert_encoding `{ return CURLOPT_TRANSFER_ENCODING; `}
575 # Follow HTTP redirects.
576 new follow_location
`{ return CURLOPT_FOLLOWLOCATION; `}
578 # new `{ return CURLOPT_UNRESTRICTED_AUTH; `}
579 # new `{ return CURLOPT_MAXREDIRS; `}
580 # new `{ return CURLOPT_POSTREDIR; `}
582 # Issue a HTTP PUT request.
583 new put
`{ return CURLOPT_PUT; `}
585 # Issue a HTTP POS request.
586 new post `{ return CURLOPT_POST; `}
588 # Send a POST with this data.
589 new postfields
`{ return CURLOPT_POSTFIELDS; `}
591 # new `{ return CURLOPT_POSTFIELDSIZE; `}
592 # new `{ return CURLOPT_POSTFIELDSIZE_LARGE; `}
593 # new `{ return CURLOPT_COPYPOSTFIELDS; `}
594 # new `{ return CURLOPT_HTTPPOST; `}
595 # new `{ return CURLOPT_REFERER; `}
597 # User-Agent: header.
598 new user_agent
`{ return CURLOPT_USERAGENT; `}
600 # Custom HTTP headers.
601 new httpheader `{ return CURLOPT_HTTPHEADER; `}
603 # new `{ return CURLOPT_HTTP200ALIASES; `}
604 # new `{ return CURLOPT_COOKIE; `}
605 # new `{ return CURLOPT_COOKIEFILE; `}
606 # new `{ return CURLOPT_COOKIEJAR; `}
607 # new `{ return CURLOPT_COOKIESESSION; `}
608 # new `{ return CURLOPT_COOKIELIST; `}
610 # Issue a HTTP GET request.
611 new get
`{ return CURLOPT_HTTPGET; `}
613 # HTTP version to use.
614 new http_version `{ return CURLOPT_HTTP_VERSION; `}
616 # new `{ return CURLOPT_IGNORE_CONTENT_LENGTH; `}
617 # new `{ return CURLOPT_HTTP_CONTENT_DECODING; `}
618 # new `{ return CURLOPT_HTTP_TRANSFER_DECODING; `}
622 # Address of the sender.
623 new mail_from
`{ return CURLOPT_MAIL_FROM; `}
625 # Address of the recipients.
626 new mail_rcpt `{ return CURLOPT_MAIL_RCPT; `}
628 # new `{ return CURLOPT_MAIL_AUTH; `}
632 # new `{ return CURLOPT_TFTP_BLKSIZE; `}
636 # new `{ return CURLOPT_FTPPORT; `}
637 # new `{ return CURLOPT_QUOTE; `}
638 # new `{ return CURLOPT_POSTQUOTE; `}
639 # new `{ return CURLOPT_PREQUOTE; `}
642 new dir_list_only
`{ return CURLOPT_DIRLISTONLY; `}
644 # Append to remote file.
645 new append `{ return CURLOPT_APPEND; `}
647 # new `{ return CURLOPT_FTP_USE_EPRT; `}
648 # new `{ return CURLOPT_FTP_USE_EPSV; `}
649 # new `{ return CURLOPT_FTP_USE_PRET; `}
650 # new `{ return CURLOPT_FTP_CREATE_MISSING_DIRS; `}
651 # new `{ return CURLOPT_FTP_RESPONSE_TIMEOUT; `}
652 # new `{ return CURLOPT_FTP_ALTERNATIVE_TO_USER; `}
653 # new `{ return CURLOPT_FTP_SKIP_PASV_IP; `}
654 # new `{ return CURLOPT_FTPSSLAUTH; `}
655 # new `{ return CURLOPT_FTP_SSL_CCC; `}
656 # new `{ return CURLOPT_FTP_ACCOUNT; `}
657 # new `{ return CURLOPT_FTP_FILEMETHOD; `}
661 # new `{ return CURLOPT_RTSP_REQUEST; `}
662 # new `{ return CURLOPT_RTSP_SESSION_ID; `}
663 # new `{ return CURLOPT_RTSP_STREAM_URI; `}
664 # new `{ return CURLOPT_RTSP_TRANSPORT; `}
665 # new `{ return CURLOPT_RTSP_CLIENT_CSEQ; `}
666 # new `{ return CURLOPT_RTSP_SERVER_CSEQ; `}
670 # Transfer data in text/ASCII format.
671 new transfert_text
`{ return CURLOPT_TRANSFERTEXT; `}
673 # new `{ return CURLOPT_PROXY_TRANSFER_MODE; `}
674 # new `{ return CURLOPT_CRLF; `}
675 # new `{ return CURLOPT_RANGE; `}
676 # new `{ return CURLOPT_RESUME_FROM; `}
677 # new `{ return CURLOPT_RESUME_FROM_LARGE; `}
679 # Issue a custom request/method.
680 new custom_request
`{ return CURLOPT_CUSTOMREQUEST; `}
682 # new `{ return CURLOPT_FILETIME; `}
684 # Do not get the body contents.
685 new no_body
`{ return CURLOPT_NOBODY; `}
687 # new `{ return CURLOPT_INFILESIZE; `}
688 # new `{ return CURLOPT_INFILESIZE_LARGE; `}
691 new upload
`{ return CURLOPT_UPLOAD; `}
693 # new `{ return CURLOPT_MAXFILESIZE; `}
694 # new `{ return CURLOPT_MAXFILESIZE_LARGE; `}
695 # new `{ return CURLOPT_TIMECONDITION; `}
696 # new `{ return CURLOPT_TIMEVALUE; `}
700 # Set maximum time the request is allowed to take.
701 new timeout
`{ return CURLOPT_TIMEOUT; `}
703 # Set maximum time the request is allowed to take (in ms).
704 new timeout_ms `{ return CURLOPT_TIMEOUT_MS; `}
706 # new `{ return CURLOPT_LOW_SPEED_LIMIT; `}
707 # new `{ return CURLOPT_LOW_SPEED_TIME; `}
708 # new `{ return CURLOPT_MAX_SEND_SPEED_LARGE; `}
709 # new `{ return CURLOPT_MAX_RECV_SPEED_LARGE; `}
710 # new `{ return CURLOPT_MAXCONNECTS; `}
711 # new `{ return CURLOPT_FRESH_CONNECT; `}
712 # new `{ return CURLOPT_FORBID_REUSE; `}
713 # new `{ return CURLOPT_CONNECTTIMEOUT; `}
714 # new `{ return CURLOPT_CONNECTTIMEOUT_MS; `}
715 # new `{ return CURLOPT_IPRESOLVE; `}
716 # new `{ return CURLOPT_CONNECT_ONLY; `}
717 # new `{ return CURLOPT_USE_SSL; `}
718 # new `{ return CURLOPT_RESOLVE; `}
719 # new `{ return CURLOPT_ACCEPTTIMEOUT_MS; `}
721 # SSL and Security Options
723 # new `{ return CURLOPT_SSLCERT; `}
724 # new `{ return CURLOPT_SSLCERTTYPE; `}
725 # new `{ return CURLOPT_SSLKEY; `}
726 # new `{ return CURLOPT_SSLKEYTYPE; `}
727 # new `{ return CURLOPT_KEYPASSWD; `}
728 # new `{ return CURLOPT_SSLENGINE; `}
729 # new `{ return CURLOPT_SSLENGINE_DEFAULT; `}
730 # new `{ return CURLOPT_SSLVERSION; `}
731 # new `{ return CURLOPT_SSL_VERIFYPEER; `}
732 # new `{ return CURLOPT_CAINFO; `}
733 # new `{ return CURLOPT_ISSUERCERT; `}
734 # new `{ return CURLOPT_CAPATH; `}
735 # new `{ return CURLOPT_CRLFILE; `}
736 # new `{ return CURLOPT_SSL_VERIFYHOST; `}
737 # new `{ return CURLOPT_CERTINFO; `}
738 # new `{ return CURLOPT_RANDOM_FILE; `}
739 # new `{ return CURLOPT_EGDSOCKET; `}
740 # new `{ return CURLOPT_SSL_CIPHER_LIST; `}
741 # new `{ return CURLOPT_SSL_SESSIONID_CACHE; `}
742 # new `{ return CURLOPT_SSL_OPTIONS; `}
743 # new `{ return CURLOPT_KRBLEVEL; `}
744 # new `{ return CURLOPT_GSSAPI_DELEGATION; `}
748 # new `{ return CURLOPT_SSH_AUTH_TYPES; `}
749 # new `{ return CURLOPT_SSH_HOST_PUBLIC_KEY_MD5; `}
750 # new `{ return CURLOPT_SSH_PUBLIC_KEYFILE; `}
751 # new `{ return CURLOPT_SSH_PRIVATE_KEYFILE; `}
752 # new `{ return CURLOPT_SSH_KNOWNHOSTS; `}
753 # new `{ return CURLOPT_SSH_KEYFUNCTION; `}
754 # new `{ return CURLOPT_SSH_KEYDATA; `}
758 # new `{ return CURLOPT_PRIVATE; `}
759 # new `{ return CURLOPT_SHARE; `}
760 # new `{ return CURLOPT_NEW_FILE_PERMS; `}
761 # new `{ return CURLOPT_NEW_DIRECTORY_PERMS; `}
765 # new `{ return CURLOPT_TELNETOPTIONS; `}