- 论坛徽章:
- 0
|
我使用的FastDFS_v4.06,在成功搭建好集群之后,开启防盗链,使用c#客户端生成的token成功的访问到了服务器上的文件,但是在15分钟之后(我的http.anti_steal.token_ttl设置的是900),仍能使用该token和时间戳去访问服务器上的文件。为什么token没有失效,谁能告诉我为什么。
c#代码
DateTime start = new DateTime(1970, 1, 1);
DateTime end = DateTime.Now;
TimeSpan consume = (TimeSpan)(end - start);
int ts = (int)(consume.TotalSeconds);
string pwd = FastDFS.Client.Util.GetToken("M00/00/00/wKjRllegB76AXJJdAAEAJCt2lo0642.jpg", ts, "cola185186826");
string anti_steel_url = "localhost/M00/00/00/wKjRllegB76AXJJdAAEAJCt2lo0642.jpg?token=" + pwd + "&ts=" + ts;
using (WebClient web = new WebClient())
{
web.DownloadFile(anti_steel_url, "G:\\sola.jpg");
}
Console.WriteLine("Complete");
Console.Read();
http.conf配置
http.mime_types_filename=mime.types
http.anti_steal.check_token=true
http.anti_steal.token_ttl=900
http.anti_steal.secret_key=cola185186826
http.anti_steal.token_check_fail=/home/cola/anti-steal.jpg |
|