[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
[0354]
[0355]
[0356]
[0357]
[0358]
[0359]
[0360]
[0361]
[0362]
[0363]
[0364]
[0365]
[0366]
[0367]
[0368]
[0369]
[0370]
[0371]
[0372]
[0373]
[0374]
[0375]
[0376]
[0377]
[0378]
[0379]
[0380]
[0381]
[0382]
[0383]
[0384]
[0385]
[0386]
[0387]
[0388]
[0389]
[0390]
[0391]
[0392]
[0393]
[0394]
[0395]
[0396]
[0397]
[0398]
[0399]
[0400]
[0401]
[0402]
[0403]
[0404]
[0405]
[0406]
[0407]
[0408]
[0409]
[0410]
[0411]
[0412]
[0413]
[0414]
[0415]
[0416]
[0417]
[0418]
[0419]
[0420]
[0421]
[0422]
[0423]
[0424]
[0425]
[0426]
[0427]
[0428]
[0429]
[0430]
[0431]
[0432]
[0433]
[0434]
[0435]
[0436]
[0437]
[0438]
[0439]
[0440]
[0441]
[0442]
[0443]
[0444]
[0445]
[0446]
[0447]
[0448]
[0449]
[0450]
[0451]
[0452]
[0453]
[0454]
[0455]
[0456]
[0457]
[0458]
[0459]
[0460]
[0461]
[0462]
[0463]
[0464]
[0465]
[0466]
[0467]
[0468]
[0469]
[0470]
[0471]
[0472]
[0473]
[0474]
[0475]
[0476]
[0477]
[0478]
[0479]
[0480]
[0481]
[0482]
[0483]
[0484]
[0485]
[0486]
[0487]
[0488]
[0489]
[0490]
[0491]
[0492]
[0493]
[0494]
[0495]
[0496]
[0497]
[0498]
[0499]
[0500]
[0501]
[0502]
[0503]
[0504]
[0505]
[0506]
[0507]
[0508]
[0509]
[0510]
[0511]
[0512]
[0513]
[0514]
[0515]
[0516]
[0517]
[0518]
[0519]
[0520]
[0521]
[0522]
[0523]
[0524]
[0525]
[0526]
[0527]
[0528]
[0529]
[0530]
[0531]
[0532]
[0533]
[0534]
[0535]
[0536]
[0537]
[0538]
[0539]
[0540]
[0541]
[0542]
[0543]
[0544]
[0545]
[0546]
[0547]
[0548]
[0549]
[0550]
[0551]
[0552]
[0553]
[0554]
[0555]
[0556]
[0557]
[0558]
[0559]
[0560]
[0561]
[0562]
[0563]
[0564]
[0565]
[0566]
[0567]
[0568]
[0569]
[0570]
[0571]
[0572]
[0573]
[0574]
[0575]
[0576]
[0577]
[0578]
[0579]
[0580]
[0581]
[0582]
[0583]
[0584]
[0585]
[0586]
[0587]
[0588]
[0589]
[0590]
[0591]
[0592]
[0593]
[0594]
[0595]
[0596]
[0597]
[0598]
[0599]
[0600]
[0601]
[0602]
[0603]
[0604]
[0605]
[0606]
[0607]
[0608]
[0609]
[0610]
[0611]
[0612]
[0613]
[0614]
[0615]
[0616]
[0617]
[0618]
[0619]
[0620]
[0621]
[0622]
[0623]
[0624]
[0625]
[0626]
[0627]
[0628]
[0629]
[0630]
[0631]
[0632]
[0633]
[0634]
[0635]
[0636]
[0637]
[0638]
[0639]
[0640]
[0641]
[0642]
[0643]
[0644]
[0645]
[0646]
[0647]
[0648]
[0649]
[0650]
[0651]
[0652]
[0653]
[0654]
[0655]
[0656]
[0657]
[0658]
[0659]
[0660]
[0661]
[0662]
[0663]
[0664]
[0665]
[0666]
[0667]
[0668]
[0669]
[0670]
[0671]
[0672]
[0673]
[0674]
[0675]
[0676]
[0677]
[0678]
[0679]
[0680]
[0681]
[0682]
[0683]
[0684]
[0685]
[0686]
[0687]
[0688]
[0689]
[0690]
[0691]
[0692]
[0693]
[0694]
[0695]
[0696]
[0697]
[0698]
[0699]
[0700]
[0701]
[0702]
[0703]
[0704]
[0705]
[0706]
[0707]
[0708]
[0709]
[0710]
[0711]
[0712]
[0713]
[0714]
[0715]
[0716]
[0717]
[0718]
[0719]
[0720]
[0721]
[0722]
[0723]
[0724]
[0725]
[0726]
[0727]
[0728]
[0729]
[0730]
[0731]
[0732]
[0733]
[0734]
[0735]
[0736]
[0737]
[0738]
[0739]
[0740]
[0741]
[0742]
[0743]
[0744]
[0745]
[0746]
[0747]
[0748]
[0749]
[0750]
[0751]
[0752]
[0753]
[0754]
[0755]
[0756]
[0757]
[0758]
[0759]
[0760]
[0761]
[0762]
[0763]
[0764]
[0765]
[0766]
[0767]
[0768]
[0769]
[0770]
[0771]
[0772]
[0773]
[0774]
[0775]
[0776]
[0777]
[0778]
[0779]
[0780]
[0781]
[0782]
[0783]
[0784]
[0785]
[0786]
[0787]
[0788]
[0789]
[0790]
[0791]
[0792]
[0793]
[0794]
[0795]
[0796]
[0797]
[0798]
[0799]
[0800]
[0801]
[0802]
[0803]
[0804]
[0805]
[0806]
[0807]
[0808]
[0809]
[0810]
[0811]
[0812]
[0813]
[0814]
[0815]
[0816]
[0817]
[0818]
[0819]
[0820]
[0821]
[0822]
[0823]
[0824]
[0825]
[0826]
[0827]
[0828]
[0829]
[0830]
[0831]
[0832]
[0833]
[0834]
[0835]
[0836]
[0837]
[0838]
[0839]
[0840]
[0841]
[0842]
[0843]
[0844]
[0845]
[0846]
[0847]
[0848]
[0849]
[0850]
[0851]
[0852]
[0853]
[0854]
[0855]
[0856]
[0857]
[0858]
[0859]
[0860]
[0861]
[0862]
[0863]
[0864]
[0865]
[0866]
[0867]
[0868]
[0869]
[0870]
[0871]
[0872]
[0873]
[0874]
[0875]
[0876]
[0877]
[0878]
[0879]
[0880]
[0881]
[0882]
[0883]
[0884]
[0885]
[0886]
[0887]
[0888]
[0889]
[0890]
[0891]
[0892]
[0893]
[0894]
[0895]
[0896]
[0897]
[0898]
[0899]
[0900]
[0901]
[0902]
[0903]
[0904]
[0905]
[0906]
[0907]
[0908]
[0909]
[0910]
[0911]
[0912]
[0913]
[0914]
[0915]
[0916]
[0917]
[0918]
[0919]
[0920]
[0921]
[0922]
[0923]
[0924]
[0925]
[0926]
[0927]
[0928]
[0929]
[0930]
[0931]
[0932]
[0933]
[0934]
[0935]
[0936]
[0937]
[0938]
[0939]
[0940]
[0941]
[0942]
[0943]
[0944]
[0945]
[0946]
[0947]
[0948]
[0949]
[0950]
[0951]
[0952]
[0953]
[0954]
[0955]
[0956]
[0957]
[0958]
[0959]
[0960]
[0961]
[0962]
[0963]
[0964]
[0965]
[0966]
[0967]
[0968]
[0969]
[0970]
[0971]
[0972]
[0973]
[0974]
[0975]
[0976]
[0977]
[0978]
[0979]
[0980]
[0981]
[0982]
[0983]
[0984]
[0985]
[0986]
[0987]
[0988]
[0989]
[0990]
[0991]
[0992]
[0993]
[0994]
[0995]
[0996]
[0997]
[0998]
[0999]
[1000]
[1001]
[1002]
[1003]
[1004]
[1005]
[1006]
[1007]
[1008]
[1009]
[1010]
[1011]
[1012]
[1013]
[1014]
[1015]
[1016]
[1017]
[1018]
[1019]
[1020]
[1021]
[1022]
[1023]
[1024]
[1025]
[1026]
[1027]
[1028]
[1029]
[1030]
[1031]
[1032]
[1033]
[1034]
[1035]
[1036]
[1037]
[1038]
[1039]
[1040]
[1041]
[1042]
[1043]
[1044]
[1045]
[1046]
[1047]
[1048]
[1049]
[1050]
[1051]
[1052]
[1053]
[1054]
[1055]
[1056]
[1057]
[1058]
[1059]
[1060]
[1061]
[1062]
[1063]
[1064]
[1065]
[1066]
[1067]
[1068]
[1069]
[1070]
[1071]
[1072]
[1073]
[1074]
[1075]
[1076]
[1077]
[1078]
[1079]
[1080]
[1081]
[1082]
[1083]
[1084]
[1085]
[1086]
[1087]
[1088]
[1089]
[1090]
[1091]
[1092]
[1093]
[1094]
[1095]
[1096]
[1097]
[1098]
[1099]
[1100]
[1101]
[1102]
[1103]
[1104]
[1105]
[1106]
[1107]
[1108]
[1109]
[1110]
[1111]
[1112]
[1113]
[1114]
[1115]
[1116]
[1117]
[1118]
[1119]
[1120]
[1121]
[1122]
[1123]
[1124]
[1125]
[1126]
[1127]
[1128]
[1129]
[1130]
[1131]
[1132]
[1133]
[1134]
[1135]
[1136]
[1137]
[1138]
[1139]
[1140]
[1141]
[1142]
[1143]
[1144]
[1145]
[1146]
[1147]
[1148]
[1149]
[1150]
[1151]
[1152]
[1153]
[1154]
[1155]
[1156]
[1157]
[1158]
[1159]
[1160]
[1161]
[1162]
[1163]
[1164]
[1165]
[1166]
[1167]
[1168]
[1169]
[1170]
[1171]
[1172]
[1173]
[1174]
[1175]
[1176]
[1177]
[1178]
[1179]
[1180]
[1181]
[1182]
[1183]
[1184]
[1185]
[1186]
[1187]
[1188]
[1189]
[1190]
[1191]
[1192]
[1193]
[1194]
[1195]
[1196]
[1197]
[1198]
[1199]
[1200]
[1201]
[1202]
[1203]
[1204]
[1205]
[1206]
[1207]
[1208]
[1209]
[1210]
[1211]
[1212]
[1213]
[1214]
[1215]
[1216]
[1217]
[1218]
[1219]
[1220]
[1221]
[1222]
[1223]
[1224]
[1225]
[1226]
[1227]
[1228]
[1229]
[1230]
[1231]
[1232]
[1233]
[1234]
[1235]
[1236]
[1237]
[1238]
[1239]
[1240]
[1241]
[1242]
[1243]
[1244]
[1245]
[1246]
[1247]
[1248]
[1249]
[1250]
[1251]
[1252]
[1253]
[1254]
[1255]
[1256]
[1257]
[1258]
[1259]
[1260]
[1261]
[1262]
[1263]
[1264]
[1265]
[1266]
[1267]
[1268]
[1269]
[1270]
[1271]
[1272]
[1273]
[1274]
[1275]
[1276]
[1277]
[1278]
[1279]
[1280]
[1281]
[1282]
[1283]
[1284]
[1285]
[1286]
[1287]
[1288]
[1289]
[1290]
[1291]
[1292]
[1293]
[1294]
[1295]
[1296]
[1297]
[1298]
[1299]
[1300]
[1301]
[1302]
[1303]
[1304]
[1305]
[1306]
[1307]
[1308]
[1309]
[1310]
[1311]
[1312]
[1313]
[1314]
[1315]
[1316]
[1317]
[1318]
[1319]
[1320]
[1321]
[1322]
[1323]
[1324]
[1325]
[1326]
[1327]
[1328]
[1329]
[1330]
[1331]
[1332]
[1333]
[1334]
[1335]
[1336]
[1337]
[1338]
[1339]
[1340]
[1341]
[1342]
[1343]
[1344]
[1345]
[1346]
[1347]
[1348]
[1349]
[1350]
[1351]
[1352]
[1353]
[1354]
[1355]
[1356]
[1357]
[1358]
[1359]
[1360]
[1361]
[1362]
[1363]
[1364]
[1365]
[1366]
[1367]
[1368]
[1369]
[1370]
[1371]
[1372]
[1373]
[1374]
[1375]
[1376]
[1377]
[1378]
[1379]
[1380]
[1381]
[1382]
[1383]
[1384]
[1385]
[1386]
[1387]
[1388]
[1389]
[1390]
[1391]
[1392]
[1393]
[1394]
[1395]
[1396]
[1397]
[1398]
[1399]
[1400]
[1401]
[1402]
[1403]
[1404]
[1405]
[1406]
[1407]
[1408]
[1409]
[1410]
[1411]
[1412]
[1413]
[1414]
[1415]
[1416]
[1417]
[1418]
[1419]
[1420]
[1421]
[1422]
[1423]
[1424]
[1425]
[1426]
[1427]
[1428]
[1429]
[1430]
[1431]
[1432]
[1433]
[1434]
[1435]
[1436]
[1437]
[1438]
[1439]
[1440]
[1441]
[1442]
[1443]
[1444]
[1445]
[1446]
[1447]
[1448]
[1449]
[1450]
[1451]
[1452]
[1453]
[1454]
[1455]
[1456]
[1457]
[1458]
[1459]
[1460]
[1461]
[1462]
[1463]
[1464]
[1465]
[1466]
[1467]
[1468]
[1469]
[1470]
[1471]
[1472]
[1473]
[1474]
[1475]
[1476]
[1477]
[1478]
[1479]
[1480]
[1481]
[1482]
[1483]
[1484]
[1485]
[1486]
[1487]
[1488]
[1489]
[1490]
[1491]
[1492]
[1493]
[1494]
[1495]
[1496]
[1497]
[1498]
[1499]
[1500]
[1501]
[1502]
[1503]
[1504]
[1505]
[1506]
[1507]
[1508]
[1509]
[1510]
[1511]
[1512]
[1513]
[1514]
[1515]
[1516]
[1517]
[1518]
[1519]
[1520]
[1521]
[1522]
[1523]
[1524]
[1525]
[1526]
[1527]
[1528]
[1529]
[1530]
[1531]
[1532]
[1533]
[1534]
[1535]
[1536]
[1537]
[1538]
[1539]
[1540]
[1541]
[1542]
[1543]
[1544]
[1545]
[1546]
[1547]
[1548]
[1549]
[1550]
[1551]
[1552]
[1553]
[1554]
[1555]
[1556]
[1557]
[1558]
[1559]
[1560]
[1561]
[1562]
[1563]
[1564]
[1565]
[1566]
[1567]
[1568]
[1569]
[1570]
[1571]
[1572]
[1573]
[1574]
[1575]
[1576]
[1577]
[1578]
[1579]
[1580]
[1581]
[1582]
[1583]
[1584]
[1585]
[1586]
[1587]
[1588]
[1589]
[1590]
[1591]
[1592]
[1593]
[1594]
[1595]
[1596]
[1597]
[1598]
[1599]
[1600]
[1601]
[1602]
[1603]
[1604]
[1605]
[1606]
[1607]
[1608]
[1609]
[1610]
[1611]
[1612]
[1613]
[1614]
[1615]
[1616]
[1617]
[1618]
[1619]
[1620]
[1621]
[1622]
[1623]
[1624]
[1625]
[1626]
[1627]
[1628]
[1629]
[1630]
[1631]
[1632]
[1633]
[1634]
[1635]
[1636]
[1637]
[1638]
[1639]
[1640]
[1641]
[1642]
[1643]
[1644]
[1645]
[1646]
[1647]
[1648]
[1649]
[1650]
[1651]
[1652]
[1653]
[1654]
[1655]
[1656]
[1657]
[1658]
[1659]
[1660]
[1661]
[1662]
[1663]
[1664]
[1665]
[1666]
[1667]
[1668]
[1669]
[1670]
[1671]
[1672]
[1673]
[1674]
[1675]
[1676]
[1677]
[1678]
[1679]
[1680]
[1681]
[1682]
[1683]
[1684]
[1685]
[1686]
[1687]
[1688]
[1689]
[1690]
[1691]
[1692]
[1693]
[1694]
[1695]
[1696]
[1697]
[1698]
[1699]
[1700]
[1701]
[1702]
[1703]
[1704]
[1705]
[1706]
[1707]
[1708]
[1709]
[1710]
[1711]
[1712]
[1713]
[1714]
[1715]
[1716]
[1717]
[1718]
[1719]
[1720]
[1721]
[1722]
[1723]
[1724]
[1725]
[1726]
[1727]
[1728]
[1729]
[1730]
[1731]
[1732]
[1733]
[1734]
[1735]
[1736]
[1737]
[1738]
[1739]
[1740]
[1741]
[1742]
[1743]
[1744]
[1745]
[1746]
[1747]
[1748]
[1749]
[1750]
[1751]
[1752]
[1753]
[1754]
[1755]
[1756]
[1757]
[1758]
[1759]
[1760]
[1761]
[1762]
[1763]
[1764]
[1765]
[1766]
[1767]
[1768]
[1769]
[1770]
[1771]
[1772]
[1773]
[1774]
[1775]
[1776]
[1777]
[1778]
[1779]
[1780]
[1781]
[1782]
[1783]
[1784]
[1785]
[1786]
[1787]
[1788]
[1789]
[1790]
[1791]
[1792]
[1793]
[1794]
[1795]
[1796]
[1797]
[1798]
[1799]
[1800]
[1801]
[1802]
[1803]
[1804]
[1805]
[1806]
[1807]
[1808]
[1809]
[1810]
[1811]
[1812]
[1813]
[1814]
[1815]
[1816]
[1817]
[1818]
[1819]
[1820]
[1821]
[1822]
[1823]
[1824]
[1825]
[1826]
[1827]
[1828]
[1829]
[1830]
[1831]
[1832]
[1833]
[1834]
[1835]
[1836]
[1837]
[1838]
[1839]
[1840]
[1841]
[1842]
[1843]
[1844]
[1845]
[1846]
[1847]
[1848]
[1849]
[1850]
[1851]
[1852]
[1853]
[1854]
[1855]
[1856]
[1857]
[1858]
[1859]
[1860]
[1861]
[1862]
[1863]
[1864]
[1865]
[1866]
[1867]
[1868]
[1869]
[1870]
[1871]
[1872]
[1873]
[1874]
[1875]
[1876]
[1877]
[1878]
[1879]
[1880]
[1881]
[1882]
[1883]
[1884]
[1885]
[1886]
[1887]
[1888]
[1889]
[1890]
[1891]
[1892]
[1893]
[1894]
[1895]
[1896]
[1897]
[1898]
[1899]
[1900]
[1901]
[1902]
[1903]
[1904]
[1905]
[1906]
[1907]
[1908]
[1909]
[1910]
[1911]
[1912]
[1913]
[1914]
[1915]
[1916]
[1917]
[1918]
[1919]
[1920]
[1921]
[1922]
[1923]
[1924]
[1925]
[1926]
[1927]
[1928]
[1929]
[1930]
[1931]
[1932]
[1933]
[1934]
[1935]
[1936]
[1937]
[1938]
[1939]
[1940]
[1941]
[1942]
[1943]
[1944]
[1945]
[1946]
[1947]
[1948]
[1949]
[1950]
[1951]
[1952]
[1953]
[1954]
[1955]
[1956]
[1957]
[1958]
[1959]
[1960]
[1961]
[1962]
[1963]
[1964]
[1965]
[1966]
[1967]
[1968]
[1969]
[1970]
[1971]
[1972]
[1973]
[1974]
[1975]
[1976]
[1977]
[1978]
[1979]
[1980]
[1981]
[1982]
[1983]
[1984]
[1985]
[1986]
[1987]
[1988]
[1989]
[1990]
[1991]
[1992]
[1993]
[1994]
[1995]
[1996]
[1997]
[1998]
[1999]
[2000]
[2001]
[2002]
[2003]
[2004]
[2005]
[2006]
[2007]
[2008]
[2009]
[2010]
[2011]
[2012]
[2013]
[2014]
[2015]
[2016]
[2017]
[2018]
[2019]
[2020]
[2021]
[2022]
[2023]
[2024]
[2025]
[2026]
[2027]
[2028]
[2029]
[2030]
[2031]
[2032]
[2033]
[2034]
[2035]
[2036]
[2037]
[2038]
[2039]
[2040]
[2041]
[2042]
[2043]
[2044]
[2045]
[2046]
[2047]
[2048]
[2049]
[2050]
[2051]
[2052]
[2053]
[2054]
[2055]
[2056]
[2057]
[2058]
[2059]
[2060]
[2061]
[2062]
[2063]
[2064]
[2065]
[2066]
[2067]
[2068]
[2069]
[2070]
[2071]
[2072]
[2073]
[2074]
[2075]
[2076]
[2077]
[2078]
[2079]
[2080]
[2081]
[2082]
[2083]
[2084]
[2085]
[2086]
[2087]
[2088]
[2089]
[2090]
[2091]
[2092]
[2093]
[2094]
[2095]
[2096]
[2097]
[2098]
[2099]
[2100]
[2101]
[2102]
[2103]
[2104]
[2105]
[2106]
[2107]
[2108]
[2109]
[2110]
[2111]
[2112]
[2113]
[2114]
[2115]
[2116]
[2117]
[2118]
[2119]
[2120]
[2121]
[2122]
[2123]
[2124]
[2125]
[2126]
[2127]
[2128]
[2129]
[2130]
[2131]
[2132]
[2133]
[2134]
[2135]
[2136]
[2137]
[2138]
[2139]
[2140]
[2141]
/*****************************************************************************/
/*
                                  HTTP2.c

HTTP/2 is a replacement for how HTTP is expressed "on the wire".  It is not a
ground-up rewrite of the protocol; HTTP methods, status codes and semantics are
the same, and it should be possible to use the same APIs as HTTP/1.x (possibly
with some small additions) to represent the protocol.

The focus of the protocol is on performance; specifically, end-user perceived
latency, network and server resource usage. One major goal is to allow the use
of a single connection from browsers to a Web site.

Some useful (and used) sites:

https://tools.ietf.org/html/rfc7540
https://tools.ietf.org/html/rfc7541
https://en.wikipedia.org/wiki/HTTP/2
https://http2.github.io/
https://http2.github.io/faq/
http://http2-explained.haxx.se/
http://chimera.labs.oreilly.com/books/1230000000545/ch12.html
https://insouciant.org/tech/http-slash-2-considerations-and-tradeoffs/
http://undertow.io/blog/2015/04/27/An-in-depth-overview-of-HTTP2.html
https://blog.newrelic.com/2016/02/17/http2-production/
https://blog.newrelic.com/2016/02/09/http2-best-practices-web-performance/
https://blog.cloudflare.com/tools-for-debugging-testing-and-using-http-2/
https://nghttp2.org/
https://nghttp2.org/documentation/nghttp.1.html
https://nghttp2.org/documentation/h2load.1.html
https://nghttp2.org/blog/2014/11/29/test-your-http-slash-2-server-with-nghttp-client/
chrome://net-internals#http2


HTTP/2 PROCESSING
-----------------
These are indicative processing flows only.  Not all functions involved or
encountered are shown.  Too many if-buts-maybees.  Use WATCH.

   Request Processing
   ~~~~~~~~~~~~~~~~~~
   :
   |
   RequestGet()                            !match the HTTP/2 request preface 
   |
   Http2Preface()                          !either of these two functions are
   Http2SwitchResponse()                   !entry points to HTTP/2 processing
   |
   Http2Create()                           !create HTTP/2 structure and dispose
   |                                       !of initiating request structure
   |
   Http2ClientRead()    <--+      <--+     !receive frame from client
   |                       |         |
   |               {control frames}  |     !HTTP/2 internal processing
   |                       |         :
   +--{not header frames}--+         :     !frame processed by type
   |                                 .
   HpackHeadersFrame()                     !request headers frame
   |                                  
   Http2RequestBegin()                     !initialise request processing
   |
   Http2RequestProcess()                   !begin processing the request
   |
   RequestParseDictionary()                !dictionary contains request
   |
   :                                       !as per any other request
   |
   Http2RequestEnd()                       !end the request HTTP/2 specifics
   |
   :

   Read Frame Processing
   ~~~~~~~~~~~~~~~~~~~~~
   :
   Http2NetClientRead()                    !initiate HTTP/2 connection read loop
   |
   NetIoRead()                             !asynchronous read
   | 
   :
   |
   Http2NetClientReadAst()  <-- +          !asynchronous read completion
   |                            |
   !validate frame              : 
   |                            :
   !switch/case on frame type   :          !call function to process frame
   |                            :
   NetIoRead()                  :          !asynchronous read
   |                            |
   +----------------------------+

   Write Frame Processing
   ~~~~~~~~~~~~~~~~~~~~~~
   :
   NetIoWrite()                            !request standard network call
   |
   Http2NetIoWrite()                       !HTTP/2 write
   |
   Http2NetQueueWrite()   <----- +         !put the write on a queue
   |                             |
   +-->!add I/O to a queue -->   :         !return after putting in queue
   |                             :
   !check queue(s) for I/O       :         !no queued I/O then end processing
   |                             :
   NetIoWrite()  >------------+  :
                              :  :
   Http2NetWriteHeaderAst() <-+  :         !write frame header then data
   |                          :  :
   NetIoWrite()  >------------+  :
                              :  :
   Http2NetWriteDataAst()  <--+  :         !write frame header plus data
   |                             |
   NetIoWrite()  >---------------+


WATCHing via HTTP/2
-------------------
If a WATCHing request and one instantiated by Http2RequestBegin() share the
HTTP/2 connection then none of the HTTP/2 WATCH points will be reported because
down that particular rabbit hole is found only madness.


HTTP/2 DoS Mitigations
----------------------
https://tools.ietf.org/html/rfc7540#section-10.5
https://www.kb.cert.org/vuls/id/605641/
https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-002.md

WASD places explicit (and reasoanble) limits on some HTTP/2 behaviours.
Though exercising these mitigations is beyond the scope of the WASD test-bench.
When mitigations activate the connection is dropped.  Fingers crossed.

1) CVE-2019-9511, also known as Data Dribble
   WASD's asynchronous buffering and lack of stream prioritising mitigates.

2) CVE-2019-9512, also known as Ping Flood
   Http2Ping() checks for unreasonable client ping requests per second.

3) CVE-2019-9513, also known as Resource Loop
   Stream prioritising is not implemented by WASD.

4) CVE-2019-9514, also known as Reset Flood
   Http2ResetStream() checks for unreasonable server stream resets per second.

5) CVE-2019-9515, also known as Settings Flood
   Http2Settings() checks for unreasonable client setting frames per second.

6) CVE-2019-9516, also known as 0-Length Headers Leak
   HpackHeadersFrame() checks for zero-sized client headers.

7) CVE-2019-9517, also known as Internal Data Buffering
   The use of the TCP sliding window in this DoS puts it beyond WASD's control.
   WASD's asynchronous I/O should limit buffering impacts.

8) CVE-2019-9518, also known as Empty Frame Flooding
   Http2NetClientReadAst() checks for unreasonable client frame sizes.


TESTING
-------
Needless to say the major browsers (Chrome, Edge, FireFox, Safari) all
contributed to end-use development.

Indispensible were the |nghttp| and the associated |h2load| tools running on a
Linux Mint (17.3) VM.  Many thanks to the developer(s) of this package.  And of
course for someone educated in computing during the (19)70s, the availability
of VM technology for such purposes is just brilliant!  "But you know, we were
happy in those days, though we were poor."

  o  exercise the basic HTTP/2 functionality

     nghttp -nv https://klaatu.private/

  o  exercise starting HTTP/2 for "http" URIs (RFC 7450 3.2)

     nghttp -nvu http://klaatu.private/

  o  exercise starting HTTP/2 (for "http") with prior knowledge (RFC 7450 3.4)

     nghttp -nv http://klaatu.private/

  o  headers with continuation frames (RFC 7450 6.10)

     nghttp --continuation https://klaatu.private/

  o  basic HTTP/2 loading (number, clients and streams bumped)

     h2load --requests=1000 --clients=5 --max-concurrent-streams=5 https://klaatu.private/

  o  HTTP/2 loading with defined URIs

     h2load --requests=1000 --clients=5 --threads=5 --max-concurrent-streams=5 --input-file=urls.txt

  o  HTTP/1.1 loading with defined URIs

     h2load --h1 --requests=100 --clients=2 --threads=2 --max-concurrent-streams=5 --input-file=urls.txt

The HTTP/2 and HTTP/1.1 with --input-file can be concurrently used in two
separate sessions to simultaneously exercise the server against the two
protocols.  The -w17 -W17 (for example) switches can exercise flow control.

When module WATCHing is compiled-in, defining the WASD_HTTP2_SUBTLE_BREAK
logical name enables code to break request processing in specific but subtle
ways to ensure the server's continued stability in the presence of network or
client issues.  It should be used under load from soemthing akin to |h2load|.



FOR LOCAL REFERENCE
-------------------

   +-----------------------------------------------+
   |                 Length (24)                   |
   +---------------+---------------+---------------+
   |   Type (8)    |   Flags (8)   |
   +-+-------------+---------------+-------------------------------+
   |R|                 Stream Identifier (31)                      |
   +=+=============================================================+
   |                   Frame Payload (0...)                      ...
   +---------------------------------------------------------------+


VERSION HISTORY
---------------
25-AUG-2021  MGD  Http2CloseConnection() mung active flow control
                  bugfix; Http2Supervisor() idle connection
03-APR-2021  MGD  bugfix; Http2CloseConnection() once aborted always aborted
17-AUG-2020  MGD  HTTP2_DEFAULT_WINDOW_SIZE from 1048575 to 131070
05-APR-2020  MGD  Http2Report() remove proxy requests from HTTP/2-HTTP/1 ratio
31-JAN-2020  MGD  fiddle with the code (perhaps optimisations, even bugfixes)
13-JAN-2019  MGD  bugfix; Http2Priority() exclusive bit
17-NOV-2019  MGD  bugfix; Http2CloseConnection() return after RequestEnd()ing
12-OCT-2019  MGD  mitigate potential HTTP/2 DoS vulnerabilities
                    https://www.kb.cert.org/vuls/id/605641/
                    https://tools.ietf.org/html/rfc7540#section-10.5
18-APR-2018  MGD  bugfix; Http2ResetStream() rundown the request in-line 
07-APR-2018  MGD  bugfix; Http2ResetStream() explicitly rundown the request
23-DEC-2017  MGD  bugfix; window update and flow control management
02-AUG-2015  MGD  initial
*/
/*****************************************************************************/

#ifdef WASD_VMS_V7
#  undef __VMS_VER
#  define __VMS_VER 70000000
#  undef __CRTL_VER
#  define __CRTL_VER 70000000
#else
#  ifdef WASD_VMS_V7
#     undef _VMS__V6__SOURCE
#     define _VMS__V6__SOURCE
#     undef __VMS_VER
#     define __VMS_VER 70000000
#     undef __CRTL_VER
#     define __CRTL_VER 70000000
#   endif
#endif

#include <stdio.h>
#include <ctype.h>

#include "wasd.h"

#define WASD_MODULE "HTTP2"

/******************/
/* global storage */
/******************/

BOOL  Http2Enabled;

int  Http2CurrentConnected,
     Http2CurrentProcessing,
     Http2FlowControlCurrent,
     Http2PingTimerSeconds;

uint  Http2InitialWindowSize,
      Http2MaxConcurrentStreams,
      Http2MaxFrameSize,
      Http2MaxHeaderListSize,
      Http2MaxHeaderTableSize,
      Http2StreamIdent;

/* used by VM.c */
const int  Http2StructSize = sizeof(HTTP2_STRUCT);

char  Http2ClientPreface [] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
int  Http2ClientPrefaceLength = sizeof(Http2ClientPreface)-1;

char  *Http2ErrorArray [HTTP2_ERROR_COUNT] =
{
   "graceful shutdown",
   "protocol error detected",
   "implementation fault",
   "flow-control limits exceeded",
   "settings not acknowledged",
   "frame received for closed stream",
   "frame size incorrect",
   "stream not processed",
   "stream cancelled",
   "compression state not updated",
   "TCP connection error for CONNECT method",
   "processing capacity exceeded",
   "negotiated TLS parameters not acceptable",
   "use HTTP/1.1 for the request"
};

LIST_HEAD  Http2List;

/********************/
/* external storage */
/********************/

extern int  NetReadBufferSize;

extern ulong  HttpdTickSecond;

extern char  ErrorSanityCheck [];

#define acptr AccountingPtr
extern ACCOUNTING_STRUCT  *AccountingPtr;
extern CONFIG_STRUCT  Config;
extern LIST_HEAD  RequestList;
extern PROXY_ACCOUNTING_STRUCT  *ProxyAccountingPtr;
extern WATCH_STRUCT  Watch;

/*****************************************************************************/
/*
Initialise all things HTTP/2.
*/

void Http2Init ()

{
   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_HTTP2))
      WatchThis (WATCHALL, WATCH_MOD_HTTP2, "Http2Init()");

   Http2Enabled = Config.cfHttp2.Enabled;

   FaoToStdout ("%HTTPD-I-HTTP2, !AZ\n", Http2Enabled ? "enabled" : "disabled");

   Http2InitialWindowSize = Config.cfHttp2.InitialWindowSize;
   if (!Http2InitialWindowSize)
      Http2InitialWindowSize = HTTP2_DEFAULT_WINDOW_SIZE;
   else
   if (Http2InitialWindowSize < HTTP2_INITIAL_WINDOW_SIZE)
      Http2InitialWindowSize = HTTP2_INITIAL_WINDOW_SIZE;
   else
   if (Http2InitialWindowSize > HTTP2_MAX_WINDOW_SIZE)
      Http2InitialWindowSize = HTTP2_MAX_WINDOW_SIZE;

   Http2MaxConcurrentStreams = Config.cfHttp2.MaxConcurrentStreams;

   if (!Http2MaxConcurrentStreams)
      Http2MaxConcurrentStreams = HTTP2_INITIAL_MAX_CONC_STREAMS;

   if (Http2MaxConcurrentStreams < HTTP2_MIN_INITIAL_MAX_CONC_STREAMS)
      Http2MaxConcurrentStreams = HTTP2_MIN_INITIAL_MAX_CONC_STREAMS;

   Http2MaxFrameSize = Config.cfHttp2.MaxFrameSize;
   if (Http2MaxFrameSize < HTTP2_INITIAL_MAX_FRAME_SIZE)
      Http2MaxFrameSize = HTTP2_INITIAL_MAX_FRAME_SIZE;
   else
   if (Http2MaxFrameSize > HTTP2_MAX_FRAME_SIZE)
      Http2MaxFrameSize = HTTP2_MAX_FRAME_SIZE;

   if (Http2Enabled &&
       NetReadBufferSize < Http2MaxFrameSize)
   {
      NetReadBufferSize = Http2MaxFrameSize;
      FaoToStdout ("%HTTPD-W-HTTP2, network read buffer size \
increased to !UL bytes\n", NetReadBufferSize);
   }
   
   Http2MaxHeaderListSize = Config.cfHttp2.MaxHeaderListSize;
   if (Http2MaxHeaderListSize < HTTP2_INITIAL_HEAD_LIST_SIZE)
      Http2MaxHeaderListSize = HTTP2_INITIAL_HEAD_LIST_SIZE;
   else
   if (Http2MaxHeaderListSize > HTTP2_MAX_HEAD_LIST_SIZE)
      Http2MaxHeaderListSize = HTTP2_MAX_HEAD_LIST_SIZE;

   Http2MaxHeaderTableSize = Config.cfHttp2.MaxHeaderTableSize;
   if (Http2MaxHeaderTableSize < HTTP2_INITIAL_HEAD_TAB_SIZE)
      Http2MaxHeaderTableSize = HTTP2_INITIAL_HEAD_TAB_SIZE;
   else
   if (Http2MaxHeaderTableSize > HTTP2_MAX_HEAD_TAB_SIZE)
      Http2MaxHeaderTableSize = HTTP2_MAX_HEAD_TAB_SIZE;

   Http2PingTimerSeconds = Config.cfHttp2.PingTimerSeconds;
   if (Http2PingTimerSeconds == 0)
      Http2PingTimerSeconds = HTTP2_PING_SECONDS_DEFAULT;
   else
   if (Http2PingTimerSeconds < 0)
      Http2PingTimerSeconds = 0;  /* "NONE" */
   else
   if (Http2PingTimerSeconds > HTTP2_PING_SECONDS_MAX)
      Http2PingTimerSeconds = HTTP2_PING_SECONDS_MAX;

   if (!Http2Enabled) return;
             
   VmHttp2Init ();
}

