Subject: IPP>PRO Magic Numbers in ipp-messages

From: Carl Kugler <[email-masked]>
Date: Thu, 16 Oct 1997 12:22:47 -0400

I'd like to propose a change to the IPP encoding that would allow more robust
implementations in a world of buggy HTTP implementations.  Specifically, I
propose adding a magic number at the beginning of the ipp-message:

  ipp-message = ipp-request / ipp-response
  ipp-request = magic-number version operation
           *(xxx-attributes-tag  xxx-attribute-sequence) data-tag data
  ipp-response = magic-number version status-code
           *(xxx-attributes-tag xxx-attribute-sequence)  data-tag  data

  magic-number = %x3f2c59d1  ;Literal 4 byte value to be
                             ;defined by the protocol specification

Why would this be a useful addition to the protocol?  Take the example of an
IPP client reading a ipp-response.  The client can check the beginning of the
entity-body for the magic-number.  If there is a mismatch, it's not safe to
proceed with parsing the rest of the entity body, and the client should raise
some kind of protocol exception.  It might be worth scanning a few bytes along
in the data stream looking for the magic-number in case a buggy HTTP transport
layer has, say, inserted an extra CRLF after the message-header.

This kind of sanity check is difficult to apply to the protocol stream as it's
defined today, for example (pulled from the INTERNET-DRAFT IPP/1.0: Protocol
Specification   September 29, 1997):

The following is the beginning of an example of a Print-Job request:

Octets                Symbolic Value       Protocol field

0x0100                1.0                  version
0x0002                PrintJob             operation
0x01                  start operation-     operation-attributes tag
                      attributes
...

Instead, I'd like to see this:

Octets                Symbolic Value       Protocol field

0x3f2c59d1                           magic-number
0x0100                1.0                  version
0x0002                PrintJob             operation
0x01                  start operation-     operation-attributes tag
                      attributes
...

I've seen this kind of thing done before, for example, in graphics interchange
formats and various APIs. Unnecessary in theory, but a practical way to add
some robustness.

Carl Kugler
IBM
[email-masked]
303-924-5060