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")
23 #include <curl/curl.h>
26 CURLcallbackTypeHeader,
28 CURLcallbackTypeStream,
33 CCurlCallbacks delegate;
34 CURLcallbackType type;
41 } CURLCallbackReadDatas;
45 // Callbacks method for Header, Body, Stream.
46 size_t nit_curl_callback_func(void *buffer, size_t size, size_t count, CURLCallbackDatas *datas){
47 if(datas->type == CURLcallbackTypeHeader){
48 char *line_c = (char*)buffer;
49 String line_o = NativeString_to_s_with_copy(line_c);
50 CCurlCallbacks_header_callback(datas->delegate, line_o);
52 else if(datas->type == CURLcallbackTypeBody){
53 char *line_c = (char*)buffer;
54 String line_o = NativeString_to_s_with_copy(line_c);
55 CCurlCallbacks_body_callback(datas->delegate, line_o);
57 else if(datas->type == CURLcallbackTypeStream){
58 char *line_c = (char*)buffer;
59 String line_o = NativeString_to_s(line_c);
60 CCurlCallbacks_stream_callback(datas->delegate, line_o, size, count);
64 // Callback method to read datas from buffer.
65 size_t nit_curl_callback_read_func(void *buffer, size_t size, size_t count, CURLCallbackReadDatas *datas){
66 int len = datas->len - datas->pos;
67 if(len > size * count) len = size * count;
68 memcpy(buffer, datas->data + datas->pos, len);
74 # CURL Extern Type, reproduce CURL low level behaviors
75 extern CCurl `{ CURL * `}
76 # Constructor, CURL low level initializer
77 new easy_init `{ return curl_easy_init(); `}
78 # Check for correct initialization
79 fun is_init
:Bool `{ return (recv != NULL); `}
80 # Easy Clean / Release CURL instance
81 fun easy_clean `{ curl_easy_cleanup( recv ); `}
82 # Perform the transfer described by setted options
83 fun easy_perform
:CURLCode `{ return curl_easy_perform( recv ); `}
84 # Set options to tell CURL how to behave. Obj parameter type can be Int, Bool, String, OFile, CURLSList.
85 fun easy_setopt(opt: CURLOption, obj: Object):CURLCode
87 if obj isa Int then return i_setopt_int(opt, obj)
88 if obj isa Bool and obj == true then return i_setopt_int(opt, 1)
89 if obj isa Bool and obj == false then return i_setopt_int(opt, 0)
90 if obj isa String then return i_setopt_string(opt, obj)
91 if obj isa OFile then return i_setopt_file(opt, obj)
92 if obj isa CURLSList then return i_setopt_slist(opt, obj)
93 return once new CURLCode.unknown_option
95 # Internal method to set options to CURL using OFile parameter.
96 private fun i_setopt_file(opt: CURLOption, fl: OFile):CURLCode `{ return curl_easy_setopt( recv, opt, fl); `}
97 # Internal method to set options to CURL using Int parameter.
98 private fun i_setopt_int
(opt
: CURLOption, num
: Int):CURLCode `{ return curl_easy_setopt( recv, opt, num); `}
99 # Internal method to set options to CURL using CURLSList parameter.
100 private fun i_setopt_slist(opt: CURLOption, list: CURLSList):CURLCode `{ return curl_easy_setopt( recv, opt, list); `}
101 # Internal method to set options to CURL using String parameter.
102 private fun i_setopt_string
(opt
: CURLOption, str
: String):CURLCode import String.to_cstring
`{
103 char *rStr = String_to_cstring(str);
104 return curl_easy_setopt( recv, opt, rStr);
106 # Request Chars internal information from the CURL session
107 fun easy_getinfo_chars
(opt
: CURLInfoChars):nullable CURLInfoResponseString
109 var answ
= new CURLInfoResponseString
110 if not i_getinfo_chars
(opt
, answ
).is_ok
then return null
113 # Internal method used to get String object information initially knowns as C Chars type
114 private fun i_getinfo_chars
(opt
: CURLInfoChars, res
: CURLInfoResponseString):CURLCode import CURLInfoResponseString.response
=, NativeString.to_s_with_copy
`{
116 CURLcode c = curl_easy_getinfo( recv, opt, &r);
117 if((c == CURLE_OK) && r != NULL){
118 String ro = NativeString_to_s_with_copy(r);
119 CURLInfoResponseString_response__assign( res, ro);
123 # Request Long internal information from the CURL session
124 fun easy_getinfo_long
(opt
: CURLInfoLong):nullable CURLInfoResponseLong
126 var answ
= new CURLInfoResponseLong
127 if not i_getinfo_long
(opt
, answ
).is_ok
then return null
130 # Internal method used to get Int object information initially knowns as C Long type
131 private fun i_getinfo_long
(opt
: CURLInfoLong, res
: CURLInfoResponseLong):CURLCode import CURLInfoResponseLong.response
= `{
133 r = malloc(sizeof(long));
134 CURLcode c = curl_easy_getinfo( recv, opt, r);
135 if((c == CURLE_OK) && r != NULL) CURLInfoResponseLong_response__assign( res, *r);
139 # Request Double internal information from the CURL session
140 fun easy_getinfo_double
(opt
: CURLInfoDouble):nullable CURLInfoResponseDouble
142 var answ
= new CURLInfoResponseDouble
143 if not i_getinfo_double
(opt
, answ
).is_ok
then return null
146 # Internal method used to get Int object information initially knowns as C Double type
147 private fun i_getinfo_double
(opt
: CURLInfoDouble, res
: CURLInfoResponseDouble):CURLCode import CURLInfoResponseDouble.response
= `{
149 r = malloc(sizeof(double));
150 CURLcode c = curl_easy_getinfo( recv, opt, r);
151 if((c == CURLE_OK) && r != NULL) CURLInfoResponseDouble_response__assign( res, *r);
155 # Request SList internal information from the CURL session
156 fun easy_getinfo_slist
(opt
: CURLInfoSList):nullable CURLInfoResponseArray
158 var answ
= new CURLInfoResponseArray
159 if not i_getinfo_slist
(opt
, answ
).is_ok
then return null
160 answ
.response
= answ
.prim_response
.to_a
161 answ
.prim_response
.destroy
164 # Internal method used to get Array[String] object information initially knowns as C SList type
165 private fun i_getinfo_slist
(opt
: CURLInfoSList, res
: CURLInfoResponseArray):CURLCode import CURLInfoResponseArray.prim_response
=`{
166 struct curl_slist* csl = NULL;
167 CURLcode ce = curl_easy_getinfo( recv, opt, &csl);
168 CURLInfoResponseArray_prim_response__assign(res, csl);
171 # Register delegate to get callbacks about the CURL transfer performed
172 fun register_callback
(delegate
: CCurlCallbacks, cbtype
: CURLCallbackType):CURLCode
174 if once
[new CURLCallbackType.header
, new CURLCallbackType.body
, new CURLCallbackType.stream
, new CURLCallbackType.read
].has
(cbtype
) then
175 return i_register_callback
(delegate
, cbtype
)
177 return once
new CURLCode.unknown_option
179 # Register delegate to read datas from given buffer
180 fun register_read_datas_callback
(delegate
: CCurlCallbacks, datas
: String):CURLCode
182 if datas
.length
> 0 then return i_register_read_datas_callback
(delegate
, datas
, datas
.length
)
183 return once
new CURLCode.unknown_option
185 # Internal method used to configure read callback
186 private fun i_register_read_datas_callback
(delegate
: CCurlCallbacks, datas
: String, size
: Int):CURLCode import String.to_cstring
`{
187 CURLCallbackReadDatas *d = NULL;
188 d = malloc(sizeof(CURLCallbackReadDatas));
189 d->data = (char*)String_to_cstring(datas);
192 return curl_easy_setopt( recv, CURLOPT_READDATA, d);
194 # Internal method used to configure callbacks in terms of given type
195 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
`{
196 CURLCallbackDatas *d = malloc(sizeof(CURLCallbackDatas));
197 CCurlCallbacks_incr_ref(delegate);
199 d->delegate = delegate;
202 case CURLcallbackTypeHeader:
203 e = curl_easy_setopt( recv, CURLOPT_HEADERFUNCTION, (curl_write_callback)&nit_curl_callback_func);
204 if(e != CURLE_OK) return e;
205 e = curl_easy_setopt( recv, CURLOPT_WRITEHEADER, d);
207 case CURLcallbackTypeBody:
208 case CURLcallbackTypeStream:
209 e = curl_easy_setopt( recv, CURLOPT_WRITEFUNCTION, (curl_write_callback)&nit_curl_callback_func);
210 if(e != CURLE_OK) return e;
211 e = curl_easy_setopt( recv, CURLOPT_WRITEDATA, d);
213 case CURLcallbackTypeRead:
214 e = curl_easy_setopt( recv, CURLOPT_READFUNCTION, (curl_write_callback)&nit_curl_callback_read_func);
220 # Convert given string to URL encoded string
221 fun escape
(url
: String):String import String.to_cstring
, NativeString.to_s_with_copy
`{
222 char *orig_url, *encoded_url = NULL;
223 orig_url = String_to_cstring(url);
224 encoded_url = curl_easy_escape( recv, orig_url, strlen(orig_url));
225 String b_url = NativeString_to_s_with_copy(encoded_url);
226 curl_free(encoded_url);
231 # FILE Extern type, reproduce basic FILE I/O
232 extern OFile `{ FILE* `}
233 # Open / Create a file from given name
234 new open(str: NativeString) `{ return fopen(str, "wb"); `}
235 # Check for File validity
236 fun is_valid
:Bool `{ return recv != NULL; `}
237 # Internal method to write to the current file
238 private fun n_write(buffer: NativeString, size: Int, count: Int):Int `{ return fwrite(buffer, size, count, recv); `}
239 # Write datas to the current file
240 fun write
(buffer
: String, size
: Int, count
: Int):Int
242 if is_valid
== true then return n_write
(buffer
.to_cstring
, size
, count
)
245 # Internal method to close the current file
246 private fun n_close
:Int `{ return fclose(recv); `}
247 # Close the current file
250 if is_valid == true then return n_close == 0
255 # Interface for internal information callbacks methods
256 interface CCurlCallbacks
257 fun header_callback(line: String) is abstract
258 fun body_callback(line: String) is abstract
259 fun stream_callback(buffer: String, size: Int, count: Int) is abstract
262 # Extern Type to reproduce Enum of available Callback type
263 extern CURLCallbackType `{ CURLcallbackType `}
264 new header
`{ return CURLcallbackTypeHeader; `}
265 new body `{ return CURLcallbackTypeBody; `}
266 new stream
`{ return CURLcallbackTypeStream; `}
267 new read `{ return CURLcallbackTypeRead; `}
268 fun to_i
:Int `{ return recv; `}
271 # CURL Code binding and helpers
272 extern CURLCode `{ CURLcode `}
273 new unknown_option
`{ return CURLE_UNKNOWN_OPTION; `}
274 new unsupported_protocol `{ return CURLE_UNSUPPORTED_PROTOCOL; `}
275 new ok
`{ return CURLE_OK; `}
276 new failed_init `{ return CURLE_FAILED_INIT; `}
277 fun code
:Int `{ return recv; `}
278 fun is_ok:Bool `{ return recv == CURLE_OK; `}
279 fun is_valid_protocol
:Bool `{ return recv == CURLE_UNSUPPORTED_PROTOCOL; `}
280 fun is_valid_init:Bool `{ return recv == 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(recv);
284 return NativeString_to_s_with_copy(c);
288 # Extern Type of the Linked list type of CURL
289 extern CURLSList `{ struct curl_slist * `}
290 # Empty constructor which allow us to avoid the use of Nit NULLABLE type
291 private new `{ return NULL; `}
292 # Constructor allow us to get list instancied by appending an element inside.
293 new with_str
(s
: String) import String.to_cstring
`{
294 struct curl_slist *l = NULL;
295 l = curl_slist_append(l, String_to_cstring(s));
298 # Check for initialization
299 fun is_init
:Bool `{ return (recv != NULL); `}
300 # Append an element in the linked list
301 fun append(key: String) import String.to_cstring `{
302 char
*k
= String_to_cstring(key
);
303 curl_slist_append
(recv
, (char
*)k
);
305 # Internal method to check for reachability of current data
306 private fun i_data_reachable(c: CURLSList):Bool `{ return (c != NULL && c->data != NULL); `}
307 # Internal method to check for reachability of next element
308 private fun i_next_reachable
(c
: CURLSList):Bool `{ return (c != NULL && c->next != NULL); `}
309 # Internal method to get current data
310 private fun i_data(c: CURLSList):String import NativeString.to_s `{ return NativeString_to_s(c->data); `}
311 # Internal method to get next element
312 private fun i_next
(c
: CURLSList):CURLSList `{ return c->next; `}
313 # Convert current low level List to an Array[String] object
314 fun to_a:Array[String]
316 var r = new Array[String]
319 if i_data_reachable(cursor) != true then break
320 r.add(i_data(cursor))
321 cursor = i_next(cursor)
325 # Release allocated memory
326 fun destroy `{ curl_slist_free_all(recv); `}
329 redef class Collection[E
]
330 # Convert Collection[String] to CURLSList
331 fun to_curlslist
: CURLSList
333 assert collectionItemType
: self isa Collection[String] else
334 print
"Collection item must be strings."
336 var primList
= new CURLSList.with_str
(self.first
)
339 if not is_first
then primList
.append
(s
)
346 # Array Response type of CCurl.easy_getinfo method
347 class CURLInfoResponseArray
348 var response
:Array[String] = new Array[String]
349 private var prim_response
:CURLSList = new CURLSList
352 # Long Response type of CCurl.easy_getinfo method
353 class CURLInfoResponseLong
357 # Double Response type of CCurl.easy_getinfo method
358 class CURLInfoResponseDouble
362 # String Response type of CCurl:easy_getinfo method
363 class CURLInfoResponseString
364 var response
:String = ""
367 # Reproduce Enum of available CURL SList information, used for CCurl.easy_getinfo
368 extern CURLInfoSList `{ CURLINFO `}
369 new ssl_engines `{ return CURLINFO_SSL_ENGINES; `}
370 new cookielist
`{ return CURLINFO_COOKIELIST; `}
373 # Reproduce Enum of available CURL Long information, used for CCurl.easy_getinfo
374 extern CURLInfoLong `{ CURLINFO `}
375 new response_code
`{ return CURLINFO_RESPONSE_CODE; `}
376 new header_size `{ return CURLINFO_HEADER_SIZE; `}
377 new http_connectcode
`{ return CURLINFO_HTTP_CONNECTCODE; `}
378 new filetime `{ return CURLINFO_FILETIME; `}
379 new redirect_count
`{ return CURLINFO_REDIRECT_COUNT; `}
380 new request_size `{ return CURLINFO_REQUEST_SIZE; `}
381 new ssl_verifyresult
`{ return CURLINFO_SSL_VERIFYRESULT; `}
382 new httpauth_avail `{ return CURLINFO_HTTPAUTH_AVAIL; `}
383 new proxyauth_avail
`{ return CURLINFO_PROXYAUTH_AVAIL; `}
384 new os_errno `{ return CURLINFO_OS_ERRNO; `}
385 new num_connects
`{ return CURLINFO_NUM_CONNECTS; `}
386 new primary_port `{ return CURLINFO_PRIMARY_PORT; `}
387 new local_port
`{ return CURLINFO_LOCAL_PORT; `}
388 new lastsocket `{ return CURLINFO_LASTSOCKET; `}
389 new condition_unmet
`{ return CURLINFO_CONDITION_UNMET; `}
390 new rtsp_client_cseq `{ return CURLINFO_RTSP_CLIENT_CSEQ; `}
391 new rtsp_server_cseq
`{ return CURLINFO_RTSP_SERVER_CSEQ; `}
392 new rtsp_cseq_recv `{ return CURLINFO_RTSP_CSEQ_RECV; `}
395 # Reproduce Enum of available CURL Double information, used for CCurl.easy_getinfo
396 extern CURLInfoDouble `{ CURLINFO `}
397 new total_time `{ return CURLINFO_TOTAL_TIME; `}
398 new namelookup_time
`{ return CURLINFO_NAMELOOKUP_TIME; `}
399 new connect_time `{ return CURLINFO_CONNECT_TIME; `}
400 new appconnect_time
`{ return CURLINFO_APPCONNECT_TIME; `}
401 new pretransfer_time `{ return CURLINFO_PRETRANSFER_TIME; `}
402 new starttransfer_time
`{ return CURLINFO_STARTTRANSFER_TIME; `}
403 new redirect_time `{ return CURLINFO_REDIRECT_TIME; `}
404 new size_upload
`{ return CURLINFO_SIZE_UPLOAD; `}
405 new size_download `{ return CURLINFO_SIZE_DOWNLOAD; `}
406 new speed_download
`{ return CURLINFO_SPEED_DOWNLOAD; `}
407 new speed_upload `{ return CURLINFO_SPEED_UPLOAD; `}
408 new content_length_download
`{ return CURLINFO_CONTENT_LENGTH_DOWNLOAD; `}
409 new content_length_upload `{ return CURLINFO_CONTENT_LENGTH_UPLOAD; `}
412 # Reproduce Enum of available CURL Chars information, used for CCurl.easy_getinfo
413 extern CURLInfoChars `{ CURLINFO `}
414 new content_type `{ return CURLINFO_CONTENT_TYPE; `}
415 new effective_url
`{ return CURLINFO_EFFECTIVE_URL; `}
416 new redirect_url `{ return CURLINFO_REDIRECT_URL; `}
417 new primary_ip
`{ return CURLINFO_PRIMARY_IP; `}
418 new local_ip `{ return CURLINFO_LOCAL_IP; `}
419 new ftp_entry_path
`{ return CURLINFO_FTP_ENTRY_PATH; `}
420 new rtsp_session_id `{ return CURLINFO_RTSP_SESSION_ID; `}
421 new private_data
`{ return CURLINFO_PRIVATE; `}
424 # Reproduce Enum of HTTP Status Code
425 extern CURLStatusCode `{ int `}
426 new proceed
`{ return 100; `}
427 new switching_protocols `{ return 101; `}
428 new ok
`{ return 200; `}
429 new created `{ return 201; `}
430 new accepted
`{ return 202; `}
431 new non_authoritative_information `{ return 203; `}
432 new no_content
`{ return 204; `}
433 new reset_content `{ return 205; `}
434 new partial_content
`{ return 206; `}
435 new multiple_choices `{ return 300; `}
436 new moved_permanently
`{ return 301; `}
437 new moved_temporarily `{ return 302; `}
438 new see_other
`{ return 303; `}
439 new not_modified `{ return 304; `}
440 new use_proxy
`{ return 305; `}
441 new bad_request `{ return 400; `}
442 new unauthorized
`{ return 401; `}
443 new payment_required `{ return 402; `}
444 new forbidden
`{ return 403; `}
445 new not_found `{ return 404; `}
446 new method_not_allowed
`{ return 405; `}
447 new not_acceptable `{ return 406; `}
448 new proxy_authentication_required
`{ return 407; `}
449 new request_timeout `{ return 408; `}
450 new conflict
`{ return 409; `}
451 new gone `{ return 410; `}
452 new length_required
`{ return 411; `}
453 new precondition_failed `{ return 412; `}
454 new request_entity_too_large
`{ return 413; `}
455 new request_uri_too_large `{ return 414; `}
456 new unsupported_media_type
`{ return 415; `}
457 new internal_server_error `{ return 500; `}
458 new not_implemented
`{ return 501; `}
459 new bad_gateway `{ return 502; `}
460 new service_unavailable
`{ return 503; `}
461 new gateway_timeout `{ return 504; `}
462 new http_version_not_supported
`{ return 505; `}
463 fun to_i:Int `{ return recv; `}
466 # Reproduce Enum of CURL Options usable, used for CCurl.easy_setopt
467 extern CURLOption `{ CURLoption `}
468 new write_function `{ return CURLOPT_WRITEFUNCTION; `}
469 new write_data
`{ return CURLOPT_WRITEDATA; `}
470 # new `{ return CURLOPT_FILE; `}
471 new url
`{ return CURLOPT_URL; `}
472 # new `{ return CURLOPT_PORT; `}
473 # new `{ return CURLOPT_PROXY; `}
474 # new `{ return CURLOPT_USERPWD; `}
475 # new `{ return CURLOPT_PROXYUSERPWD; `}
476 # new `{ return CURLOPT_RANGE; `}
477 # new `{ return CURLOPT_INFILE; `}
478 # new `{ return CURLOPT_ERRORBUFFER; `}
479 # new `{ return CURLOPT_WRITEFUNCTION; `}
480 # new `{ return CURLOPT_READFUNCTION; `}
481 # new `{ return CURLOPT_TIMEOUT; `}
482 # new `{ return CURLOPT_INFILESIZE; `}
483 new postfields
`{ return CURLOPT_POSTFIELDS; `}
484 # new `{ return CURLOPT_REFERER; `}
485 # new `{ return CURLOPT_FTPPORT; `}
486 # new `{ return CURLOPT_USERAGENT; `}
487 # new `{ return CURLOPT_LOW_SPEED_LIMIT; `}
488 # new `{ return CURLOPT_LOW_SPEED_TIME; `}
489 # new `{ return CURLOPT_RESUME_FROM; `}
490 # new `{ return CURLOPT_COOKIE; `}
491 new httpheader
`{ return CURLOPT_HTTPHEADER; `}
492 # new `{ return CURLOPT_HTTPPOST; `}
493 # new `{ return CURLOPT_SSLCERT; `}
494 # new `{ return CURLOPT_KEYPASSWD; `}
495 # new `{ return CURLOPT_CRLF; `}
496 # new `{ return CURLOPT_QUOTE; `}
497 # new `{ return CURLOPT_WRITEHEADER; `}
498 # new `{ return CURLOPT_COOKIEFILE; `}
499 # new `{ return CURLOPT_SSLVERSION; `}
500 # new `{ return CURLOPT_TIMECONDITION; `}
501 # new `{ return CURLOPT_TIMEVALUE; `}
502 # new `{ return CURLOPT_CUSTOMREQUEST; `}
503 # new `{ return CURLOPT_STDERR; `}
504 # new `{ return CURLOPT_POSTQUOTE; `}
505 # new `{ return CURLOPT_WRITEINFO; `} /* DEPRECATED, do not use! */
506 new verbose
`{ return CURLOPT_VERBOSE; `} # talk a lot
507 new header `{ return CURLOPT_HEADER; `} # throw the header out too
508 new no_progress
`{ return CURLOPT_NOPROGRESS; `} # shut off the progress meter
509 new no_body `{ return CURLOPT_NOBODY; `} # use HEAD to get http document
510 new fail_on_error
`{ return CURLOPT_FAILONERROR; `} # no output on http error codes >= 300
511 new upload `{ return CURLOPT_UPLOAD; `} # this is an upload
512 new post
`{ return CURLOPT_POST; `} # HTTP POST method
513 new dir_list_only `{ return CURLOPT_DIRLISTONLY; `} # bare names when listing directories
514 new append
`{ return CURLOPT_APPEND; `} # Append instead of overwrite on upload!
515 # new `{ return CURLOPT_NETRC; `}
516 new follow_location
`{ return CURLOPT_FOLLOWLOCATION; `} # use Location: Luke!
517 new transfert_text `{ return CURLOPT_TRANSFERTEXT; `} # transfer data in text/ASCII format
518 new put
`{ return CURLOPT_PUT; `} # HTTP PUT */
519 # new `{ return CURLOPT_PROGRESSFUNCTION; `}
520 # new `{ return CURLOPT_PROGRESSDATA; `}
521 # new `{ return CURLOPT_AUTOREFERER; `}
522 # new `{ return CURLOPT_PROXYPORT; `}
523 # new `{ return CURLOPT_POSTFIELDSIZE; `}
524 # new `{ return CURLOPT_HTTPPROXYTUNNEL; `}
525 # new `{ return CURLOPT_INTERFACE; `}
526 # new `{ return CURLOPT_KRBLEVEL; `}
527 # new `{ return CURLOPT_SSL_VERIFYPEER; `}
528 # new `{ return CURLOPT_CAINFO; `}
529 # new `{ return CURLOPT_MAXREDIRS; `}
530 # new `{ return CURLOPT_FILETIME; `}
531 # new `{ return CURLOPT_TELNETOPTIONS; `}
532 # new `{ return CURLOPT_MAXCONNECTS; `}
533 # new `{ return CURLOPT_CLOSEPOLICY; `} /* DEPRECATED, do not use! */
534 # new `{ return CURLOPT_FRESH_CONNECT; `}
535 # new `{ return CURLOPT_FORBID_REUSE; `}
536 # new `{ return CURLOPT_RANDOM_FILE; `}
537 # new `{ return CURLOPT_EGDSOCKET; `}
538 # new `{ return CURLOPT_CONNECTTIMEOUT; `}
539 # new `{ return CURLOPT_HEADERFUNCTION; `}
540 # new `{ return CURLOPT_HTTPGET; `}
541 # new `{ return CURLOPT_SSL_VERIFYHOST; `}
542 # new `{ return CURLOPT_COOKIEJAR; `}
543 # new `{ return CURLOPT_SSL_CIPHER_LIST; `}
544 # new `{ return CURLOPT_HTTP_VERSION; `}
545 # new `{ return CURLOPT_FTP_USE_EPSV; `}
546 # new `{ return CURLOPT_SSLCERTTYPE; `}
547 # new `{ return CURLOPT_SSLKEY; `}
548 # new `{ return CURLOPT_SSLKEYTYPE; `}
549 # new `{ return CURLOPT_SSLENGINE; `}
550 # new `{ return CURLOPT_SSLENGINE_DEFAULT; `}
551 # new `{ return CURLOPT_DNS_USE_GLOBAL_CACHE; `} /* DEPRECATED, do not use! */
552 # new `{ return CURLOPT_DNS_CACHE_TIMEOUT; `}
553 # new `{ return CURLOPT_PREQUOTE; `}
554 # new `{ return CURLOPT_DEBUGFUNCTION; `}
555 # new `{ return CURLOPT_DEBUGDATA; `}
556 # new `{ return CURLOPT_COOKIESESSION; `}
557 # new `{ return CURLOPT_CAPATH; `}
558 # new `{ return CURLOPT_BUFFERSIZE; `}
559 # new `{ return CURLOPT_NOSIGNAL; `}
560 # new `{ return CURLOPT_SHARE; `}
561 # new `{ return CURLOPT_PROXYTYPE; `}
562 # new `{ return CURLOPT_ACCEPT_ENCODING; `}
563 # new `{ return CURLOPT_PRIVATE; `}
564 # new `{ return CURLOPT_HTTP200ALIASES; `}
565 # new `{ return CURLOPT_UNRESTRICTED_AUTH; `}
566 # new `{ return CURLOPT_FTP_USE_EPRT; `}
567 # new `{ return CURLOPT_HTTPAUTH; `}
568 # new `{ return CURLOPT_SSL_CTX_FUNCTION; `}
569 # new `{ return CURLOPT_SSL_CTX_DATA; `}
570 # new `{ return CURLOPT_FTP_CREATE_MISSING_DIRS; `}
571 # new `{ return CURLOPT_PROXYAUTH; `}
572 # new `{ return CURLOPT_FTP_RESPONSE_TIMEOUT; `}
573 # new `{ return CURLOPT_IPRESOLVE; `}
574 # new `{ return CURLOPT_MAXFILESIZE; `}
575 # new `{ return CURLOPT_INFILESIZE_LARGE; `}
576 # new `{ return CURLOPT_RESUME_FROM_LARGE; `}
577 # new `{ return CURLOPT_MAXFILESIZE_LARGE; `}
578 # new `{ return CURLOPT_NETRC_FILE; `}
579 # new `{ return CURLOPT_USE_SSL; `}
580 # new `{ return CURLOPT_POSTFIELDSIZE_LARGE; `}
581 # new `{ return CURLOPT_TCP_NODELAY; `}
582 # new `{ return CURLOPT_FTPSSLAUTH; `}
583 # new `{ return CURLOPT_IOCTLFUNCTION; `}
584 # new `{ return CURLOPT_IOCTLDATA; `}
585 # new `{ return CURLOPT_FTP_ACCOUNT; `}
586 # new `{ return CURLOPT_COOKIELIST; `}
587 # new `{ return CURLOPT_IGNORE_CONTENT_LENGTH; `}
588 # new `{ return CURLOPT_FTP_SKIP_PASV_IP; `}
589 # new `{ return CURLOPT_FTP_FILEMETHOD; `}
590 # new `{ return CURLOPT_LOCALPORT; `}
591 # new `{ return CURLOPT_LOCALPORTRANGE; `}
592 # new `{ return CURLOPT_CONNECT_ONLY; `}
593 # new `{ return CURLOPT_CONV_FROM_NETWORK_FUNCTION; `}
594 # new `{ return CURLOPT_CONV_TO_NETWORK_FUNCTION; `}
595 # new `{ return CURLOPT_CONV_FROM_UTF8_FUNCTION; `}
596 # new `{ return CURLOPT_MAX_SEND_SPEED_LARGE; `}
597 # new `{ return CURLOPT_MAX_RECV_SPEED_LARGE; `}
598 # new `{ return CURLOPT_FTP_ALTERNATIVE_TO_USER; `}
599 # new `{ return CURLOPT_SOCKOPTFUNCTION; `}
600 # new `{ return CURLOPT_SOCKOPTDATA; `}
601 # new `{ return CURLOPT_SSL_SESSIONID_CACHE; `}
602 # new `{ return CURLOPT_SSH_AUTH_TYPES; `}
603 # new `{ return CURLOPT_SSH_PUBLIC_KEYFILE; `}
604 # new `{ return CURLOPT_SSH_PRIVATE_KEYFILE; `}
605 # new `{ return CURLOPT_FTP_SSL_CCC; `}
606 # new `{ return CURLOPT_TIMEOUT_MS; `}
607 # new `{ return CURLOPT_CONNECTTIMEOUT_MS; `}
608 # new `{ return CURLOPT_HTTP_TRANSFER_DECODING; `}
609 # new `{ return CURLOPT_HTTP_CONTENT_DECODING; `}
610 # new `{ return CURLOPT_NEW_FILE_PERMS; `}
611 # new `{ return CURLOPT_NEW_DIRECTORY_PERMS; `}
612 # new `{ return CURLOPT_POSTREDIR; `}
613 # new `{ return CURLOPT_SSH_HOST_PUBLIC_KEY_MD5; `}
614 # new `{ return CURLOPT_OPENSOCKETFUNCTION; `}
615 # new `{ return CURLOPT_OPENSOCKETDATA; `}
616 # new `{ return CURLOPT_COPYPOSTFIELDS; `}
617 # new `{ return CURLOPT_PROXY_TRANSFER_MODE; `}
618 # new `{ return CURLOPT_SEEKFUNCTION; `}
619 # new `{ return CURLOPT_SEEKDATA; `}
620 # new `{ return CURLOPT_CRLFILE; `}
621 # new `{ return CURLOPT_ISSUERCERT; `}
622 # new `{ return CURLOPT_ADDRESS_SCOPE; `}
623 # new `{ return CURLOPT_CERTINFO; `}
624 new username
`{ return CURLOPT_USERNAME; `}
625 new password `{ return CURLOPT_PASSWORD; `}
626 # new `{ return CURLOPT_PROXYUSERNAME; `}
627 # new `{ return CURLOPT_PROXYPASSWORD; `}
628 # new `{ return CURLOPT_NOPROXY; `}
629 # new `{ return CURLOPT_TFTP_BLKSIZE; `}
630 # new `{ return CURLOPT_SOCKS5_GSSAPI_SERVICE; `}
631 # new `{ return CURLOPT_SOCKS5_GSSAPI_NEC; `}
632 # new `{ return CURLOPT_PROTOCOLS; `}
633 # new `{ return CURLOPT_REDIR_PROTOCOLS; `}
634 # new `{ return CURLOPT_SSH_KNOWNHOSTS; `}
635 # new `{ return CURLOPT_SSH_KEYFUNCTION; `}
636 # new `{ return CURLOPT_SSH_KEYDATA; `}
637 new mail_from
`{ return CURLOPT_MAIL_FROM; `}
638 new mail_rcpt `{ return CURLOPT_MAIL_RCPT; `}
639 # new `{ return CURLOPT_FTP_USE_PRET; `}
640 # new `{ return CURLOPT_RTSP_REQUEST; `}
641 # new `{ return CURLOPT_RTSP_SESSION_ID; `}
642 # new `{ return CURLOPT_RTSP_STREAM_URI; `}
643 # new `{ return CURLOPT_RTSP_TRANSPORT; `}
644 # new `{ return CURLOPT_RTSP_CLIENT_CSEQ; `}
645 # new `{ return CURLOPT_RTSP_SERVER_CSEQ; `}
646 # new `{ return CURLOPT_INTERLEAVEDATA; `}
647 # new `{ return CURLOPT_INTERLEAVEFUNCTION; `}
648 # new `{ return CURLOPT_WILDCARDMATCH; `}
649 # new `{ return CURLOPT_CHUNK_BGN_FUNCTION; `}
650 # new `{ return CURLOPT_CHUNK_END_FUNCTION; `}
651 # new `{ return CURLOPT_FNMATCH_FUNCTION; `}
652 # new `{ return CURLOPT_CHUNK_DATA; `}
653 # new `{ return CURLOPT_FNMATCH_DATA; `}
654 # new `{ return CURLOPT_RESOLVE; `}
655 # new `{ return CURLOPT_TLSAUTH_USERNAME; `}
656 # new `{ return CURLOPT_TLSAUTH_PASSWORD; `}
657 # new `{ return CURLOPT_TLSAUTH_TYPE; `}
658 # new `{ return CURLOPT_TRANSFER_ENCODING; `}
659 # new `{ return CURLOPT_CLOSESOCKETFUNCTION; `}
660 # new `{ return CURLOPT_CLOSESOCKETDATA; `}
661 # new `{ return CURLOPT_GSSAPI_DELEGATION; `}
662 # new `{ return CURLOPT_DNS_SERVERS; `}
663 # new `{ return CURLOPT_ACCEPTTIMEOUT_MS; `}
664 # new `{ return CURLOPT_TCP_KEEPALIVE; `}
665 # new `{ return CURLOPT_TCP_KEEPIDLE; `}
666 # new `{ return CURLOPT_TCP_KEEPINTVL; `}
667 # new `{ return CURLOPT_SSL_OPTIONS; `}
668 # new `{ return CURLOPT_MAIL_AUTH; `}