View e2e.patch
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
From 391facbb5616c4a712b42fd6e60b1852c8f39c45 Mon Sep 17 00:00:00 2001 | |
From: Bogdan Popa <bogdan@defn.io> | |
Date: Mon, 13 Jan 2020 11:05:11 +0200 | |
Subject: [PATCH] tests: update e2e tests to use safety-limits | |
--- | |
.../tests/web-server/e2e/file-upload/server.rkt | 8 +++++--- | |
web-server-test/tests/web-server/e2e/json/server.rkt | 4 +++- | |
.../tests/web-server/e2e/read-write/server.rkt | 6 ++++-- | |
3 files changed, 12 insertions(+), 6 deletions(-) |
View codesign.sh
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
codesign --force \ | |
--timestamp \ | |
--entitlements="$CODE_SIGN_ENTITLEMENTS" \ | |
--sign="$EXPANDED_CODE_SIGN_IDENTITY_NAME" \ | |
-o runtime \ | |
"${PROJECT_DIR}/Resources/core/lib/Racket.framework/Versions/7.5_3m/Racket" | |
codesign --force \ | |
--timestamp \ | |
--entitlements="$CODE_SIGN_ENTITLEMENTS" \ |
View web-app-from-scratch-1-14.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
with socket.socket() as server_sock: | |
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
server_sock.bind((HOST, PORT)) | |
server_sock.listen(0) | |
print(f"Listening on {HOST}:{PORT}...") | |
while True: | |
client_sock, client_addr = server_sock.accept() | |
print(f"Received connection from {client_addr}...") | |
with client_sock: |
View web-app-from-scratch-1-13.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
import mimetypes | |
import os | |
import socket | |
import typing | |
SERVER_ROOT = os.path.abspath("www") | |
FILE_RESPONSE_TEMPLATE = """\ | |
HTTP/1.1 200 OK | |
Content-type: {content_type} |
View web-app-from-scratch-1-12.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
METHOD_NOT_ALLOWED_RESPONSE = b"""\ | |
HTTP/1.1 405 Method Not Allowed | |
Content-type: text/plain | |
Content-length: 17 | |
Method Not Allowed""".replace(b"\n", b"\r\n") |
View web-app-from-scratch-1-11.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
NOT_FOUND_RESPONSE = b"""\ | |
HTTP/1.1 404 Not Found | |
Content-type: text/plain | |
Content-length: 9 | |
Not Found""".replace(b"\n", b"\r\n") | |
#... | |
with socket.socket() as server_sock: |
View web-app-from-scratch-1-10.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
BAD_REQUEST_RESPONSE = b"""\ | |
HTTP/1.1 400 Bad Request | |
Content-type: text/plain | |
Content-length: 11 | |
Bad Request""".replace(b"\n", b"\r\n") | |
with socket.socket() as server_sock: | |
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
server_sock.bind((HOST, PORT)) |
View web-app-from-scratch-1-09.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
with socket.socket() as server_sock: | |
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
server_sock.bind((HOST, PORT)) | |
server_sock.listen(0) | |
print(f"Listening on {HOST}:{PORT}...") | |
while True: | |
client_sock, client_addr = server_sock.accept() | |
print(f"Received connection from {client_addr}...") | |
with client_sock: |
View web-app-from-scratch-1-08.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
class Request(typing.NamedTuple): | |
method: str | |
path: str | |
headers: typing.Mapping[str, str] | |
@classmethod | |
def from_socket(cls, sock: socket.socket) -> "Request": | |
"""Read and parse the request from a socket object. | |
Raises: |
View web-app-from-scratch-1-07.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
import typing | |
class Request(typing.NamedTuple): | |
method: str | |
path: str | |
headers: typing.Mapping[str, str] |
NewerOlder