Skip to content

Cheaple/gohttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Server

Run server using Docker image:

docker pull chenyule/http-server
docker run -d -p <port number>:8080 chenyule/http-server

Build & Run server from source code:

go build -o ./server/main ./server/server.go 
./server/main -p=<port number, default as 80>
# or 
go run ./proxy/proxy.go

Test GET command:

curl -X GET 16.170.214.245:8080/test.txt
curl -X GET 16.170.214.245:8080/no.txt		# 404 not found
curl -X GET 16.170.214.245:8080/test		# 500 invalid file type

or 16.170.214.245:8080/test.jpg (download an image)

Test POST command:

  • Use Postman

Test concurrency:

for i in {1..10}; do curl -X GET 16.170.214.245:8080/test.txt; done

Proxy

Run proxy locally:

go build -o ./proxy/main ./proxy/proxy.go 
./proxy/main -p=8999
# or
go run ./proxy/proxy.go 

Test GET command:

curl -X GET 16.170.214.245:8080/test.jpg -x localhost:8999

Test POST command:

curl -X POST 16.170.214.245:8080/test.jpg -x localhost:8999  # 501 Method not allowed

Test proxy concurrency:

for i in {1..10}; do curl -X GET 16.170.214.245:8080/test.txt -x localhost:8999; done

About

HTTP Server & Proxy toys

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published