-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
123 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM http-garden-soil:latest | ||
|
||
RUN apt -y update && apt -y upgrade && apt -y install --no-install-recommends pkg-config autoconf-archive automake libssl-dev | ||
|
||
ARG APP_REPO | ||
RUN git clone --recurse-submodules "$APP_REPO" | ||
|
||
ARG APP_VERSION | ||
RUN cd /app/cpython && git pull && git checkout "$APP_VERSION" && ./configure --enable-optimizations && make -j"$(nproc)" | ||
|
||
RUN /app/cpython/python -m venv /app/venv && . /app/venv/bin/activate && pip install /app/python-afl | ||
|
||
COPY ./server.py /app | ||
CMD ["/app/venv/bin/python", "/app/server.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from base64 import b64encode | ||
from wsgiref.simple_server import make_server | ||
|
||
RESERVED_HEADERS = ("CONTENT_LENGTH", "CONTENT_TYPE") | ||
|
||
def app(environ, start_response) -> list[bytes]: | ||
response_body: bytes = ( | ||
b'{"headers":[' | ||
+ b",".join( | ||
b'["' | ||
+ b64encode(k.encode("latin1")[len("HTTP_") if k not in RESERVED_HEADERS else 0 :]) | ||
+ b'","' | ||
+ b64encode(environ[k].encode("latin1")) | ||
+ b'"]' | ||
for k in environ | ||
if k.startswith("HTTP_") or k in RESERVED_HEADERS | ||
) | ||
+ b'],"body":"' | ||
+ b64encode(environ["wsgi.input"].read()) | ||
+ b'","version":"' | ||
+ b64encode(environ["SERVER_PROTOCOL"].encode("latin1")) | ||
+ b'","uri":"' | ||
+ b64encode( | ||
( | ||
environ["PATH_INFO"] + (("?" + environ["QUERY_STRING"]) if environ["QUERY_STRING"] else "") | ||
).encode("latin1") | ||
) | ||
+ b'","method":"' | ||
+ b64encode(environ["REQUEST_METHOD"].encode("latin1")) | ||
+ b'"}' | ||
) | ||
start_response( | ||
"200 OK", [("Content-Length", f"{len(response_body)}")] | ||
) | ||
return [response_body] | ||
|
||
|
||
if __name__ == "__main__": | ||
with make_server('0.0.0.0', 80, app) as httpd: | ||
httpd.default_request_version = "HTTP/1.1" | ||
httpd.serve_forever() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.