/*****************************************************************************/
/*
Called by WatchSetWatch().
*/

void Http2SetWatch
(
HTTP2_STRUCT *h2ptr,
int item
)
{
   h2ptr->WatchItem = item;

   if (h2ptr->NetIoPtr)
      if (h2ptr->NetIoPtr->SesolaPtr)
         SesolaSetWatch (h2ptr->NetIoPtr->SesolaPtr, item);
      else
         h2ptr->NetIoPtr->WatchItem = item;
}

/*****************************************************************************/
/*
This is a TLS/SSL (https:) encrypted connection that has specified HTTP/2 via
the TLS ALPN negotiation and transmitted the HTTP/2 client connection preface
(RFC 7540 3.3) --OR-- a clear-text (http:) connection prior-knowledge (RFC 7540
3.4) connection preface.  Create an HTTP/2 structure and then dispose of the
request structure used to initiate the network connection.
*/

BOOL Http2Preface (REQUEST_STRUCT *rqptr)

{
   int  count, idx;
   HTTP2_STRUCT  *h2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_HTTP2,
                 "Http2Preface() preface:!UL read:!UL http2:!UL",
                 Http2ClientPrefaceLength, rqptr->NetIoPtr->ReadCount,
                 rqptr->NetIoPtr->ReadCount - Http2ClientPrefaceLength);

   if (WATCHING (rqptr, WATCH_CONNECT))
      WatchThis (WATCHITM(rqptr), WATCH_CONNECT,
                 "HTTP/2 connection preface (h2)");

   if (!Http2Enabled) return (false);

   if (WATCHING (rqptr, WATCH_CONNECT))
      WatchThis (WATCHITM(rqptr), WATCH_CONNECT, "HTTP/2 protocol");

   h2ptr = Http2Create (rqptr);

   /* if HTTP/2 traffic has been pipelined with the preface */
   if ((count = rqptr->NetIoPtr->ReadCount - Http2ClientPrefaceLength) > 0)
   {
      if (count > h2ptr->ReadBufferSize)
         ErrorExitVmsStatus (SS$_BUGCHECK, ErrorSanityCheck, FI_LI);
      memcpy (h2ptr->ReadBufferPtr,
              rqptr->rqNet.ReadBufferPtr + Http2ClientPrefaceLength,
              count);
      h2ptr->NetIoPtr->ReadStatus = SS$_NORMAL;
      h2ptr->NetIoPtr->ReadCount = count;
      SysDclAst (Http2NetClientReadAst, h2ptr);
   }
   else
      Http2NetClientRead (h2ptr);

   InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
   NetUpdateConnected (rqptr, -1);
   NetUpdateConnected (h2ptr, +1);
   InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);

   RequestEnd5 (rqptr);

   return (true);
}

