Skip to main content

The secret message hidden in every HTTP/2 connection

If you spy on an HTTP/2 connection starting up you'll notice that it sends an almost-but-not-quite valid HTTP request at the very start of the connection. Like this:


Written a little more clearly that's:

    PRI * HTTP2.0

    SM

The HTTP verb is PRI and the body contains just SM. Put them together and you get... PRISM. This occurs right at the start of the connection to ensure that the server really supports HTTP/2.0. It is detailed in Section 3.5 of RFC7540 as follows:

   In HTTP/2, each endpoint is required to send a connection preface as
   a final confirmation of the protocol in use and to establish the
   initial settings for the HTTP/2 connection.  The client and server
   each send a different connection preface.

   The client connection preface starts with a sequence of 24 octets,
   which in hex notation is:

     0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a

   That is, the connection preface starts with the string "PRI *
   HTTP/2.0\r\n\r\nSM\r\n\r\n").

I tried to find an explanation of the specific letters used and why they spell PRISM. After a bit of spelunking the following comes to light.

May 29, 2013
IETF draft-ietf-httpbis-http2-03 describes this connection mechanism and indicates that the string to send is FOO * HTTP/2.0\r\n\r\nBA\r\n\r\n.

July 8, 2013
IETF draft-ietf-httpbis-http2-04 changes the string to PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n.

Strange. 

I wonder what happened between May 29, 2013 and July 8, 2013? Could it be "U.S., British intelligence mining data from nine U.S. Internet companies in broad secret program"?

Thanks to this comment on Hacker News here's the actual commit that introduced this change. On June 14, 2013 the string was changed with the comment "Exercising editorial discretion regarding magic."

Comments

Chester said…
Interesting. It seems to have been noticed before in https://html5experts.jp/jovi0608/1622/ - you can Google Translate and search for "PRI SM" that they notice the pun to be related to the (then) recent Snowden disclosure, emphasizing its provisory aspect (it may be anything that is *not* valid non-HTTP/2 server) and even dismisses further discussion on that as "bikeshedding". Since provisory names tend to stick, I will not be surprised if this indeed becomes the norm...
mnot said…
We needed two pseudo-HTTP requests for the "magic" to assure it wasn't being interpreted as HTTP/1; I'd done runs across something like 2% of the HTTP servers on the Internet and found that that form failed most reliably.

In the SF meeting at Twitter HQ, we were trying to nail this down; see Originally, we were looking at "STA" and "RT .

However, PRISM had just broken, and it was all that was being discussed in the hallway. People were pissed. It didn't get into the minutes, but it came up as an idea to replace START since it had five letters, and people were unlikely to every want a "PRI" or "SM" method.

Since this was effectively a bikeshed painting exercise, we let Martin determine the result using editorial discretion; although it doesn't get into the minutes, it was pretty clear that people were OK with this (since it was split into two, it was pretty harmless anyway).

Later, over dinner at the Zurich F2F, a number of people thought it would be good to replace "GOAWAY" with "GTFO" (after WAY too much fondue). That application of editorial discretion go so well in the end.

This is all from my quite fallible memory, YMMV.
Matty K said…
Everyone knows Martin is Illuminati, why else would he be allowed on the internet with that accent?

But more seriously, I had a bit of a whinge on my blog around that time wherein I compared it to a crude phallic graffito scrawled on the side of a bike shed. I ended with:

But I can't complain, because that would be "bike shedding." Surely there must come a point where the colour of the shed is important. Trivial details in a spec are still details in the spec, and this one is part of a MUST-level interop requirement, so absolutely everyone who implements or interacts with HTTP/2 is going to have to reproduce (or at least look at) that c**k-and-balls every time they delve into the spec.

So, a question: do bike-shedding details ever become important? And if so, when?

No one ever answered, so I still don't know.

Popular posts from this blog

Your last name contains invalid characters

My last name is "Graham-Cumming". But here's a typical form response when I enter it: Does the web site have any idea how rude it is to claim that my last name contains invalid characters? Clearly not. What they actually meant is: our web site will not accept that hyphen in your last name. But do they say that? No, of course not. They decide to shove in my face the claim that there's something wrong with my name. There's nothing wrong with my name, just as there's nothing wrong with someone whose first name is Jean-Marie, or someone whose last name is O'Reilly. What is wrong is that way this is being handled. If the system can't cope with non-letters and spaces it needs to say that. How about the following error message: Our system is unable to process last names that contain non-letters, please replace them with spaces. Don't blame me for having a last name that your system doesn't like, whose fault is that? Saying "Your

All the symmetrical watch faces (and code to generate them)

If you ever look at pictures of clocks and watches in advertising they are set to roughly 10:10 which is meant to be the most attractive (smiling!) position for the hands . They are actually set to 10:09.14 if the hands are truly symmetrical. CC BY 2.0 image by Shinji I wanted to know what all the possible symmetrical watch faces are and so I wrote some code using Processing. Here's the output (there's one watch face missing, 00:00 or 12:00, because it's very boring): The key to writing this is to figure out the relationship between the hour and minute hands when the watch face is symmetrical. In an hour the minute hand moves through 360° and the hour hand moves through 30° (12 hours are shown on the watch face and 360/12 = 30). The core loop inside the program is this:   for (int h = 0; h <= 12; h++) {     float m = (360-30*float(h))*2/13;     int s = round(60*(m-floor(m)));     int col = h%6;     int row = floor(h/6);     draw_clock((r+f)*(2*col+1), (r+f)*(row*2+1),

The Elevator Button Problem

User interface design is hard. It's hard because people perceive apparently simple things very differently. For example, take a look at this interface to an elevator: From flickr Now imagine the following situation. You are on the third floor of this building and you wish to go to the tenth. The elevator is on the fifth floor and there's an indicator that tells you where it is. Which button do you press? Most people probably say: "press up" since they want to go up. Not long ago I watched someone do the opposite and questioned them about their behavior. They said: "well the elevator is on the fifth floor and I am on the third, so I want it to come down to me". Much can be learnt about the design of user interfaces by considering this, apparently, simple interface. If you think about the elevator button problem you'll find that something so simple has hidden depths. How do people learn about elevator calling? What's the right amount of