multicodec icon indicating copy to clipboard operation
multicodec copied to clipboard

Multicodec Idea: HTTP Response as one codec? HTTP Request as a second?

Open bumblefudge opened this issue 1 year ago • 1 comments

@aarongoldman mentioned a crazy idea that I think might be useful for some web-interop usecases I've been looking into: a codec for CIDv1 that described HTTP requests and another for HTTP responses. This would certainly have made Webrecorder and Internet Archive easier to build! Could also be useful for all kinds of automated testing, CI, etc etc. Any obvious reason why this could be a disaster or a footgun?

bumblefudge avatar Oct 10 '24 16:10 bumblefudge

https://datatracker.ietf.org/doc/html/rfc7231 0x7231 and hex(7231) = 0x1c3f seam to be available.

Example Request

GET /logo.gif HTTP/1.1
Host: www.example.re
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1)
Accept: */*
Accept-Language: en-US, en; q=0.5
Accept-Encoding: gzip, deflate

Example Response

200 OK
Age: 8450220
Cache-Control: public, max-age=315360000
Connection: Keep-Alive
Content-Type: image/gif
Content-Length: 5000
Date: Thu, 01 Jan 1998 12:01:01 GMT
Last-Modified: Sun, 01 Jan 1995 12:01:00 GMT
Server: Apache

<The binary data for a 5K GIF image is included in the message body>

Note: Only a single multi-code is needed as all rfc7231 Requests start with a letter and all rfc7231 Responses start with a number.

AaronGoldman avatar Oct 22 '24 22:10 AaronGoldman