Hack the planet! Send feedback to jtunney@gmail.com
command line api
Latency should be 30 milliseconds, plus network overhead.
curl --tcp-fastopen -H 'Content-Type: text/plain' -d ' import time time.sleep(1) print("hello") time.sleep(1) print("hello") ' http://redbean.systems/python
source code
- cosmopolitan/libc/calls/unveil.c
- cosmopolitan/libc/calls/pledge-linux.c
- cosmopolitan/net/http/tokenbucket.c
- cosmopolitan/net/turfwar/blackholed.c
# Copyright 2023 Justine Alexandra Roberts Tunney # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the # above copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE # AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL # DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR # PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. import cosmo import errno import http.server import math import os import resource import signal import socketserver import sys import time import tokenbucket import traceback import urllib.parse # public python sandbox # secured by pledge() and unveil() # # git clone https://github.com/jart/cosmopolitan # cd cosmopolitan # make -j8 o//third_party/python/python.com # o//third_party/python/python.com pledgethon.py 8080 # google-chrome http://127.0.0.1:8080 REPLENISH = 30. # seconds to grant a token BUCKETBIT = 24 # netmask bits for each bucket BURSTNESS = 5 # number of fast executions allowed TIM_LIMIT = 3. # max seconds of wall time for client THR_LIMIT = (0, 0) # max numbers of threads on whole system CPU_LIMIT = (1, 2) # max seconds of cpu time for each client FDS_LIMIT = (128, 128) # highest numbered file descriptor allowed FSZ_LIMIT = (500*1000, 512*1000)