Created
January 13, 2023 14:30
-
-
Save froop/32dffeeaf94cc0e19a9672c8748791d0 to your computer and use it in GitHub Desktop.
[Python] HTTP POST Broken pipe負荷テスト
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import socket | |
def send_broken_pipe(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(("localhost", 8082)) | |
request = "POST / HTTP/1.1\r\n" | |
request += "Content-Length: 123\r\n" | |
request += "\r\n" | |
s.sendall(request.encode()) | |
s.close() | |
for i in range(100): | |
send_broken_pipe() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment