public void http_request_tests() { string path = "/testuri"; string query = "parm1=1&parm2=2"; string request = String.Format("{0}?{1}", path, query); WvHttpRequest t = new WvHttpRequest(request); WVPASSEQ(t.request_uri, request); WVPASSEQ(t.path, path); WVPASSEQ(t.query_string, query); WVPASS(t.request_method == Wv.Web.Cgi.Method.Get); t.parse_header("Test-Header: asdf"); WVPASSEQ(t.headers["test-header"], "asdf"); }
static void do_request(WvHttpRequest req, Stream s) { WvLog log = new WvLog("do_request"); log.print("Handling...\n"); foreach (KeyValuePair<string,string> p in req.headers) log.print("Header: '{0}' = '{1}'", p.Key, p.Value); using (StreamWriter w = new StreamWriter(s)) { w.WriteLine("HTTP/1.0 200 OK"); w.WriteLine("Content-type: text/plain"); w.WriteLine(""); w.WriteLine("Hello world! Your path was '{0}'", req.path); w.WriteLine("Query string: '{0}'", req.query_string); } }