vweb: make compile

pull/5228/head
Alexander Medvednikov 2020-06-05 21:04:18 +02:00
parent e3917d98c2
commit 11908410f3
2 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ fn main() {
vweb.run<App>(port)
}
pub fn (app App) init() {
pub fn (mut app App) init() {
app.vweb.handle_static('.')
}

View File

@ -143,7 +143,7 @@ pub fn run<T>(port int) {
for {
conn := l.accept() or { panic('accept() failed') }
//handle_conn<T>(conn, mut app)
app = handle_conn<T>(conn, app)
handle_conn<T>(conn, mut app)
// TODO move this to handle_conn<T>(conn, app)
//message := readall(conn)
//println(message)
@ -169,7 +169,7 @@ pub fn run<T>(port int) {
}
}
fn handle_conn<T>(conn net.Socket, app mut T) {
fn handle_conn<T>(conn net.Socket, mut app T) {
//fn handle_conn<T>(conn net.Socket, app_ T) T {
//mut app := app_
//first_line := strip(lines[0])
@ -184,7 +184,7 @@ fn handle_conn<T>(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<T>(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<T>(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<T>(conn net.Socket, app mut T) {
*/
conn.close() or {}
app.reset()
return app
return
}
fn (mut ctx Context) parse_form(s string) {