BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / bbs-man-dev / #8423同步于 1 周前
BBSMan_Dev机器人发帖

求教,不能看附件的问题。

JulyClyde.
1 周前镜像同步11 回复
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH 打不开是怎么个打不开法? 【 在 spadger (这里的水很深) 的大作中提到: 】 : 系统ubuntu 8.04 server,apache和php都是apt-get安装,基本正常,但是web下面不能看 : 附件,比如下面的链接,上面的附件是可以访问的,但是下面的全文链接打不开。显示如下: : picture 版 : ...................
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
spadger.机器人#1 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH 用FF看到出错信息了,IE什么都不提示。。。 Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/bbsmailcon.php on line 57 <?php $s = bbs2_readfile($filename); 这一句阻塞勒。。。 【 在 spadger (这里的水很深) 的大作中提到: 】 : 系统ubuntu 8.04 server,apache和php都是apt-get安装,基本正常,但是web下面不能看 : 附件,比如下面的链接,上面的附件是可以访问的,但是下面的全文链接打不开。显示如下: : picture 版 : ...................
JulyClyde.机器人#2 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH ie过于友好了 你得关闭“显示友好的http错误信息”才可以 【 在 spadger (这里的水很深) 的大作中提到: 】 : 用FF看到出错信息了,IE什么都不提示。。。 : Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/bbsmailcon.php on line 57 : <?php $s = bbs2_readfile($filename); 这一句阻塞勒。。。 : ...................
spadger.机器人#3 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH 嗯,这个不是问题,问题在下面。。。 【 在 JulyClyde (十月有点冷,还是七月好) 的大作中提到: 】 : ie过于友好了 : 你得关闭“显示友好的http错误信息”才可以
spadger.机器人#4 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH FF错误控制台提示:missing ) after argument list... 【 在 spadger (这里的水很深) 的大作中提到: 】 : 嗯,这个不是问题,问题在下面。。。
spadger.机器人#5 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/bbsmailcon.php on line 57 【 在 spadger (这里的水很深) 的大作中提到: 】 : FF错误控制台提示:missing ) after argument list...
fancyrabbit.机器人#6 · 1 周前
转信站: BYR!news.byr.edu.cn!news.pigpark.net!news.newsmth.net!NEWSMTH cd php make install 【 在 spadger (这里的水很深) 的大作中提到: 】 : make install是安装所有程序。如果我想只安装php扩展模块,应该make what?
atppp.机器人#7 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH gdb attach httpd 去看它到底在干啥 【 在 spadger (这里的水很深) 的大作中提到: 】 : Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/bbsmailcon.php on line 57 : 192.168.1.100 - - [18/Nov/2008:21:17:40 +0800] "GET /bbsmailcon.php?dir=.DIR&num : =16&title=%CA%D5%BC%FE%CF%E4 HTTP/1.1" 200 548 "http://192.168.1.101/bbsmailbox. : ...................
atppp.机器人#8 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH 机器什么系统?x86? x64? 【 在 spadger (这里的水很深) 的大作中提到: 】 : 系统ubuntu 8.04 server,apache和php都是apt-get安装,基本正常,但是web下面不能看 : 附件,比如下面的链接,上面的附件是可以访问的,但是下面的全文链接打不开。显示如下: : picture 版 : ...................
spadger.机器人#9 · 1 周前
转信站: BYR!news.byr.edu.cn!news.newsmth.net!NEWSMTH x86的机器,linux装在vmware里面。 问题最后定位到了bbs2_readfile()函数里面。 gdb不是很熟悉,在函数里面开了一个文件,把变量输出到一个日志文件中。 /* * refer Ecma-262 * '\033' -> \r (not exactly the same thing, but borrow...) * '\n' -> \n * '\\' -> \\ * '\'' -> \' * '\"' -> \" * '\0' -> possible start of attachment * 0 <= char < 32 -> ignore * others -> passthrough */ PHP_FUNCTION(bbs2_readfile) { char *filename; int filename_len; char *output_buffer; int output_buffer_len, output_buffer_size, j,i; char c; char *ptr, *cur_ptr; off_t ptrlen, mmap_ptrlen; int in_chinese = false; int chunk_size = 51200; FILE *logs = fopen("/home/bbs/log/debug.txt","w+"); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { fprintf(logs,"begin to parse parameter\n"); WRONG_PARAM_COUNT; } // ptr is the content of the file, mmap_ptrlen is the length of the file if (safe_mmapfile(filename, O_RDONLY, PROT_READ, MAP_SHARED, &ptr, &mmap_ptrlen, NULL) == 0) { fprintf(logs,"safe_mmapfile() error\n"); RETURN_LONG(-1); } fprintf(logs,"the file size = %ld\n", mmap_ptrlen); j = ptrlen = mmap_ptrlen; if (j > chunk_size) j = chunk_size; output_buffer_size = 2 * j + 16; output_buffer = (char* )emalloc(output_buffer_size); output_buffer_len = 0; cur_ptr = ptr; strcpy(output_buffer + output_buffer_len, "prints('"); output_buffer_len += 8; while (1) { for (; j > 0 ; j--) { c = *cur_ptr; if (c == '\0') { //we find an attachment here! there are eight '\0' next fprintf(logs, "ptrlen: %ld \t", ptrlen); for(i=0;i<8;i++) fprintf(logs,"%02X ", cur_ptr[i]); 上面红色的语句加上以后,带附件的文章完全正常了,日志输出也完全正确, 但是没有附件的文章根本打不开了,函数根本不返回,浏览器里面30秒超时退出. 如果没有上面的语句的话情况刚好翻过来 if (ptrlen >= ATTACHMENT_SIZE + sizeof(int) + 2) { if (!memcmp(cur_ptr, ATTACHMENT_PAD, ATTACHMENT_SIZE)) { fprintf(logs,"\tgo to deal with attchment.\n"); ptrlen = -ptrlen; break; } } ptrlen--; cur_ptr++; continue; } if (c < 0) { //this byte and the next byte consist of a hanzi in_chinese = !in_chinese; output_buffer[output_buffer_len++] = c; } else { do { if (c == '\n') { c = 'n'; } else if (c == '\033') { c = 'r'; } else if (c != '\\' && c != '\'' && c != '\"' && c != '/' ) { /* to prevent things like </script> */ if (c >= 32) output_buffer[output_buffer_len++] = c; break; } if (in_chinese && c == 'n') { //jump half hanzi output_buffer[output_buffer_len++] = ' '; } output_buffer[output_buffer_len++] = '\\'; output_buffer[output_buffer_len++] = c; } while(0); in_chinese = false; } ptrlen--; cur_ptr++; } if (ptrlen <= 0) break; j = ptrlen; if (j > chunk_size) j = chunk_size; output_buffer_size += 2 * j; output_buffer = (char*)erealloc(output_buffer, output_buffer_size); if (output_buffer == NULL) RETURN_LONG(3); } if (in_chinese) { output_buffer[output_buffer_len++] = ' '; } strncpy(output_buffer + output_buffer_len, "');", 3); output_buffer_len += 3; if (ptrlen < 0) { //attachment char *attachfilename, *attachptr; char buf[1024]; //filename, attach_len, and attach_pos char *startbufptr, *bufptr; long attach_len, attach_pos, newlen; int l; ptrlen = -ptrlen; strcpy(buf, "attach('"); startbufptr = buf + strlen(buf); while(ptrlen > 0) { if (((attachfilename = checkattach(cur_ptr, ptrlen, &attach_len, &attachptr)) == NULL)) { break; } attach_pos = attachfilename - ptr; newlen = attachptr - cur_ptr + attach_len; cur_ptr += newlen; ptrlen -= newlen; if (ptrlen < 0) break; bufptr = startbufptr; while(*attachfilename != '\0') { switch(*attachfilename) { case '\'': case '\"': case '\\': *bufptr++ = '\\'; /* TODO: boundary check */ /* break is missing *intentionally* */ default: *bufptr++ = *attachfilename++; /* TODO: boundary check */ } } sprintf(bufptr, "', %ld, %ld);", attach_len, attach_pos); /* TODO: boundary check */ l = strlen(buf); if (output_buffer_len + l > output_buffer_size) { output_buffer_size = output_buffer_size + sizeof(buf) * 10; output_buffer = (char*)erealloc(output_buffer, output_buffer_size); if (output_buffer == NULL) RETURN_LONG(3); } strcpy(output_buffer + output_buffer_len, buf); output_buffer_len += l; } } end_mmapfile(ptr, mmap_ptrlen, -1); fclose(logs); RETVAL_STRINGL(output_buffer, output_buffer_len, 0); } 【 在 atppp (Big Mouse) 的大作中提到: 】 : 机器什么系统?x86? x64?