Subject: MICE: specify record size inline, not in separate header

From: "Manger, James" <[email-masked]>
Date: Mon, 9 May 2016 13:43:51 +1000

Merkle Integrity Content Encoding (draft-thomson-http-mice) is a nice idea.
Specifying the record size in a separate "MI" HTTP header feels like a poor design: Content-Encoding indicates the encoding, but its critical parameter is in a separate header.
How about just putting the record size at the start of the content, eg a 4-byte prefix holding the record size in bytes as a big-endian unsigned int?

The 2nd example from the spec would become:

Content-Encoding: mi-sha256
Content-Length: 109

<00 00 00 10>When I grow up, <OElbplJlPK-Rv6JNK6p5_515IaoPoZo-2elWL7OQ60A>I want to be a w<iPMpmgExHPrbEX3_RvwP4d16fWlK4l--p75PUu_KyN0>atermelon

--
James Manger

---

From: Martin Thomson <[email-masked]>
Date: Mon, 9 May 2016 14:11:03 +1000

On 9 May 2016 at 13:43, Manger, James <[email-masked]> wrote:
> How about just putting the record size at the start of the content, eg a
> 4-byte prefix holding the record size in bytes as a big-endian unsigned int?

I chose the header because you pretty much need one anyway to carry
the proof.  Including the size in the body is more space-efficient,
but it makes the processing less regular because you have to read off
4 octets before proceeding to call fragment(body, rs+32).

I'm not convinced that there's a clear win either way.

---

From: "Manger, James" <[email-masked]>
Date: Mon, 9 May 2016 15:56:58 +1000

It seems unnecessarily annoying that you cannot even remove the mi-sha256 content-encoding (because you don't know the record size) despite having the Content-Encoding header and the content. Someone needs the proof, but perhaps not everything that handles the content. Even the spec admits that the proof might be acquired by other means, in which case "the MI header MAY be omitted".
Perhaps making it hard to remove the encoding without a proof is a perverse way of discouraging software from simply ignoring the integrity check?

--
James Manger

-----Original Message-----
From: Martin Thomson [mailto:[email-masked]] 
Sent: Monday, 9 May 2016 2:11 PM
To: Manger, James <[email-masked]>
Cc: [email-masked]
Subject: Re: MICE: specify record size inline, not in separate header

On 9 May 2016 at 13:43, Manger, James <[email-masked]> wrote:
> How about just putting the record size at the start of the content, eg 
> a 4-byte prefix holding the record size in bytes as a big-endian unsigned int?

I chose the header because you pretty much need one anyway to carry the proof.  Including the size in the body is more space-efficient, but it makes the processing less regular because you have to read off
4 octets before proceeding to call fragment(body, rs+32).

---

From: "Poul-Henning Kamp" <[email-masked]>
Date: Mon, 09 May 2016 06:14:41 +0000

--------
In message <[email-masked]
ra.com>, "Manger, James" writes:

>How about just putting the record size at the start of the content, eg a 4-
>byte prefix holding the record size in bytes as a big-endian unsigned int?

Surely you mean 8-byte ?

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[email-masked]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.