@@ -219,10 +219,7 @@ function handleRequest(req, res) {
219219 u = url . parse ( req . url , true ) ;
220220 }
221221 var content = getHttpContent ( u . pathname ) ;
222- var push , push1 , push1a , push2 , push3 ;
223-
224- // PushService tests.
225- var pushPushServer1 , pushPushServer2 , pushPushServer3 , pushPushServer4 ;
222+ var push ;
226223
227224 function createCNameContent ( payload ) {
228225 let packet = dnsPacket . decode ( payload ) ;
@@ -615,104 +612,6 @@ function handleRequest(req, res) {
615612 return ;
616613 } else if ( u . pathname === "/cookie_crumbling" ) {
617614 res . setHeader ( "X-Received-Header-Pairs" , JSON . stringify ( decompressedPairs ) ) ;
618- } else if ( u . pathname === "/push" ) {
619- push = res . push ( "/push.js" ) ;
620- push . writeHead ( 200 , {
621- "content-type" : "application/javascript" ,
622- pushed : "yes" ,
623- "content-length" : 11 ,
624- "X-Connection-Http2" : "yes" ,
625- } ) ;
626- push . end ( "// comments" ) ;
627- content = '<head> <script src="push.js"/></head>body text' ;
628- } else if ( u . pathname === "/push.js" ) {
629- content = "// comments" ;
630- res . setHeader ( "pushed" , "no" ) ;
631- } else if ( u . pathname === "/push2" ) {
632- push = res . push ( "/push2.js" ) ;
633- push . writeHead ( 200 , {
634- "content-type" : "application/javascript" ,
635- pushed : "yes" ,
636- // no content-length
637- "X-Connection-Http2" : "yes" ,
638- } ) ;
639- push . end ( "// comments" ) ;
640- content = '<head> <script src="push2.js"/></head>body text' ;
641- } else if ( u . pathname === "/push5" ) {
642- push = res . push ( "/push5.js" ) ;
643- push . writeHead ( 200 , {
644- "content-type" : "application/javascript" ,
645- pushed : "yes" ,
646- // no content-length
647- "X-Connection-Http2" : "yes" ,
648- } ) ;
649- content = generateContent ( 1024 * 150 ) ;
650- push . write ( content ) ;
651- push . end ( ) ;
652- content = '<head> <script src="push5.js"/></head>body text' ;
653- } else if ( u . pathname === "/pushapi1" ) {
654- push1 = res . push ( {
655- hostname : "localhost:" + serverPort ,
656- port : serverPort ,
657- path : "/pushapi1/1" ,
658- method : "GET" ,
659- headers : { "x-pushed-request" : "true" , "x-foo" : "bar" } ,
660- } ) ;
661- push1 . writeHead ( 200 , {
662- pushed : "yes" ,
663- "content-length" : 1 ,
664- subresource : "1" ,
665- "X-Connection-Http2" : "yes" ,
666- } ) ;
667- push1 . end ( "1" ) ;
668-
669- push1a = res . push ( {
670- hostname : "localhost:" + serverPort ,
671- port : serverPort ,
672- path : "/pushapi1/1" ,
673- method : "GET" ,
674- headers : { "x-foo" : "bar" , "x-pushed-request" : "true" } ,
675- } ) ;
676- push1a . writeHead ( 200 , {
677- pushed : "yes" ,
678- "content-length" : 1 ,
679- subresource : "1a" ,
680- "X-Connection-Http2" : "yes" ,
681- } ) ;
682- push1a . end ( "1" ) ;
683-
684- push2 = res . push ( {
685- hostname : "localhost:" + serverPort ,
686- port : serverPort ,
687- path : "/pushapi1/2" ,
688- method : "GET" ,
689- headers : { "x-pushed-request" : "true" } ,
690- } ) ;
691- push2 . writeHead ( 200 , {
692- pushed : "yes" ,
693- subresource : "2" ,
694- "content-length" : 1 ,
695- "X-Connection-Http2" : "yes" ,
696- } ) ;
697- push2 . end ( "2" ) ;
698-
699- push3 = res . push ( {
700- hostname : "localhost:" + serverPort ,
701- port : serverPort ,
702- path : "/pushapi1/3" ,
703- method : "GET" ,
704- headers : { "x-pushed-request" : "true" , "Accept-Encoding" : "br" } ,
705- } ) ;
706- push3 . writeHead ( 200 , {
707- pushed : "yes" ,
708- "content-length" : 6 ,
709- subresource : "3" ,
710- "content-encoding" : "br" ,
711- "X-Connection-Http2" : "yes" ,
712- } ) ;
713- push3 . end ( Buffer . from ( [ 0x8b , 0x00 , 0x80 , 0x33 , 0x0a , 0x03 ] ) ) ; // '3\n'
714-
715- content = "0" ;
716615 } else if ( u . pathname === "/big" ) {
717616 content = generateContent ( 128 * 1024 ) ;
718617 var hash = crypto . createHash ( "md5" ) ;
@@ -1280,43 +1179,6 @@ function handleRequest(req, res) {
12801179 res . writeHead ( 101 ) ;
12811180 res . end ( "something...." ) ;
12821181 return ;
1283- }
1284- // for use with test_dns_by_type_resolve.js
1285- else if ( u . pathname === "/txt-dns-push" ) {
1286- // _esni_push.example.com has A entry 127.0.0.1
1287- let rContent = Buffer . from (
1288- "0000010000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000010001C00C000100010000003700047F000001" ,
1289- "hex"
1290- ) ;
1291-
1292- // _esni_push.example.com has TXT entry 2062586B67646D39705932556761584D6762586B676347467A63336476636D513D
1293- var pcontent = Buffer . from (
1294- "0000818000010001000000000A5F65736E695F70757368076578616D706C6503636F6D0000100001C00C001000010000003700212062586B67646D39705932556761584D6762586B676347467A63336476636D513D" ,
1295- "hex"
1296- ) ;
1297-
1298- push = res . push ( {
1299- hostname : "foo.example.com:" + serverPort ,
1300- port : serverPort ,
1301- path : "/dns-pushed-response?dns=AAABAAABAAAAAAABCl9lc25pX3B1c2gHZXhhbXBsZQNjb20AABAAAQAAKRAAAAAAAAAIAAgABAABAAA" ,
1302- method : "GET" ,
1303- headers : {
1304- accept : "application/dns-message" ,
1305- } ,
1306- } ) ;
1307- push . writeHead ( 200 , {
1308- "content-type" : "application/dns-message" ,
1309- pushed : "yes" ,
1310- "content-length" : pcontent . length ,
1311- "X-Connection-Http2" : "yes" ,
1312- } ) ;
1313- push . end ( pcontent ) ;
1314- res . setHeader ( "Content-Type" , "application/dns-message" ) ;
1315- res . setHeader ( "Content-Length" , rContent . length ) ;
1316- res . writeHead ( 200 ) ;
1317- res . write ( rContent ) ;
1318- res . end ( "" ) ;
1319- return ;
13201182 } else if ( u . pathname === "/.well-known/http-opportunistic" ) {
13211183 res . setHeader ( "Cache-Control" , "no-cache" ) ;
13221184 res . setHeader ( "Content-Type" , "application/json" ) ;
@@ -1334,189 +1196,6 @@ function handleRequest(req, res) {
13341196 res . writeHead ( 200 , "OK" ) ;
13351197 res . end ( "1" ) ;
13361198 return ;
1337- }
1338-
1339- // for PushService tests.
1340- else if ( u . pathname === "/pushSubscriptionSuccess/subscribe" ) {
1341- res . setHeader (
1342- "Location" ,
1343- "https://localhost:" + serverPort + "/pushSubscriptionSuccesss"
1344- ) ;
1345- res . setHeader (
1346- "Link" ,
1347- '</pushEndpointSuccess>; rel="urn:ietf:params:push", ' +
1348- '</receiptPushEndpointSuccess>; rel="urn:ietf:params:push:receipt"'
1349- ) ;
1350- res . writeHead ( 201 , "OK" ) ;
1351- res . end ( "" ) ;
1352- return ;
1353- } else if ( u . pathname === "/pushSubscriptionSuccesss" ) {
1354- // do nothing.
1355- return ;
1356- } else if ( u . pathname === "/pushSubscriptionMissingLocation/subscribe" ) {
1357- res . setHeader (
1358- "Link" ,
1359- '</pushEndpointMissingLocation>; rel="urn:ietf:params:push", ' +
1360- '</receiptPushEndpointMissingLocation>; rel="urn:ietf:params:push:receipt"'
1361- ) ;
1362- res . writeHead ( 201 , "OK" ) ;
1363- res . end ( "" ) ;
1364- return ;
1365- } else if ( u . pathname === "/pushSubscriptionMissingLink/subscribe" ) {
1366- res . setHeader (
1367- "Location" ,
1368- "https://localhost:" + serverPort + "/subscriptionMissingLink"
1369- ) ;
1370- res . writeHead ( 201 , "OK" ) ;
1371- res . end ( "" ) ;
1372- return ;
1373- } else if ( u . pathname === "/pushSubscriptionLocationBogus/subscribe" ) {
1374- res . setHeader ( "Location" , "1234" ) ;
1375- res . setHeader (
1376- "Link" ,
1377- '</pushEndpointLocationBogus; rel="urn:ietf:params:push", ' +
1378- '</receiptPushEndpointLocationBogus>; rel="urn:ietf:params:push:receipt"'
1379- ) ;
1380- res . writeHead ( 201 , "OK" ) ;
1381- res . end ( "" ) ;
1382- return ;
1383- } else if ( u . pathname === "/pushSubscriptionMissingLink1/subscribe" ) {
1384- res . setHeader (
1385- "Location" ,
1386- "https://localhost:" + serverPort + "/subscriptionMissingLink1"
1387- ) ;
1388- res . setHeader (
1389- "Link" ,
1390- '</receiptPushEndpointMissingLink1>; rel="urn:ietf:params:push:receipt"'
1391- ) ;
1392- res . writeHead ( 201 , "OK" ) ;
1393- res . end ( "" ) ;
1394- return ;
1395- } else if ( u . pathname === "/pushSubscriptionMissingLink2/subscribe" ) {
1396- res . setHeader (
1397- "Location" ,
1398- "https://localhost:" + serverPort + "/subscriptionMissingLink2"
1399- ) ;
1400- res . setHeader (
1401- "Link" ,
1402- '</pushEndpointMissingLink2>; rel="urn:ietf:params:push"'
1403- ) ;
1404- res . writeHead ( 201 , "OK" ) ;
1405- res . end ( "" ) ;
1406- return ;
1407- } else if ( u . pathname === "/subscriptionMissingLink2" ) {
1408- // do nothing.
1409- return ;
1410- } else if ( u . pathname === "/pushSubscriptionNot201Code/subscribe" ) {
1411- res . setHeader (
1412- "Location" ,
1413- "https://localhost:" + serverPort + "/subscriptionNot2xxCode"
1414- ) ;
1415- res . setHeader (
1416- "Link" ,
1417- '</pushEndpointNot201Code>; rel="urn:ietf:params:push", ' +
1418- '</receiptPushEndpointNot201Code>; rel="urn:ietf:params:push:receipt"'
1419- ) ;
1420- res . writeHead ( 200 , "OK" ) ;
1421- res . end ( "" ) ;
1422- return ;
1423- } else if ( u . pathname === "/pushNotifications/subscription1" ) {
1424- pushPushServer1 = res . push ( {
1425- hostname : "localhost:" + serverPort ,
1426- port : serverPort ,
1427- path : "/pushNotificationsDeliver1" ,
1428- method : "GET" ,
1429- headers : {
1430- "Encryption-Key" :
1431- 'keyid="notification1"; dh="BO_tgGm-yvYAGLeRe16AvhzaUcpYRiqgsGOlXpt0DRWDRGGdzVLGlEVJMygqAUECarLnxCiAOHTP_znkedrlWoU"' ,
1432- Encryption : 'keyid="notification1";salt="uAZaiXpOSfOLJxtOCZ09dA"' ,
1433- "Content-Encoding" : "aesgcm128" ,
1434- } ,
1435- } ) ;
1436- pushPushServer1 . writeHead ( 200 , {
1437- subresource : "1" ,
1438- } ) ;
1439-
1440- pushPushServer1 . end (
1441- "370aeb3963f12c4f12bf946bd0a7a9ee7d3eaff8f7aec62b530fc25cfa" ,
1442- "hex"
1443- ) ;
1444- return ;
1445- } else if ( u . pathname === "/pushNotifications/subscription2" ) {
1446- pushPushServer2 = res . push ( {
1447- hostname : "localhost:" + serverPort ,
1448- port : serverPort ,
1449- path : "/pushNotificationsDeliver3" ,
1450- method : "GET" ,
1451- headers : {
1452- "Encryption-Key" :
1453- 'keyid="notification2"; dh="BKVdQcgfncpNyNWsGrbecX0zq3eHIlHu5XbCGmVcxPnRSbhjrA6GyBIeGdqsUL69j5Z2CvbZd-9z1UBH0akUnGQ"' ,
1454- Encryption : 'keyid="notification2";salt="vFn3t3M_k42zHBdpch3VRw"' ,
1455- "Content-Encoding" : "aesgcm128" ,
1456- } ,
1457- } ) ;
1458- pushPushServer2 . writeHead ( 200 , {
1459- subresource : "1" ,
1460- } ) ;
1461-
1462- pushPushServer2 . end (
1463- "66df5d11daa01e5c802ff97cdf7f39684b5bf7c6418a5cf9b609c6826c04b25e403823607ac514278a7da945" ,
1464- "hex"
1465- ) ;
1466- return ;
1467- } else if ( u . pathname === "/pushNotifications/subscription3" ) {
1468- pushPushServer3 = res . push ( {
1469- hostname : "localhost:" + serverPort ,
1470- port : serverPort ,
1471- path : "/pushNotificationsDeliver3" ,
1472- method : "GET" ,
1473- headers : {
1474- "Encryption-Key" :
1475- 'keyid="notification3";dh="BD3xV_ACT8r6hdIYES3BJj1qhz9wyv7MBrG9vM2UCnjPzwE_YFVpkD-SGqE-BR2--0M-Yf31wctwNsO1qjBUeMg"' ,
1476- Encryption :
1477- 'keyid="notification3"; salt="DFq188piWU7osPBgqn4Nlg"; rs=24' ,
1478- "Content-Encoding" : "aesgcm128" ,
1479- } ,
1480- } ) ;
1481- pushPushServer3 . writeHead ( 200 , {
1482- subresource : "1" ,
1483- } ) ;
1484-
1485- pushPushServer3 . end (
1486- "2caaeedd9cf1059b80c58b6c6827da8ff7de864ac8bea6d5775892c27c005209cbf9c4de0c3fbcddb9711d74eaeebd33f7275374cb42dd48c07168bc2cc9df63e045ce2d2a2408c66088a40c" ,
1487- "hex"
1488- ) ;
1489- return ;
1490- } else if ( u . pathname == "/pushNotifications/subscription4" ) {
1491- pushPushServer4 = res . push ( {
1492- hostname : "localhost:" + serverPort ,
1493- port : serverPort ,
1494- path : "/pushNotificationsDeliver4" ,
1495- method : "GET" ,
1496- headers : {
1497- "Crypto-Key" :
1498- 'keyid="notification4";dh="BJScXUUTcs7D8jJWI1AOxSgAKkF7e56ay4Lek52TqDlWo1yGd5czaxFWfsuP4j7XNWgGYm60-LKpSUMlptxPFVQ"' ,
1499- Encryption : 'keyid="notification4"; salt="sn9p2QqF3V6KBclda8vx7w"' ,
1500- "Content-Encoding" : "aesgcm" ,
1501- } ,
1502- } ) ;
1503- pushPushServer4 . writeHead ( 200 , {
1504- subresource : "1" ,
1505- } ) ;
1506-
1507- pushPushServer4 . end (
1508- "9eba7ba6192544a39bd9e9b58e702d0748f1776b27f6616cdc55d29ed5a015a6db8f2dd82cd5751a14315546194ff1c18458ab91eb36c9760ccb042670001fd9964557a079553c3591ee131ceb259389cfffab3ab873f873caa6a72e87d262b8684c3260e5940b992234deebf57a9ff3a8775742f3cbcb152d249725a28326717e19cce8506813a155eff5df9bdba9e3ae8801d3cc2b7e7f2f1b6896e63d1fdda6f85df704b1a34db7b2dd63eba11ede154300a318c6f83c41a3d32356a196e36bc905b99195fd91ae4ff3f545c42d17f1fdc1d5bd2bf7516d0765e3a859fffac84f46160b79cedda589f74c25357cf6988cd8ba83867ebd86e4579c9d3b00a712c77fcea3b663007076e21f9819423faa830c2176ff1001c1690f34be26229a191a938517" ,
1509- "hex"
1510- ) ;
1511- return ;
1512- } else if (
1513- u . pathname === "/pushNotificationsDeliver1" ||
1514- u . pathname === "/pushNotificationsDeliver2" ||
1515- u . pathname === "/pushNotificationsDeliver3"
1516- ) {
1517- res . writeHead ( 410 , "GONE" ) ;
1518- res . end ( "" ) ;
1519- return ;
15201199 } else if ( u . pathname === "/illegalhpacksoft" ) {
15211200 // This will cause the compressor to compress a header that is not legal,
15221201 // but only affects the stream, not the session.
@@ -1591,38 +1270,10 @@ function handleRequest(req, res) {
15911270 res . writeHead ( "200 OK" ) ;
15921271 res . end ( content ) ;
15931272 return ;
1594- } else if ( u . pathname === "/doublepush" ) {
1595- push1 = res . push ( "/doublypushed" ) ;
1596- push1 . writeHead ( 200 , {
1597- "content-type" : "text/plain" ,
1598- pushed : "yes" ,
1599- "content-length" : 6 ,
1600- "X-Connection-Http2" : "yes" ,
1601- } ) ;
1602- push1 . end ( "pushed" ) ;
1603-
1604- push2 = res . push ( "/doublypushed" ) ;
1605- push2 . writeHead ( 200 , {
1606- "content-type" : "text/plain" ,
1607- pushed : "yes" ,
1608- "content-length" : 6 ,
1609- "X-Connection-Http2" : "yes" ,
1610- } ) ;
1611- push2 . end ( "pushed" ) ;
16121273 } else if ( u . pathname === "/doublypushed" ) {
16131274 content = "not pushed" ;
16141275 } else if ( u . pathname === "/diskcache" ) {
16151276 content = "this was pulled via h2" ;
1616- } else if ( u . pathname === "/pushindisk" ) {
1617- var pushedContent = "this was pushed via h2" ;
1618- push = res . push ( "/diskcache" ) ;
1619- push . writeHead ( 200 , {
1620- "content-type" : "text/html" ,
1621- pushed : "yes" ,
1622- "content-length" : pushedContent . length ,
1623- "X-Connection-Http2" : "yes" ,
1624- } ) ;
1625- push . end ( pushedContent ) ;
16261277 }
16271278
16281279 // For test_header_Server_Timing.js
0 commit comments