Blog.ecjtu.net的问题已经出了好几天了,一直没有时间仔细去研究。具体问题体现在某些用户的博客首页无法打开,而大部分有可以正常打开,最近这两天听博客管理员说报告类似错误的用户越来越多所以今天就仔细的找了一下原因。
博客系统使用的是SupeSite/X-Space由Ucenter和论坛整合,服务器是FreeBSD,前端Nginx,后端Apache跑php(暂时这样,准备年后换FastCGI)。
用IE6访问全站正常,用非IE6的浏览器,如IE7、IE8、FireFox、Chrome等浏览器打开时都无法打开部分用户的首页,提示内容如下

FireFox无法访问,提示错误

Chrome无法访问,提示错误

IE可以访问
一开始以为是Rewrite的问题,换了好几种Rewrite的方法,问题依旧。 后来注意到所有的Rewrite都会重定向都会回到一个文件iframe.php上,而且所有无法访问的用户的首页几乎都是形同这种http://blog.ecjtu.net/iframe.php?uid=92649样式。接着开始仔细分析这个iframe.php文件。
这是iframe.php文件
- <?php
- /*
- [SupeSite/X-Space] (C)2001-2006 Comsenz Inc.
- $RCSfile: iframe.php,v $
- $Revision: 1.3 $
- $Date: 2007/08/01 08:11:21 $
- */
- include_once('./include/main.inc.php');
- include_once(S_ROOT.'./language/batch.lang.php');
- dbconnect();
- $_GET['uid'] = intval($_GET['uid']);
- $reauthcode = md5($_SCONFIG['sitekey'].$_GET['uid']);
- $s_url = S_URL;
- if($_GET['passpage'] == 1) {
- echo '<script language="javascript" type="text/javascript">location.href="'.S_URL.'/index.php?uid-'.$_GET['uid'].'-noframe-1";</script>';
- exit;
- }else {
- $newurl = S_URL."/batch.common.php?action=musicpasspage&uid=$_GET[uid]&hash=$reauthcode";
- }
- if(emptyempty($newurl)) {
- $display = 'none';
- } else {
- $display = '';
- }
- $space = getuserspace($_GET['uid']);
- print <<<EOF
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=$_SCONFIG[charset];">
- <title>$space[spacename] Power by X-Space</title>
- <script>
- function framebutton(){
- var obj = document.getElementById('navigation');
- var musicobj = document.getElementById('topFrame');
- var frameswitch = document.getElementById('frameswitch');
- var switchbar = document.getElementById('switchbar');
- if(obj.style.width == '1px'){
- obj.style.width = '192px';
- musicobj.style.width = '192px';
- switchbar.style.left = '192px';
- frameswitch.style.backgroundPosition = '0';
- frameswitch.src = '$s_url/images/flashplayer/btn_hide.jpg';
- }else{
- obj.style.width = '1px';
- musicobj.style.width = '1px';
- switchbar.style.left = '1px';
- frameswitch.style.backgroundPosition = '-11';
- frameswitch.src = '$s_url/images/flashplayer/btn_show.jpg';
- }
- }
- if(top != self) {
- top.location = self.location;
- }
- </script>
- </head>
- <body style="height: 100%; margin: 0; padding: 0;" scroll="no">
- <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td id="navigation" style="width:1px; height:200px; url($s_url/images/flashplayer/bg_framebottom.jpg) no-repeat left bottom; vertical-align:top; ">
- <iframe src="$newurl" frameborder="0" scrolling="no" style="width:1px; height:100% ;" name="topFrame" id="topFrame"></iframe>
- </td>
- <td style="height: 100%;width: 100%;">
- <table id="switchbar" width="14" height="100%" cellspacing="0" cellpadding="0" border="0" style="position: absolute; left: 1px; background-repeat: repeat-y; background-position: -192px; repeat-y left center;">
- <tbody>
- <tr>
- <td onClick="framebutton()" style="display:$display"><img id="frameswitch" border="0" src="images/flashplayer/btn_show.jpg" style="background-position: 0pt 50%;"/></a></td>
- </tr>
- </tbody>
- </table>
- <iframe style="height: 100%; width: 100%; " src="$s_url/index.php?uid-$_GET[uid]-noframe-1" name="mainFrame" frameborder="0" scrolling="yes"></iframe>
- </td>
- </tr>
- </table>
- </body>
- </html>
- EOF;
- ?>
但是经过一番分析和测试之后基本可以确定这个文件是没有问题的,无意之中注意到Firefox和Chrome的错误提示:
Chrome提示
错误 330 (net::ERR_CONTENT_DECODING_FAILED):未知错误。
FireFox提示
无法显示您尝试查看的页面,因为它使用了无效或者不支持的压缩格式。
因为没有读过这个x-space的代码 所以不好百分之百确定原因 不过就目前所有的现象表明,这个可能性最高的还是这个Iframe.php文件,尤其是最后那一个<iframe>标签。单间地说就是客户端接收到的内容是部分Gzip压缩,所以符合标准像FireFox,Chrome这样符合标准的浏览器就会提示内容有错误不可靠。但是IE6啥也不管:能解压的就解压没压缩的就不解压 所以就能看。至于为什么部分用户的博客首页可以打开而另一部分不可以,那就要关注一个细节:所有不能打开的用户的首页都加入了在线音乐播放器这个功能,不出意外的话问题就应该出在这个播放器代码上了。
嗯嗯嗯……纯猜测得差不多了,具体原因下次技术部开会再探讨吧。呵呵
发表评论: