From 11908410f3d12e9b2b2bd6237f2fdf31942466c6 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 5 Jun 2020 21:04:18 +0200 Subject: [PATCH] vweb: make compile --- examples/vweb/vweb_example.v | 2 +- vlib/vweb/vweb.v | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/vweb/vweb_example.v b/examples/vweb/vweb_example.v index 6fea04f88b..9bbdd0ee15 100644 --- a/examples/vweb/vweb_example.v +++ b/examples/vweb/vweb_example.v @@ -17,7 +17,7 @@ fn main() { vweb.run(port) } -pub fn (app App) init() { +pub fn (mut app App) init() { app.vweb.handle_static('.') } diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 7855f9993d..5f3f9d1600 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -143,7 +143,7 @@ pub fn run(port int) { for { conn := l.accept() or { panic('accept() failed') } //handle_conn(conn, mut app) - app = handle_conn(conn, app) + handle_conn(conn, mut app) // TODO move this to handle_conn(conn, app) //message := readall(conn) //println(message) @@ -169,7 +169,7 @@ pub fn run(port int) { } } -fn handle_conn(conn net.Socket, app mut T) { +fn handle_conn(conn net.Socket, mut app T) { //fn handle_conn(conn net.Socket, app_ T) T { //mut app := app_ //first_line := strip(lines[0]) @@ -184,7 +184,7 @@ fn handle_conn(conn net.Socket, app mut T) { println('no vals for http') conn.send_string(http_500) or {} conn.close() or {} - return app + return //continue } mut headers := []string{} @@ -265,7 +265,7 @@ fn handle_conn(conn net.Socket, app mut T) { println('no vals for http') } conn.close() or {} - return app + return //continue } @@ -276,10 +276,10 @@ fn handle_conn(conn net.Socket, app mut T) { if static_file != '' && mime_type != '' { data := os.read_file(static_file) or { conn.send_string(http_404) or {} - return app + return } app.vweb.send_response_to_client(mime_type, data) - return app + return } // Call the right action @@ -294,7 +294,7 @@ fn handle_conn(conn net.Socket, app mut T) { */ conn.close() or {} app.reset() - return app + return } fn (mut ctx Context) parse_form(s string) {