From 9e380e28864380536a7a1955725f28ac5ea34ca0 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 2 Aug 2019 23:45:36 +0200 Subject: [PATCH] vweb: clean up --- vlib/vweb/vweb.v | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 3a43757d0c..0f556ec468 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -73,8 +73,7 @@ fn (ctx mut Context) set_header(key, val string) { } pub fn (ctx Context) html(html string) { - //tmpl := os.read_file(path) or {return} - h := ctx.headers.join('\n') + h := ctx.headers.join('\n') ctx.conn.write('HTTP/1.1 200 OK Content-Type: text/html $h @@ -119,7 +118,6 @@ pub fn run(port int) { first_line := s.all_before('\n') vals := first_line.split(' ') mut action := vals[1].right(1).all_before('/') - println('vweb.v: action="$action"') if action.contains('?') { action = action.all_before('?') } @@ -134,19 +132,19 @@ pub fn run(port int) { method: vals[0] url: vals[1] } - //mut app := T{ - app.vweb = Context{ + println('vweb action = "$action"') + mut app := T{ + vweb: Context{ req: req conn: conn post_form: map[string]string{} static_files: map[string]string{} static_mime_types: map[string]string{} } - //} + } if req.method == 'POST' { app.vweb.parse_form(s) } - println('vweb action = "$action"') if vals.len < 2 { println('no vals for http') conn.close()