[whatwg] Fetch: please review!

Simon Pieters simonp at opera.com
Thu May 23 01:33:57 PDT 2013

On Thu, 23 May 2013 07:11:45 +0200, Anne van Kesteren <annevk at annevk.nl>  

> On Wed, May 22, 2013 at 12:20 PM, Janusz Majnert <j.majnert at samsung.com>  
> wrote:
>> I have a few notes to make on the use of "byte string" notion.
>> First of all, let's look at the definition of "byte string":
>> "A byte string is a byte sequence written down as a string."
>> Where "byte" and "string" are:
>> "A byte is a sequence of eight bits, represented as a double-digit
>> hexadecimal number in the range 0x00 to 0xFF."
>> "A string is a sequence of code points." and later "A code point is a
>> Unicode code point and is represented as a four-to-six digit hexadecimal
>> number, typically prefixed with "U+"."
>> So, just by looking at the definition, I would expect a byte string to  
>> be a
>> sequence of hex numbers. That is of course not what is put in the  
>> examples
>> and not what this definition aimed for.
> If you have a better way to do this, please do suggest. This problem
> has been introduced by HTTP and I think it's important to make sure we
> carefully distinguish between what are actually bytes and what are
> strings, while still maintaining the readability of Content-Type over
> expressing that as a sequence of hex numbers.

Maybe say that for readability, byte strings are not written as hex  
numbers but as strings encoded as ASCII.

Also, instead of distinguishing between the two by including or omitting  
quotes which seems subtle and hard to remember which is which, call out  
when something is a byte string rather than a string.

Example (using backticks for <code>):

↪ `about`

If request's url's scheme data is `blank`, return a response whose headers  
consist of a single header whose name is the byte string `Content-Type`  
and value is the byte string `text/html;charset=utf-8`, and body is the  
empty string.

Otherwise, return a network error.

(BTW should body be the empty byte string above?)

Simon Pieters
Opera Software

More information about the whatwg mailing list