/****************************************************************************/
/*
This is an unencrypted connection (http:) with request header indicating a
desire to upgrade to HTTP/2 (RFC 7540 3.2).  Major browser communities indicate
no interest in providing HTTP/2 over clear-text connections so it's a bit of a
niche but supported by the RFC.  Generate an HTTP/2 101 Switching Protocols
response and then handle the original request in the HTTP/2 environment. 
Exercise using nghttp -nvu http://<host.name>/
*/

BOOL Http2SwitchResponse (REQUEST_STRUCT *rqptr)

{
   static char  Http2Switching [] =
"HTTP/1.1 101 Switching Protocols\r\n\
Upgrade: h2c\r\n\
Connection: Upgrade\r\n\
\r\n";

   int  retval,
        SettingsLength;
   char  *cptr;
   uchar  SettingsBuffer [256];
   HTTP2_STRUCT  *h2ptr;
   HTTP2_STREAM_STRUCT  *s2ptr;
   NETIO_STRUCT  *ioptr;


   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_RESPONSE))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_RESPONSE,
                 "Http2SwitchResponse()");

   if (WATCHING (rqptr, WATCH_CONNECT))
      WatchThis (WATCHITM(rqptr), WATCH_CONNECT, "HTTP/2 upgrade");

   if (!Http2Enabled) return (false);

   if (rqptr->rqHeader.UpgradeHttp2onHttp &&
       rqptr->ServicePtr->RequestScheme != SCHEME_HTTP)
   {
      rqptr->rqResponse.HttpStatus = 400;
      ErrorGeneral (rqptr, MsgFor(rqptr,MSG_REQUEST_FORMAT), FI_LI);
      RequestEnd (rqptr);
      return (true);
   }

   if (rqptr->rqHeader.Http2SettingsPtr != NULL)
   {
      /* span the length of base-64 acceptable characters */
      for (cptr = rqptr->rqHeader.Http2SettingsPtr;
           isalnum(*cptr) || *cptr == '+' || *cptr == '/' || *cptr == '=';
           *cptr++);
      SettingsLength = sizeof(SettingsBuffer);
      retval = base64_decode (SettingsBuffer, &SettingsLength,
                              rqptr->rqHeader.Http2SettingsPtr,
                              cptr - rqptr->rqHeader.Http2SettingsPtr);
   }

   if (rqptr->rqHeader.Http2SettingsPtr == NULL || retval != 0)
   {
      rqptr->rqResponse.HttpStatus = 400;
      ErrorGeneral (rqptr, MsgFor(rqptr,MSG_REQUEST_FORMAT), FI_LI);
      RequestEnd (rqptr);
      return (true);
   }

   /****************/
   /* 101 response */
   /****************/

   /* no update to status code counters as this is an intermediate response */
   rqptr->rqResponse.HttpStatus = 101;
   rqptr->rqResponse.HeaderSent = true;

   /* blocking write (for the convenience) */
   NetWrite (rqptr, NULL, Http2Switching, sizeof(Http2Switching)-1);

   rqptr->rqResponse.HttpStatus = 0;
   rqptr->rqResponse.HeaderSent = false;

   /******************/
   /* HTTP/2 request */
   /******************/

   if (WATCHING (rqptr, WATCH_CONNECT))
      WatchThis (WATCHITM(rqptr), WATCH_CONNECT, "HTTP/2 protocol");

   /* these that got us here are definitely no longer the case */
   DictRemove (rqptr->rqDictPtr, DICT_TYPE_REQUEST, "connection", 10);
   DictRemove (rqptr->rqDictPtr, DICT_TYPE_REQUEST, "http2-settings", 14);
   DictRemove (rqptr->rqDictPtr, DICT_TYPE_REQUEST, "upgrade", 7);

   /* and the associated flags */
   rqptr->rqHeader.UpgradeHttp2onHttp = false;
   rqptr->rqHeader.ConnectionHttp2Settings = false;
   rqptr->rqHeader.ConnectionUpgrade = false;

   /* see Http2RequestBegin() for parallels with what's done here */

   h2ptr = Http2Create (rqptr);

   h2ptr->ExpectingH2cPreface = true;

   /* attach the request to the HTTP/2 stream */
   Http2RequestBegin2 (rqptr, h2ptr, 1);

   Http2RequestProcess (rqptr);

   Http2NetClientRead (h2ptr);

   /* adjust the connected from the request to the HTTP/2 connection */
   InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
   NetUpdateProcessing (rqptr, -1);
   NetUpdateConnected (rqptr, -1);
   NetUpdateConnected (h2ptr, +1);
   InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);

   return (true);
}

