Chromium Code Reviews| Index: net/spdy/spdy_protocol.h |
| =================================================================== |
| --- net/spdy/spdy_protocol.h (revision 125802) |
| +++ net/spdy/spdy_protocol.h (working copy) |
| @@ -141,17 +141,25 @@ |
| // | Certificate | | |
| // +----------------------------------+ <+ |
| // |
| + |
| +namespace { |
| + |
| +// Default SPDY version for unit tests. |
| +const int SPDY_VERSION_FOR_TESTS = 2; |
|
Ryan Hamilton
2012/03/09 19:09:58
Oh, now I see where this is defined. This does no
ramant (doing other things)
2012/03/10 01:14:09
Moved this to forked versions for spdy_framer_test
|
| + |
| +} // namespace |
| + |
| namespace spdy { |
| -// This implementation of Spdy is version 2; It's like version 1, with some |
| -// minor tweaks. |
| +// Default SPDY version. |
| +// TODO(hkhalil): Remove gfe_spdy::kSpdyProtocolVersion |
| const int kSpdyProtocolVersion = 2; |
|
Ryan Hamilton
2012/03/09 19:09:58
Where is this used?
ramant (doing other things)
2012/03/10 01:14:09
Deleted it (and changed all uses of it). Will upst
|
| // Initial window size for a Spdy stream |
| -const size_t kSpdyStreamInitialWindowSize = 64 * 1024; // 64 KBytes |
| +const int32 kSpdyStreamInitialWindowSize = 64 * 1024; // 64 KBytes |
| // Maximum window size for a Spdy stream |
| -const size_t kSpdyStreamMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int |
| +const int32 kSpdyStreamMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int |
| // HTTP-over-SPDY header constants |
| const char kMethod[] = "method"; |
| @@ -162,6 +170,207 @@ |
| // push headers so that the client will know what url the data corresponds to. |
| const char kPath[] = "path"; |
| +// SPDY 2 dictionary. |
| +// This is just a hacked dictionary to use for shrinking HTTP-like headers. |
| +const char kV2Dictionary[] = |
| + "optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-" |
| + "languageauthorizationexpectfromhostif-modified-sinceif-matchif-none-matchi" |
| + "f-rangeif-unmodifiedsincemax-forwardsproxy-authorizationrangerefererteuser" |
| + "-agent10010120020120220320420520630030130230330430530630740040140240340440" |
| + "5406407408409410411412413414415416417500501502503504505accept-rangesageeta" |
| + "glocationproxy-authenticatepublicretry-afterservervarywarningwww-authentic" |
| + "ateallowcontent-basecontent-encodingcache-controlconnectiondatetrailertran" |
| + "sfer-encodingupgradeviawarningcontent-languagecontent-lengthcontent-locati" |
| + "oncontent-md5content-rangecontent-typeetagexpireslast-modifiedset-cookieMo" |
| + "ndayTuesdayWednesdayThursdayFridaySaturdaySundayJanFebMarAprMayJunJulAugSe" |
| + "pOctNovDecchunkedtext/htmlimage/pngimage/jpgimage/gifapplication/xmlapplic" |
| + "ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1" |
| + ".1statusversionurl"; |
| +const int kV2DictionarySize = arraysize(kV2Dictionary); |
| + |
| +// SPDY 3 dictionary. |
| +const char kV3Dictionary[] = { |
| + 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // ....opti |
| + 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // ons....h |
| + 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // ead....p |
| + 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // ost....p |
| + 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // ut....de |
| + 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // lete.... |
| + 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // trace... |
| + 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // .accept. |
| + 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep |
| + 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // t-charse |
| + 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, // t....acc |
| + 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ept-enco |
| + 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, // ding.... |
| + 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, // accept-l |
| + 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, // anguage. |
| + 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, // ...accep |
| + 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, // t-ranges |
| + 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, // ....age. |
| + 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, // ...allow |
| + 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, // ....auth |
| + 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, // orizatio |
| + 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, // n....cac |
| + 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, // he-contr |
| + 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, // ol....co |
| + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // nnection |
| + 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, // ....cont |
| + 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, // ent-base |
| + 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, // ....cont |
| + 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // ent-enco |
| + 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, // ding.... |
| + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, // content- |
| + 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, // language |
| + 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, // ....cont |
| + 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, // ent-leng |
| + 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, // th....co |
| + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, // ntent-lo |
| + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // cation.. |
| + 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten |
| + 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, // t-md5... |
| + 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, // .content |
| + 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, // -range.. |
| + 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // ..conten |
| + 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // t-type.. |
| + 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, // ..date.. |
| + 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, // ..etag.. |
| + 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, // ..expect |
| + 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, // ....expi |
| + 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, // res....f |
| + 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, // rom....h |
| + 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, // ost....i |
| + 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, // f-match. |
| + 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, // ...if-mo |
| + 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, // dified-s |
| + 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, // ince.... |
| + 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, // if-none- |
| + 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, // match... |
| + 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, // .if-rang |
| + 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, // e....if- |
| + 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, // unmodifi |
| + 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, // ed-since |
| + 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, // ....last |
| + 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, // -modifie |
| + 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, // d....loc |
| + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // ation... |
| + 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, // .max-for |
| + 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, // wards... |
| + 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, // .pragma. |
| + 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, // ...proxy |
| + 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, // -authent |
| + 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, // icate... |
| + 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, // .proxy-a |
| + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, // uthoriza |
| + 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // tion.... |
| + 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, // range... |
| + 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, // .referer |
| + 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, // ....retr |
| + 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, // y-after. |
| + 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, // ...serve |
| + 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, // r....te. |
| + 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, // ...trail |
| + 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, // er....tr |
| + 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, // ansfer-e |
| + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, // ncoding. |
| + 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, // ...upgra |
| + 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, // de....us |
| + 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, // er-agent |
| + 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, // ....vary |
| + 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, // ....via. |
| + 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, // ...warni |
| + 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, // ng....ww |
| + 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, // w-authen |
| + 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, // ticate.. |
| + 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, // ..method |
| + 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, // ....get. |
| + 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, // ...statu |
| + 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, // s....200 |
| + 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, // .OK....v |
| + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ersion.. |
| + 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, // ..HTTP.1 |
| + 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, // .1....ur |
| + 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, // l....pub |
| + 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, // lic....s |
| + 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, // et-cooki |
| + 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, // e....kee |
| + 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, // p-alive. |
| + 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, // ...origi |
| + 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, // n1001012 |
| + 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, // 01202205 |
| + 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, // 20630030 |
| + 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, // 23033043 |
| + 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, // 05306307 |
| + 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, // 40240540 |
| + 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, // 64074084 |
| + 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, // 09410411 |
| + 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, // 41241341 |
| + 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, // 44154164 |
| + 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, // 17502504 |
| + 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, // 505203.N |
| + 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, // on-Autho |
| + 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, // ritative |
| + 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, // .Informa |
| + 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, // tion204. |
| + 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, // No.Conte |
| + 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, // nt301.Mo |
| + 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, // ved.Perm |
| + 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, // anently4 |
| + 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, // 00.Bad.R |
| + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, // equest40 |
| + 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, // 1.Unauth |
| + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, // orized40 |
| + 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, // 3.Forbid |
| + 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, // den404.N |
| + 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, // ot.Found |
| + 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, // 500.Inte |
| + 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, // rnal.Ser |
| + 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, // ver.Erro |
| + 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, // r501.Not |
| + 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, // .Impleme |
| + 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, // nted503. |
| + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, // Service. |
| + 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, // Unavaila |
| + 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, // bleJan.F |
| + 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, // eb.Mar.A |
| + 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, // pr.May.J |
| + 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, // un.Jul.A |
| + 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, // ug.Sept. |
| + 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, // Oct.Nov. |
| + 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, // Dec.00.0 |
| + 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, // 0.00.Mon |
| + 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, // ..Tue..W |
| + 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, // ed..Thu. |
| + 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, // .Fri..Sa |
| + 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, // t..Sun.. |
| + 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, // GMTchunk |
| + 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, // ed.text. |
| + 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, // html.ima |
| + 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, // ge.png.i |
| + 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, // mage.jpg |
| + 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, // .image.g |
| + 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // if.appli |
| + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x |
| + 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // ml.appli |
| + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // cation.x |
| + 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, // html.xml |
| + 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, // .text.pl |
| + 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, // ain.text |
| + 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, // .javascr |
| + 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, // ipt.publ |
| + 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, // icprivat |
| + 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, // emax-age |
| + 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, // .gzip.de |
| + 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, // flate.sd |
| + 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // chcharse |
| + 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, // t.utf-8c |
| + 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, // harset.i |
| + 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, // so-8859- |
| + 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, // 1.utf-.. |
| + 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e // .enq.0. |
| +}; |
| +const int kV3DictionarySize = arraysize(kV3Dictionary); |
| + |
| // Note: all protocol data structures are on-the-wire format. That means that |
| // data is stored in network-normalized order. Readers must use the |
| // accessors provided or call ntohX() functions. |
| @@ -172,7 +381,7 @@ |
| SYN_REPLY, |
| RST_STREAM, |
| SETTINGS, |
| - NOOP, |
| + NOOP, // No longer valid kept for identifiability/enum order. |
|
Ryan Hamilton
2012/03/09 19:09:58
This class is shared between spdy 2 and spdy 3, so
ramant (doing other things)
2012/03/10 01:14:09
Done.
|
| PING, |
| GOAWAY, |
| HEADERS, |
| @@ -239,7 +448,9 @@ |
| // A SPDY stream id is a 31 bit entity. |
| typedef uint32 SpdyStreamId; |
| -// A SPDY priority is a number between 0 and 3 (inclusive). |
| +// A SPDY priority is a number between 0 and 7 (inclusive). |
| +// SPDY priority range is version-dependant. For SPDY 2 and below, priority is a |
| +// number between 0 and 3. |
| typedef uint8 SpdyPriority; |
| // SPDY Priorities. (there are only 2 bits) |
| @@ -285,7 +496,6 @@ |
| // A SYN_REPLY Control Frame structure. |
| struct SpdySynReplyControlFrameBlock : SpdyFrameBlock { |
| SpdyStreamId stream_id_; |
| - uint16 unused_; |
| }; |
| // A RST_STREAM Control Frame structure. |
| @@ -300,15 +510,12 @@ |
| // Variable data here. |
| }; |
| -// A NOOP Control Frame structure. |
| -struct SpdyNoopControlFrameBlock : SpdyFrameBlock { |
| -}; |
| - |
| // A PING Control Frame structure. |
| struct SpdyPingControlFrameBlock : SpdyFrameBlock { |
| uint32 unique_id_; |
| }; |
| +// TODO(avd): remove this struct |
| // A CREDENTIAL Control Frame structure. |
| struct SpdyCredentialControlFrameBlock : SpdyFrameBlock { |
| uint16 slot_; |
| @@ -326,7 +533,6 @@ |
| // A HEADERS Control Frame structure. |
| struct SpdyHeadersControlFrameBlock : SpdyFrameBlock { |
| SpdyStreamId stream_id_; |
| - uint16 unused_; |
| }; |
| // A WINDOW_UPDATE Control Frame structure |
| @@ -335,22 +541,6 @@ |
| uint32 delta_window_size_; |
| }; |
| -// A structure for the 8 bit flags and 24 bit ID fields. |
| -union SettingsFlagsAndId { |
| - // Sets both flags and id to the value for flags-and-id as sent over the wire |
| - SettingsFlagsAndId(uint32 val) : id_(val) {} |
| - uint8 flags() const { return flags_[0]; } |
| - void set_flags(uint8 flags) { flags_[0] = flags; } |
| - uint32 id() const { return (ntohl(id_) & kSettingsIdMask); } |
| - void set_id(uint32 id) { |
| - DCHECK_EQ(0u, (id & ~kSettingsIdMask)); |
| - id_ = htonl((flags() << 24) | (id & kSettingsIdMask)); |
| - } |
| - |
| - uint8 flags_[4]; // 8 bits |
| - uint32 id_; // 24 bits |
| -}; |
| - |
| #pragma pack(pop) |
| // ------------------------------------------------------------------------- |
| @@ -467,7 +657,9 @@ |
| bool AppearsToBeAValidControlFrame() const { |
| // Right now we only check if the frame has an out-of-bounds type. |
| uint16 type = ntohs(block()->control_.type_); |
| - return (type >= SYN_STREAM && type < NUM_CONTROL_FRAME_TYPES); |
| + return type >= SYN_STREAM && |
| + type < NUM_CONTROL_FRAME_TYPES && |
| + type != NOOP; // NOOP is not a 'valid' control frame. |
|
Ryan Hamilton
2012/03/09 19:09:58
NOOP is valid in SPDY/2
ramant (doing other things)
2012/03/10 01:14:09
Will do the "type != NOOP" test if version !=2. Th
|
| } |
| uint16 version() const { |
| @@ -476,13 +668,15 @@ |
| } |
| void set_version(uint16 version) { |
| - DCHECK_EQ(0u, version & kControlFlagMask); |
| - mutable_block()->control_.version_ = htons(kControlFlagMask | version); |
| + const uint16 kControlBit = 0x80; |
| + DCHECK_EQ(0, version & kControlBit); |
| + mutable_block()->control_.version_ = kControlBit | htons(version); |
| } |
| SpdyControlType type() const { |
| uint16 type = ntohs(block()->control_.type_); |
| - DCHECK(type >= SYN_STREAM && type < NUM_CONTROL_FRAME_TYPES); |
| + LOG_IF(DFATAL, type < SYN_STREAM || type >= NUM_CONTROL_FRAME_TYPES) |
| + << "Invalid control frame type " << type; |
| return static_cast<SpdyControlType>(type); |
| } |
| @@ -497,15 +691,6 @@ |
| return type() == SYN_STREAM || type() == SYN_REPLY || type() == HEADERS; |
| } |
| - // The size of the 'Number of Name/Value pairs' field in a Name/Value block. |
| - static const size_t kNumNameValuePairsSize = 2; |
| - |
| - // The size of the 'Length of a name' field in a Name/Value block. |
| - static const size_t kLengthOfNameSize = 2; |
| - |
| - // The size of the 'Length of a value' field in a Name/Value block. |
| - static const size_t kLengthOfValueSize = 2; |
| - |
| private: |
| const struct SpdyFrameBlock* block() const { |
| return frame_; |
| @@ -540,7 +725,11 @@ |
| } |
| SpdyPriority priority() const { |
| - return (block()->priority_ & kPriorityMask) >> 6; |
| + if (version() < 3) { |
| + return (block()->priority_ & kSpdy2PriorityMask) >> 6; |
| + } else { |
| + return (block()->priority_ & kSpdy3PriorityMask) >> 5; |
| + } |
| } |
| // The number of bytes in the header block beyond the frame header length. |
| @@ -582,11 +771,21 @@ |
| } |
| int header_block_len() const { |
| - return length() - (size() - SpdyFrame::kHeaderSize); |
| + size_t header_block_len = length() - (size() - SpdyFrame::kHeaderSize); |
| + // SPDY 2 had 2 bytes of unused space preceeding the header block. |
| + if (version() < 3) { |
| + header_block_len -= 2; |
| + } |
| + return header_block_len; |
| } |
| const char* header_block() const { |
| - return reinterpret_cast<const char*>(block()) + size(); |
| + const char* header_block = reinterpret_cast<const char*>(block()) + size(); |
| + // SPDY 2 had 2 bytes of unused space preceeding the header block. |
| + if (version() < 3) { |
| + header_block += 2; |
| + } |
| + return header_block; |
| } |
| // Returns the size of the SpdySynReplyControlFrameBlock structure. |
| @@ -680,15 +879,6 @@ |
| DISALLOW_COPY_AND_ASSIGN(SpdySettingsControlFrame); |
| }; |
| -class SpdyNoOpControlFrame : public SpdyControlFrame { |
| - public: |
| - SpdyNoOpControlFrame() : SpdyControlFrame(size()) {} |
| - SpdyNoOpControlFrame(char* data, bool owns_buffer) |
| - : SpdyControlFrame(data, owns_buffer) {} |
| - |
| - static size_t size() { return sizeof(SpdyNoopControlFrameBlock); } |
| -}; |
| - |
| class SpdyPingControlFrame : public SpdyControlFrame { |
| public: |
| SpdyPingControlFrame() : SpdyControlFrame(size()) {} |
| @@ -776,11 +966,21 @@ |
| // The number of bytes in the header block beyond the frame header length. |
| int header_block_len() const { |
| - return length() - (size() - SpdyFrame::kHeaderSize); |
| + size_t header_block_len = length() - (size() - SpdyFrame::kHeaderSize); |
| + // SPDY 2 had 2 bytes of unused space preceeding the header block. |
| + if (version() < 3) { |
| + header_block_len -= 2; |
| + } |
| + return header_block_len; |
| } |
| const char* header_block() const { |
| - return reinterpret_cast<const char*>(block()) + size(); |
| + const char* header_block = reinterpret_cast<const char*>(block()) + size(); |
| + // SPDY 2 had 2 bytes of unused space preceeding the header block. |
| + if (version() < 3) { |
| + header_block += 2; |
| + } |
| + return header_block; |
| } |
| // Returns the size of the SpdyHeadersControlFrameBlock structure. |