https://github.com/rsharifnasab/java-http-client
simple HTTP client that use java socket to send get requests
https://github.com/rsharifnasab/java-http-client
http http-client java socket
Last synced: 8 months ago
JSON representation
simple HTTP client that use java socket to send get requests
- Host: GitHub
- URL: https://github.com/rsharifnasab/java-http-client
- Owner: rsharifnasab
- License: gpl-3.0
- Created: 2021-01-10T16:36:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-10T17:19:49.000Z (about 5 years ago)
- Last Synced: 2025-01-14T11:14:35.105Z (about 1 year ago)
- Topics: http, http-client, java, socket
- Language: Java
- Homepage:
- Size: 73.2 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple http client with java
DO NOT COMPARE THIS WITH CURL OR INSOMNIA OR POSTMAN :)
this is a simple http client for internet engineering course.
it will send string to server by socket in port 80.
learn more about project in `todo.pdf`
## how to run
1. install jdk11+
2. compile with `javac Main.java`
3. run with `java Main`
4. enter request url (only http 1.0 supported. no https)
5. enter method (please use `get` :) )
6. wait for server response.
7. answer would be something like this:
```
==============HttpResponse==========
version = HTTP/1.1
errorCode = 200
errorDesc = OK
headers = {Server=gunicorn/19.9.0, Access-Control-Allow-Origin=*, Access-Control-Allow-Credentials=true, Connection=close, Content-Length=248, Date=Sun, 10 Jan 2021 16:45:31 GMT, Content-Type=application/json}
-------body--------
{
"args": {},
"headers": {
"Accept": "*/*",
"Content-Length": "0",
"Host": "httpbin.org",
"X-Amzn-Trace-Id": "Root=1-5ffb2f2a-40a054d36ab2677f3214b6a7"
},
"origin": "5.113.239.236",
"url": "http://httpbin.org/get"
}
----end of body----
==========End Of HttpResponse=======
```
8. note that [httpbin](http://httpbin.org/) is a very good site for demonstrating this program features.
### friends
another implementation of this project could be found [here](https://github.com/mehditeymorian/HttpClient)