vweb: ip()

pull/5842/head
Alexander Medvednikov 2020-07-16 00:48:10 +02:00
parent 2492066041
commit 6245876806
3 changed files with 9 additions and 1 deletions

View File

@ -50,6 +50,7 @@ jobs:
./v vet vlib/v/ast ./v vet vlib/v/ast
./v vet vlib/v/gen/cgen.v ./v vet vlib/v/gen/cgen.v
./v vet vlib/v/checker ./v vet vlib/v/checker
./v vet vlib/sqlite
# - name: Test v binaries # - name: Test v binaries
# run: ./v -silent build-vbinaries # run: ./v -silent build-vbinaries

View File

@ -101,6 +101,7 @@ pub fn (db DB) exec(query string) ([]Row,int) {
res = C.sqlite3_step(stmt) res = C.sqlite3_step(stmt)
// Result Code SQLITE_ROW; Another row is available // Result Code SQLITE_ROW; Another row is available
if res != 100 { if res != 100 {
//C.puts(C.sqlite3_errstr(res))
break break
} }
mut row := Row{} mut row := Row{}

View File

@ -507,6 +507,12 @@ pub fn (mut ctx Context) serve_static(url, file_path, mime_type string) {
ctx.static_mime_types[url] = mime_type ctx.static_mime_types[url] = mime_type
} }
pub fn (ctx &Context) ip() string {
// TODO make return ctx.conn.peer_ip() or { '' } work
res := ctx.conn.peer_ip() or { '' }
return res
}
pub fn (mut ctx Context) error(s string) { pub fn (mut ctx Context) error(s string) {
ctx.form_error = s ctx.form_error = s
} }