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 curl_c
is pkgconfig
("libcurl")
21 #include <curl/curl.h>
24 CURLcallbackTypeHeader,
26 CURLcallbackTypeStream,
31 CCurlCallbacks delegate;
32 CURLcallbackType type;
39 } CURLCallbackReadDatas;
47 // Callbacks method for Header, Body, Stream.
48 size_t nit_curl_callback_func(void *buffer, size_t size, size_t count, CURLCallbackDatas *datas){
49 if(datas->type == CURLcallbackTypeHeader){
50 char *line_c = (char*)buffer;
51 String line_o = NativeString_to_s_with_copy(line_c);
52 CCurlCallbacks_header_callback(datas->delegate, line_o);
54 else if(datas->type == CURLcallbackTypeBody){
55 char *line_c = (char*)buffer;
56 String line_o = NativeString_to_s_with_copy(line_c);
57 CCurlCallbacks_body_callback(datas->delegate, line_o);
59 else if(datas->type == CURLcallbackTypeStream){
60 char *line_c = (char*)buffer;
61 String line_o = NativeString_to_s(line_c);
62 CCurlCallbacks_stream_callback(datas->delegate, line_o, size, count);
66 // Callback method to read datas from buffer.
67 size_t nit_curl_callback_read_func(void *buffer, size_t size, size_t count, CURLCallbackReadDatas *datas){
68 int len = datas->len - datas->pos;
69 if(len > size * count) len = size * count;
70 memcpy(buffer, datas->data + datas->pos, len);
76 # CURL Extern Type, reproduce CURL low level behaviors
77 extern class CCurl `{ CURL * `}
78 # Constructor, CURL low level initializer
79 new easy_init `{ return curl_easy_init(); `}
80 # Check for correct initialization
81 fun is_init
:Bool `{ return (recv != NULL); `}
82 # Easy Clean / Release CURL instance
83 fun easy_clean `{ curl_easy_cleanup( recv ); `}
84 # Perform the transfer described by setted options
85 fun easy_perform
:CURLCode `{ return curl_easy_perform( recv ); `}
86 # Set options to tell CURL how to behave. Obj parameter type can be Int, Bool, String, OFile, CURLSList.
87 fun easy_setopt(opt: CURLOption, obj: Object):CURLCode
89 if obj isa Int then return i_setopt_int(opt, obj)
90 if obj isa Bool and obj == true then return i_setopt_int(opt, 1)
91 if obj isa Bool and obj == false then return i_setopt_int(opt, 0)
92 if obj isa String then return i_setopt_string(opt, obj)
93 if obj isa OFile then return i_setopt_file(opt, obj)
94 if obj isa CURLSList then return i_setopt_slist(opt, obj)
95 return once new CURLCode.unknown_option
97 # Internal method to set options to CURL using OFile parameter.
98 private fun i_setopt_file(opt: CURLOption, fl: OFile):CURLCode `{ return curl_easy_setopt( recv, opt, fl); `}
99 # Internal method to set options to CURL using Int parameter.
100 private fun i_setopt_int
(opt
: CURLOption, num
: Int):CURLCode `{ return curl_easy_setopt( recv, opt, num); `}
101 # Internal method to set options to CURL using CURLSList parameter.
102 private fun i_setopt_slist(opt: CURLOption, list: CURLSList):CURLCode `{ return curl_easy_setopt( recv, opt, list); `}
103 # Internal method to set options to CURL using String parameter.
104 private fun i_setopt_string
(opt
: CURLOption, str
: String):CURLCode import String.to_cstring
`{
105 char *rStr = String_to_cstring(str);
106 return curl_easy_setopt( recv, opt, rStr);
108 # Request Chars internal information from the CURL session
109 fun easy_getinfo_chars
(opt
: CURLInfoChars):nullable CURLInfoResponseString
111 var answ
= new CURLInfoResponseString
112 if not i_getinfo_chars
(opt
, answ
).is_ok
then return null
115 # Internal method used to get String object information initially knowns as C Chars type
116 private fun i_getinfo_chars
(opt
: CURLInfoChars, res
: CURLInfoResponseString):CURLCode import CURLInfoResponseString.response
=, NativeString.to_s_with_copy
`{
118 CURLcode c = curl_easy_getinfo( recv, opt, &r);
119 if((c == CURLE_OK) && r != NULL){
120 String ro = NativeString_to_s_with_copy(r);
121 CURLInfoResponseString_response__assign( res, ro);
125 # Request Long internal information from the CURL session
126 fun easy_getinfo_long
(opt
: CURLInfoLong):nullable CURLInfoResponseLong
128 var answ
= new CURLInfoResponseLong
129 if not i_getinfo_long
(opt
, answ
).is_ok
then return null
132 # Internal method used to get Int object information initially knowns as C Long type
133 private fun i_getinfo_long
(opt
: CURLInfoLong, res
: CURLInfoResponseLong):CURLCode import CURLInfoResponseLong.response
= `{
135 r = malloc(sizeof(long));
136 CURLcode c = curl_easy_getinfo( recv, opt, r);
137 if((c == CURLE_OK) && r != NULL) CURLInfoResponseLong_response__assign( res, *r);
141 # Request Double internal information from the CURL session
142 fun easy_getinfo_double
(opt
: CURLInfoDouble):nullable CURLInfoResponseDouble
144 var answ
= new CURLInfoResponseDouble
145 if not i_getinfo_double
(opt
, answ
).is_ok
then return null
148 # Internal method used to get Int object information initially knowns as C Double type
149 private fun i_getinfo_double
(opt
: CURLInfoDouble, res
: CURLInfoResponseDouble):CURLCode import CURLInfoResponseDouble.response
= `{
151 r = malloc(sizeof(double));
152 CURLcode c = curl_easy_getinfo( recv, opt, r);
153 if((c == CURLE_OK) && r != NULL) CURLInfoResponseDouble_response__assign( res, *r);
157 # Request SList internal information from the CURL session
158 fun easy_getinfo_slist
(opt
: CURLInfoSList):nullable CURLInfoResponseArray
160 var answ
= new CURLInfoResponseArray
161 if not i_getinfo_slist
(opt
, answ
).is_ok
then return null
162 answ
.response
= answ
.prim_response
.to_a
163 answ
.prim_response
.destroy
166 # Internal method used to get Array[String] object information initially knowns as C SList type
167 private fun i_getinfo_slist
(opt
: CURLInfoSList, res
: CURLInfoResponseArray):CURLCode import CURLInfoResponseArray.prim_response
=`{
168 struct curl_slist* csl = NULL;
169 CURLcode ce = curl_easy_getinfo( recv, opt, &csl);
170 CURLInfoResponseArray_prim_response__assign(res, csl);
173 # Register delegate to get callbacks about the CURL transfer performed
174 fun register_callback
(delegate
: CCurlCallbacks, cbtype
: CURLCallbackType):CURLCode
176 if once
[new CURLCallbackType.header
, new CURLCallbackType.body
, new CURLCallbackType.stream
, new CURLCallbackType.read
].has
(cbtype
) then
177 return i_register_callback
(delegate
, cbtype
)
179 return once
new CURLCode.unknown_option
181 # Register delegate to read datas from given buffer
182 fun register_read_datas_callback
(delegate
: CCurlCallbacks, datas
: String):CURLCode
184 if datas
.length
> 0 then return i_register_read_datas_callback
(delegate
, datas
, datas
.length
)
185 return once
new CURLCode.unknown_option
187 # Internal method used to configure read callback
188 private fun i_register_read_datas_callback
(delegate
: CCurlCallbacks, datas
: String, size
: Int):CURLCode import String.to_cstring
`{
189 CURLCallbackReadDatas *d = NULL;
190 d = malloc(sizeof(CURLCallbackReadDatas));
191 d->data = (char*)String_to_cstring(datas);
194 return curl_easy_setopt( recv, CURLOPT_READDATA, d);
196 # Internal method used to configure callbacks in terms of given type
197 private fun i_register_callback
(delegate
: CCurlCallbacks, cbtype
: CURLCallbackType):CURLCode is extern import CCurlCallbacks.header_callback
, CCurlCallbacks.body_callback
, CCurlCallbacks.stream_callback
, NativeString.to_s_with_copy
, NativeString.to_s
`{
198 CURLCallbackDatas *d = malloc(sizeof(CURLCallbackDatas));
199 CCurlCallbacks_incr_ref(delegate);
201 d->delegate = delegate;
204 case CURLcallbackTypeHeader:
205 e = curl_easy_setopt( recv, CURLOPT_HEADERFUNCTION, (curl_write_callback)&nit_curl_callback_func);
206 if(e != CURLE_OK) return e;
207 e = curl_easy_setopt( recv, CURLOPT_WRITEHEADER, d);
209 case CURLcallbackTypeBody:
210 case CURLcallbackTypeStream:
211 e = curl_easy_setopt( recv, CURLOPT_WRITEFUNCTION, (curl_write_callback)&nit_curl_callback_func);
212 if(e != CURLE_OK) return e;
213 e = curl_easy_setopt( recv, CURLOPT_WRITEDATA, d);
215 case CURLcallbackTypeRead:
216 e = curl_easy_setopt( recv, CURLOPT_READFUNCTION, (curl_write_callback)&nit_curl_callback_read_func);
222 # Convert given string to URL encoded string
223 fun escape
(url
: String):String import String.to_cstring
, NativeString.to_s_with_copy
`{
224 char *orig_url, *encoded_url = NULL;
225 orig_url = String_to_cstring(url);
226 encoded_url = curl_easy_escape( recv, orig_url, strlen(orig_url));
227 String b_url = NativeString_to_s_with_copy(encoded_url);
228 curl_free(encoded_url);
233 # FILE Extern type, reproduce basic FILE I/O
234 extern class OFile `{ FILE* `}
235 # Open / Create a file from given name
236 new open(str: NativeString) `{ return fopen(str, "wb"); `}
237 # Check for File validity
238 fun is_valid
:Bool `{ return recv != NULL; `}
239 # Internal method to write to the current file
240 private fun n_write(buffer: NativeString, size: Int, count: Int):Int `{ return fwrite(buffer, size, count, recv); `}
241 # Write datas to the current file
242 fun write
(buffer
: String, size
: Int, count
: Int):Int
244 if is_valid
== true then return n_write
(buffer
.to_cstring
, size
, count
)
247 # Internal method to close the current file
248 private fun n_close
:Int `{ return fclose(recv); `}
249 # Close the current file
252 if is_valid == true then return n_close == 0
257 # Interface for internal information callbacks methods
258 interface CCurlCallbacks
259 fun header_callback(line: String) is abstract
260 fun body_callback(line: String) is abstract
261 fun stream_callback(buffer: String, size: Int, count: Int) is abstract
264 # Extern Type to reproduce Enum of available Callback type
265 extern class CURLCallbackType `{ CURLcallbackType `}
266 new header
`{ return CURLcallbackTypeHeader; `}
267 new body `{ return CURLcallbackTypeBody; `}
268 new stream
`{ return CURLcallbackTypeStream; `}
269 new read `{ return CURLcallbackTypeRead; `}
270 fun to_i
:Int `{ return recv; `}
273 # CURL Code binding and helpers
274 extern class CURLCode `{ CURLcode `}
275 new unknown_option
`{ return CURLE_UNKNOWN_OPTION; `}
276 new unsupported_protocol `{ return CURLE_UNSUPPORTED_PROTOCOL; `}
277 new ok
`{ return CURLE_OK; `}
278 new failed_init `{ return CURLE_FAILED_INIT; `}
279 fun code
:Int `{ return recv; `}
280 fun is_ok:Bool `{ return recv == CURLE_OK; `}
281 fun is_valid_protocol
:Bool `{ return recv == CURLE_UNSUPPORTED_PROTOCOL; `}
282 fun is_valid_init:Bool `{ return recv == CURLE_FAILED_INIT; `}
283 fun to_i
:Int do return code
end
284 redef fun to_s
import NativeString.to_s_with_copy
`{
285 char *c = (char*)curl_easy_strerror(recv);
286 return NativeString_to_s_with_copy(c);
290 # Extern Type of the Linked list type of CURL
291 extern class CURLSList `{ struct curl_slist * `}
292 # Empty constructor which allow us to avoid the use of Nit NULLABLE type
293 private new `{ return NULL; `}
294 # Constructor allow us to get list instancied by appending an element inside.
295 new with_str
(s
: String) import String.to_cstring
`{
296 struct curl_slist *l = NULL;
297 l = curl_slist_append(l, String_to_cstring(s));
300 # Check for initialization
301 fun is_init
:Bool `{ return (recv != NULL); `}
302 # Append an element in the linked list
303 fun append(key: String) import String.to_cstring `{
304 char
*k
= String_to_cstring(key
);
305 curl_slist_append
(recv
, (char
*)k
);
307 # Internal method to check for reachability of current data
308 private fun i_data_reachable(c: CURLSList):Bool `{ return (c != NULL && c->data != NULL); `}
309 # Internal method to check for reachability of next element
310 private fun i_next_reachable
(c
: CURLSList):Bool `{ return (c != NULL && c->next != NULL); `}
311 # Internal method to get current data
312 private fun i_data(c: CURLSList):String import NativeString.to_s `{ return NativeString_to_s(c->data); `}
313 # Internal method to get next element
314 private fun i_next
(c
: CURLSList):CURLSList `{ return c->next; `}
315 # Convert current low level List to an Array[String] object
316 fun to_a:Array[String]
318 var r = new Array[String]
321 if i_data_reachable(cursor) != true then break
322 r.add(i_data(cursor))
323 cursor = i_next(cursor)
327 # Release allocated memory
328 fun destroy `{ curl_slist_free_all(recv); `}
331 redef class Collection[E
]
332 # Convert Collection[String] to CURLSList
333 fun to_curlslist
: CURLSList
335 assert collectionItemType
: self isa Collection[String] else
336 print
"Collection item must be strings."
338 var primList
= new CURLSList.with_str
(self.first
)
341 if not is_first
then primList
.append
(s
)
348 # Array Response type of CCurl.easy_getinfo method
349 class CURLInfoResponseArray
350 var response
:Array[String] = new Array[String]
351 private var prim_response
:CURLSList = new CURLSList
354 # Long Response type of CCurl.easy_getinfo method
355 class CURLInfoResponseLong
359 # Double Response type of CCurl.easy_getinfo method
360 class CURLInfoResponseDouble
364 # String Response type of CCurl:easy_getinfo method
365 class CURLInfoResponseString
366 var response
:String = ""
369 # Reproduce Enum of available CURL SList information, used for CCurl.easy_getinfo
370 extern class CURLInfoSList `{ CURLINFO `}
371 new ssl_engines `{ return CURLINFO_SSL_ENGINES; `}
372 new cookielist
`{ return CURLINFO_COOKIELIST; `}
375 # Reproduce Enum of available CURL Long information, used for CCurl.easy_getinfo
376 extern class CURLInfoLong `{ CURLINFO `}
377 new response_code
`{ return CURLINFO_RESPONSE_CODE; `}
378 new header_size `{ return CURLINFO_HEADER_SIZE; `}
379 new http_connectcode
`{ return CURLINFO_HTTP_CONNECTCODE; `}
380 new filetime `{ return CURLINFO_FILETIME; `}
381 new redirect_count
`{ return CURLINFO_REDIRECT_COUNT; `}
382 new request_size `{ return CURLINFO_REQUEST_SIZE; `}
383 new ssl_verifyresult
`{ return CURLINFO_SSL_VERIFYRESULT; `}
384 new httpauth_avail `{ return CURLINFO_HTTPAUTH_AVAIL; `}
385 new proxyauth_avail
`{ return CURLINFO_PROXYAUTH_AVAIL; `}
386 new os_errno `{ return CURLINFO_OS_ERRNO; `}
387 new num_connects
`{ return CURLINFO_NUM_CONNECTS; `}
388 new primary_port `{ return CURLINFO_PRIMARY_PORT; `}
389 new local_port
`{ return CURLINFO_LOCAL_PORT; `}
390 new lastsocket `{ return CURLINFO_LASTSOCKET; `}
391 new condition_unmet
`{ return CURLINFO_CONDITION_UNMET; `}
392 new rtsp_client_cseq `{ return CURLINFO_RTSP_CLIENT_CSEQ; `}
393 new rtsp_server_cseq
`{ return CURLINFO_RTSP_SERVER_CSEQ; `}
394 new rtsp_cseq_recv `{ return CURLINFO_RTSP_CSEQ_RECV; `}
397 # Reproduce Enum of available CURL Double information, used for CCurl.easy_getinfo
398 extern class CURLInfoDouble `{ CURLINFO `}
399 new total_time `{ return CURLINFO_TOTAL_TIME; `}
400 new namelookup_time
`{ return CURLINFO_NAMELOOKUP_TIME; `}
401 new connect_time `{ return CURLINFO_CONNECT_TIME; `}
402 new appconnect_time
`{ return CURLINFO_APPCONNECT_TIME; `}
403 new pretransfer_time `{ return CURLINFO_PRETRANSFER_TIME; `}
404 new starttransfer_time
`{ return CURLINFO_STARTTRANSFER_TIME; `}
405 new redirect_time `{ return CURLINFO_REDIRECT_TIME; `}
406 new size_upload
`{ return CURLINFO_SIZE_UPLOAD; `}
407 new size_download `{ return CURLINFO_SIZE_DOWNLOAD; `}
408 new speed_download
`{ return CURLINFO_SPEED_DOWNLOAD; `}
409 new speed_upload `{ return CURLINFO_SPEED_UPLOAD; `}
410 new content_length_download
`{ return CURLINFO_CONTENT_LENGTH_DOWNLOAD; `}
411 new content_length_upload `{ return CURLINFO_CONTENT_LENGTH_UPLOAD; `}
414 # Reproduce Enum of available CURL Chars information, used for CCurl.easy_getinfo
415 extern class CURLInfoChars `{ CURLINFO `}
416 new content_type `{ return CURLINFO_CONTENT_TYPE; `}
417 new effective_url
`{ return CURLINFO_EFFECTIVE_URL; `}
418 new redirect_url `{ return CURLINFO_REDIRECT_URL; `}
419 new primary_ip
`{ return CURLINFO_PRIMARY_IP; `}
420 new local_ip `{ return CURLINFO_LOCAL_IP; `}
421 new ftp_entry_path
`{ return CURLINFO_FTP_ENTRY_PATH; `}
422 new rtsp_session_id `{ return CURLINFO_RTSP_SESSION_ID; `}
423 new private_data
`{ return CURLINFO_PRIVATE; `}
426 # Reproduce Enum of HTTP Status Code
427 extern class CURLStatusCode `{ int `}
428 new proceed
`{ return 100; `}
429 new switching_protocols `{ return 101; `}
430 new ok
`{ return 200; `}
431 new created `{ return 201; `}
432 new accepted
`{ return 202; `}
433 new non_authoritative_information `{ return 203; `}
434 new no_content
`{ return 204; `}
435 new reset_content `{ return 205; `}
436 new partial_content
`{ return 206; `}
437 new multiple_choices `{ return 300; `}
438 new moved_permanently
`{ return 301; `}
439 new moved_temporarily `{ return 302; `}
440 new see_other
`{ return 303; `}
441 new not_modified `{ return 304; `}
442 new use_proxy
`{ return 305; `}
443 new bad_request `{ return 400; `}
444 new unauthorized
`{ return 401; `}
445 new payment_required `{ return 402; `}
446 new forbidden
`{ return 403; `}
447 new not_found `{ return 404; `}
448 new method_not_allowed
`{ return 405; `}
449 new not_acceptable `{ return 406; `}
450 new proxy_authentication_required
`{ return 407; `}
451 new request_timeout `{ return 408; `}
452 new conflict
`{ return 409; `}
453 new gone `{ return 410; `}
454 new length_required
`{ return 411; `}
455 new precondition_failed `{ return 412; `}
456 new request_entity_too_large
`{ return 413; `}
457 new request_uri_too_large `{ return 414; `}
458 new unsupported_media_type
`{ return 415; `}
459 new internal_server_error `{ return 500; `}
460 new not_implemented
`{ return 501; `}
461 new bad_gateway `{ return 502; `}
462 new service_unavailable
`{ return 503; `}
463 new gateway_timeout `{ return 504; `}
464 new http_version_not_supported
`{ return 505; `}
465 fun to_i:Int `{ return recv; `}
468 # Reproduce Enum of CURL Options usable, used for CCurl.easy_setopt
469 extern class CURLOption `{ CURLoption `}
473 # Display verbose information.
474 new verbose `{ return CURLOPT_VERBOSE; `}
475 # Include the header in the body output.
476 new header
`{ return CURLOPT_HEADER; `}
477 # Shut off the progress meter.
478 new no_progress `{ return CURLOPT_NOPROGRESS; `}
479 # Do not install signal handlers.
480 new no_signal
`{ return CURLOPT_NOSIGNAL; `}
481 # Transfer multiple files according to a file name pattern.
482 new wild_card_match `{ return CURLOPT_WILDCARDMATCH; `}
486 # Callback for writing data.
487 new write_function
`{ return CURLOPT_WRITEFUNCTION; `}
488 # Data pointer to pass to the write callback.
489 new write_data `{ return CURLOPT_WRITEDATA; `}
491 # new `{ return CURLOPT_READFUNCTION; `}
492 # new `{ return CURLOPT_READDATA; `}
493 # new `{ return CURLOPT_IOCTLFUNCTION; `}
494 # new `{ return CURLOPT_IOCTLDATA; `}
495 # new `{ return CURLOPT_SEEKFUNCTION; `}
496 # new `{ return CURLOPT_SEEKDATA; `}
497 # new `{ return CURLOPT_SOCKOPTFUNCTION; `}
498 # new `{ return CURLOPT_SOCKOPTDATA; `}
499 # new `{ return CURLOPT_OPENSOCKETFUNCTION; `}
500 # new `{ return CURLOPT_OPENSOCKETDATA; `}
501 # new `{ return CURLOPT_CLOSESOCKETFUNCTION; `}
502 # new `{ return CURLOPT_CLOSESOCKETDATA; `}
503 # new `{ return CURLOPT_PROGRESSFUNCTION; `}
504 # new `{ return CURLOPT_PROGRESSDATA; `}
505 # new `{ return CURLOPT_HEADERFUNCTION; `}
506 # new `{ return CURLOPT_DEBUGFUNCTION; `}
507 # new `{ return CURLOPT_DEBUGDATA; `}
508 # new `{ return CURLOPT_SSL_CTX_FUNCTION; `}
509 # new `{ return CURLOPT_SSL_CTX_DATA; `}
510 # new `{ return CURLOPT_CONV_TO_NETWORK_FUNCTION; `}
511 # new `{ return CURLOPT_CONV_FROM_NETWORK_FUNCTION; `}
512 # new `{ return CURLOPT_CONV_FROM_UTF8_FUNCTION; `}
513 # new `{ return CURLOPT_INTERLEAVEFUNCTION; `}
514 # new `{ return CURLOPT_INTERLEAVEDATA; `}
515 # new `{ return CURLOPT_CHUNK_BGN_FUNCTION; `}
516 # new `{ return CURLOPT_CHUNK_END_FUNCTION; `}
517 # new `{ return CURLOPT_CHUNK_DATA; `}
518 # new `{ return CURLOPT_FNMATCH_FUNCTION; `}
519 # new `{ return CURLOPT_FNMATCH_DATA; `}
523 # new `{ return CURLOPT_ERRORBUFFER; `}
524 # new `{ return CURLOPT_STDERR; `}
526 # Fail on HTTP 4xx errors.
527 new fail_on_error
`{ return CURLOPT_FAILONERROR; `}
532 new url `{ return CURLOPT_URL; `}
534 # new `{ return CURLOPT_PROTOCOLS; `}
535 # new `{ return CURLOPT_REDIR_PROTOCOLS; `}
536 # new `{ return CURLOPT_PROXY; `}
537 # new `{ return CURLOPT_PROXYPORT; `}
538 # new `{ return CURLOPT_PROXYTYPE; `}
539 # new `{ return CURLOPT_NOPROXY; `}
540 # new `{ return CURLOPT_HTTPPROXYTUNNEL; `}
541 # new `{ return CURLOPT_SOCKS5_GSSAPI_SERVICE; `}
542 # new `{ return CURLOPT_SOCKS5_GSSAPI_NEC; `}
543 # new `{ return CURLOPT_INTERFACE; `}
544 # new `{ return CURLOPT_LOCALPORT; `}
545 # new `{ return CURLOPT_LOCALPORTRANGE; `}
546 # new `{ return CURLOPT_DNS_CACHE_TIMEOUT; `}
547 # new `{ return CURLOPT_DNS_USE_GLOBAL_CACHE; `} /* DEPRECATED, do not use! */
548 # new `{ return CURLOPT_BUFFERSIZE; `}
549 # new `{ return CURLOPT_PORT; `}
550 # new `{ return CURLOPT_TCP_NODELAY; `}
551 # new `{ return CURLOPT_ADDRESS_SCOPE; `}
552 # new `{ return CURLOPT_TCP_KEEPALIVE; `}
553 # new `{ return CURLOPT_TCP_KEEPIDLE; `}
554 # new `{ return CURLOPT_TCP_KEEPINTVL; `}
556 # Names and Passwords Options
558 # new `{ return CURLOPT_NETRC; `}
559 # new `{ return CURLOPT_NETRC_FILE; `}
560 # new `{ return CURLOPT_USERPWD; `}
561 # new `{ return CURLOPT_PROXYUSERPWD; `}
563 new username
`{ return CURLOPT_USERNAME; `}
564 new password `{ return CURLOPT_PASSWORD; `}
566 # new `{ return CURLOPT_PROXYUSERNAME; `}
567 # new `{ return CURLOPT_PROXYPASSWORD; `}
568 # new `{ return CURLOPT_HTTPAUTH; `}
569 # new `{ return CURLOPT_TLSAUTH_USERNAME; `}
570 # new `{ return CURLOPT_TLSAUTH_PASSWORD; `}
571 # new `{ return CURLOPT_PROXYAUTH; `}
575 # new `{ return CURLOPT_AUTOREFERER; `}
577 # Accept-Encoding and automatic decompressing data.
578 new accept_encoding
`{ return CURLOPT_ACCEPT_ENCODING; `}
579 # Request Transfer-Encoding.
580 new transfert_encoding `{ return CURLOPT_TRANSFER_ENCODING; `}
581 # Follow HTTP redirects.
582 new follow_location
`{ return CURLOPT_FOLLOWLOCATION; `}
584 # new `{ return CURLOPT_UNRESTRICTED_AUTH; `}
585 # new `{ return CURLOPT_MAXREDIRS; `}
586 # new `{ return CURLOPT_POSTREDIR; `}
588 # Issue a HTTP PUT request.
589 new put
`{ return CURLOPT_PUT; `}
590 # Issue a HTTP POS request.
591 new post `{ return CURLOPT_POST; `}
592 # Send a POST with this data.
593 new postfields
`{ return CURLOPT_POSTFIELDS; `}
595 # new `{ return CURLOPT_POSTFIELDSIZE; `}
596 # new `{ return CURLOPT_POSTFIELDSIZE_LARGE; `}
597 # new `{ return CURLOPT_COPYPOSTFIELDS; `}
598 # new `{ return CURLOPT_HTTPPOST; `}
599 # new `{ return CURLOPT_REFERER; `}
601 # User-Agent: header.
602 new user_agent
`{ return CURLOPT_USERAGENT; `}
603 # Custom HTTP headers.
604 new httpheader `{ return CURLOPT_HTTPHEADER; `}
606 # new `{ return CURLOPT_HTTP200ALIASES; `}
607 # new `{ return CURLOPT_COOKIE; `}
608 # new `{ return CURLOPT_COOKIEFILE; `}
609 # new `{ return CURLOPT_COOKIEJAR; `}
610 # new `{ return CURLOPT_COOKIESESSION; `}
611 # new `{ return CURLOPT_COOKIELIST; `}
613 # Issue a HTTP GET request.
614 new get
`{ return CURLOPT_HTTPGET; `}
616 # HTTP version to use.
617 new http_version `{ return CURLOPT_HTTP_VERSION; `}
619 # new `{ return CURLOPT_IGNORE_CONTENT_LENGTH; `}
620 # new `{ return CURLOPT_HTTP_CONTENT_DECODING; `}
621 # new `{ return CURLOPT_HTTP_TRANSFER_DECODING; `}
625 # Address of the sender.
626 new mail_from
`{ return CURLOPT_MAIL_FROM; `}
627 # Address of the recipients.
628 new mail_rcpt `{ return CURLOPT_MAIL_RCPT; `}
630 # new `{ return CURLOPT_MAIL_AUTH; `}
634 # new `{ return CURLOPT_TFTP_BLKSIZE; `}
638 # new `{ return CURLOPT_FTPPORT; `}
639 # new `{ return CURLOPT_QUOTE; `}
640 # new `{ return CURLOPT_POSTQUOTE; `}
641 # new `{ return CURLOPT_PREQUOTE; `}
644 new dir_list_only
`{ return CURLOPT_DIRLISTONLY; `}
645 # Append to remote file.
646 new append `{ return CURLOPT_APPEND; `}
648 # new `{ return CURLOPT_FTP_USE_EPRT; `}
649 # new `{ return CURLOPT_FTP_USE_EPSV; `}
650 # new `{ return CURLOPT_FTP_USE_PRET; `}
651 # new `{ return CURLOPT_FTP_CREATE_MISSING_DIRS; `}
652 # new `{ return CURLOPT_FTP_RESPONSE_TIMEOUT; `}
653 # new `{ return CURLOPT_FTP_ALTERNATIVE_TO_USER; `}
654 # new `{ return CURLOPT_FTP_SKIP_PASV_IP; `}
655 # new `{ return CURLOPT_FTPSSLAUTH; `}
656 # new `{ return CURLOPT_FTP_SSL_CCC; `}
657 # new `{ return CURLOPT_FTP_ACCOUNT; `}
658 # new `{ return CURLOPT_FTP_FILEMETHOD; `}
662 # new `{ return CURLOPT_RTSP_REQUEST; `}
663 # new `{ return CURLOPT_RTSP_SESSION_ID; `}
664 # new `{ return CURLOPT_RTSP_STREAM_URI; `}
665 # new `{ return CURLOPT_RTSP_TRANSPORT; `}
666 # new `{ return CURLOPT_RTSP_CLIENT_CSEQ; `}
667 # new `{ return CURLOPT_RTSP_SERVER_CSEQ; `}
671 # Transfer data in text/ASCII format.
672 new transfert_text
`{ return CURLOPT_TRANSFERTEXT; `}
674 # new `{ return CURLOPT_PROXY_TRANSFER_MODE; `}
675 # new `{ return CURLOPT_CRLF; `}
676 # new `{ return CURLOPT_RANGE; `}
677 # new `{ return CURLOPT_RESUME_FROM; `}
678 # new `{ return CURLOPT_RESUME_FROM_LARGE; `}
680 # Issue a custom request/method.
681 new custom_request
`{ return CURLOPT_CUSTOMREQUEST; `}
683 # new `{ return CURLOPT_FILETIME; `}
685 # Do not get the body contents.
686 new no_body
`{ return CURLOPT_NOBODY; `}
688 # new `{ return CURLOPT_INFILESIZE; `}
689 # new `{ return CURLOPT_INFILESIZE_LARGE; `}
692 new upload
`{ return CURLOPT_UPLOAD; `}
694 # new `{ return CURLOPT_MAXFILESIZE; `}
695 # new `{ return CURLOPT_MAXFILESIZE_LARGE; `}
696 # new `{ return CURLOPT_TIMECONDITION; `}
697 # new `{ return CURLOPT_TIMEVALUE; `}
701 # new `{ return CURLOPT_TIMEOUT; `}
702 # new `{ return CURLOPT_TIMEOUT_MS; `}
703 # new `{ return CURLOPT_LOW_SPEED_LIMIT; `}
704 # new `{ return CURLOPT_LOW_SPEED_TIME; `}
705 # new `{ return CURLOPT_MAX_SEND_SPEED_LARGE; `}
706 # new `{ return CURLOPT_MAX_RECV_SPEED_LARGE; `}
707 # new `{ return CURLOPT_MAXCONNECTS; `}
708 # new `{ return CURLOPT_FRESH_CONNECT; `}
709 # new `{ return CURLOPT_FORBID_REUSE; `}
710 # new `{ return CURLOPT_CONNECTTIMEOUT; `}
711 # new `{ return CURLOPT_CONNECTTIMEOUT_MS; `}
712 # new `{ return CURLOPT_IPRESOLVE; `}
713 # new `{ return CURLOPT_CONNECT_ONLY; `}
714 # new `{ return CURLOPT_USE_SSL; `}
715 # new `{ return CURLOPT_RESOLVE; `}
716 # new `{ return CURLOPT_ACCEPTTIMEOUT_MS; `}
718 # SSL and Security Options
720 # new `{ return CURLOPT_SSLCERT; `}
721 # new `{ return CURLOPT_SSLCERTTYPE; `}
722 # new `{ return CURLOPT_SSLKEY; `}
723 # new `{ return CURLOPT_SSLKEYTYPE; `}
724 # new `{ return CURLOPT_KEYPASSWD; `}
725 # new `{ return CURLOPT_SSLENGINE; `}
726 # new `{ return CURLOPT_SSLENGINE_DEFAULT; `}
727 # new `{ return CURLOPT_SSLVERSION; `}
728 # new `{ return CURLOPT_SSL_VERIFYPEER; `}
729 # new `{ return CURLOPT_CAINFO; `}
730 # new `{ return CURLOPT_ISSUERCERT; `}
731 # new `{ return CURLOPT_CAPATH; `}
732 # new `{ return CURLOPT_CRLFILE; `}
733 # new `{ return CURLOPT_SSL_VERIFYHOST; `}
734 # new `{ return CURLOPT_CERTINFO; `}
735 # new `{ return CURLOPT_RANDOM_FILE; `}
736 # new `{ return CURLOPT_EGDSOCKET; `}
737 # new `{ return CURLOPT_SSL_CIPHER_LIST; `}
738 # new `{ return CURLOPT_SSL_SESSIONID_CACHE; `}
739 # new `{ return CURLOPT_SSL_OPTIONS; `}
740 # new `{ return CURLOPT_KRBLEVEL; `}
741 # new `{ return CURLOPT_GSSAPI_DELEGATION; `}
745 # new `{ return CURLOPT_SSH_AUTH_TYPES; `}
746 # new `{ return CURLOPT_SSH_HOST_PUBLIC_KEY_MD5; `}
747 # new `{ return CURLOPT_SSH_PUBLIC_KEYFILE; `}
748 # new `{ return CURLOPT_SSH_PRIVATE_KEYFILE; `}
749 # new `{ return CURLOPT_SSH_KNOWNHOSTS; `}
750 # new `{ return CURLOPT_SSH_KEYFUNCTION; `}
751 # new `{ return CURLOPT_SSH_KEYDATA; `}
755 # new `{ return CURLOPT_PRIVATE; `}
756 # new `{ return CURLOPT_SHARE; `}
757 # new `{ return CURLOPT_NEW_FILE_PERMS; `}
758 # new `{ return CURLOPT_NEW_DIRECTORY_PERMS; `}
762 # new `{ return CURLOPT_TELNETOPTIONS; `}