Benton Edmondson 93adacf7dd jtp: fix typo in readme | hai 1 ano | |
---|---|---|
.. | ||
jtp.go | hai 1 ano | |
jtp_test.go | hai 1 ano | |
readme.md | hai 1 ano |
JTP is a profile (in the same sense as RFC 3339) of HTTP/1.0 that facilitates extremely simple transfer of JSON objects or arrays over a TCP connection.
I had read about the gemini://
protocol as a simplified alternative to https://
, and so I wanted to explore how complicated https://
really was. Ultimately, I found that the subset of features needed to do a basic JSON transfer is extremely simple.
The format of the request I send is
GET /resource.json HTTP/1.0
Host: server.org
Accept: application/activity+json
I specify the version as HTTP/1.0
to prevent the server from sending me a chunked-transfer encoded response. I specify Host:
because, although not formally required in HTTP/1.0
, many servers complain about its absence. Accept:
is how I request that the server send me ActivityPub JSON instead of text/html
.
My response parsing handles any valid response to an HTTP/1.0
request, but the most minimal responses I accept are as follows.
In the successful case:
HTTP/1.1 200
content-type: application/activity+json
{
"the": "json"
}
In the redirect case:
HTTP/1.1 300
location: /over-here.json
And in the error case:
HTTP/1.1 400