I am looking for a simple Linux/Ubuntu proxy which only purpose is record the request and the answer from a http transaction.
I am writing an application that will not run on a web browser but it will talk to a web server. I want to mimic, to learn how I should send properly a request to my web server by examining a valid transaction between a web browser and a web server.
This application will run in an Arduino, and this program will be written in C, so I can not rely on fancy libs and high level tools like curl or python running BeautySoup, for instance. Think on it as a tiny http browser that does not render HTML code, but only send requests and understand the answer.
I manage to use netcat in listing mode to capture the data sent by the browser, so my app already can send something similar, but I am in trouble to know what is the proper answer the web server reply with. Since my app needs to understand what is going on and take the next step.
I am using Postman to send the requests. Postman is great to that. The problem with Postman is I can not inspect the answer as raw data. It gives me the body of the answer, but not the header of the answer.
I am looking for a proxy that can output the raw data somewhere, both requests and answers, with the full header and body, as raw data.
I want to see something like this:
PUT /testAuth.php HTTP/1.1
Authorization: Basic Y291cmFnZTpkb2c=
User-Agent: PostmanRuntime/7.15.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 7a4c180f-d893-4e7d-8375-a4dfd7b5663e
Host: localhost:80
accept-encoding: gzip, deflate
content-length: 0
Connection: keep-alive
HTTP/1.1 200 OK
Date: Thu, 04 Jul 2019 20:24:08 GMT
Server: Apache/2.4.38 (Ubuntu)
Content-Length: 36
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
<h1>Hello, Authenticated User.</h1>
I think that understanding the whole HTTP protocol by reading the protocol specification will take so long until I get the point I can do it by my self. I think I can save time by just imitate a GET/PUT/POST request sent by Postman and seeing what I should expect on the answer.
So, I thought about a proxy that can output both the request and the answer and use that info as a template to build my own requests and parse the answer.
thank you in advance,
PS: Currently, I am using telnet to talk to the browser and receive the answer. The problem with it is I have to copy the request from somewhere and paste on telnet's input. And then, I receive the answer and the connection closes. It works, kind off. But I want to use Postman to build my requests and get the answer and see the details elsewhere.