歡迎您光臨本站 註冊首頁

用perl做的squid的重定向器

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

用perl做的squid的重定向器

perl程序

#!C:\squid\sbin\redirect.pl
$|=1;
while (<>) {
[email protected]://[email protected]:http://[email protected];
print;
}

在squid.conf里修改了
url_rewrite_program C:\\squid\\sbin\\redirect.pl
url_rewrite_children 20
url_rewrite_host_header off

我用的是suqid2.7
配置好了后能正常啟動,但是發起http請求後會出現異常程序終止的報錯。

cache.log里
2011/01/09 13:13:34| Starting Squid Cache version 2.7.STABLE8 for i686-pc-winnt...
2011/01/09 13:13:34| Running on Windows Vista
2011/01/09 13:13:34| Process ID 3596
2011/01/09 13:13:34| With 2048 file descriptors available
2011/01/09 13:13:34| With 512 CRT stdio descriptors available
2011/01/09 13:13:34| Windows sockets initialized
2011/01/09 13:13:34| Using select for the IO loop
2011/01/09 13:13:34| Performing DNS Tests...
2011/01/09 13:13:34| Successful DNS name lookup tests...
2011/01/09 13:13:34| DNS Socket created at 0.0.0.0, port 60812, FD 4
2011/01/09 13:13:34| Adding DHCP nameserver 192.168.0.1 from Registry
2011/01/09 13:13:34| Adding DHCP nameserver 10.10.1.201 from Registry
2011/01/09 13:13:34| Adding DHCP nameserver 10.10.1.202 from Registry
2011/01/09 13:13:34| Adding domain from Registry
2011/01/09 13:13:34| helperOpenServers: Starting 20 'redirect.pl' processes
2011/01/09 13:13:34| ipcCreate: CHILD: C:\squid/sbin/redirect.pl: (8) Exec format error
2011/01/09 13:13:34| ipcCreate: PARENT: OK read test failed
2011/01/09 13:13:34| --> read returned 4
2011/01/09 13:13:34| --> got 'ERR%0A'
2011/01/09 13:13:34| WARNING: Cannot run 'C:\squid/sbin/redirect.pl' process.
2011/01/09 13:13:34| ipcCreate: CHILD: C:\squid/sbin/redirect.pl: (8) Exec format error
2011/01/09 13:13:34| ipcCreate: PARENT: OK read test failed
...
2011/01/09 13:13:34| --> read returned 4
2011/01/09 13:13:34| --> got 'ERR%0A'
2011/01/09 13:13:34| WARNING: Cannot run 'C:\squid/sbin/redirect.pl' process.
2011/01/09 13:13:34| User-Agent logging is disabled.
2011/01/09 13:13:34| Referer logging is disabled.
2011/01/09 13:13:34| logfileOpen: opening log c:/squid/var/logs/access.log
2011/01/09 13:13:34| Unlinkd pipe opened on FD 7
2011/01/09 13:13:34| Swap maxSize 102400 + 102400 KB, estimated 15753 objects
2011/01/09 13:13:34| Target number of buckets: 787
2011/01/09 13:13:34| Using 8192 Store buckets
2011/01/09 13:13:34| Max Mem size: 102400 KB
2011/01/09 13:13:34| Max Swap size: 102400 KB
2011/01/09 13:13:34| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2011/01/09 13:13:34| logfileOpen: opening log c:/squid/var/logs/store.log
2011/01/09 13:13:34| Rebuilding storage in c:/squid/var/cache (DIRTY)
2011/01/09 13:13:34| Using Least Load store dir selection
2011/01/09 13:13:34| Set Current Directory to c:/squid/var/cache
2011/01/09 13:13:34| Loaded Icons.
2011/01/09 13:13:34| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 13.
2011/01/09 13:13:34| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2011/01/09 13:13:34| Accepting HTCP messages on port 4827, FD 15.
2011/01/09 13:13:34| Accepting SNMP messages on port 3401, FD 16.
2011/01/09 13:13:34| Ready to serve requests.
2011/01/09 13:13:34| Store rebuilding is 52.5% complete
2011/01/09 13:13:34| Done reading c:/squid/var/cache swaplog (7798 entries)
2011/01/09 13:13:34| Finished rebuilding storage from disk.
2011/01/09 13:13:34| 7798 Entries scanned
2011/01/09 13:13:34| 0 Invalid entries.
2011/01/09 13:13:34| 0 With invalid flags.
2011/01/09 13:13:34| 7798 Objects loaded.
2011/01/09 13:13:34| 0 Objects expired.
2011/01/09 13:13:34| 0 Objects cancelled.
2011/01/09 13:13:34| 0 Duplicate URLs purged.
2011/01/09 13:13:34| 0 Swapfile clashes avoided.
2011/01/09 13:13:34| Took 0.2 seconds (46975.9 objects/sec).
2011/01/09 13:13:34| Beginning Validation Procedure
2011/01/09 13:13:34| Completed Validation Procedure
2011/01/09 13:13:34| Validated 7798 Entries
2011/01/09 13:13:34| store_swap_size = 90288k
2011/01/09 13:13:35| storeLateRelease: released 0 objects
2011/01/09 13:13:40| WARNING: All url_rewriter processes are busy.
2011/01/09 13:13:40| WARNING: up to 1 pending requests queued
2011/01/09 13:13:40| storeDirWriteCleanLogs: Starting...
2011/01/09 13:13:40| WARNING: Closing open FD 13
2011/01/09 13:13:40| Finished. Wrote 7798 entries.
2011/01/09 13:13:40| Took 0.0 seconds (866444.4 entries/sec).
FATAL: Too many queued url_rewriter requests (1 on 0)
Squid Cache (Version 2.7.STABLE8): Terminated abnormally.

很多行顯示格式錯誤,不知道是什麼問題,網上找很多也找不到windows下的配置

順便問一下,能否在windows下安裝squirm,請高手指教下,謝謝了,弄了好幾天了,幫幫忙吧

[火星人 ] 用perl做的squid的重定向器已經有504次圍觀

http://coctec.com/docs/service/show-post-15500.html