/*****************************************************************************/
/*
This is where the real fun begins.  Create and initialise an HTTP/2 structure,
using some data from the request structure.  Return a pointer to the structure.
*/

HTTP2_STRUCT* Http2Create (REQUEST_STRUCT *rqptr)

{
   HTTP2_STRUCT  *h2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_HTTP2, "Http2Create()");

   h2ptr = VmHttp2Get (rqptr->ConnectNumber);

   /* add to the HTTP/2 connection list */
   ListAddHead (&Http2List, h2ptr, LIST_ENTRY_TYPE_HTTP2);

   h2ptr->NetIoPtr = rqptr->NetIoPtr;
   h2ptr->WatchItem = rqptr->WatchItem;
   h2ptr->NetIoPtr->WatchItem = h2ptr->WatchItem;
   h2ptr->ConnectTime64 = rqptr->rqTime.BeginTime64;

   /* always use original client data (see MapUrl_SetClientAddress()) */
   if (rqptr->ClientResetPtr)
      h2ptr->ClientPtr = rqptr->ClientResetPtr;
   else
      h2ptr->ClientPtr = rqptr->ClientPtr;

   /* use the same service of the upgrade request */
   h2ptr->ServicePtr = rqptr->ServicePtr;

   /* intialise server protocol parameters */
   h2ptr->ServerInitialWindowSize = Http2InitialWindowSize;
   h2ptr->ServerMaxConcStreams = Http2MaxConcurrentStreams;
   h2ptr->ServerMaxFrameSize = Http2MaxFrameSize;
   h2ptr->ServerMaxHeaderListSize = Http2MaxHeaderListSize;
   h2ptr->ServerMaxHeaderTableSize = Http2MaxHeaderTableSize;
   h2ptr->ServerPushPromise = 0;

   /* intialise client protocol parameters */
   h2ptr->ClientInitialWindowSize = HTTP2_INITIAL_WINDOW_SIZE;
   h2ptr->ClientMaxConcStreams = HTTP2_INITIAL_MAX_CONC_STREAMS;
   h2ptr->ClientMaxFrameSize = HTTP2_INITIAL_MAX_FRAME_SIZE;
   h2ptr->ClientMaxHeaderListSize = HTTP2_INITIAL_HEAD_LIST_SIZE;
   h2ptr->ClientMaxHeaderTableSize = HTTP2_INITIAL_HEAD_TAB_SIZE;
   h2ptr->ClientPushPromise = 0;

   /* HPACK initialisation */
   h2ptr->HpackClientTable.max = Http2MaxHeaderTableSize;
   h2ptr->HpackServerTable.max = Http2MaxHeaderTableSize;
   h2ptr->HpackClientTable.h2ptr = h2ptr->HpackServerTable.h2ptr = h2ptr;

   /* initial flow control */
   h2ptr->ReadWindowSize == h2ptr->ServerInitialWindowSize;
   h2ptr->WriteWindowSize = h2ptr->ClientInitialWindowSize;

   /* send server settings */
   Http2Settings (h2ptr, 0, NULL, 0);

   /* set the initial connection flow-control window size */
   h2ptr->ReadWindowSize = h2ptr->ServerInitialWindowSize *
                           h2ptr->ServerMaxConcStreams;
   Http2WindowUpdate (h2ptr, 0, h2ptr->ReadWindowSize, NULL, 0);

   /* buffer for multiplexed reads */
   h2ptr->ReadBufferSize = h2ptr->ServerMaxFrameSize + 128;
   h2ptr->ReadBufferPtr = VmGet2Heap (h2ptr, h2ptr->ReadBufferSize);

   return (h2ptr);
}

/*****************************************************************************/
/*
Close the HTTP/2 protocol connection with the client.  If there are still
requests associated with the connection wait for them to end (based on
delivered CANCELed I/O).  If there's still HTTP/2 I/O in progress wait for it
to rundown.  Then check for any connection management writes still queued. 
Finally a check for straggling connection I/O in progress.  After that the
connection is removed from the list and the associated memory released in an
indepedent AST.  This function should only be called the once by HTTP/2
processing code when the channel number is non-zero.  After that the
Http2Supervisor() calls it every second until all the above conditions are met. 
Once removed from the connection list it's gone!
*/

