|
Welcome Einit.com! 他们彼此深信,是瞬间迸发的热情让他们相遇。这样的确定是美丽的,但变幻无常更为美丽 |
|
前段时间发现有几个朋友用不同方法实现对一些文件实现下载而不是在线打开. 我发一个如何在硬件网络设备上来控制,不用大家去编程.当然这个只是一个例子,为了表现F5的强大而发的,也是一种思路,很多我们在应用上看似很复杂的东西,到了网络设备上,却能轻易的实现令人激动的功能~~ F5 irule~ TCL,UIE实现解包。从中可以看出,硬件处理的强大性:
class dlFiles {
".exe"
".pdf"
".vb"
}
when HTTP_REQUEST {
# Compare the file extension to the list you wish to force downloads for
if { [matchclass [string tolower [HTTP::uri]] ends_with $::dlFiles] } {
set forceDownload 1
}
}
when HTTP_RESPONSE {
if { $forceDownload == 1 } {
# Check if the response has a Content-Disposition header
if {[HTTP::header exists Content-Disposition]}{
# Replace the existing Content-Disposition header
# with one that prompts the user to download the content
HTTP::header replace Content-Disposition "attachment; filename="
}
set forceDownload 0
}
}
|
|
|
|
|