[root@ gwan]# file gwan
gwan: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped
[root@ gwan]# ldd gwan
not a dynamic executable
[root@ gwan]# du -csh gwan
208K gwan
208K total
Run Code Online (Sandbox Code Playgroud)
gwan是如何做到的?
作为一个Web服务器,它需要执行套接字编程和许多其他繁重的工作,这些工作都需要与libc链接,但gwan似乎并非如此.怎么可能?
引用自CGI.pm文档:
使用它时,你必须注意的是多值CGI参数.因为哈希不能区分标量和列表上下文,所以多值参数将作为打包字符串返回,由"\ 0"(空)字符分隔.
然而,事实证明,\0在Perl中没有什么特别之处:
print length("test\0hi");
Run Code Online (Sandbox Code Playgroud)
输出是:
7
Run Code Online (Sandbox Code Playgroud)
而在C中它应该是4.
为什么CGI.pm \0在Perl中被视为普通字符(不再是字符串结尾的标记)时仍然使用空字符?
在PHP中它就像htmlspecialchars在Perl中如何做到这一点一样简单?