void Http2CloseConnection (HTTP2_STRUCT *h2ptr)

{
   BOOL  OneShot;
   int  idx;
   HTTP2_STREAM_STRUCT  *s2ptr;
   REQUEST_STRUCT  *rqeptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
"Http2CloseConnection() !&F chan:!UL list:!UL read:!&B write:!&B",
                 Http2CloseConnection,
                 h2ptr->NetIoPtr->Channel,
                 LIST_GET_COUNT (&h2ptr->StreamList),
                 NETIO_READ_IN_PROGRESS(h2ptr->NetIoPtr),
                 NETIO_WRITE_IN_PROGRESS(h2ptr->NetIoPtr));

   h2ptr->NetIoPtr->VmsStatus = SS$_VCCLOSED;

   /* if still stream(s) attached to the connection */
   if (LIST_NOT_EMPTY (&h2ptr->StreamList)) return;

   /* if still queued write(s) waiting */
   for (idx = HTTP2_WRITE_QUEUE_MAX; idx <= HTTP2_WRITE_QUEUE_LOW; idx++)
      if (LIST_NOT_EMPTY (&h2ptr->QueuedWriteList[idx]))
      {
         Http2NetQueueWrite (h2ptr, NULL);
         return;
      }

   /* any last gasp I/O still in progress */
   if (NETIO_WRITE_IN_PROGRESS(h2ptr->NetIoPtr)) return;
   if (NETIO_READ_IN_PROGRESS(h2ptr->NetIoPtr))
   {
      sys$cancel (h2ptr->NetIoPtr->Channel);
      return;
   }

   if (h2ptr->WriteInUseCount)
   {
      char *cptr = FaoToMemory (NULL, "WriteInUseCount:!SL",
                                h2ptr->WriteInUseCount);
      ErrorNoticed (NULL, 0, cptr, FI_LI);
      VmFree (cptr, FI_LI);
      if (h2ptr->WriteInUseCount > 0) return;
   }

   /***********/
   /* finally */
   /***********/

   if (WATCHPNT(h2ptr))
   {
      if (WATCH_CATEGORY(WATCH_HTTP2))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, 
"FRAMES tx:!UL rx:!UL REQUESTS tx:!UL rx:!UL total:!UL peak:!UL",
                    h2ptr->FrameCountTx, h2ptr->FrameCountRx,
                    h2ptr->FrameRequestCountTx, h2ptr->FrameRequestCountRx,
                    h2ptr->RequestCount, h2ptr->RequestPeak);

      if (WATCH_CATEGORY(WATCH_HTTP2))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "HTTP/2 closed");
      else
      if (WATCH_CATEGORY(WATCH_CONNECT))
         WatchThis (WATCHITM(h2ptr), WATCH_CONNECT, "HTTP/2 closed");
   }

   NetIoEnd (h2ptr->NetIoPtr);

   InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
   NetUpdateConnected (h2ptr, -1);
   InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);

   /* remove from the HTTP/2 connection list */
   ListRemove (&Http2List, h2ptr);

   VmFree2Heap (h2ptr, FI_LI);

   /* if this HTTP/2 connection was being (one-shot) WATCHed */
   OneShot = h2ptr->WatchItem & WATCH_ITEM_HTTP2_FLAG;

   VmHttp2Free (h2ptr, FI_LI);

   if (OneShot && Watch.RequestPtr)
   {
      Watch.RequestPtr->RequestState = REQUEST_STATE_ENDING;
      SysDclAst (RequestEnd, Watch.RequestPtr); 
   }
}

/*****************************************************************************/
/*
An HTTP/2 error has been encountered.  Signal this to the client as a non-fatal
stream error or a fatal connection error.  Return zero to continue, non-zero to
abort the connection.
*/

int Http2Error
(
HTTP2_STRUCT *h2ptr,
uint ident,
uint error
)
{
   int  retval;
   char  *cptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2Error() !SL", error);

   if (WATCHING (h2ptr, WATCH_HTTP2)) Http2WatchError (h2ptr, error);

   switch (error)
   {
      /* stream oriented non-fatal errors */
      case HTTP2_ERROR_NONE :
      case HTTP2_ERROR_REFUSED :
      case HTTP2_ERROR_CANCEL :
      case HTTP2_ERROR_CALM :
      case HTTP2_ERROR_HTTP11 :
           retval = Http2ResetStream (h2ptr, ident, 0, NULL, 0);
           if (retval >= 0) return (0);
           Http2GoAway (h2ptr, -(int)retval, NULL, 0);
           return (HTTP2_ERROR_INTERNAL);
           break;
      /* connection breaking errors */
      case HTTP2_ERROR_PROTOCOL :
      case HTTP2_ERROR_INTERNAL :
      case HTTP2_ERROR_FLOW :
      case HTTP2_ERROR_TIMEOUT :
      case HTTP2_ERROR_CLOSED :
      case HTTP2_ERROR_SIZE :
      case HTTP2_ERROR_COMPRESS :
      case HTTP2_ERROR_CONNECT :
      case HTTP2_ERROR_SECURITY :
           Http2GoAway (h2ptr, error, NULL, 0);
           return (error);
           break;
      default :
           Http2GoAway (h2ptr, HTTP2_ERROR_INTERNAL, NULL, 0);
           return (HTTP2_ERROR_INTERNAL);
   }
}

/*****************************************************************************/
/*
Send and receive GOAWAY frames.
*/

int Http2GoAway
(
HTTP2_STRUCT *h2ptr,
uint error,
uchar *bptr,
uint blen
)
{
   uint  size, stream;
   uchar  *cptr, *czptr, *sptr, *zptr;
   uchar  buf [256];
   HTTP2_WRITE_STRUCT  *w2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2GoAway() bptr:!8XL blen:!UL", blen);

   if (bptr != NULL)
   {
      /**********************/
      /* goaway from client */
      /**********************/

      if (blen < 8) return (-(HTTP2_ERROR_SIZE));

      if (WATCHING (h2ptr, WATCH_HTTP2))
         Http2WatchGoaway (h2ptr, bptr, blen);

      HTTP2_GET_32 (bptr, stream);
      stream &= 0x7fffffff;
      HTTP2_GET_32 (bptr, error);
      zptr = (sptr = buf) + sizeof(buf)-1;
      if (blen > 8)
      {
         czptr = (cptr = bptr) + blen - 8;
         while (cptr < czptr && sptr < zptr) *sptr++ = *cptr++;
      }
      *sptr = '\0';

      if (stream) return (-(HTTP2_ERROR_PROTOCOL));

      h2ptr->GoAwayLastStreamIdent = stream;
   }
   else
   {
      /********************/
      /* goaway to client */
      /********************/

      h2ptr->GoAwayIdent = h2ptr->LastStreamIdent;

      if (!bptr) bptr = "";
      for (cptr = bptr; *cptr; cptr++);
      size = cptr - bptr;
      if (size <= (HTTP2_WRITE_PAYLOAD - 8)) size = 0;

      w2ptr = Http2GetWriteStruct (h2ptr, size, FI_LI);

      sptr = bptr;
      bptr = w2ptr->payload;
      HTTP2_PUT_32 (bptr, h2ptr->GoAwayIdent);
      HTTP2_PUT_32 (bptr, error);
      while (*bptr) *bptr++ = *sptr++;
      *bptr = '\0';

      HTTP2_PLACE_24 (w2ptr->length, bptr - w2ptr->payload);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_GOAWAY);
      HTTP2_PLACE_8  (w2ptr->flags, 0);
      HTTP2_PLACE_32 (w2ptr->ident, 0);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->AstParam = h2ptr;
      /* send the goaway frame and once sent close the connection */
      w2ptr->AstFunction = Http2CloseConnection;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = bptr - w2ptr->payload;

      if (WATCHING (h2ptr, WATCH_HTTP2))
         Http2WatchGoaway (h2ptr, w2ptr->DataPtr, w2ptr->DataLength);

      Http2NetQueueWrite (h2ptr, w2ptr);
   }

   /* if not gone after this period then close the connection anyway */
   h2ptr->GoAwaySecond = HttpdTickSecond + HTTP2_TIMEOUT_GOAWAY_SECONDS;

   return (0);
}

/*****************************************************************************/
/*
Send and receive PING frames.
*/

int Http2Ping
(
HTTP2_STRUCT *h2ptr,
uint flags,
uchar *bptr,
uint blen
)
{
   uchar  *sptr;
   int64  ResultTime64;
   HTTP2_WRITE_STRUCT  *w2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2Ping() blen:!UL", blen);

   if (bptr != NULL)
   {
      /********************/
      /* ping from client */
      /********************/

      if (blen != 8) return (-(HTTP2_ERROR_PROTOCOL));

      if (flags & HTTP2_FLAG_PING_ACK)
      {
         /*******************/
         /* ack from client */
         /*******************/

         /* client acknowledging server ping */
         if (*(INT64PTR)bptr == h2ptr->PingTime64)
         {
            /* the number of 100 nano-seconds (up to 100 seconds) */
            sys$gettim (&ResultTime64);
            ResultTime64 -= h2ptr->PingTime64;
            h2ptr->PingMicroSeconds = ResultTime64 / 10;
         }
         else
            h2ptr->PingMicroSeconds = -1;

         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                       (int)h2ptr->PingMicroSeconds == -1 ?
                          "PING client ERROR" :
                          "PING !UL.!3ZLmS",
                       h2ptr->PingMicroSeconds / 1000,
                       h2ptr->PingMicroSeconds % 1000);

         h2ptr->PingBackTickSecond = 0;
         h2ptr->PingTime64 = 0;
         return (0);
      }

      /*****************/
      /* ack to client */
      /*****************/

      if (WATCHING (h2ptr, WATCH_HTTP2))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                    "PING server ACKNOWLEDGE");

      /* mitigate CVE-2019-9512 */
      if (h2ptr->PingLimitCount++ > HTTP2_PING_LIMIT_COUNT)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                       "LIMIT client ping to !UL/S (DoS?)",
                       HTTP2_PING_LIMIT_COUNT);
         return (-(HTTP2_ERROR_CALM));
      }

      w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

      /* replay the client payload */
      sptr = w2ptr->payload;
      while (blen--) *sptr++ = *bptr++;

      HTTP2_PLACE_24 (w2ptr->length, 8);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_PING);
      HTTP2_PLACE_8  (w2ptr->flags, HTTP2_FLAG_PING_ACK);
      HTTP2_PLACE_32 (w2ptr->ident, 0);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = 8;
   }
   else
   {
      /******************/
      /* ping to client */
      /******************/

      /* only one outstanding with the specified timeout */
      if (h2ptr->PingBackTickSecond)
         if (HttpdTickSecond < h2ptr->PingBackTickSecond)
            return (0);

      w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

      /* generate and note the ping time */
      sys$gettim (&h2ptr->PingTime64);
      *(INT64PTR)w2ptr->payload = h2ptr->PingTime64;
      h2ptr->PingBackTickSecond = HttpdTickSecond + HTTP2_PING_RESPONSE_MAX;

      HTTP2_PLACE_24 (w2ptr->length, 8);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_PING);
      HTTP2_PLACE_8  (w2ptr->flags, 0);
      HTTP2_PLACE_32 (w2ptr->ident, 0);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = 8;

      if (WATCHING (h2ptr, WATCH_HTTP2))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "PING to client");
   }

   Http2NetQueueWrite (h2ptr, w2ptr);

   return (0);
}

/*****************************************************************************/
/*
HTTP/2 priority/dependency is not currently implemented.
Weight is weight plus one, 1..256.
*/

int Http2Priority
(
HTTP2_STRUCT *h2ptr,
uint flags,
uchar *bptr,
uint blen
)
{
   uint  stream, value, weight;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2Priority() blen:!UL", blen);

   if (blen != 5) return (-(HTTP2_ERROR_SIZE));

   HTTP2_GET_32 (bptr, stream);
   HTTP2_GET_8 (bptr, weight);

   return (0);
}

