1 29 30 package com.caucho.quercus.lib.curl; 31 32 import com.caucho.quercus.QuercusModuleException; 33 import com.caucho.quercus.UnimplementedException; 34 import com.caucho.quercus.annotation.NotNull; 35 import com.caucho.quercus.annotation.Optional; 36 import com.caucho.quercus.annotation.Reference; 37 import com.caucho.quercus.annotation.ReturnNullAsFalse; 38 import com.caucho.quercus.env.*; 39 import com.caucho.quercus.lib.file.BinaryInput; 40 import com.caucho.quercus.lib.file.BinaryOutput; 41 import com.caucho.quercus.module.AbstractQuercusModule; 42 import com.caucho.util.L10N; 43 import com.caucho.util.QDate; 44 import com.caucho.vfs.Path; 45 import com.caucho.vfs.ReadStream; 46 47 import java.io.IOException ; 48 import java.util.Map ; 49 import java.util.logging.Level ; 50 import java.util.logging.Logger ; 51 52 public class CurlModule 53 extends AbstractQuercusModule 54 { 55 private static final Logger log 56 = Logger.getLogger(CurlModule.class.getName()); 57 private static final L10N L = new L10N(CurlModule.class); 58 59 public static final int CURLOPT_AUTOREFERER = 1; 60 public static final int CURLOPT_COOKIESESSION = 2; 61 public static final int CURLOPT_PORT = 6; 65 public static final int CURLOPT_FILE = 7; 66 public static final int CURLOPT_INFILE = 8; 67 public static final int CURLOPT_INFILESIZE = 9; 68 public static final int CURLOPT_URL = 10; 69 public static final int CURLOPT_PROXY = 11; 70 public static final int CURLOPT_VERBOSE = 12; 71 public static final int CURLOPT_HEADER = 13; 72 public static final int CURLOPT_HTTPHEADER = 14; 73 public static final int CURLOPT_NOPROGRESS = 15; 74 public static final int CURLOPT_NOBODY = 16; 75 public static final int CURLOPT_FAILONERROR = 17; 76 public static final int CURLOPT_UPLOAD = 18; 77 public static final int CURLOPT_POST = 19; 78 public static final int CURLOPT_NETRC = 22; 81 public static final int CURLOPT_FOLLOWLOCATION = 23; 82 public static final int CURLOPT_PUT = 25; 84 public static final int CURLOPT_MUTE = 26; 85 public static final int CURLOPT_USERPWD = 27; 86 public static final int CURLOPT_PROXYUSERPWD = 28; 87 public static final int CURLOPT_RANGE = 29; 88 public static final int CURLOPT_TIMEOUT = 30; 89 public static final int CURLOPT_POSTFIELDS = 31; 90 public static final int CURLOPT_REFERER = 32; 91 public static final int CURLOPT_USERAGENT = 33; 92 public static final int CURLOPT_LOW_SPEED_LIMIT = 36; 95 public static final int CURLOPT_LOW_SPEED_TIME = 37; 96 public static final int CURLOPT_COOKIE = 39; 98 public static final int CURLOPT_WRITEHEADER = 42; 101 public static final int CURLOPT_COOKIEFILE = 44; 103 public static final int CURLOPT_TIMECONDITION = 46; 105 public static final int CURLOPT_TIMEVALUE = 47; 106 public static final int CURLOPT_CUSTOMREQUEST = 48; 107 public static final int CURLOPT_STDERR = 49; 108 public static final int CURLOPT_RETURNTRANSFER = 51; 110 public static final int CURLOPT_HTTPPROXYTUNNEL = 56; 115 public static final int CURLOPT_WRITEFUNCTION = 58; 117 public static final int CURLOPT_READFUNCTION = 59; 118 public static final int CURLOPT_PASSWDFUNCTION = 60; 119 public static final int CURLOPT_HEADERFUNCTION = 61; 120 public static final int CURLOPT_MAXREDIRS = 62; 121 public static final int CURLOPT_MAXCONNECTS = 63; 122 public static final int CURLOPT_CLOSEPOLICY = 64; 123 public static final int CURLOPT_FRESH_CONNECT = 65; 124 public static final int CURLOPT_FORBID_REUSE = 66; 125 public static final int CURLOPT_CONNECTTIMEOUT = 69; 128 public static final int CURLOPT_COOKIEJAR = 73; 132 public static final int CURLOPT_BINARYTRANSFER = 75; 134 public static final int CURLOPT_NOSIGNAL = 76; 135 public static final int CURLOPT_PROXYTYPE = 77; 136 public static final int CURLOPT_BUFFERSIZE = 78; 137 public static final int CURLOPT_HTTPGET = 79; 138 public static final int CURLOPT_HTTP_VERSION = 80; 139 public static final int CURLOPT_ENCODING = 88; 147 public static final int CURLOPT_PROXYPORT = 89; 148 public static final int CURLOPT_UNRESTRICTED_AUTH = 90; 149 public static final int CURLOPT_HTTP200ALIASES = 92; 151 public static final int CURLOPT_HTTPAUTH = 93; 152 public static final int CURLAUTH_BASIC = 1; 153 public static final int CURLAUTH_DIGEST = 2; 154 public static final int CURLAUTH_GSSNEGOTIATE = 4; 155 public static final int CURLAUTH_NTLM = 8; 156 public static final int CURLAUTH_ANY = 15; 157 public static final int CURLAUTH_ANYSAFE = 14; 158 public static final int CURLOPT_PROXYAUTH = 100; 159 public static final int CURLCLOSEPOLICY_LEAST_RECENTLY_USED = 101; 160 public static final int CURLCLOSEPOLICY_LEAST_TRAFFIC = 102; 161 public static final int CURLCLOSEPOLICY_SLOWEST = 103; 162 public static final int CURLCLOSEPOLICY_CALLBACK = 104; 163 public static final int CURLCLOSEPOLICY_OLDEST = 105; 164 public static final int CURLINFO_EFFECTIVE_URL = 106; 165 public static final int CURLINFO_HTTP_CODE = 107; 166 public static final int CURLINFO_HEADER_OUT = 108; 167 public static final int CURLINFO_HEADER_SIZE = 109; 168 public static final int CURLINFO_REQUEST_SIZE = 110; 169 public static final int CURLINFO_TOTAL_TIME = 111; 170 public static final int CURLINFO_NAMELOOKUP_TIME = 112; 171 public static final int CURLINFO_CONNECT_TIME = 113; 172 public static final int CURLINFO_PRETRANSFER_TIME = 114; 173 public static final int CURLINFO_SIZE_UPLOAD = 115; 174 public static final int CURLINFO_SIZE_DOWNLOAD = 116; 175 public static final int CURLINFO_SPEED_DOWNLOAD = 117; 176 public static final int CURLINFO_SPEED_UPLOAD = 118; 177 public static final int CURLINFO_FILETIME = 119; 178 public static final int CURLINFO_CONTENT_LENGTH_DOWNLOAD = 121; 180 public static final int CURLINFO_CONTENT_LENGTH_UPLOAD = 122; 181 public static final int CURLINFO_STARTTRANSFER_TIME = 123; 182 public static final int CURLINFO_CONTENT_TYPE = 124; 183 public static final int CURLINFO_REDIRECT_TIME = 125; 184 public static final int CURLINFO_REDIRECT_COUNT = 126; 185 public static final int CURL_VERSION_SSL = 129; 188 public static final int CURL_VERSION_LIBZ = 130; 189 public static final int CURLVERSION_NOW = 131; 190 public static final int CURLE_OK = 132; 191 public static final int CURLE_UNSUPPORTED_PROTOCOL = 133; 192 public static final int CURLE_FAILED_INIT = 134; 193 public static final int CURLE_URL_MALFORMAT = 135; 194 public static final int CURLE_URL_MALFORMAT_USER = 136; 195 public static final int CURLE_COULDNT_RESOLVE_PROXY = 137; 196 public static final int CURLE_COULDNT_RESOLVE_HOST = 138; 197 public static final int CURLE_COULDNT_CONNECT = 139; 198 public static final int CURLE_PARTIAL_FILE = 150; 209 public static final int CURLE_HTTP_NOT_FOUND = 154; 213 public static final int CURLE_WRITE_ERROR = 155; 214 public static final int CURLE_MALFORMAT_USER = 156; 215 public static final int CURLE_READ_ERROR = 158; 217 public static final int CURLE_OUT_OF_MEMORY = 159; 218 public static final int CURLE_OPERATION_TIMEOUTED = 160; 219 public static final int CURLE_HTTP_RANGE_ERROR = 165; 224 public static final int CURLE_HTTP_POST_ERROR = 166; 225 public static final int CURLE_SSL_CONNECT_ERROR = 167; 226 public static final int CURLE_FILE_COULDNT_READ_FILE = 169; 228 public static final int CURLE_LIBRARY_NOT_FOUND = 172; 231 public static final int CURLE_FUNCTION_NOT_FOUND = 173; 232 public static final int CURLE_ABORTED_BY_CALLBACK = 174; 233 public static final int CURLE_BAD_FUNCTION_ARGUMENT = 175; 234 public static final int CURLE_BAD_CALLING_ORDER = 176; 235 public static final int CURLE_HTTP_PORT_FAILED = 177; 236 public static final int CURLE_BAD_PASSWORD_ENTERED = 178; 237 public static final int CURLE_TOO_MANY_REDIRECTS = 179; 238 public static final int CURLE_OBSOLETE = 182; 241 public static final int CURLE_GOT_NOTHING = 184; 243 public static final int CURLE_SEND_ERROR = 187; 246 public static final int CURLE_RECV_ERROR = 188; 247 public static final int CURLE_SHARE_IN_USE = 189; 248 public static final int CURLE_BAD_CONTENT_ENCODING = 193; 252 public static final int CURLE_FILESIZE_EXCEEDED = 195; 254 257 public static final int CURL_TIMECOND_IFMODSINCE = 198; 259 public static final int CURL_TIMECOND_IFUNMODSINCE = 199; 260 public static final int CURL_HTTP_VERSION_NONE = 200; 261 public static final int CURL_HTTP_VERSION_1_0 = 201; 262 public static final int CURL_HTTP_VERSION_1_1 = 202; 263 public static final int CURLPROXY_HTTP = 203; 264 public static final int CURLPROXY_SOCKS5 = 204; 265 266 public String []getLoadedExtensions() 267 { 268 return new String [] { "curl" }; 269 } 270 271 277 public static void curl_close(Env env, 278 @NotNull CurlResource curl) 279 { 280 if (curl == null) 281 return; 282 283 curl.close(); 284 } 285 286 292 @ReturnNullAsFalse 293 public static CurlResource curl_copy_handle(Env env, 294 @NotNull CurlResource curl) 295 { 296 if (curl == null) 297 return null; 298 299 return curl.clone(); 300 } 301 302 308 public static Value curl_errno(Env env, 309 @NotNull CurlResource curl) 310 { 311 if (curl == null) 312 return BooleanValue.FALSE; 313 314 return LongValue.create(curl.getErrorCode()); 315 } 316 317 323 public static Value curl_error(Env env, 324 @NotNull CurlResource curl) 325 { 326 if (curl == null) 327 return BooleanValue.FALSE; 328 329 return new StringValueImpl(curl.getError()); 330 } 331 332 336 public static Value curl_exec(Env env, 337 @NotNull CurlResource curl) 338 { 339 if (curl == null) 340 return BooleanValue.FALSE; 341 342 return curl.execute(env); 343 } 344 345 352 public static Value curl_getinfo(Env env, 353 @NotNull CurlResource curl, 354 @Optional Value option) 355 { 356 359 if (curl == null) 360 return BooleanValue.FALSE; 361 362 return getInfo(env, curl, option.toInt()); 363 } 364 365 private static Value getInfo(Env env, 366 CurlResource curl, 367 int option) 368 { 369 switch (option) { 370 case CURLINFO_EFFECTIVE_URL: 371 return new StringValueImpl(curl.getURL()); 372 case CURLINFO_HTTP_CODE: 373 return LongValue.create(curl.getResponseCode()); 374 case CURLINFO_FILETIME: 375 break; 376 case CURLINFO_TOTAL_TIME: 377 break; 378 case CURLINFO_NAMELOOKUP_TIME: 379 break; 380 case CURLINFO_CONNECT_TIME: 381 break; 382 case CURLINFO_PRETRANSFER_TIME: 383 break; 384 case CURLINFO_STARTTRANSFER_TIME: 385 break; 386 case CURLINFO_REDIRECT_TIME: 387 break; 388 case CURLINFO_SIZE_UPLOAD: 389 break; 390 case CURLINFO_SIZE_DOWNLOAD: 391 break; 392 case CURLINFO_SPEED_DOWNLOAD: 393 break; 394 case CURLINFO_SPEED_UPLOAD: 395 break; 396 case CURLINFO_HEADER_SIZE: 397 return LongValue.create(curl.getHeader().length()); 398 case CURLINFO_HEADER_OUT: 399 return curl.getHeader(); 400 case CURLINFO_REQUEST_SIZE: 401 break; 402 case CURLINFO_CONTENT_LENGTH_DOWNLOAD: 403 return LongValue.create(curl.getContentLength()); 404 case CURLINFO_CONTENT_LENGTH_UPLOAD: 405 break; 406 case CURLINFO_CONTENT_TYPE: 407 String type = curl.getContentType(); 408 409 if (type == null) 410 return NullValue.NULL; 411 412 return new StringValueImpl(type); 413 default: 414 env.warning(L.l("Unknown CURL getinfo option")); 415 } 416 417 return NullValue.NULL; 418 } 419 420 426 public static CurlResource curl_init(Env env, 427 @Optional String url) 428 { 429 CurlResource curl = new CurlResource(); 430 431 if (url.length() > 0) 432 setURL(curl, url); 433 435 return curl; 436 } 437 438 442 private static void setURL(CurlResource curl, String url) 443 { 444 int atSignIndex = url.indexOf('@'); 445 446 if (atSignIndex < 0) { 447 curl.setURL(url); 448 return; 449 } 450 451 int j = url.indexOf("://"); 452 453 String protocol; 454 if (j < 0) { 455 protocol = "http://"; 456 j = 0; 457 } 458 else { 459 j += 3; 460 protocol = url.substring(0, j); 461 } 462 463 int colonIndex = url.indexOf(':', j); 464 465 if (colonIndex < 0) 466 return; 467 468 curl.setUsername(url.substring(j, colonIndex++)); 469 curl.setPassword(url.substring(colonIndex, atSignIndex++)); 470 curl.setURL(protocol + url.substring(atSignIndex)); 471 } 472 473 480 public static LongValue curl_multi_add_handle(Env env, 481 Value curls, 482 Value curl) 483 { 484 throw new UnimplementedException("curl_multi_add_handle"); 485 } 486 487 493 public static LongValue curl_multi_close(Env env, 494 Value curls) 495 { 496 throw new UnimplementedException("curl_multi_close"); 497 } 498 499 506 public static LongValue curl_multi_exec(Env env, 507 Value curls, 508 @Reference Value stillRunning) 509 { 510 throw new UnimplementedException("curl_multi_exec"); 511 } 512 513 519 public static StringValue curl_multi_getcontent(Env env, 520 Value curl) 521 { 522 throw new UnimplementedException("curl_multi_getcontent"); 523 } 524 525 531 public static ArrayValue curl_multi_info_read(Env env, 532 Value curls) 533 { 534 throw new UnimplementedException("curl_multi_info_read"); 535 } 536 537 542 public static Value curl_multi_init(Env env) 543 { 544 throw new UnimplementedException("curl_multi_init"); 545 } 546 547 554 public static LongValue curl_multi_remove_handle(Env env, 555 Value curls, 556 Value curl) 557 { 558 throw new UnimplementedException("curl_multi_remove_handle"); 559 } 560 561 568 public static LongValue curl_multi_select(Env env, 569 Value curls, 570 @Optional Value timeout) 571 { 572 throw new UnimplementedException("curl_multi_select"); 573 } 574 575 582 public static BooleanValue curl_setopt_array(Env env, 583 @NotNull CurlResource curl, 584 ArrayValue options) 585 { 586 if (curl == null) 587 return BooleanValue.FALSE; 588 589 for (Map.Entry <Value,Value> entry: options.entrySet()) { 590 if (setOption(env, curl, entry.getKey().toInt(), entry.getValue())) 591 return BooleanValue.FALSE; 592 } 593 594 return BooleanValue.TRUE; 595 } 596 597 607 public static BooleanValue curl_setopt(Env env, 608 @NotNull CurlResource curl, 609 int option, 610 Value value) 611 { 612 if (curl == null) 613 return BooleanValue.FALSE; 614 615 if (setOption(env, curl, option, value)) 616 return BooleanValue.TRUE; 617 else 618 return BooleanValue.FALSE; 619 } 620 621 private static boolean setOption(Env env, 622 CurlResource curl, 623 int option, 624 Value value) 625 { 626 int i; 627 628 switch (option) { 629 case CURLOPT_AUTOREFERER: 633 break; 635 case CURLOPT_COOKIESESSION: 636 curl.setCookie(null); 637 break; 638 case CURLOPT_FAILONERROR: 639 curl.setFailOnError(value.toBoolean()); 640 break; 641 case CURLOPT_FOLLOWLOCATION: 642 curl.setIsFollowingRedirects(value.toBoolean()); 643 break; 644 case CURLOPT_HEADER: 645 curl.setIsReturningHeader(value.toBoolean()); 646 break; 647 case CURLOPT_HTTPGET: 648 curl.setRequestMethod("GET"); 649 break; 650 case CURLOPT_HTTPPROXYTUNNEL: 651 curl.setIsProxying(value.toBoolean()); 652 break; 653 case CURLOPT_MUTE: 654 curl.setIsVerbose(! value.toBoolean()); 655 break; 656 case CURLOPT_NETRC: 657 break; 660 case CURLOPT_NOBODY: 661 curl.setIsReturningBody(false); 662 break; 663 case CURLOPT_NOPROGRESS: 664 break; 666 case CURLOPT_POST: 667 curl.setRequestMethod("POST"); 668 break; 669 case CURLOPT_PUT: 670 curl.setRequestMethod("PUT"); 671 break; 672 case CURLOPT_RETURNTRANSFER: 673 curl.setIsReturningData(value.toBoolean()); 674 break; 675 case CURLOPT_UNRESTRICTED_AUTH: 676 break; 678 case CURLOPT_UPLOAD: 679 if (value.toBoolean()) 680 curl.setRequestMethod("PUT"); 681 break; 682 case CURLOPT_VERBOSE: 683 curl.setIsVerbose(value.toBoolean()); 684 break; 685 686 case CURLOPT_BUFFERSIZE: 690 break; 692 case CURLOPT_CONNECTTIMEOUT: 693 curl.setConnectTimeout(value.toInt() * 1000); 694 break; 695 case CURLOPT_HTTP_VERSION: 696 if (value.toInt() == CURL_HTTP_VERSION_1_0) { 697 env.stub("cURL HTTP/1.0 not specifically supported"); 698 } 699 break; 700 case CURLOPT_HTTPAUTH: 701 712 break; 713 case CURLOPT_INFILESIZE: 714 curl.setUploadFileSize(value.toInt()); 715 break; 716 case CURLOPT_LOW_SPEED_LIMIT: 717 break; 719 case CURLOPT_LOW_SPEED_TIME: 720 break; 722 case CURLOPT_MAXCONNECTS: 723 break; 725 case CURLOPT_PORT: 726 curl.setPort(value.toInt()); 727 break; 728 case CURLOPT_PROXYAUTH: 729 break; 731 case CURLOPT_PROXYPORT: 732 curl.setProxyPort(value.toInt()); 733 break; 734 case CURLOPT_PROXYTYPE: 735 switch (value.toInt()) { 736 case CURLPROXY_HTTP: 737 curl.setProxyType("HTTP"); 738 break; 739 case CURLPROXY_SOCKS5: 740 curl.setProxyType("SOCKS"); 741 break; 742 default: 743 env.warning(L.l("unknown curl proxy type")); 744 } 745 break; 746 case CURLOPT_TIMECONDITION: 747 switch (value.toInt()) { 748 case CURL_TIMECOND_IFMODSINCE: 749 curl.setIfModifiedSince(true); 750 break; 751 case CURL_TIMECOND_IFUNMODSINCE: 752 curl.setIfModifiedSince(false); 753 break; 754 default: 755 env.warning(L.l("invalid CURLOPT_TIMECONDITION option")); 756 } 757 break; 758 case CURLOPT_TIMEOUT: 759 curl.setReadTimeout(value.toInt() * 1000); 760 break; 761 case CURLOPT_TIMEVALUE: 762 long time = value.toInt() * 1000L; 763 String format = "%a, %d %b %Y %H:%M:%S %Z"; 764 765 curl.setModifiedTime(QDate.formatGMT(time, format)); 766 break; 767 768 case CURLOPT_COOKIE: 772 curl.setCookie(value.toString()); 773 break; 774 case CURLOPT_COOKIEFILE: 775 ReadStream in = null; 777 778 try { 779 Path path = env.getPwd().lookup(value.toString()); 780 781 if (path.exists()) { 782 in = path.openRead(); 783 784 StringBuilder sb = new StringBuilder (); 785 786 int ch; 787 while ((ch = in.read()) >= 0) { 788 sb.append((char)ch); 789 } 790 791 curl.setCookie(sb.toString()); 792 } 793 } 794 catch (IOException e) { 795 throw new QuercusModuleException(e); 796 } 797 finally { 798 if (in != null) 799 in.close(); 800 } 801 break; 802 case CURLOPT_COOKIEJAR: 803 curl.setCookieFilename(value.toString()); 805 break; 806 case CURLOPT_CUSTOMREQUEST: 807 curl.setRequestMethod(value.toString()); 808 break; 809 case CURLOPT_ENCODING: 810 String encoding = value.toString(); 811 if (encoding.length() == 0) 812 encoding = "gzip, deflate, identity"; 813 curl.setRequestProperty("Accept-Encoding", encoding); 814 break; 815 case CURLOPT_POSTFIELDS: 816 curl.setRequestMethod("POST"); 817 curl.setPostBody(value.toBinaryValue(env)); 818 break; 819 case CURLOPT_PROXY: 820 curl.setIsProxying(true); 821 curl.setProxyURL(value.toString()); 822 break; 823 case CURLOPT_PROXYUSERPWD: 824 String proxyUserPwd = value.toString(); 825 i = proxyUserPwd.indexOf(':'); 826 827 if (i >= 0) 828 curl.setProxyUsername(proxyUserPwd.substring(0, i)); 829 830 curl.setProxyPassword(proxyUserPwd.substring(i + 1)); 831 break; 832 case CURLOPT_RANGE: 833 curl.setRequestProperty("Range", "bytes=" + value.toString()); 834 break; 835 case CURLOPT_REFERER: 836 curl.setRequestProperty("Referer", value.toString()); 837 break; 838 case CURLOPT_URL: 839 setURL(curl, value.toString()); 840 break; 842 case CURLOPT_USERAGENT: 843 curl.setRequestProperty("User-Agent", value.toString()); 844 break; 845 case CURLOPT_USERPWD: 846 String userpwd = value.toString(); 847 i = userpwd.indexOf(':'); 848 849 if (i >= 0) 850 curl.setUsername(userpwd.substring(0, i)); 851 852 curl.setPassword(userpwd.substring(i + 1)); 853 break; 854 855 case CURLOPT_HTTP200ALIASES: 859 break; 861 case CURLOPT_HTTPHEADER: 862 ArrayValue array = value.toArrayValue(env); 863 864 for (Map.Entry <Value,Value> entry: array.entrySet()) { 865 curl.setRequestProperty(entry.getKey().toString(), 866 entry.getValue().toString()); 867 } 868 break; 869 870 case CURLOPT_FILE: 874 Object outputFile = value.toJavaObject(); 875 876 if (outputFile instanceof BinaryOutput) 877 curl.setOutputFile((BinaryOutput)outputFile); 878 break; 879 case CURLOPT_INFILE: 880 Object uploadFile = value.toJavaObject(); 881 882 if (uploadFile instanceof BinaryInput) 883 curl.setUploadFile((BinaryInput)uploadFile); 884 break; 885 case CURLOPT_STDERR: 886 break; 888 case CURLOPT_WRITEHEADER: 889 Object outputHeaderFile = value.toJavaObject(); 890 891 if (outputHeaderFile instanceof BinaryOutput) 892 curl.setOutputHeaderFile((BinaryOutput)outputHeaderFile); 893 break; 894 895 case CURLOPT_HEADERFUNCTION: 900 curl.setHeaderFunction(env.createCallback(value)); 901 if (true) 902 throw new UnimplementedException("cURL callback support"); 903 break; 904 case CURLOPT_PASSWDFUNCTION: 905 curl.setPasswordFunction(env.createCallback(value)); 906 if (true) 907 throw new UnimplementedException("cURL callback support"); 908 break; 909 case CURLOPT_READFUNCTION: 910 curl.setReadFunction(env.createCallback(value)); 911 if (true) 912 throw new UnimplementedException("cURL callback support"); 913 break; 914 case CURLOPT_WRITEFUNCTION: 915 curl.setWriteFunction(env.createCallback(value)); 916 if (true) 917 throw new UnimplementedException("cURL callback support"); 918 break; 919 920 default: 921 env.warning(L.l("CURL option unknown or unimplemented")); 922 log.log(Level.FINE, L.l("CURL option unknown orunimplemented")); 923 return false; 924 } 925 926 return true; 927 } 928 929 935 public static ArrayValue curl_version(Env env, 936 @Optional Value version) 937 { 938 throw new UnimplementedException("curl_version"); 939 } 940 941 } 942 | Popular Tags |