« September 2005 | Main | November 2005 »
October 21, 2005
SetEnv fail in Suexec - Suexec下setenv失效
有时候,最不起眼的问题却最耗时间。
早上10点多想起还没完成ExtMail的0.19 release中计划要增加的功能:per domain template , 于是开始动手。
本来是一个非常简单的功能,几行code就搞定,利用的是Apache等webserver的SetEnv,将特定信息导入环境变量中,谁知道怪事发生了。
在httpd.conf中,有如下的配置:
SetEnv EXTMAIL_TEMPLDIR "/var/www/extmail/newhtml"
可是在perl代码里,却死活没办法通过访问$ENV{'EXTMAIL_TEMPLDIR'}来获得这个值。
开始有点怀疑是不是自己写错了,查了一下Apache的docs,看看配置指令有没问题,可又没发现问题。又在google上到处搜索,甚至搜索到了perl的beginner 的邮件列表,可是所有有关的问题都几乎是一样的答案,通过SetEnv传递环境变量。
后来,忽然想起自己的extmail是工作在SuExec+SELinux双重保护的环境里,会不会因为这个原因导致了自定义的环境变量被屏蔽掉?
于是做了一个试验,关闭了Suexec,结果就成功了。于是还是老老实实的仔细看Apache手册的env模块,才发现了根源:
Some Caveats
It is not possible to override or change the standard CGI variables using the environment manipulation directives.
When suexec is used to launch CGI scripts, the environment will be cleaned down to a set of safe variables before CGI scripts are launched. The list of safe variables is defined at compile-time in suexec.c.
For portability reasons, the names of environment variables may contain only letters, numbers, and the underscore character. In addition, the first character may not be a number. Characters which do not match this restriction will be replaced by an underscore when passed to CGI scripts and SSI pages.
第二段就写得很清晰,“the environment will be cleaned down to a set of safe variables before CGI scripts are launched.”。
只怪当时心切没耐着性子看,当时也没联想到Suexec的问题。
知道这个问题的根源以后,设计又可以继续下去
Posted by hzqbbc at 02:32 PM | Comments (0)
October 20, 2005
Email threads algorithm - 邮件线索排序算法
很早以前,一些邮件客户端,例如Netscape 等就支持邮件的线索模式,在线索模式下,可以很有条理的阅读邮件.
邮件客户端becky我曾经使用了相当长的一段时间,原因之一就是因为它支持线索模式,这样可以很方便的查看与某些朋友的邮件来往,尤其是订阅了邮件列表后,每个话题及回复都看得很清晰。
不少线索排序都是使用jwz算法. 地址: message threading
根据jwz的介绍,jwz算法相当可靠,也许在不久的将来,邮件线索排序技术将用于Extmail :-)
相关的链接
- Mail::Thread
- Email::Thread
Posted by hzqbbc at 06:31 PM | Comments (0)
October 09, 2005
Comment Spam flood - 遭遇MT Spam洪水
有整一周没上blog里看消息了,一登陆,吓了一跳,136个comments! 第一感觉就是Spam! 打开评论管理一看,果然都是一些外国的留言,实质都是一些广告。
气愤之余,只好一条一条删除,但删除前,留一张截图吧,立此存照:

看样子,迟点还是得装SCode模块。
Posted by hzqbbc at 02:37 PM | Comments (1)