/*****************************************************************************/
/*
Mark the stream as closed.  When the server closes a stream (as when a request
times out) send a RST_STREAM frame to the client.
*/

int Http2ResetStream
(
HTTP2_STRUCT *h2ptr,
uint ident,
uint error,
uchar *bptr,
uint blen
)
{
   HTTP2_STREAM_STRUCT  *s2ptr;
   HTTP2_WRITE_STRUCT  *w2ptr;
   REQUEST_STRUCT  *rqeptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2ResetStream() blen:!UL ident:!UL error:!UL",
                 blen, ident, error);

   if (ident == 0) return (-(HTTP2_ERROR_PROTOCOL));

   /* locate the request corresponding to the stream */
   for (s2ptr = LIST_GET_HEAD(&h2ptr->StreamList);
        s2ptr != NULL;
        s2ptr = LIST_GET_NEXT(s2ptr))
   {
      rqeptr = (REQUEST_STRUCT*)s2ptr->RequestPtr;
      if (rqeptr->Http2Stream.Ident == ident) break;
   }

   if (s2ptr == NULL)
   {
      /* no stream found with that ident */
      if (ident > h2ptr->LastStreamIdent) return (-(HTTP2_ERROR_PROTOCOL));
      /* could be a hangover from a previous (closed) stream so ignore */
      return (HTTP2_ERROR_NONE);
   }

   if (bptr != NULL)
   {
      /*******************/
      /* reset by client */
      /*******************/

      if (blen != 4) return (-(HTTP2_ERROR_SIZE));

      /* RFC 7540 6.4 */
      if (s2ptr->State == HTTP2_STATE_IDLE) return (-(HTTP2_ERROR_PROTOCOL));

      /* mitigate CVE-2019-9514 */
      if (h2ptr->StreamResetLimitCount++ > HTTP2_STREAM_RESET_LIMIT_COUNT)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                       "LIMIT server stream resets to !UL/S (DoS?)",
                       HTTP2_STREAM_RESET_LIMIT_COUNT);
         return (-(HTTP2_ERROR_CALM));
      }

      s2ptr->State = HTTP2_STATE_CLOSED_REM;

      RequestAbort (rqeptr);
   }
   else
   {
      /*******************/
      /* reset by server */
      /*******************/

      if (s2ptr->State == HTTP2_STATE_CLOSED_REM ||
          s2ptr->State == HTTP2_STATE_CLOSED_LOC)
         s2ptr->State = HTTP2_STATE_CLOSED;
      else
         s2ptr->State = HTTP2_STATE_CLOSED_LOC;

      if (h2ptr->NetIoPtr->VmsStatus) s2ptr->State = HTTP2_STATE_CLOSED;

      if (s2ptr->State != HTTP2_STATE_CLOSED)
      {
         w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

         HTTP2_PLACE_24 (w2ptr->length, 4);
         HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_RST_STREAM);
         HTTP2_PLACE_8  (w2ptr->flags, 0);
         HTTP2_PLACE_32 (w2ptr->ident, ident);

         w2ptr->Http2Ptr = h2ptr;
         w2ptr->HeaderPtr = w2ptr->header;
         w2ptr->DataPtr = w2ptr->payload;
         w2ptr->DataLength = 4;
         HTTP2_PLACE_32 (w2ptr->payload, error);

         Http2NetQueueWrite (h2ptr, w2ptr);
      }
   }

   return (HTTP2_ERROR_NONE);
}

/*****************************************************************************/
/*
Send and receive HTTP/2 settings.
*/

int Http2Settings
(
HTTP2_STRUCT *h2ptr,
uint flags,
uchar *bptr,
uint blen
)
{
   uint  count, setting, value;
   uchar  *aptr;
   HTTP2_WRITE_STRUCT  *w2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2Settings() flags:0x!2XL len:!UL (!UL)",
                 flags, blen, blen / 6);

   if (bptr != NULL)
   {
      /***************/
      /* from client */
      /***************/

      /* all setting are in multiples of 6 octets */
      if (blen % 6) return (-(HTTP2_ERROR_SIZE));
      count = blen / 6;

      if (flags & HTTP2_FLAG_SETTINGS_ACK)
      {
         /**************/
         /* client ack */
         /**************/

         /* payload must be empty */
         if (count) return (-(HTTP2_ERROR_PROTOCOL));
         return (0);
      }

      /*********************/
      /* client setting(s) */
      /*********************/

      if (WATCHING (h2ptr, WATCH_HTTP2))
         Http2WatchSettings (h2ptr, "client", bptr, blen);

      /* mitigate CVE-2019-9515 */
      if (h2ptr->SettingsLimitCount++ > HTTP2_SETTINGS_LIMIT_COUNT)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                       "LIMIT client settings to !UL/S (DoS?)",
                       HTTP2_SETTINGS_LIMIT_COUNT);
         return (-(HTTP2_ERROR_CALM));
      }

      while (count--)
      {
         HTTP2_GET_8 (bptr, setting);
         HTTP2_GET_32 (bptr, value);
         /* process client requested settings */

         switch (setting)
         {
            case HTTP2_SETTING_MAX_HEAD_TABLE_SIZE :
                 h2ptr->ClientMaxHeaderTableSize = value;
                 h2ptr->HpackClientTable.max = value;
                 break;

            case HTTP2_SETTING_ENABLE_PUSH :
                 h2ptr->ClientPushPromise = value;
                 break;

            case HTTP2_SETTING_MAX_CONC_STREAMS :
                 h2ptr->ClientMaxConcStreams = value;
                 break;

            case HTTP2_SETTING_INIT_WIN_SIZE :
                 Http2FlowControl (h2ptr, value);
                 break;

            case HTTP2_SETTING_MAX_FRAME_SIZE :
                 h2ptr->ClientMaxFrameSize = value;
                 break;

            case HTTP2_SETTING_MAX_HEAD_LIST_SIZE :
                 h2ptr->ClientMaxHeaderListSize = value;
                 break;

            default :
                 /* ignore unknown settings RFC 7540 6.5.2 */
         }
      }


      /*****************/
      /* ack to client */
      /*****************/

      if (WATCHING (h2ptr, WATCH_HTTP2))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                    "SETTINGS server ACKNOWLEDGE");

      w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

      HTTP2_PLACE_24 (w2ptr->length, 0);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_SETTINGS);
      HTTP2_PLACE_8  (w2ptr->flags, HTTP2_FLAG_SETTINGS_ACK);
      HTTP2_PLACE_32 (w2ptr->ident, 0);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = 0;
   }
   else
   {
      /*************/
      /* to client */
      /*************/

      w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

      bptr = w2ptr->payload;

      HTTP2_PUT_16 (bptr, HTTP2_SETTING_MAX_HEAD_TABLE_SIZE);
      HTTP2_PUT_32 (bptr, h2ptr->ServerMaxHeaderTableSize);

      HTTP2_PUT_16 (bptr, HTTP2_SETTING_MAX_CONC_STREAMS);
      HTTP2_PUT_32 (bptr, h2ptr->ServerMaxConcStreams);

      HTTP2_PUT_16 (bptr, HTTP2_SETTING_INIT_WIN_SIZE);
      HTTP2_PUT_32 (bptr, h2ptr->ServerInitialWindowSize);

      HTTP2_PUT_16 (bptr, HTTP2_SETTING_MAX_FRAME_SIZE);
      HTTP2_PUT_32 (bptr, h2ptr->ServerMaxFrameSize);

      HTTP2_PUT_16 (bptr, HTTP2_SETTING_MAX_HEAD_LIST_SIZE);
      HTTP2_PUT_32 (bptr, h2ptr->ServerMaxHeaderListSize);

      HTTP2_PLACE_24 (w2ptr->length, bptr - w2ptr->payload);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_SETTINGS);
      HTTP2_PLACE_8  (w2ptr->flags, 0); 
      HTTP2_PLACE_32 (w2ptr->ident, 0);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = bptr - w2ptr->payload;

      if (WATCHING (h2ptr, WATCH_HTTP2))
         Http2WatchSettings (h2ptr, "server", w2ptr->DataPtr,
                                              w2ptr->DataLength);
   }

   Http2NetQueueWrite (h2ptr, w2ptr);

   return (0);
}

/*****************************************************************************/
/*
Client setting change to initial window size initiates connection-wide flow
control window adjustment.  The resulting window size can be negative (RFC 7540
6.9.2).  Blocked flow control may now resume, or vice-versa.
*/

void Http2FlowControl
(
HTTP2_STRUCT *h2ptr,
uint value
)
{
   int  adjust;
   HTTP2_STREAM_STRUCT  *s2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2FlowControl() !UL", value);

   adjust = -(h2ptr->ClientInitialWindowSize - value);

   for (s2ptr = LIST_GET_HEAD(&h2ptr->StreamList);
        s2ptr != NULL;
        s2ptr = LIST_GET_NEXT(s2ptr))
      s2ptr->WriteWindowSize += adjust;

   h2ptr->ClientInitialWindowSize = value;

   /* resume writing if flow control was blocking and now permits */
   Http2NetQueueWrite (h2ptr, NULL);
}

/*****************************************************************************/
/*
Flow control feedback from the client.
*/

int Http2WindowUpdate
(
HTTP2_STRUCT *h2ptr,
uint ident,
uint update,
uchar *bptr,
uint blen
)
{
   uint  size;
   HTTP2_STREAM_STRUCT  *s2ptr;
   REQUEST_STRUCT  *rqeptr;
   HTTP2_WRITE_STRUCT  *w2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (h2ptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(h2ptr), WATCH_MOD_HTTP2,
                 "Http2WindowUpdate() blen:!UL ident:!UL", blen, ident);

   if (bptr != NULL)
   {
      /***************/
      /* from client */
      /***************/

      if (blen != 4) return (-(HTTP2_ERROR_SIZE));

      HTTP2_GET_32 (bptr, update);

      if (WATCHING (h2ptr, WATCH_HTTP2) &&
          !WATCHING1S(h2ptr) && !WATCHING2(h2ptr))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                    "WINDOW client ident:!UL update:!UL", ident, update);

      if (update == 0 || update & 0x80000000) return (-(HTTP2_ERROR_PROTOCOL));

      if (ident)
      {
         /**********/
         /* stream */
         /**********/

         /* locate the request corresponding to the stream */
         for (s2ptr = LIST_GET_HEAD(&h2ptr->StreamList);
              s2ptr != NULL;
              s2ptr = LIST_GET_NEXT(s2ptr))
         {
            rqeptr = (REQUEST_STRUCT*)s2ptr->RequestPtr;
            if (rqeptr->Http2Stream.Ident == ident) break;
         }
         if (s2ptr == NULL)
         {
            /* no stream found with that ident */
            if (ident > h2ptr->LastStreamIdent)
               return (-(HTTP2_ERROR_PROTOCOL));
   
            /* could be a hangover from a previous (closed) stream so ignore */
            return (HTTP2_ERROR_NONE);
         }

         size = (s2ptr->WriteWindowSize += update);
      }
      else
      {
         /**************/
         /* connection */
         /**************/

         size = (h2ptr->WriteWindowSize += update);
      }

      /* the most significant bit indicates overflow */
      if (size & 0x80000000) return (-(HTTP2_ERROR_PROTOCOL));

      /* resume writing if flow control was blocking and now permits */
      if (!NETIO_WRITE_IN_PROGRESS(h2ptr->NetIoPtr))
         Http2NetQueueWrite (h2ptr, NULL);
   }
   else
   {
      /*************/
      /* to client */
      /*************/

      if (WATCHING (h2ptr, WATCH_HTTP2) &&
                    !WATCHING1S(h2ptr) && !WATCHING2(h2ptr))
         WatchThis (WATCHITM(h2ptr), WATCH_HTTP2,
                    "WINDOW server ident:!UL update:!UL", ident, update);

      if (update == 0 || update & 0x80000000)
      {
         /* note and ignore */
         ErrorNoticed (NULL, SS$_BUGCHECK, ErrorSanityCheck, FI_LI);
         return (0);
      }

      w2ptr = Http2GetWriteStruct (h2ptr, 0, FI_LI);

      HTTP2_PLACE_24 (w2ptr->length, 4);
      HTTP2_PLACE_8  (w2ptr->type, HTTP2_FRAME_WINDOW_UPDATE);
      HTTP2_PLACE_8  (w2ptr->flags, 0);
      HTTP2_PLACE_32 (w2ptr->ident, ident);
      HTTP2_PLACE_32 (w2ptr->payload, update);

      w2ptr->Http2Ptr = h2ptr;
      w2ptr->HeaderPtr = w2ptr->header;
      w2ptr->DataPtr = w2ptr->payload;
      w2ptr->DataLength = 4;

      Http2NetQueueWrite (h2ptr, w2ptr);
   }

   return (0);
}

