Mantis - Quercus
Viewing Issue Advanced Details
3104 minor always 11-29-08 14:23 12-10-08 09:14
koreth  
nam  
normal  
closed 3.2.1  
fixed  
none    
none 4.0.0  
0003104: curl_getinfo doesn't support default behavior
PHP docs say curl_getinfo() is supposed to return an array of all the values if no particular option is specified. Quercus logs "Unknown CURL getinfo option" if you try that.

Patch:

--- a/modules/quercus/src/com/caucho/quercus/lib/curl/CurlModule.java
+++ b/modules/quercus/src/com/caucho/quercus/lib/curl/CurlModule.java
@@ -379,9 +379,43 @@ public class CurlModule
     if (curl == null)
       return BooleanValue.FALSE;
 
+ if (option instanceof DefaultValue) {
+ ArrayValue result = new ArrayValueImpl();
+ putInfo(env, curl, result, "url", CURLINFO_EFFECTIVE_URL);
+ putInfo(env, curl, result, "content_type", CURLINFO_CONTENT_TYPE);
+ putInfo(env, curl, result, "http_code", CURLINFO_HTTP_CODE);
+ putInfo(env, curl, result, "header_size", CURLINFO_HEADER_SIZE);
+ putInfo(env, curl, result, "request_size", CURLINFO_REQUEST_SIZE);
+ putInfo(env, curl, result, "filetime", CURLINFO_FILETIME);
+ putInfo(env, curl, result, "total_time", CURLINFO_TOTAL_TIME);
+ putInfo(env, curl, result, "namelookup_time", CURLINFO_NAMELOOKUP_TIME);
+ putInfo(env, curl, result, "connect_time", CURLINFO_CONNECT_TIME);
+ putInfo(env, curl, result, "pretransfer_time", CURLINFO_PRETRANSFER_TIME);
+ putInfo(env, curl, result, "size_upload", CURLINFO_SIZE_UPLOAD);
+ putInfo(env, curl, result, "size_download", CURLINFO_SIZE_DOWNLOAD);
+ putInfo(env, curl, result, "speed_download", CURLINFO_SPEED_DOWNLOAD);
+ putInfo(env, curl, result, "speed_upload", CURLINFO_SPEED_UPLOAD);
+ putInfo(env, curl, result, "download_content_length", CURLINFO_CONTENT_LENGTH_DOWNLOAD);
+ putInfo(env, curl, result, "upload_content_length", CURLINFO_CONTENT_LENGTH_UPLOAD);
+ putInfo(env, curl, result, "starttransfer_time", CURLINFO_STARTTRANSFER_TIME);
+ putInfo(env, curl, result, "redirect_time", CURLINFO_REDIRECT_TIME);
+ // Constant defined but not recognized by getInfo
+ //putInfo(env, curl, result, "redirect_count", CURLINFO_REDIRECT_COUNT);
+ // Not implemented and constant not defined
+ //putInfo(env, curl, result, "ssl_verify_result", CURLINFO_SSL_VERIFYRESULT);
+ return result;
+ }
     return getInfo(env, curl, option.toInt());
   }
 
+ private static void putInfo(Env env,
+ CurlResource curl,
+ ArrayValue array,
+ String name,
+ int option) {
+ array.put(new StringBuilderValue(name), getInfo(env, curl, option));
+ }
+
   private static Value getInfo(Env env,
                               CurlResource curl,
                               int option)

Notes
(0003585)
nam   
12-10-08 09:14   
php/5040