Skip to content

Send and receive HTTP and HTTPS requests to target server using sockets

Notifications You must be signed in to change notification settings

sa-akhavani/http-request-relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

HTTP and HTTPS Request Relay

Send and receive HTTP and HTTPS requests to target server using sockets. Supports all content types and request methods.

Usage examples: Provide the code your target hostname and port and request data in byte string format such as:

Example HTTP POST Request

relay = Relay(host='example.com', port=80, use_ssl=False)
request = b'POST / HTTP/1.1\r\nHost: example.com\r\nContent-Type: application/json\r\nContent-Length: 16\r\n\r\n{"key": "value"}'
response = relay.forward_request(request)
print(response.decode())

Example HTTPS GET Request

relay = Relay(host='example.com', port=443, use_ssl=True)
request = b'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
response = relay.forward_request(request)
print(response.decode())

About

Send and receive HTTP and HTTPS requests to target server using sockets

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages