Mercurial Hosting > luan
comparison src/luan/modules/Boot.luan @ 1364:45363886f256
add url methods
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 29 May 2019 19:03:25 -0600 |
parents | 8d95711f6615 |
children | 836e00bf7ce2 |
comparison
equal
deleted
inserted
replaced
1363:1a7b8e38921a | 1364:45363886f256 |
---|---|
107 function schemes.stdin(path) | 107 function schemes.stdin(path) |
108 local Io = require "luan:Io.luan" | 108 local Io = require "luan:Io.luan" |
109 return Io.stdin | 109 return Io.stdin |
110 end | 110 end |
111 | 111 |
112 | |
113 local function new_LuanUrl(io) | |
114 local this = new_LuanIn(io) | |
115 | |
116 local function check() | |
117 io.httpCon or error "must open first" | |
118 end | |
119 | |
120 function this.get_header(name) | |
121 check() | |
122 return io.httpCon.getHeaderField(name) | |
123 end | |
124 | |
125 function this.get_response_code() | |
126 check() | |
127 return io.httpCon.getResponseCode() | |
128 end | |
129 | |
130 function this.get_response_message() | |
131 check() | |
132 return io.httpCon.getResponseMessage() | |
133 end | |
134 | |
135 return this | |
136 end | |
137 | |
112 local function url(path,options) | 138 local function url(path,options) |
113 return new_LuanIn( LuanUrl.new(URL.new(path),options) ) | 139 return new_LuanUrl( LuanUrl.new(URL.new(path),options) ) |
114 end | 140 end |
115 | 141 |
116 function schemes.http(path,options) | 142 function schemes.http(path,options) |
117 return url( "http:"..path, options ) | 143 return url( "http:"..path, options ) |
118 end | 144 end |