/*****************************************************************************/
/*
Allocate a write struct while performing some sanity checking.
*/

HTTP2_WRITE_STRUCT* Http2GetWriteStruct
(
HTTP2_STRUCT *h2ptr,
int size,
char *module,
int line
)
{
   HTTP2_WRITE_STRUCT  *w2ptr;

   /*********/
   /* begin */
   /*********/

   if (++h2ptr->WriteInUseCount > 256) /* arbitrary */
   {
      char *cptr = FaoToMemory (NULL, "WriteInUseCount:!SL",
                                h2ptr->WriteInUseCount);
      ErrorNoticed (NULL, SS$_BUGCHECK, cptr, module, line);
      VmFree (cptr, FI_LI);
   }
   w2ptr = VmGet2Heap (h2ptr, sizeof(HTTP2_WRITE_STRUCT) + size);
   return (w2ptr);
}

/*****************************************************************************/
/*
Free a write struct while performing some sanity checking.
*/

void Http2FreeWriteStruct
(
HTTP2_STRUCT *h2ptr,
HTTP2_WRITE_STRUCT *w2ptr,
char *module,
int line
)
{
   /*********/
   /* begin */
   /*********/

   if (--h2ptr->WriteInUseCount < 0)
   {
      HttpdStackTrace ("Http2FreeWriteStruct()", FI_LI);
      char *cptr = FaoToMemory (NULL, "WriteInUseCount:!SL",
                                h2ptr->WriteInUseCount);
      ErrorNoticed (NULL, SS$_BUGCHECK, cptr, module, line);
      VmFree (cptr, FI_LI);
   }
   VmFreeFrom2Heap (h2ptr, w2ptr, module, line);
}

/*****************************************************************************/
/*
Return a pointer to a string respresenting the supplied error code.
*/

char* Http2ErrorString (int error)

{
   /*********/
   /* begin */
   /*********/

   if (error > HTTP2_ERROR_COUNT) return ("*UNKNOWN*");
   return (Http2ErrorArray[error]);
}

/*****************************************************************************/
/*
Scan the HTTP/2 connection list for connections that have been idle for the
timeout period and close them down elegantly.
*/

BOOL Http2Supervisor ()

{
   HTTP2_STRUCT  *h2ptr, *next2;

   /*********/
   /* begin */
   /*********/

/**
   if (WATCH_MODULE(WATCH_MOD_HTTP2))
      WatchThis (WATCHALL, WATCH_MOD_HTTP2, "Http2Supervisor()");
**/

   /* process the connection list from least to most recent */
   for (h2ptr = LIST_GET_HEAD(&Http2List); h2ptr != NULL; h2ptr = next2)
   {
      /* get (any) next in list in case the current connection is closed */
      next2 = LIST_GET_NEXT(h2ptr);

      if (LIST_GET_HEAD(&h2ptr->StreamList))
         h2ptr->IdleSecond = 0;
      else
      if (!h2ptr->IdleSecond)
      {
         if (Config.cfTimeout.Http2Idle)
            h2ptr->IdleSecond = HttpdTickSecond + Config.cfTimeout.Http2Idle;
         else
            h2ptr->IdleSecond = HttpdTickSecond + HTTP2_TIMEOUT_IDLE_SECONDS;
      }

      if (h2ptr->IdleSecond &&
          h2ptr->IdleSecond < HttpdTickSecond)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "TIMEOUT idle");
         Http2CloseConnection (h2ptr);
         continue;
      }

      if (h2ptr->GoAwaySecond &&
          h2ptr->GoAwaySecond < HttpdTickSecond)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "TIMEOUT goaway");
         Http2CloseConnection (h2ptr);
         continue;
      }

      if (h2ptr->NetIoPtr->VmsStatus)
      {
         /* with each call check if the connection can be closed */
         Http2CloseConnection (h2ptr);
         continue;
      }

      if (h2ptr->GoAwayLastStreamIdent)
      {
         /* connection has been told to goaway */
         Http2CloseConnection (h2ptr);
         continue;
      }

      if (h2ptr->PingBackTickSecond &&
          h2ptr->PingBackTickSecond < HttpdTickSecond)
      {
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "TIMEOUT ping");
         h2ptr->PingBackTickSecond = 0;
      }
      else
      if (Http2PingTimerSeconds &&
          (h2ptr->PingSendTickSecond == 0 ||
           h2ptr->PingSendTickSecond < HttpdTickSecond))
      {
         /* send a ping every so-many seconds */
         if (WATCHING (h2ptr, WATCH_HTTP2))
            WatchThis (WATCHITM(h2ptr), WATCH_HTTP2, "TIME to ping");
         Http2Ping (h2ptr, 0, NULL, 0);
         h2ptr->PingSendTickSecond = HttpdTickSecond + Http2PingTimerSeconds;
      }

      /* reset DoS limit counters */
      h2ptr->EmptyFrameLimitCount =
         h2ptr->PingLimitCount =
         h2ptr->SettingsLimitCount =
         h2ptr->StreamResetLimitCount =
         h2ptr->ZeroHeaderLimitCount = 0;
   }

   return (LIST_NOT_EMPTY(&Http2List));
}

/*****************************************************************************/
/*
*/

void Http2Report (REQUEST_STRUCT *rqptr)

