mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-04 00:40:27 +00:00
Redbean getstatus and more (#308)
* Add GetBody() Lua API to redbean. This improves consistency with RFC 7230 terminology and should be favored over the old GetPayload function. * Add GetStatus() API to redbean. This is useful to get status after it's changed/set by Redbean, for example if 505 or 508 is set when ServeRedirect is called. * Introduce GetAssetComment() API to redbean. This function should be favored over the old name GetComment(). * Introduce IsLoopbackClient() API to redbean * Limit redbean reason to 128 chars when set instead of reporting an error
This commit is contained in:
parent
e5d1536256
commit
ca611efc43
2 changed files with 39 additions and 12 deletions
|
@ -597,6 +597,10 @@ FUNCTIONS
|
|||
Turns integer like 0x01020304 into a string like 1.2.3.4. See also
|
||||
ParseIp for the inverse operation.
|
||||
|
||||
GetAssetComment(path:str) → str
|
||||
Returns comment text associated with asset in the ZIP central
|
||||
directory. Also available as GetComment (deprecated).
|
||||
|
||||
GetAssetMode(path:str) → int
|
||||
Returns UNIX-style octal mode for ZIP asset (or local file if the
|
||||
-D flag is used)
|
||||
|
@ -605,9 +609,9 @@ FUNCTIONS
|
|||
Returns byte size of uncompressed contents of ZIP asset (or local
|
||||
file if the -D flag is used)
|
||||
|
||||
GetComment(path:str) → str
|
||||
Returns comment text associated with asset in the ZIP central
|
||||
directory.
|
||||
GetBody() → str
|
||||
Returns the request message body if present or an empty string.
|
||||
Also available as GetPayload (deprecated).
|
||||
|
||||
GetCookie(name:str) → str
|
||||
Returns cookie value.
|
||||
|
@ -714,13 +718,13 @@ FUNCTIONS
|
|||
GetScheme() → str
|
||||
Returns scheme from Request-URL, if any.
|
||||
|
||||
GetStatus() → int
|
||||
Returns current status (as set by an earlier SetStatus call) or
|
||||
`nil` if the status hasn't been set yet.
|
||||
|
||||
GetTime() → seconds:number
|
||||
Returns current time as a UNIX timestamp with 0.0001s precision.
|
||||
|
||||
GetPayload() → str
|
||||
Returns the request message payload, or empty string if there
|
||||
isn't one.
|
||||
|
||||
GetUrl() → str
|
||||
Returns the effective Request-URL as an ASCII string, where
|
||||
illegal characters or UTF-8 is guaranteed to be percent encoded,
|
||||
|
@ -763,6 +767,10 @@ FUNCTIONS
|
|||
Returns true if IP address is part of a private network
|
||||
(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
|
||||
|
||||
IsLoopbackClient() → bool
|
||||
Returns true if the client IP address (returned by GetRemoteAddr)
|
||||
is part of the localhost network (127.0.0.0/8).
|
||||
|
||||
IsLoopbackIp(uint32) → bool
|
||||
Returns true if IP address is part of the localhost network
|
||||
(127.0.0.0/8).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue