Index: trunk/extensions/SwiftCloudFiles/php-cloudfiles-1.7.10/cloudfiles.php |
— | — | @@ -1332,11 +1332,12 @@ |
1333 | 1333 | * </code> |
1334 | 1334 | * |
1335 | 1335 | * @param string $obj_name name of storage Object |
| 1336 | + * @param array $hdrs user-defined headers (X-Newest: true, etc.) |
1336 | 1337 | * @return obj CF_Object instance |
1337 | 1338 | */ |
1338 | | - function create_object($obj_name=NULL) |
| 1339 | + function create_object($obj_name=NULL, $hdrs=array()) |
1339 | 1340 | { |
1340 | | - return new CF_Object($this, $obj_name); |
| 1341 | + return new CF_Object($this, $obj_name, False, True, $hdrs); |
1341 | 1342 | } |
1342 | 1343 | |
1343 | 1344 | /** |
— | — | @@ -1361,11 +1362,12 @@ |
1362 | 1363 | * </code> |
1363 | 1364 | * |
1364 | 1365 | * @param string $obj_name name of storage Object |
| 1366 | + * @param array $hdrs user-defined headers (X-Newest: true, etc.) |
1365 | 1367 | * @return obj CF_Object instance |
1366 | 1368 | */ |
1367 | | - function get_object($obj_name=NULL) |
| 1369 | + function get_object($obj_name=NULL, $hdrs=array()) |
1368 | 1370 | { |
1369 | | - return new CF_Object($this, $obj_name, True); |
| 1371 | + return new CF_Object($this, $obj_name, True, True, $hdrs); |
1370 | 1372 | } |
1371 | 1373 | |
1372 | 1374 | /** |
— | — | @@ -1898,8 +1900,10 @@ |
1899 | 1901 | * @param obj $container CF_Container instance |
1900 | 1902 | * @param string $name name of Object |
1901 | 1903 | * @param boolean $force_exists if set, throw an error if Object doesn't exist |
| 1904 | + * @param boolean $dohead if set, do a HEAD request to get object metadata |
| 1905 | + * @param array $hdrs user-defined headers (X-Newest: true, etc.) |
1902 | 1906 | */ |
1903 | | - function __construct(&$container, $name, $force_exists=False, $dohead=True) |
| 1907 | + function __construct(&$container, $name, $force_exists=False, $dohead=True, $hdrs=array()) |
1904 | 1908 | { |
1905 | 1909 | if ($name[0] == "/") { |
1906 | 1910 | $r = "Object name '".$name; |
— | — | @@ -1921,7 +1925,7 @@ |
1922 | 1926 | $this->headers = array(); |
1923 | 1927 | $this->manifest = NULL; |
1924 | 1928 | if ($dohead) { |
1925 | | - if (!$this->_initialize() && $force_exists) { |
| 1929 | + if (!$this->_initialize($hdrs) && $force_exists) { |
1926 | 1930 | throw new NoSuchObjectException("No such object '".$name."'"); |
1927 | 1931 | } |
1928 | 1932 | } |
— | — | @@ -2541,11 +2545,11 @@ |
2542 | 2546 | /** |
2543 | 2547 | * PRIVATE: fetch information about the remote Object if it exists |
2544 | 2548 | */ |
2545 | | - private function _initialize() |
| 2549 | + private function _initialize($hdrs=array()) |
2546 | 2550 | { |
2547 | 2551 | list($status, $reason, $etag, $last_modified, $content_type, |
2548 | 2552 | $content_length, $metadata, $manifest, $headers) = |
2549 | | - $this->container->cfs_http->head_object($this); |
| 2553 | + $this->container->cfs_http->head_object($this,$hdrs); |
2550 | 2554 | #if ($status == 401 && $this->_re_auth()) { |
2551 | 2555 | # return $this->_initialize(); |
2552 | 2556 | #} |
Index: trunk/extensions/SwiftCloudFiles/php-cloudfiles-1.7.10/cloudfiles_http.php |
— | — | @@ -903,7 +903,7 @@ |
904 | 904 | |
905 | 905 | # HEAD /v1/Account/Container/Object |
906 | 906 | # |
907 | | - function head_object(&$obj) |
| 907 | + function head_object(&$obj, $hdrs=array()) |
908 | 908 | { |
909 | 909 | if (!is_object($obj) || get_class($obj) != "CF_Object") { |
910 | 910 | throw new SyntaxException( |
— | — | @@ -913,7 +913,7 @@ |
914 | 914 | $conn_type = "HEAD"; |
915 | 915 | |
916 | 916 | $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name); |
917 | | - $return_code = $this->_send_request($conn_type,$url_path); |
| 917 | + $return_code = $this->_send_request($conn_type,$url_path,$hdrs); |
918 | 918 | |
919 | 919 | if (!$return_code) { |
920 | 920 | $this->error_str .= ": Failed to obtain valid HTTP response."; |