{
   static char  PageBeginFao [] =
"<p><table class=\"ctgry\">\n\
<tr><td>\n\
<table class=\"rghtrght\">\n\
\
<tr><td></td>\
<th class=\"sbttl\" style=\"width:5em;padding-left:1em;\">HTTP/2</th><td></td>\
<th class=\"sbttl\">HTTP/1.<i>n</i></th><td></td>\
</tr>\n\
\
<tr><th>Requests&nbsp;&nbsp;/Total:</th><td>!&L</td><td>(!UL%)</td>\
<td>!&L</td><td>(!UL%)</td>\
\
<tr><th>/Peak:</th><td>!&L</td><td></td><td>!&L</td></tr>\n\
\
<tr><th>Bytes&nbsp;&nbsp;/Min:</th>\
<td>!&,@SQ</td></td><td><td>!&,@SQ</td></tr>\n\
<tr><th>/Max:</th><td>!&,@SQ</td><td></td><td>!&,@SQ</td></tr>\n\
<tr><th>/Ave:</th><td>!&L</td><td></td><td>!&L</td></tr>\n\
\
<tr><th>Duration&nbsp;&nbsp;/Min:</th>\
<td>!AZ</td></td><td><td>!AZ</td></tr>\n\
<tr><th>/Max:</th><td>!AZ</td><td></td><td>!AZ</td></tr>\n\
<tr><th>/Ave:</th><td>!AZ</td><td></td><td>!AZ</td></tr>\n\
\
<tr><th>Bytes/Sec&nbsp;&nbsp;/Min:</th>\
<td>!&L</td></td><td><td>!&L</td></tr>\n\
<tr><th>/Max:</th><td>!&L</td><td></td><td>!&L</td></tr>\n\
<tr><th>/Ave:</th><td>!&L</td><td></td><td>!&L</td></tr>\n\
\
<tr><th style=\"padding-left:0;\">\
Frames&nbsp;&nbsp;/Total:</th><td>!&,@SQ</td></tr>\n\
<tr><th>/Request:</th><td>!&,@SQ</td><td>(!UL%)</td></tr>\n\
<tr><th>/Average:</th><td>!&L</td></tr>\n\
<tr><th>/Flow Cntrl:</th><td>!&,@SQ</td><td>(!UL%)</td></tr>\n\
<tr><th>/Rx:</th><td>!&,@SQ</td></tr>\n\
<tr><th>/Tx:</th><td>!&,@SQ</td></tr>\n\
\
</table>\n\
</td></tr>\n\
</table>\n";

   /* the final column just adds a little white-space on the page far right */
   static char  Http2TableFao [] =
"<p><table class=\"rghtrght\">\n\
<tr><th colspan=\"4\"></th>\
<th colspan=\"3\" style=\"text-align:center;\"><u>Frames</u></th>\
<th colspan=\"2\" style=\"text-align:center;\"><u>Bytes</u></th>\
<th colspan=\"5\" style=\"text-align:center;\"><u>Write Queue</u></th>\
<th colspan=\"2\" style=\"text-align:center;\"><u>HPACK</u></th>\
<th colspan=\"3\" style=\"text-align:center;\"><u>Requests</u></th>\
</tr>\n\
<tr><th></th>\
<th class=\"sbttl\" style=\"text-align:left;\">Service</th>\
<th class=\"sbttl\" style=\"text-align:left;\">Client</th>\
<th class=\"sbttl\">Duration</th>\
<th class=\"sbttl\">Rx</th>\
<th class=\"sbttl\">Tx</th>\
<th class=\"sbttl\">FC</th>\
<th class=\"sbttl\">Rx</th>\
<th class=\"sbttl\">Tx</th>\
<th class=\"sbttl\">0</th>\
<th class=\"sbttl\">H</th>\
<th class=\"sbttl\">N</th>\
<th class=\"sbttl\">L</th>\
<th class=\"sbttl\">Pk</th>\
<th class=\"sbttl\">Rx</th>\
<th class=\"sbttl\">Tx</th>\
<th class=\"sbttl\">Tot</th>\
<th class=\"sbttl\">Pk</th>\
<th class=\"sbttl\">Cur</th>\
<th class=\"sbttl\">WATCH</th>\
<td style=\"width:99%\"></td>\
</tr>\n\
<tr height=\"5\"></tr>\n";

   /* the empty 99% column just forces the rest left */
   static char  Http2EntryFao [] =
"<tr!AZ>\
<th>!3ZL</th>\
<td style=\"text-align:left;\"><nobr>!AZ//!AZ</nobr></td>\
<td style=\"text-align:left;\"><nobr>!AZ,!UL</nobr></td>\
<td class=\"pdlft1\"><nobr>!AZ</nobr></td>\
<td class=\"pdlft1\">!&L</td>\
<td>!&L</td>\
<td>!UL</td>\
<td class=\"pdlft1\">!&,@SQ</td>\
<td>!&,@SQ</td>\
<td class=\"pdlft1\">!UL</td>\
<td>!UL</td>\
<td>!UL</td>\
<td>!UL</td>\
<td>!UL</td>\
<td class=\"pdlft1\"><a style=\"color:inherit;text-decoration:inherit;\" \
href=\"!AZ?http2=!UL\">!UL%</a></td>\
<td><a style=\"color:inherit;text-decoration:inherit;\" \
href=\"!AZ?http2=!UL\">!UL%</a></td>\
<td class=\"pdlft1\">!&L</td>\
<td>!UL</td>\
<td>!UL</td>\
<td class=\"pdlft1\">!&@</td>\
</tr>\n";

   static char  Http2EmptyFao [] =
"<tr class=\"hlght\"><th>000</th>\
<td colspan=\"14\" style=\"text-align:left;\"><i>empty</i></td></tr>\n";

   static char  PageEndFao [] =
"</table>\n\
<p><table class=\"lftlft\">\n\
<tr><td>\n\
<form method=\"GET\" action=\"!AZ\">\n\
<input type=\"submit\" value=\" Purge Idle \">\n\
</form>\n\
</td><td>\n\
<form method=\"GET\" action=\"!AZ\">\n\
<input type=\"submit\" value=\" Force Disconnect \">\n\
</form>\n\
</td></tr>\n\
</table>\n\
!AZ\
</div>\n\
</body>\n\
</html>\n";

   int  idx, status,
        EntryCount,
        RequestHttpCount,
        RequestHttp1Count,
        RequestHttp2Count;
   int64  bytes64,
          Time64,
          ConnectTime64,
          FrameRequest64,
          FrameTotal64;
   ulong  FaoVector [48];
   ulong  *vecptr;
   char  *cptr;
   HTTP2_STRUCT  *h2ptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_HTTP2))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_HTTP2, "Http2Report()");

   AdminPageTitle (rqptr, "HTTP Report");

   vecptr = FaoVector;

   InstanceMutexLock (INSTANCE_MUTEX_HTTPD);

   RequestHttp1Count = acptr->RequestHttp11Count + acptr->RequestHttp10Count;
   RequestHttp1Count -= acptr->DoProxyCount;
   RequestHttp2Count = acptr->RequestHttp2Count;
   RequestHttpCount = RequestHttp1Count + RequestHttp2Count;

   *vecptr++ = RequestHttp2Count;
   *vecptr++ = PercentOf32 (RequestHttp2Count, RequestHttpCount);
   *vecptr++ = RequestHttp1Count;
   *vecptr++ = PercentOf32 (RequestHttp1Count, RequestHttpCount);
   *vecptr++ = acptr->ProcessingPeak[HTTP2];
   *vecptr++ = acptr->ProcessingPeak[HTTP1];

   *vecptr++ = &acptr->BytesPerSecondMinBytes64[HTTP2];
   *vecptr++ = &acptr->BytesPerSecondMinBytes64[HTTP1];
   *vecptr++ = &acptr->BytesPerSecondMaxBytes64[HTTP2];
   *vecptr++ = &acptr->BytesPerSecondMaxBytes64[HTTP1];
   if (acptr->RequestHttp2Count)
      *vecptr++ = (ulong)(float)acptr->BytesPerSecondRawTotal64[HTTP2] /
                         (float)acptr->RequestHttp2Count;
   else
      *vecptr++ = 0;
   if (acptr->RequestHttp11Count + acptr->RequestHttp10Count)
      *vecptr++ = (ulong)(float)acptr->BytesPerSecondRawTotal64[HTTP1] /
                          (float)(acptr->RequestHttp11Count +
                                  acptr->RequestHttp10Count);
   else
      *vecptr++ = 0;

   /* this kludge steps over %CC-W-ALIGNCONFLICT */
   bytes64 = acptr->ResponseDurationMin64[HTTP2];
   *vecptr++ = DurationString (rqptr, &bytes64);
   bytes64 = acptr->ResponseDurationMin64[HTTP1];
   *vecptr++ = DurationString (rqptr, &bytes64);
   bytes64 = acptr->ResponseDurationMax64[HTTP2];
   *vecptr++ = DurationString (rqptr, &bytes64);
   bytes64 = acptr->ResponseDurationMax64[HTTP1];
   *vecptr++ = DurationString (rqptr, &bytes64);
   bytes64 = acptr->ResponseDuration64[HTTP2];
   *vecptr++ = AverageDurationString (rqptr,
                                      &bytes64,
                                      acptr->ResponseDurationCount[HTTP2]);
   bytes64 = acptr->ResponseDuration64[HTTP1];
   *vecptr++ = AverageDurationString (rqptr,
                                      &bytes64,
                                      acptr->ResponseDurationCount[HTTP1]);

   *vecptr++ = acptr->BytesPerSecondMin[HTTP2];
   *vecptr++ = acptr->BytesPerSecondMin[HTTP1];
   *vecptr++ = acptr->BytesPerSecondMax[HTTP2];
   *vecptr++ = acptr->BytesPerSecondMax[HTTP1];
   *vecptr++ = acptr->BytesPerSecondAve[HTTP2];
   *vecptr++ = acptr->BytesPerSecondAve[HTTP1];

   FrameTotal64 = acptr->Http2FrameCountRx64;
   FrameTotal64 += acptr->Http2FrameCountTx64;
   *vecptr++ = &FrameTotal64;

   FrameRequest64 = acptr->Http2FrameRequestCountRx64;
   FrameRequest64 += acptr->Http2FrameRequestCountTx64;
   *vecptr++ = &FrameRequest64;
   *vecptr++ = PercentOf64 (&FrameRequest64, &FrameTotal64);
   if (acptr->RequestHttp2Count)
      *vecptr++ = (ulong)((float)FrameTotal64 /
                          (float)acptr->RequestHttp2Count);
   else
      *vecptr++ = 0;
   *vecptr++ = &acptr->Http2FlowControlCount64;
   *vecptr++ = PercentOf64 (&acptr->Http2FlowControlCount64,
                            &acptr->Http2FlowFrameCount64);

   *vecptr++ = &acptr->Http2FrameCountRx64;
   *vecptr++ = &acptr->Http2FrameCountTx64;

   InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);

   FaoCheck (sizeof(FaoVector), &FaoVector, vecptr, FI_LI);
   status = FaolToNet (rqptr, PageBeginFao, &FaoVector);
   if (VMSnok (status)) ErrorNoticed (rqptr, status, NULL, FI_LI);

   /***********************/
   /* HTTP/2 list entries */
   /***********************/

   status = FaolToNet (rqptr, Http2TableFao, NULL);
   if (VMSnok (status)) ErrorNoticed (rqptr, status, NULL, FI_LI);

   EntryCount = 0;
   sys$gettim (&Time64);

   /* process the request list from least to most recent */
   for (h2ptr = LIST_GET_HEAD(&Http2List);
        h2ptr != NULL;
        h2ptr = LIST_GET_NEXT(h2ptr))
   {
      EntryCount++;

      vecptr = FaoVector;

      ConnectTime64 = h2ptr->ConnectTime64 - Time64;

      *vecptr++ = EntryCount % 2 ? " class=\"hlght\"" : "";
      *vecptr++ = EntryCount;
      *vecptr++ = h2ptr->ServicePtr->RequestSchemeNamePtr;
      *vecptr++ = h2ptr->ServicePtr->ServerHostPort;
      *vecptr++ = h2ptr->ClientPtr->Lookup.HostName;
      *vecptr++ = h2ptr->ClientPtr->IpPort;
      *vecptr++ = DurationString (rqptr, &ConnectTime64);
      *vecptr++ = h2ptr->FrameCountRx;
      *vecptr++ = h2ptr->FrameCountTx;
      *vecptr++ = h2ptr->FlowControlCount;

      *vecptr++ = &h2ptr->BytesRawRx64;
      *vecptr++ = &h2ptr->BytesRawTx64;

      for (idx = HTTP2_WRITE_QUEUE_MAX; idx <= HTTP2_WRITE_QUEUE_LOW; idx++)
         *vecptr++ = LIST_GET_COUNT (&h2ptr->QueuedWriteList[idx]);
      *vecptr++ = h2ptr->QueuedWritePeak;

      *vecptr++ = ADMIN_REPORT_HPACK;
      *vecptr++ = h2ptr->ConnectNumber;
      if (h2ptr->HpackClientOutputCount)
         *vecptr++ = (h2ptr->HpackClientInputCount * 100) /
                     h2ptr->HpackClientOutputCount;
      else
         *vecptr++ = 0;

      *vecptr++ = ADMIN_REPORT_HPACK;
      *vecptr++ = h2ptr->ConnectNumber;
      if (h2ptr->HpackServerInputCount)
         *vecptr++ = (h2ptr->HpackServerOutputCount * 100) /
                     h2ptr->HpackServerInputCount;
      else
         *vecptr++ = 0;

      *vecptr++ = h2ptr->RequestCount;
      *vecptr++ = h2ptr->RequestPeak;
      *vecptr++ = h2ptr->RequestCurrent;

      if (rqptr->Http2Stream.Http2Ptr != NULL &&
          rqptr->Http2Stream.Http2Ptr->ConnectNumber == h2ptr->ConnectNumber)
         *vecptr++ = "current";
      else
      {
         *vecptr++ =
"<a class=\"abttn bttn090 px1\" href=\"!AZ?at=!UL\">P</a>\
<a class=\"abttn bttn090 px1\" href=\"!AZ?at=!UL&this=!UL\">+</a>\
<a class=\"abttn bttn090 px1\" href=\"!AZ?this=!UL\">W</a>";
         *vecptr++ = ADMIN_REPORT_WATCH;
         *vecptr++ = h2ptr->ConnectNumber;
         *vecptr++ = ADMIN_REPORT_WATCH;
         *vecptr++ = h2ptr->ConnectNumber;
         *vecptr++ = h2ptr->ConnectNumber;
         *vecptr++ = ADMIN_REPORT_WATCH;
         *vecptr++ = h2ptr->ConnectNumber;
      }

      FaoCheck (sizeof(FaoVector), &FaoVector, vecptr, FI_LI);
      status = FaolToNet (rqptr, Http2EntryFao, &FaoVector);
      if (VMSnok (status)) ErrorNoticed (rqptr, status, NULL, FI_LI);
   }

   if (!EntryCount) FaolToNet (rqptr, Http2EmptyFao, NULL);

   /**************/
   /* end report */
   /**************/

   vecptr = FaoVector;

   *vecptr++ = ADMIN_CONTROL_HTTP2_PURGE;
   *vecptr++ = ADMIN_CONTROL_HTTP2_PURGE_ALL,
   *vecptr++ = AdminRefresh();

   FaolToNet (rqptr, PageEndFao, FaoVector);

   rqptr->rqResponse.PreExpired = PRE_EXPIRE_ADMIN;
   ResponseHeader200 (rqptr, "text/html", NULL);

   AdminEnd (rqptr);
}

/*****************************************************************************/
/*
See NetTestBreak().
*/

#if WATCH_MOD

void Http2TestBreak (int every)

{
   int  count, total;
   HTTP2_STRUCT  *h2ptr;
   HTTP2_STREAM_STRUCT  *s2ptr;
   NETIO_STRUCT  *ioptr;
   REQUEST_STRUCT  *rqeptr;

   /*********/
   /* begin */
   /*********/

   if (every < 0) every = 1;
   count = total = 0;
   for (h2ptr = LIST_GET_HEAD(&Http2List);
        h2ptr != NULL;
        h2ptr = LIST_GET_NEXT(h2ptr))
   {
      if (++count % every) continue;
      ioptr = h2ptr->NetIoPtr;
      if (ioptr->Channel)
      {
         /* do not kill WATCHing request */
         rqeptr = (REQUEST_STRUCT*)-1;
         for (s2ptr = LIST_GET_HEAD(&h2ptr->StreamList);
              s2ptr != NULL;
              s2ptr = LIST_GET_NEXT(s2ptr))
         {
            rqeptr = (REQUEST_STRUCT*)s2ptr->RequestPtr;
            if (rqeptr == Watch.RequestPtr) break;
         }
         if (rqeptr == Watch.RequestPtr) continue;

         WatchThis (WATCHITM(h2ptr), WATCH_NETWORK, "BREAK2 !AZ",
                    h2ptr->ServicePtr->ServerHostPort);
         sys$dassgn (ioptr->Channel);
         ioptr->Channel = 0;
         total++;

         for (s2ptr = LIST_GET_HEAD(&h2ptr->StreamList);
              s2ptr != NULL;
              s2ptr = LIST_GET_NEXT(s2ptr))
         {
            rqeptr = (REQUEST_STRUCT*)s2ptr->RequestPtr;
            if (rqeptr->rqHeader.RequestUriPtr)
               WatchThis (WATCHITM(rqeptr), WATCH_NETWORK, "BREAK2 !AZ !AZ !AZ",
                          rqeptr->ServicePtr->ServerHostPort,
                          rqeptr->rqHeader.MethodName,
                          rqeptr->rqHeader.RequestUriPtr);
            else
               WatchThis (WATCHITM(rqeptr), WATCH_NETWORK, "BREAK2 !AZ 0",
                          rqeptr->ServicePtr->ServerHostPort);
          }
      }
   }
   FaoToStdout ("%HTTPD-I-HTTP2, !%T, !UL/!UL/!UL broken\n",
                0, every, total, count);
}

#endif /* WATCH_MOD */

/*****************************************************************************/