Skip to content

Instantly share code, notes, and snippets.

@froop
Created January 13, 2023 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save froop/32dffeeaf94cc0e19a9672c8748791d0 to your computer and use it in GitHub Desktop.
Save froop/32dffeeaf94cc0e19a9672c8748791d0 to your computer and use it in GitHub Desktop.
[Python] HTTP POST Broken pipe負荷テスト
#!/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