Example #1
0
 private void body_end(string whence)
 {
     this.imsg("websvc: body_end called {0}", (object)whence);
     if (this.isgzip)
     {
         byte[] bf = Websvc.ungzip(this.mem_body.inbf, this.mem_body.Length);
         this.mem_body = new MyBuffer();
         this.mem_body.add(bf, bf.Length);
     }
     ++Websvc.nrequests;
     try
     {
         this.wmod.do_body_end(this);
     }
     catch (Exception ex)
     {
         this.imsg("crash in do_body_end() {0} {1}", (object)ex.Message, (object)ex.ToString());
         Web.simple_error(this, "crash in do_body_end() " + ex.Message);
     }
     clib.imsg("body_end setting wmod to null");
     this.wmod = (WebModule)null;
     if (this.query != null)
     {
         this.query.Clear();
     }
     if (this.form != null)
     {
         this.form.Clear();
     }
     this.inbody      = false;
     this.content_len = 0;
     this.in_chunked  = false;
     this.imsg("mystery body_end called {0}", (object)this.content_len);
 }
Example #2
0
 public override void OnDropConnection(ConnectionState state)
 {
     --Websvc.nopen;
     this.imsg("ondropconnection - close stuff if needed. ");
     if (this.wmod != null)
     {
         this.imsg("ondropconnection: calling wmod dropconnection");
         this.wmod.dropconnection(this);
     }
     else
     {
         this.imsg("ondropconnection: wmod was null");
     }
     this.wmod = (WebModule)null;
 }
Example #3
0
 private void process_cmd_early()
 {
     if (this.iswebdav)
     {
         this.wmod = (WebModule) new WebDav();
         this.imsg("Using webdav module for this one");
     }
     else
     {
         foreach (WebModule webModule in Websvc.modlist)
         {
             if (webModule.isforme(clib.pathstart(this.url), this.url))
             {
                 this.wmod = (WebModule)webModule.Clone();
             }
         }
     }
     if (this.wmod == null)
     {
         this.imsg("FATAL: isforme... No module found for url {0} {1} iswebdav = {2}", (object)this.url, (object)clib.pathstart(this.url), (object)this.iswebdav);
         string x = "Sorry invalid url";
         this.chan.write(string.Format("HTTP/1.1 500 Invalid url for this server\r\nContent-Length: {0}\r\n\r\n", (object)x.Length));
         this.chan.write(x);
     }
     else
     {
         this.imsg("wmod: Found module {0}", (object)this.wmod.myname());
         this.query = clib.ParseQueryString(this.url_raw);
         foreach (string allKey in this.query.AllKeys)
         {
             this.imsg("QUERY:   {0,-10} {1}", (object)allKey, (object)this.query[allKey]);
         }
         this.auth_decode(this.head_get("Authorization"));
         this.ifmodified = this.head_get("If-Modified-Since");
         if (this.ifmodified == null)
         {
             this.ifmodified = "";
         }
         this.ifheader      = this.head_get("If");
         this.ifheader_done = false;
         this.top_done      = false;
         if (this.ifheader == null)
         {
             this.ifheader = "";
         }
         this.host = this.head_get("Host");
         if (this.host == null)
         {
             this.host = "http://localhost";
         }
         this.lockid = this.head_get("Lock-Token");
         if (this.lockid == null)
         {
             this.lockid = "";
         }
         this.lockid       = this.lockid.Trim("<> ".ToCharArray());
         this.content_type = this.head_get("Content-Type");
         this.data_ok      = false;
         this.wmod.do_headers(this);
         this.inbody = true;
         if (this.method == Wmethod.POST || this.method == Wmethod.PUT)
         {
             this.inmem = false;
         }
         else
         {
             this.inmem    = true;
             this.mem_body = new MyBuffer();
         }
     }
 }