Esempio n. 1
0
 /**
  * 设置一个bucket的referer访问白名单和是否允许referer字段为空的请求访问
  * Bucket Referer防盗链具体见OSS防盗链
  *
  * @param string $bucket bucket名称
  * @param RefererConfig $refererConfig
  * @param array $options
  * @return ResponseCore
  * @throws null
  */
 public function putBucketReferer($bucket, $refererConfig, $options = NULL)
 {
     $this->precheckCommon($bucket, NULL, $options, false);
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
     $options[self::OSS_OBJECT] = '/';
     $options[self::OSS_SUB_RESOURCE] = 'referer';
     $options[self::OSS_CONTENT_TYPE] = 'application/xml';
     $options[self::OSS_CONTENT] = $refererConfig->serializeToXml();
     $response = $this->auth($options);
     $result = new PutSetDeleteResult($response);
     return $result->getData();
 }
 public function testParseValidXml()
 {
     $refererConfig = new RefererConfig();
     $refererConfig->parseFromXml($this->validXml);
     $this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($refererConfig->serializeToXml()));
 }