.github
datadog
doc
examples
foreman
src
t
Event
Hydra
input-types
jobs
declarative
dependencies
aggregate.nix
api-test.nix
basic.nix
broken-constituent.nix
build-output-as-input.nix
build-product-simple.sh
build-product-with-spaces.sh
build-products.nix
bzr-checkout-input.nix
bzr-checkout-update.sh
bzr-input.nix
bzr-update.sh
config.nix.in
darcs-input.nix
darcs-update.sh
deepgit-builder.sh
deepgit-input.nix
default-machine-file.nix
empty-dir-builder.sh
fail.sh
git-input.nix
git-rev-input.nix
git-rev-update.sh
git-update.sh
hg-input.nix
hg-update.sh
hydra-eval-notifications.nix
nested-attributes.nix
notifications.nix
one-job.nix
runcommand.nix
scm-builder.sh
server.py
succeed-with-failed.sh
svn-checkout-input.nix
svn-checkout-update.sh
svn-input.nix
svn-update.sh
lib
queue-runner
scripts
Makefile.am
api-test.t
build-products.t
evaluate-basic.t
evaluate-dependent-jobsets.t
perlcritic.pl
s3-backup-test.config
s3-backup-test.pl
setup-notifications-jobset.pl
test.pl
.editorconfig
.gitignore
.perlcriticrc
.yath.rc
COPYING
INSTALL
Makefile.am
Procfile
README.md
bootstrap
configure.ac
default.nix
flake.lock
flake.nix
hydra-api.yaml
hydra-module.nix
shell.nix
version.txt
This seems to work fine in a `nix build`-sandbox as it doesn't depend on `getprotobyname`.
36 lines
887 B
Python
36 lines
887 B
Python
#!/usr/bin/env python3
|
|
|
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
from sys import argv
|
|
|
|
|
|
def factory(file):
|
|
h = handler
|
|
h.file = file
|
|
return h
|
|
|
|
|
|
class handler(BaseHTTPRequestHandler):
|
|
def do_POST(self):
|
|
self.send_response(200)
|
|
self.send_header('Content-type', 'application/json')
|
|
with open(self.file, 'w+') as f:
|
|
f.write(f"{self.path}\n")
|
|
length = int(self.headers.get('content-length', 0))
|
|
body = str(self.rfile.read(length).decode("utf-8"))
|
|
|
|
f.write(f"{body}")
|
|
self.end_headers()
|
|
|
|
message = "{}"
|
|
self.wfile.write(bytes(message, "utf8"))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
assert len(argv) > 1
|
|
with HTTPServer(('localhost', 8282), factory(argv[1])) as server:
|
|
server.serve_forever()
|
|
except KeyboardInterrupt:
|
|
pass
|