http.cs
---------------------------- 【程序编程相关:在Delphi中使用自定义光标】 【推荐阅读:判断文件是否正在使用】using system; 【扩展信息:程序删除自身】 using system.collections; using system.io; using system.net; using system.net.sockets; using system.threading;class httpprocessor {
private socket s;
private bufferedstream bs; private streamreader sr; private streamwriter sw; private string method; private string url; private string protocol; private hashtable hashtable;public httpprocessor(socket s) {
this.s = s; hashtable = new hashtable(); }public void process() {
networkstream ns = new networkstream(s, fileaccess.readwrite); bs = new bufferedstream(ns); sr = new streamreader(bs); sw = new streamwriter(bs); parserequest(); readheaders(); writeurl(); s.shutdown(socketshutdown.sdboth); ns.close(); }public void parserequest() {
string request = sr.readline(); string[] tokens = request.split(new char[]{ }); method = tokens[0]; ... 下一页