1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
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
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
|
Network Working Group C. Feather
Request for Comments: 3977 THUS plc
Obsoletes: 977 October 2006
Updates: 2980
Category: Standards Track
Network News Transfer Protocol (NNTP)
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2006).
Abstract
The Network News Transfer Protocol (NNTP) has been in use in the
Internet for a decade, and remains one of the most popular protocols
(by volume) in use today. This document is a replacement for
RFC 977, and officially updates the protocol specification. It
clarifies some vagueness in RFC 977, includes some new base
functionality, and provides a specific mechanism to add standardized
extensions to NNTP.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Author's Note . . . . . . . . . . . . . . . . . . . . . . 4
2. Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . 6
3.1. Commands and Responses . . . . . . . . . . . . . . . . . 6
3.1.1. Multi-line Data Blocks . . . . . . . . . . . . . . . . 8
3.2. Response Codes . . . . . . . . . . . . . . . . . . . . . 9
3.2.1. Generic Response Codes . . . . . . . . . . . . . . . 10
3.2.1.1. Examples . . . . . . . . . . . . . . . . . . . . 12
3.3. Capabilities and Extensions . . . . . . . . . . . . . . . 14
3.3.1. Capability Descriptions . . . . . . . . . . . . . . . 14
3.3.2. Standard Capabilities . . . . . . . . . . . . . . . . 15
3.3.3. Extensions . . . . . . . . . . . . . . . . . . . . . 16
3.3.4. Initial IANA Register . . . . . . . . . . . . . . . . 18
3.4. Mandatory and Optional Commands . . . . . . . . . . . . . 20
Feather Standards Track [Page 1]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
3.4.1. Reading and Transit Servers . . . . . . . . . . . . . 21
3.4.2. Mode Switching . . . . . . . . . . . . . . . . . . . 21
3.5. Pipelining . . . . . . . . . . . . . . . . . . . . . . . 22
3.5.1. Examples . . . . . . . . . . . . . . . . . . . . . . 23
3.6. Articles . . . . . . . . . . . . . . . . . . . . . . . . 24
4. The WILDMAT Format . . . . . . . . . . . . . . . . . . . . . 25
4.1. Wildmat Syntax . . . . . . . . . . . . . . . . . . . . . 26
4.2. Wildmat Semantics . . . . . . . . . . . . . . . . . . . . 26
4.3. Extensions . . . . . . . . . . . . . . . . . . . . . . . 27
4.4. Examples . . . . . . . . . . . . . . . . . . . . . . . . 27
5. Session Administration Commands . . . . . . . . . . . . . . . 28
5.1. Initial Connection . . . . . . . . . . . . . . . . . . . 28
5.2. CAPABILITIES . . . . . . . . . . . . . . . . . . . . . . 29
5.3. MODE READER . . . . . . . . . . . . . . . . . . . . . . . 32
5.4. QUIT . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6. Article Posting and Retrieval . . . . . . . . . . . . . . . . 35
6.1. Group and Article Selection . . . . . . . . . . . . . . . 36
6.1.1. GROUP . . . . . . . . . . . . . . . . . . . . . . . . 36
6.1.2. LISTGROUP . . . . . . . . . . . . . . . . . . . . . . 39
6.1.3. LAST . . . . . . . . . . . . . . . . . . . . . . . . 42
6.1.4. NEXT . . . . . . . . . . . . . . . . . . . . . . . . 44
6.2. Retrieval of Articles and Article Sections . . . . . . . 45
6.2.1. ARTICLE . . . . . . . . . . . . . . . . . . . . . . . 46
6.2.2. HEAD . . . . . . . . . . . . . . . . . . . . . . . . 49
6.2.3. BODY . . . . . . . . . . . . . . . . . . . . . . . . 51
6.2.4. STAT . . . . . . . . . . . . . . . . . . . . . . . . 53
6.3. Article Posting . . . . . . . . . . . . . . . . . . . . . 56
6.3.1. POST . . . . . . . . . . . . . . . . . . . . . . . . 56
6.3.2. IHAVE . . . . . . . . . . . . . . . . . . . . . . . . 58
7. Information Commands . . . . . . . . . . . . . . . . . . . . 61
7.1. DATE . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.2. HELP . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.3. NEWGROUPS . . . . . . . . . . . . . . . . . . . . . . . . 63
7.4. NEWNEWS . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.5. Time . . . . . . . . . . . . . . . . . . . . . . . . . . 65
7.5.1. Examples . . . . . . . . . . . . . . . . . . . . . . 66
7.6. The LIST Commands . . . . . . . . . . . . . . . . . . . . 66
7.6.1. LIST . . . . . . . . . . . . . . . . . . . . . . . . 67
7.6.2. Standard LIST Keywords . . . . . . . . . . . . . . . 69
7.6.3. LIST ACTIVE . . . . . . . . . . . . . . . . . . . . . 70
7.6.4. LIST ACTIVE.TIMES . . . . . . . . . . . . . . . . . . 71
7.6.5. LIST DISTRIB.PATS . . . . . . . . . . . . . . . . . . 72
7.6.6. LIST NEWSGROUPS . . . . . . . . . . . . . . . . . . . 73
8. Article Field Access Commands . . . . . . . . . . . . . . . . 73
8.1. Article Metadata . . . . . . . . . . . . . . . . . . . . 74
8.1.1. The :bytes Metadata Item . . . . . . . . . . . . . . 74
8.1.2. The :lines Metadata Item . . . . . . . . . . . . . . 75
8.2. Database Consistency . . . . . . . . . . . . . . . . . . 75
Feather Standards Track [Page 2]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.3. OVER . . . . . . . . . . . . . . . . . . . . . . . . . . 76
8.4. LIST OVERVIEW.FMT . . . . . . . . . . . . . . . . . . . . 81
8.5. HDR . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.6. LIST HEADERS . . . . . . . . . . . . . . . . . . . . . . 87
9. Augmented BNF Syntax for NNTP . . . . . . . . . . . . . . . . 90
9.1. Introduction . . . . . . . . . . . . . . . . . . . . . . 90
9.2. Commands . . . . . . . . . . . . . . . . . . . . . . . . 92
9.3. Command Continuation . . . . . . . . . . . . . . . . . . 93
9.4. Responses . . . . . . . . . . . . . . . . . . . . . . . . 93
9.4.1. Generic Responses . . . . . . . . . . . . . . . . . . 93
9.4.2. Initial Response Line Contents . . . . . . . . . . . 94
9.4.3. Multi-line Response Contents . . . . . . . . . . . . 94
9.5. Capability Lines . . . . . . . . . . . . . . . . . . . . 95
9.6. LIST Variants . . . . . . . . . . . . . . . . . . . . . . 96
9.7. Articles . . . . . . . . . . . . . . . . . . . . . . . . 97
9.8. General Non-terminals . . . . . . . . . . . . . . . . . . 97
9.9. Extensions and Validation . . . . . . . . . . . . . . . . 99
10. Internationalisation Considerations . . . . . . . . . . . . .100
10.1. Introduction and Historical Situation . . . . . . . . . .100
10.2. This Specification . . . . . . . . . . . . . . . . . . .101
10.3. Outstanding Issues . . . . . . . . . . . . . . . . . . .102
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . .103
12. Security Considerations . . . . . . . . . . . . . . . . . . .103
12.1. Personal and Proprietary Information . . . . . . . . . .104
12.2. Abuse of Server Log Information . . . . . . . . . . . . .104
12.3. Weak Authentication and Access Control . . . . . . . . .104
12.4. DNS Spoofing . . . . . . . . . . . . . . . . . . . . . .104
12.5. UTF-8 Issues . . . . . . . . . . . . . . . . . . . . . .105
12.6. Caching of Capability Lists . . . . . . . . . . . . . . .106
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . .107
14. References . . . . . . . . . . . . . . . . . . . . . . . . .110
14.1. Normative References . . . . . . . . . . . . . . . . . .110
14.2. Informative References . . . . . . . . . . . . . . . . .110
A. Interaction with Other Specifications . . . . . . . . . . . .112
A.1. Header Folding . . . . . . . . . . . . . . . . . . . . .112
A.2. Message-IDs . . . . . . . . . . . . . . . . . . . . . . .112
A.3. Article Posting . . . . . . . . . . . . . . . . . . . . .114
B. Summary of Commands . . . . . . . . . . . . . . . . . . . . .115
C. Summary of Response Codes . . . . . . . . . . . . . . . . . .117
D. Changes from RFC 977 . . . . . . . . . . . . . . . . . . . .121
1. Introduction
This document specifies the Network News Transfer Protocol (NNTP),
which is used for the distribution, inquiry, retrieval, and posting
of Netnews articles using a reliable stream-based mechanism. For
news-reading clients, NNTP enables retrieval of news articles that
Feather Standards Track [Page 3]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
are stored in a central database, giving subscribers the ability to
select only those articles they wish to read.
The Netnews model provides for indexing, cross-referencing, and
expiration of aged messages. NNTP is designed for efficient
transmission of Netnews articles over a reliable full duplex
communication channel.
Although the protocol specification in this document is largely
compatible with the version specified in RFC 977 [RFC977], a number
of changes are summarised in Appendix D. In particular:
o the default character set is changed from US-ASCII [ANSI1986] to
UTF-8 [RFC3629] (note that US-ASCII is a subset of UTF-8);
o a number of commands that were optional in RFC 977 or that have
been taken from RFC 2980 [RFC2980] are now mandatory; and
o a CAPABILITIES command has been added to allow clients to
determine what functionality is available from a server.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
An implementation is not compliant if it fails to satisfy one or more
of the MUST requirements for this protocol. An implementation that
satisfies all the MUST and all the SHOULD requirements for its
protocols is said to be "unconditionally compliant"; one that
satisfies all the MUST requirements but not all the SHOULD
requirements for NNTP is said to be "conditionally compliant".
For the remainder of this document, the terms "client" and "client
host" refer to a host making use of the NNTP service, while the terms
"server" and "server host" refer to a host that offers the NNTP
service.
1.1. Author's Note
This document is written in XML using an NNTP-specific DTD. Custom
software is used to convert this to RFC 2629 [RFC2629] format, and
then the public "xml2rfc" package to further reduce this to text,
nroff source, and HTML.
No perl was used in producing this document.
Feather Standards Track [Page 4]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
2. Notation
The following notational conventions are used in this document.
UPPERCASE indicates literal text to be included in the
command.
lowercase indicates a token described elsewhere.
[brackets] indicate that the enclosed material is optional.
elliptical indicates that the argument may be repeated any
... marks number of times (it must occur at least once).
vertical|bar indicates a choice of two mutually exclusive
arguments (exactly one must be provided).
The name "message-id" for a command or response argument indicates
that it is the message-id of an article as described in Section 3.6,
including the angle brackets.
The name "wildmat" for an argument indicates that it is a wildmat as
defined in Section 4. If the argument does not meet the requirements
of that section (for example, if it does not fit the grammar of
Section 4.1), the NNTP server MAY place some interpretation on it
(not specified by this document) or otherwise MUST treat it as a
syntax error.
Responses for each command will be described in tables listing the
required format of a response followed by the meaning that should be
ascribed to that response.
The terms "NUL", "TAB", "LF", "CR, and "space" refer to the octets
%x00, %x09, %x0A, %x0D, and %x20, respectively (that is, the octets
with those codes in US-ASCII [ANSI1986] and thus in UTF-8 [RFC3629]).
The term "CRLF" or "CRLF pair" means the sequence CR immediately
followed by LF (that is, %x0D.0A). A "printable US-ASCII character"
is an octet in the range %x21-7E. Quoted characters refer to the
octets with those codes in US-ASCII (so "." and "<" refer to %x2E and
%x3C) and will always be printable US-ASCII characters; similarly,
"digit" refers to the octets %x30-39.
A "keyword" MUST consist only of US-ASCII letters, digits, and the
characters dot (".") and dash ("-") and MUST begin with a letter.
Keywords MUST be at least three characters in length.
Feather Standards Track [Page 5]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Examples in this document are not normative but serve to illustrate
usages, arguments, and responses. In the examples, a "[C]" will be
used to represent the client host and an "[S]" will be used to
represent the server host. Most of the examples do not rely on a
particular server state. In some cases, however, they do assume that
the currently selected newsgroup (see the GROUP command,
Section 6.1.1) is invalid; when so, this is indicated at the start of
the example. Examples may use commands or other keywords not defined
in this specification (such as an XENCRYPT command). These will be
used to illustrate some point and do not imply that any such command
is defined elsewhere or needs to exist in any particular
implementation.
Terms that might be read as specifying details of a client or server
implementation, such as "database", are used simply to ease
description. Provided that implementations conform to the protocol
and format specifications in this document, no specific technique is
mandated.
3. Basic Concepts
3.1. Commands and Responses
NNTP operates over any reliable bi-directional 8-bit-wide data stream
channel. When the connection is established, the NNTP server host
MUST send a greeting. The client host and server host then exchange
commands and responses (respectively) until the connection is closed
or aborted. If the connection used is TCP, then the server host
starts the NNTP service by listening on a TCP port. When a client
host wishes to make use of the service, it MUST establish a TCP
connection with the server host by connecting to that host on the
same port on which the server is listening.
The character set for all NNTP commands is UTF-8 [RFC3629]. Commands
in NNTP MUST consist of a keyword, which MAY be followed by one or
more arguments. A CRLF pair MUST terminate all commands. Multiple
commands MUST NOT be on the same line. Unless otherwise noted
elsewhere in this document, arguments SHOULD consist of printable US-
ASCII characters. Keywords and arguments MUST each be separated by
one or more space or TAB characters. Command lines MUST NOT exceed
512 octets, which includes the terminating CRLF pair. The arguments
MUST NOT exceed 497 octets. A server MAY relax these limits for
commands defined in an extension.
Where this specification permits UTF-8 characters outside the range
of U+0000 to U+007F, implementations MUST NOT use the Byte Order Mark
(U+FEFF, encoding %xEF.BB.BF) and MUST use the Word Joiner (U+2060,
encoding %xE2.91.A0) for the meaning Zero Width No-Break Space in
Feather Standards Track [Page 6]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
command lines and the initial lines of responses. Implementations
SHOULD apply these same principles throughout.
The term "character" means a single Unicode code point.
Implementations are not required to carry out Unicode normalisation.
Thus, U+0084 (A-dieresis) is one character, while U+0041 U+0308 (A
composed with dieresis) is two; the two need not be treated as
equivalent.
Commands may have variants; if so, they use a second keyword
immediately after the first to indicate which variant is required.
The only such commands in this specification are LIST and MODE. Note
that such variants are sometimes referred to as if they were commands
in their own right: "the LIST ACTIVE" command should be read as
shorthand for "the ACTIVE variant of the LIST command".
Keywords are case insensitive; the case of keywords for commands MUST
be ignored by the server. Command and response arguments are case or
language specific only when stated, either in this document or in
other relevant specifications.
In some cases, a command involves more data than just a single line.
The further data may be sent either immediately after the command
line (there are no instances of this in this specification, but there
are in extensions such as [NNTP-STREAM]) or following a request from
the server (indicated by a 3xx response).
Each response MUST start with a three-digit response code that is
sufficient to distinguish all responses. Certain valid responses are
defined to be multi-line; for all others, the response is contained
in a single line. The initial line of the response MUST NOT exceed
512 octets, which includes the response code and the terminating CRLF
pair; an extension MAY specify a greater maximum for commands that it
defines, but not for any other command. Single-line responses
consist of an initial line only. Multi-line responses consist of an
initial line followed by a multi-line data block.
An NNTP server MAY have an inactivity autologout timer. Such a timer
SHOULD be of at least three minutes' duration, with the exception
that there MAY be a shorter limit on how long the server is willing
to wait for the first command from the client. The receipt of any
command from the client during the timer interval SHOULD suffice to
reset the autologout timer. Similarly, the receipt of any
significant amount of data from a client that is sending a multi-line
data block (such as during a POST or IHAVE command) SHOULD suffice to
reset the autologout timer. When the timer expires, the server
SHOULD close the connection without sending any response to the
client.
Feather Standards Track [Page 7]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
3.1.1. Multi-line Data Blocks
A multi-line data block is used in certain commands and responses.
It MUST adhere to the following rules:
1. The block consists of a sequence of zero or more "lines", each
being a stream of octets ending with a CRLF pair. Apart from
those line endings, the stream MUST NOT include the octets NUL,
LF, or CR.
2. In a multi-line response, the block immediately follows the CRLF
at the end of the initial line of the response. When used in any
other context, the specific command will define when the block is
sent.
3. If any line of the data block begins with the "termination octet"
("." or %x2E), that line MUST be "dot-stuffed" by prepending an
additional termination octet to that line of the block.
4. The lines of the block MUST be followed by a terminating line
consisting of a single termination octet followed by a CRLF pair
in the normal way. Thus, unless it is empty, a multi-line block
is always terminated with the five octets CRLF "." CRLF
(%x0D.0A.2E.0D.0A).
5. When a multi-line block is interpreted, the "dot-stuffing" MUST
be undone; i.e., the recipient MUST ensure that, in any line
beginning with the termination octet followed by octets other
than a CRLF pair, that initial termination octet is disregarded.
6. Likewise, the terminating line ("." CRLF or %x2E.0D.0A) MUST NOT
be considered part of the multi-line block; i.e., the recipient
MUST ensure that any line beginning with the termination octet
followed immediately by a CRLF pair is disregarded. (The first
CRLF pair of the terminating CRLF "." CRLF of a non-empty block
is, of course, part of the last line of the block.)
Note that texts using an encoding (such as UTF-16 or UTF-32) that may
contain the octets NUL, LF, or CR other than a CRLF pair cannot be
reliably conveyed in the above format (that is, they violate the MUST
requirement above). However, except when stated otherwise, this
specification does not require the content to be UTF-8, and therefore
(subject to that same requirement) it MAY include octets above and
below 128 mixed arbitrarily.
This document does not place any limit on the length of a line in a
multi-line block. However, the standards that define the format of
articles may do so.
Feather Standards Track [Page 8]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
3.2. Response Codes
Each response MUST begin with a three-digit status indicator. These
are status reports from the server and indicate the response to the
last command received from the client.
The first digit of the response broadly indicates the success,
failure, or progress of the previous command:
1xx - Informative message
2xx - Command completed OK
3xx - Command OK so far; send the rest of it
4xx - Command was syntactically correct but failed for some reason
5xx - Command unknown, unsupported, unavailable, or syntax error
The next digit in the code indicates the function response category:
x0x - Connection, setup, and miscellaneous messages
x1x - Newsgroup selection
x2x - Article selection
x3x - Distribution functions
x4x - Posting
x8x - Reserved for authentication and privacy extensions
x9x - Reserved for private use (non-standard extensions)
Certain responses contain arguments such as numbers and names in
addition to the status indicator. In those cases, to simplify
interpretation by the client, the number and type of such arguments
is fixed for each response code, as is whether the code is
single-line or multi-line. Any extension MUST follow this principle
as well. Note that, for historical reasons, the 211 response code is
an exception to this in that the response may be single-line or
multi-line depending on the command (GROUP or LISTGROUP) that
generated it. In all other cases, the client MUST only use the
status indicator itself to determine the nature of the response. The
exact response codes that can be returned by any given command are
detailed in the description of that command.
Arguments MUST be separated from the numeric status indicator and
from each other by a single space. All numeric arguments MUST be in
base 10 (decimal) format and MAY have leading zeros. String
arguments MUST contain at least one character and MUST NOT contain
TAB, LF, CR, or space. The server MAY add any text after the
response code or last argument, as appropriate, and the client MUST
NOT make decisions based on this text. Such text MUST be separated
from the numeric status indicator or the last argument by at least
one space.
Feather Standards Track [Page 9]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The server MUST respond to any command with the appropriate generic
response (given in Section 3.2.1) if it represents the situation.
Otherwise, each recognized command MUST return one of the response
codes specifically listed in its description or in an extension. A
server MAY provide extensions to this specification, including new
commands, new variants or features of existing commands, and other
ways of changing the internal state of the server. However, the
server MUST NOT produce any other responses to a client that does not
invoke any of the additional features. (Therefore, a client that
restricts itself to this specification will only receive the
responses that are listed.)
If a client receives an unexpected response, it SHOULD use the first
digit of the response to determine the result. For example, an
unexpected 2xx should be taken as success, and an unexpected 4xx or
5xx as failure.
Response codes not specified in this document MAY be used for any
installation-specific additional commands also not specified. These
SHOULD be chosen to fit the pattern of x9x specified above.
Neither this document nor any registered extension (see
Section 3.3.3) will specify any response codes of the x9x pattern.
(Implementers of extensions are accordingly cautioned not to use such
responses for extensions that may subsequently be submitted for
registration.)
3.2.1. Generic Response Codes
The server MUST respond to any command with the appropriate one of
the following generic responses if it represents the situation.
If the command is not recognized, or if it is an optional command
that is not implemented by the server, the response code 500 MUST be
returned.
If there is a syntax error in the arguments of a recognized command,
including the case where more arguments are provided than the command
specifies or the command line is longer than the server accepts, the
response code 501 MUST be returned. The line MUST NOT be truncated
or split and then interpreted. Note that where a command has
variants depending on a second keyword (e.g., LIST ACTIVE and LIST
NEWSGROUPS), 501 MUST be used when the base command is implemented
but the requested variant is not, and 500 MUST be used only when the
base command itself is not implemented.
If an argument is required to be a base64-encoded string [RFC4648]
(there are no such arguments in this specification, but there may be
Feather Standards Track [Page 10]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
in extensions) and is not validly encoded, the response code 504 MUST
be returned.
If the server experiences an internal fault or problem that means it
is unable to carry out the command (for example, a necessary file is
missing or a necessary service could not be contacted), the response
code 403 MUST be returned. If the server recognizes the command but
does not provide an optional feature (for example, because it does
not store the required information), or if it only handles a subset
of legitimate cases (see the HDR command, Section 8.5, for an
example), the response code 503 MUST be returned.
If the client is not authorized to use the specified facility when
the server is in its current state, then the appropriate one of the
following response codes MUST be used.
502: It is necessary to terminate the connection and to start a new
one with the appropriate authority before the command can be used.
Historically, some mode-switching servers (see Section 3.4.1) used
this response to indicate that this command will become available
after the MODE READER command (Section 5.3) is used, but this
usage does not conform to this specification and MUST NOT be used.
Note that the server MUST NOT close the connection immediately
after a 502 response except at the initial connection
(Section 5.1) and with the MODE READER command.
480: The client must authenticate itself to the server (that is, it
must provide information as to the identity of the client) before
the facility can be used on this connection. This will involve
the use of an authentication extension such as [NNTP-AUTH].
483: The client must negotiate appropriate privacy protection on the
connection. This will involve the use of a privacy extension such
as [NNTP-TLS].
401: The client must change the state of the connection in some other
manner. The first argument of the response MUST be the capability
label (see Section 5.2) of the facility that provides the
necessary mechanism (usually an extension, which may be a private
extension). The server MUST NOT use this response code except as
specified by the definition of the capability in question.
If the server has to terminate the connection for some reason, it
MUST give a 400 response code to the next command and then
immediately close the connection. Following a 400 response, clients
SHOULD NOT simply reconnect immediately and retry the same actions.
Rather, a client SHOULD either use an exponentially increasing delay
between retries (e.g., double the waiting time after each 400
Feather Standards Track [Page 11]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
response) or present any associated text to the user for them to
decide whether and when to retry.
The client MUST be prepared to receive any of these responses for any
command (except, of course, that the server MUST NOT generate a 500
response code for mandatory commands).
3.2.1.1. Examples
Example of an unknown command:
[C] MAIL
[S] 500 Unknown command
Example of an unsupported command:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] NEWNEWS
[S] LIST ACTIVE NEWSGROUPS
[S] .
[C] OVER
[S] 500 Unknown command
Example of an unsupported variant:
[C] MODE POSTER
[S] 501 Unknown MODE option
Example of a syntax error:
[C] ARTICLE a.message.id@no.angle.brackets
[S] 501 Syntax error
Example of an overlong command line:
[C] HEAD 53 54 55
[S] 501 Too many arguments
Example of a bad wildmat:
[C] LIST ACTIVE u[ks].*
[S] 501 Syntax error
Feather Standards Track [Page 12]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of a base64-encoding error (the second argument is meant to
be base64 encoded):
[C] XENCRYPT RSA abcd=efg
[S] 504 Base64 encoding error
Example of an attempt to access a facility not available to this
connection:
[C] MODE READER
[S] 200 Reader mode, posting permitted
[C] IHAVE <i.am.an.article.you.will.want@example.com>
[S] 500 Permission denied
Example of an attempt to access a facility requiring authentication:
[C] GROUP secret.group
[S] 480 Permission denied
Example of a successful attempt following such authentication:
[C] XSECRET fred flintstone
[S] 290 Password for fred accepted
[C] GROUP secret.group
[S] 211 5 1 20 secret.group selected
Example of an attempt to access a facility requiring privacy:
[C] GROUP secret.group
[S] 483 Secure connection required
[C] XENCRYPT
[Client and server negotiate encryption on the link]
[S] 283 Encrypted link established
[C] GROUP secret.group
[S] 211 5 1 20 secret.group selected
Example of a need to change mode before a facility is used:
[C] GROUP binary.group
[S] 401 XHOST Not on this virtual host
[C] XHOST binary.news.example.org
[S] 290 binary.news.example.org virtual host selected
[C] GROUP binary.group
[S] 211 5 1 77 binary.group selected
Feather Standards Track [Page 13]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of a temporary failure:
[C] GROUP archive.local
[S] 403 Archive server temporarily offline
Example of the server needing to close down immediately:
[C] ARTICLE 123
[S] 400 Power supply failed, running on UPS
[Server closes connection.]
3.3. Capabilities and Extensions
Not all NNTP servers provide exactly the same facilities, both
because this specification allows variation and because servers may
provide extensions. A set of facilities that are related are called
a "capability". This specification provides a way to determine what
capabilities are available, includes a list of standard capabilities,
and includes a mechanism (the extension mechanism) for defining new
capabilities.
3.3.1. Capability Descriptions
A client can determine the available capabilities of the server by
using the CAPABILITIES command (Section 5.2). This returns a
capability list, which is a list of capability lines. Each line
describes one available capability.
Each capability line consists of one or more tokens, which MUST be
separated by one or more space or TAB characters. A token is a
string of 1 or more printable UTF-8 characters (that is, either
printable US-ASCII characters or any UTF-8 sequence outside the US-
ASCII range, but not space or TAB). Unless stated otherwise, tokens
are case insensitive. Each capability line consists of the
following:
o The capability label, which is a keyword indicating the
capability. A capability label may be defined by this
specification or a successor, or by an extension.
o The label is then followed by zero or more tokens, which are
arguments of the capability. The form and meaning of these tokens
is specific to each capability.
The server MUST ensure that the capability list accurately reflects
the capabilities (including extensions) currently available. If a
capability is only available with the server in a certain state (for
example, only after authentication), the list MUST only include the
Feather Standards Track [Page 14]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
capability label when the server is in that state. Similarly, if
only some of the commands in an extension will be available, or if
the behaviour of the extension will change in some other manner,
according to the state of the server, this MUST be indicated by
different arguments in the capability line.
Note that a capability line can only begin with a letter. Lines
beginning with other characters are reserved for future versions of
this specification. In order to interoperate with such versions,
clients MUST be prepared to receive lines beginning with other
characters and MUST ignore any they do not understand.
3.3.2. Standard Capabilities
The following capabilities are defined by this specification.
VERSION
This capability MUST be advertised by all servers and MUST be the
first capability in the capability list; it indicates the
version(s) of NNTP that the server supports. There must be at
least one argument; each argument is a decimal number and MUST NOT
have a leading zero. Version numbers are assigned only in RFCs
that update or replace this specification; servers MUST NOT create
their own version numbers.
The version number of this specification is 2.
READER
This capability indicates that the server implements the various
commands useful for reading clients.
IHAVE
This capability indicates that the server implements the IHAVE
command.
POST
This capability indicates that the server implements the POST
command.
NEWNEWS
This capability indicates that the server implements the NEWNEWS
command.
HDR
This capability indicates that the server implements the header
access commands (HDR and LIST HEADERS).
Feather Standards Track [Page 15]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
OVER
This capability indicates that the server implements the overview
access commands (OVER and LIST OVERVIEW.FMT). If and only if the
server supports the message-id form of the OVER command, there
must be a single argument MSGID.
LIST
This capability indicates that the server implements at least one
variant of the LIST command. There MUST be one argument for each
variant of the LIST command supported by the server, giving the
keyword for that variant.
IMPLEMENTATION
This capability MAY be provided by a server. If so, the arguments
SHOULD be used to provide information such as the server software
name and version number. The client MUST NOT use this line to
determine capabilities of the server. (While servers often
provide this information in the initial greeting, clients need to
guess whether this is the case; this capability makes it clear
what the information is.)
MODE-READER
This capability indicates that the server is mode-switching
(Section 3.4.2) and that the MODE READER command needs to be used
to enable the READER capability.
3.3.3. Extensions
Although NNTP is widely and robustly deployed, some parts of the
Internet community might wish to extend the NNTP service. It must be
emphasized that any extension to NNTP should not be considered
lightly. NNTP's strength comes primarily from its simplicity.
Experience with many protocols has shown that:
Protocols with few options tend towards ubiquity, whilst protocols
with many options tend towards obscurity.
This means that each and every extension, regardless of its benefits,
must be carefully scrutinized with respect to its implementation,
deployment, and interoperability costs. In many cases, the cost of
extending the NNTP service will likely outweigh the benefit.
An extension is a package of associated facilities, often but not
always including one or more new commands. Each extension MUST
define at least one new capability label (this will often, but need
not, be the name of one of these new commands). While any additional
capability information can normally be specified using arguments to
Feather Standards Track [Page 16]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
that label, an extension MAY define more than one capability label.
However, this SHOULD be limited to exceptional circumstances.
An extension is either a private extension, or its capabilities are
included in the IANA registry of capabilities (see Section 3.3.4) and
it is defined in an RFC (in which case it is a "registered
extension"). Such RFCs either must be on the standards track or must
define an IESG-approved experimental protocol.
The definition of an extension must include the following:
o a descriptive name for the extension.
o the capability label or labels defined by the extension (the
capability label of a registered extension MUST NOT begin with
"X").
o The syntax, values, and meanings of any arguments for each
capability label defined by the extension.
o Any new NNTP commands associated with the extension (the names of
commands associated with registered extensions MUST NOT begin with
"X").
o The syntax and possible values of arguments associated with the
new NNTP commands.
o The response codes and possible values of arguments for the
responses of the new NNTP commands.
o Any new arguments the extension associates with any other
pre-existing NNTP commands.
o Any increase in the maximum length of commands and initial
response lines over the value specified in this document.
o A specific statement about the effect on pipelining that this
extension may have (if any).
o A specific statement about the circumstances when use of this
extension can alter the contents of the capabilities list (other
than the new capability labels it defines).
o A specific statement about the circumstances under which the
extension can cause any pre-existing command to produce a 401,
480, or 483 response.
Feather Standards Track [Page 17]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
o A description of how the use of MODE READER on a mode-switching
server interacts with the extension.
o A description of how support for the extension affects the
behaviour of a server and NNTP client in any other manner not
outlined above.
o Formal syntax as described in Section 9.9.
A private extension MAY or MAY NOT be included in the capabilities
list. If it is, the capability label MUST begin with "X". A server
MAY provide additional keywords (for new commands and also for new
variants of existing commands) as part of a private extension. To
avoid the risk of a clash with a future registered extension, these
keywords SHOULD begin with "X".
If the server advertises a capability defined by a registered
extension, it MUST implement the extension so as to fully conform
with the specification (for example, it MUST implement all the
commands that the extension describes as mandatory). If it does not
implement the extension as specified, it MUST NOT list the extension
in the capabilities list under its registered name. In that case, it
MAY, but SHOULD NOT, provide a private extension (not listed, or
listed with a different name) that implements part of the extension
or implements the commands of the extension with a different meaning.
A server MUST NOT send different response codes to basic NNTP
commands documented here or to commands documented in registered
extensions in response to the availability or use of a private
extension.
3.3.4. Initial IANA Register
IANA will maintain a registry of NNTP capability labels. All
capability labels in the registry MUST be keywords and MUST NOT begin
with X.
Feather Standards Track [Page 18]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The initial content of the registry consists of these entries:
+-------------------+--------------------------+--------------------+
| Label | Meaning | Definition |
+-------------------+--------------------------+--------------------+
| AUTHINFO | Authentication | [NNTP-AUTH] |
| | | |
| HDR | Batched header retrieval | Section 3.3.2, |
| | | Section 8.5, and |
| | | Section 8.6 |
| | | |
| IHAVE | IHAVE command available | Section 3.3.2 and |
| | | Section 6.3.2 |
| | | |
| IMPLEMENTATION | Server | Section 3.3.2 |
| | implementation-specific | |
| | information | |
| | | |
| LIST | LIST command variants | Section 3.3.2 and |
| | | Section 7.6.1 |
| | | |
| MODE-READER | Mode-switching server | Section 3.4.2 |
| | and MODE READER command | |
| | available | |
| | | |
| NEWNEWS | NEWNEWS command | Section 3.3.2 and |
| | available | Section 7.4 |
| | | |
| OVER | Overview support | Section 3.3.2, |
| | | Section 8.3, and |
| | | Section 8.4 |
| | | |
| POST | POST command available | Section 3.3.2 and |
| | | Section 6.3.1 |
| | | |
| READER | Reader commands | Section 3.3.2 |
| | available | |
| | | |
| SASL | Supported SASL | [NNTP-AUTH] |
| | mechanisms | |
| | | |
| STARTTLS | Transport layer security | [NNTP-TLS] |
| | | |
| STREAMING | Streaming feeds | [NNTP-STREAM] |
| | | |
| VERSION | Supported NNTP versions | Section 3.3.2 |
+-------------------+--------------------------+--------------------+
Feather Standards Track [Page 19]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
3.4. Mandatory and Optional Commands
For a number of reasons, not all the commands in this specification
are mandatory. However, it is equally undesirable for every command
to be optional, since this means that a client will have no idea what
facilities are available. Therefore, as a compromise, some of the
commands in this specification are mandatory (they must be supported
by all servers) while the remainder are not. The latter are then
subdivided into bundles, each indicated by a single capability label.
o If the label is included in the capability list returned by the
server, the server MUST support all commands in that bundle.
o If the label is not included, the server MAY support none or some
of the commands but SHOULD NOT support all of them. In general,
there will be no way for a client to determine which commands are
supported without trying them.
The bundles have been chosen to provide useful functionality, and
therefore server authors are discouraged from implementing only part
of a bundle.
The description of each command will either indicate that it is
mandatory, or will give, using the term "indicating capability", the
capability label indicating whether the bundle including this command
is available.
Where a server does not implement a command, it MUST always generate
a 500 generic response code (or a 501 generic response code in the
case of a variant of a command depending on a second keyword where
the base command is recognised). Otherwise, the command MUST be
fully implemented as specified; a server MUST NOT only partially
implement any of the commands in this specification. (Client authors
should note that some servers not conforming to this specification
will return a 502 generic response code to some commands that are not
implemented.)
Note: some commands have cases that require other commands to be used
first. If the former command is implemented but the latter is not,
the former MUST still generate the relevant specific response code.
For example, if ARTICLE (Section 6.2.1) is implemented but GROUP
(Section 6.1.1) is not, the correct response to "ARTICLE 1234"
remains 412.
Feather Standards Track [Page 20]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
3.4.1. Reading and Transit Servers
NNTP is traditionally used in two different ways. The first use is
"reading", where the client fetches articles from a large store
maintained by the server for immediate or later presentation to a
user and sends articles created by that user back to the server (an
action called "posting") to be stored and distributed to other stores
and users. The second use is for the bulk transfer of articles from
one store to another. Since the hosts making this transfer tend to
be peers in a network that transmit articles among one another, and
not end-user systems, this process is called "peering" or "transit".
(Even so, one host is still the client and the other is the server).
In practice, these two uses are so different that some server
implementations are optimised for reading or for transit and, as a
result, do not offer the other facility or only offer limited
features. Other implementations are more general and offer both.
This specification allows for this by bundling the relevant commands
accordingly: the IHAVE command is designed for transit, while the
commands indicated by the READER capability are designed for reading
clients.
Except as an effect of the MODE READER command (Section 5.3) on a
mode-switching server, once a server advertises either or both of the
IHAVE or READER capabilities, it MUST continue to advertise them for
the entire session.
A server MAY provide different modes of behaviour (transit, reader,
or a combination) to different client connections and MAY use
external information, such as the IP address of the client, to
determine which mode to provide to any given connection.
The official TCP port for the NNTP service is 119. However, if a
host wishes to offer separate servers for transit and reading
clients, port 433 SHOULD be used for the transit server and 119 for
the reading server.
3.4.2. Mode Switching
An implementation MAY, but SHOULD NOT, provide both transit and
reader facilities on the same server but require the client to select
which it wishes to use. Such an arrangement is called a
"mode-switching" server.
Feather Standards Track [Page 21]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
A mode-switching server has two modes:
o Transit mode, which applies after the initial connection.
* It MUST advertise the MODE-READER capability.
* It MUST NOT advertise the READER capability.
However, the server MAY cease to advertise the MODE-READER
capability after the client uses any command except CAPABILITIES.
o Reading mode, after a successful MODE READER command (see Section
5.3).
* It MUST NOT advertise the MODE-READER capability.
* It MUST advertise the READER capability.
* It MAY NOT advertise the IHAVE capability, even if it was
advertising it in transit mode.
A client SHOULD only issue a MODE READER command to a server if it is
advertising the MODE-READER capability. If the server does not
support CAPABILITIES (and therefore does not conform to this
specification), the client MAY use the following heuristic:
o If the client wishes to use any "reader" commands, it SHOULD use
the MODE READER command immediately after the initial connection.
o Otherwise, it SHOULD NOT use the MODE READER command.
In each case, it should be prepared for some commands to be
unavailable that would have been available if it had made the other
choice.
3.5. Pipelining
NNTP is designed to operate over a reliable bi-directional
connection, such as TCP. Therefore, if a command does not depend on
the response to the previous one, it should not matter if it is sent
before that response is received. Doing this is called "pipelining".
However, certain server implementations throw away all text received
from the client following certain commands before sending their
response. If this happens, pipelining will be affected because one
or more commands will have been ignored or misinterpreted, and the
client will be matching the wrong responses to each command. Since
there are significant benefits to pipelining, but also circumstances
where it is reasonable or common for servers to behave in the above
Feather Standards Track [Page 22]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
manner, this document puts certain requirements on both clients and
servers.
Except where stated otherwise, a client MAY use pipelining. That is,
it may send a command before receiving the response for the previous
command. The server MUST allow pipelining and MUST NOT throw away
any text received after a command. Irrespective of whether
pipelining is used, the server MUST process commands in the order
they are sent.
If the specific description of a command says it "MUST NOT be
pipelined", that command MUST end any pipeline of commands. That is,
the client MUST NOT send any following command until it receives the
CRLF at the end of the response from the command. The server MAY
ignore any data received after the command and before the CRLF at the
end of the response is sent to the client.
The initial connection must not be part of a pipeline; that is, the
client MUST NOT send any command until it receives the CRLF at the
end of the greeting.
If the client uses blocking system calls to send commands, it MUST
ensure that the amount of text sent in pipelining does not cause a
deadlock between transmission and reception. The amount of text
involved will depend on window sizes in the transmission layer;
typically, it is 4k octets for TCP. (Since the server only sends
data in response to commands from the client, the converse problem
does not occur.)
3.5.1. Examples
Example of correct use of pipelining:
[C] GROUP misc.test
[C] STAT
[C] NEXT
[S] 211 1234 3000234 3002322 misc.test
[S] 223 3000234 <45223423@example.com> retrieved
[S] 223 3000237 <668929@example.org> retrieved
Example of incorrect use of pipelining (the MODE READER command may
not be pipelined):
[C] MODE READER
[C] DATE
[C] NEXT
[S] 200 Server ready, posting allowed
[S] 223 3000237 <668929@example.org> retrieved
Feather Standards Track [Page 23]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The DATE command has been thrown away by the server, so there is no
111 response to match it.
3.6. Articles
NNTP is intended to transfer articles between clients and servers.
For the purposes of this specification, articles are required to
conform to the rules in this section, and clients and servers MUST
correctly process any article received from the other that does so.
Note that this requirement applies only to the contents of
communications over NNTP; it does not prevent the client or server
from subsequently rejecting an article for reasons of local policy.
Also see Appendix A for further restrictions on the format of
articles in some uses of NNTP.
An article consists of two parts: the headers and the body. They are
separated by a single empty line, or in other words by two
consecutive CRLF pairs (if there is more than one empty line, the
second and subsequent ones are part of the body). In order to meet
the general requirements of NNTP, an article MUST NOT include the
octet NUL, MUST NOT contain the octets LF and CR other than as part
of a CRLF pair, and MUST end with a CRLF pair. This specification
puts no further restrictions on the body; in particular, it MAY be
empty.
The headers of an article consist of one or more header lines. Each
header line consists of a header name, a colon, a space, the header
content, and a CRLF, in that order. The name consists of one or more
printable US-ASCII characters other than colon and, for the purposes
of this specification, is not case sensitive. There MAY be more than
one header line with the same name. The content MUST NOT contain
CRLF; it MAY be empty. A header may be "folded"; that is, a CRLF
pair may be placed before any TAB or space in the line. There MUST
still be some other octet between any two CRLF pairs in a header
line. (Note that folding means that the header line occupies more
than one line when displayed or transmitted; nevertheless, it is
still referred to as "a" header line.) The presence or absence of
folding does not affect the meaning of the header line; that is, the
CRLF pairs introduced by folding are not considered part of the
header content. Header lines SHOULD NOT be folded before the space
after the colon that follows the header name and SHOULD include at
least one octet other than %x09 or %x20 between CRLF pairs. However,
if an article that fails to satisfy this requirement has been
received from elsewhere, clients and servers MAY transfer it to each
other without re-folding it.
Feather Standards Track [Page 24]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The content of a header SHOULD be in UTF-8. However, if an
implementation receives an article from elsewhere that uses octets in
the range 128 to 255 in some other manner, it MAY pass it to a client
or server without modification. Therefore, implementations MUST be
prepared to receive such headers, and data derived from them (e.g.,
in the responses from the OVER command, Section 8.3), and MUST NOT
assume that they are always UTF-8. Any external processing of those
headers, including identifying the encoding used, is outside the
scope of this document.
Each article MUST have a unique message-id; two articles offered by
an NNTP server MUST NOT have the same message-id. For the purposes
of this specification, message-ids are opaque strings that MUST meet
the following requirements:
o A message-id MUST begin with "<", end with ">", and MUST NOT
contain the latter except at the end.
o A message-id MUST be between 3 and 250 octets in length.
o A message-id MUST NOT contain octets other than printable US-ASCII
characters.
Two message-ids are the same if and only if they consist of the same
sequence of octets.
This specification does not describe how the message-id of an article
is determined. If the server does not have any way to determine a
message-id from the article itself, it MUST synthesize one (this
specification does not require that the article be changed as a
result). See also Appendix A.2.
4. The WILDMAT Format
The WILDMAT format described here is based on the version first
developed by Rich Salz [SALZ1992], which was in turn derived from the
format used in the UNIX "find" command to articulate file names. It
was developed to provide a uniform mechanism for matching patterns in
the same manner that the UNIX shell matches filenames.
Feather Standards Track [Page 25]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
4.1. Wildmat Syntax
A wildmat is described by the following ABNF [RFC4234] syntax, which
is an extract of that in Section 9.8.
wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
wildmat-pattern = 1*wildmat-item
wildmat-item = wildmat-exact / wildmat-wild
wildmat-exact = %x22-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E /
UTF8-non-ascii ; exclude ! * , ? [ \ ]
wildmat-wild = "*" / "?"
Note: the characters ",", "\", "[", and "]" are not allowed in
wildmats, while * and ? are always wildcards. This should not be a
problem, since these characters cannot occur in newsgroup names,
which is the only current use of wildmats. Backslash is commonly
used to suppress the special meaning of characters, whereas brackets
are used to introduce sets. However, these usages are not universal,
and interpretation of these characters in the context of UTF-8
strings is potentially complex and differs from existing practice, so
they were omitted from this specification. A future extension to
this specification may provide semantics for these characters.
4.2. Wildmat Semantics
A wildmat is tested against a string and either matches or does not
match. To do this, each constituent <wildmat-pattern> is matched
against the string, and the rightmost pattern that matches is
identified. If that <wildmat-pattern> is not preceded with "!", the
whole wildmat matches. If it is preceded by "!", or if no <wildmat-
pattern> matches, the whole wildmat does not match.
For example, consider the wildmat "a*,!*b,*c*":
o The string "aaa" matches because the rightmost match is with "a*".
o The string "abb" does not match because the rightmost match is
with "*b".
o The string "ccb" matches because the rightmost match is with
"*c*".
o The string "xxx" does not match because no <wildmat-pattern>
matches.
A <wildmat-pattern> matches a string if the string can be broken into
components, each of which matches the corresponding <wildmat-item> in
the pattern. The matches must be in the same order, and the whole
Feather Standards Track [Page 26]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
string must be used in the match. The pattern is "anchored"; that
is, the first and last characters in the string must match the first
and last item, respectively (unless that item is an asterisk matching
zero characters).
A <wildmat-exact> matches the same character (which may be more than
one octet in UTF-8).
"?" matches exactly one character (which may be more than one octet).
"*" matches zero or more characters. It can match an empty string,
but it cannot match a subsequence of a UTF-8 sequence that is not
aligned to the character boundaries.
4.3. Extensions
An NNTP server or extension MAY extend the syntax or semantics of
wildmats provided that all wildmats that meet the requirements of
Section 4.1 have the meaning ascribed to them by Section 4.2. Future
editions of this document may also extend wildmats.
4.4. Examples
In these examples, $ and @ are used to represent the two octets %xC2
and %xA3, respectively; $@ is thus the UTF-8 encoding for the pound
sterling symbol, shown as # in the descriptions.
Wildmat Description of strings that match
abc The one string "abc"
abc,def The two strings "abc" and "def"
$@ The one character string "#"
a* Any string that begins with "a"
a*b Any string that begins with "a" and ends with "b"
a*,*b Any string that begins with "a" or ends with "b"
a*,!*b Any string that begins with "a" and does not end with
"b"
a*,!*b,c* Any string that begins with "a" and does not end with
"b", and any string that begins with "c" no matter
what it ends with
a*,c*,!*b Any string that begins with "a" or "c" and does not
end with "b"
?a* Any string with "a" as its second character
??a* Any string with "a" as its third character
*a? Any string with "a" as its penultimate character
*a?? Any string with "a" as its antepenultimate character
Feather Standards Track [Page 27]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
5. Session Administration Commands
5.1. Initial Connection
5.1.1. Usage
This command MUST NOT be pipelined.
Responses [1]
200 Service available, posting allowed
201 Service available, posting prohibited
400 Service temporarily unavailable [2]
502 Service permanently unavailable [2]
[1] These are the only valid response codes for the initial greeting;
the server MUST not return any other generic response code.
[2] Following a 400 or 502 response, the server MUST immediately
close the connection.
5.1.2. Description
There is no command presented by the client upon initial connection
to the server. The server MUST present an appropriate response code
as a greeting to the client. This response informs the client
whether service is available and whether the client is permitted to
post.
If the server will accept further commands from the client including
POST, the server MUST present a 200 greeting code. If the server
will accept further commands from the client, but the client is not
authorized to post articles using the POST command, the server MUST
present a 201 greeting code.
Otherwise, the server MUST present a 400 or 502 greeting code and
then immediately close the connection. 400 SHOULD be used if the
issue is only temporary (for example, because of load) and the client
can expect to be able to connect successfully at some point in the
future without making any changes. 502 MUST be used if the client is
not permitted under any circumstances to interact with the server,
and MAY be used if the server has insufficient information to
determine whether the issue is temporary or permanent.
Note: the distinction between the 200 and 201 response codes has
turned out in practice to be insufficient; for example, some servers
do not allow posting until the client has authenticated, while other
clients assume that a 201 response means that posting will never be
possible even after authentication. Therefore, clients SHOULD use
Feather Standards Track [Page 28]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
the CAPABILITIES command (Section 5.2) rather than rely on this
response.
5.1.3. Examples
Example of a normal connection from an authorized client that then
terminates the session (see Section 5.4):
[Initial connection set-up completed.]
[S] 200 NNTP Service Ready, posting permitted
[C] QUIT
[S] 205 NNTP Service exits normally
[Server closes connection.]
Example of a normal connection from an authorized client that is not
permitted to post, which also immediately terminates the session:
[Initial connection set-up completed.]
[S] 201 NNTP Service Ready, posting prohibited
[C] QUIT
[S] 205 NNTP Service exits normally
[Server closes connection.]
Example of a normal connection from an unauthorized client:
[Initial connection set-up completed.]
[S] 502 NNTP Service permanently unavailable
[Server closes connection.]
Example of a connection from a client if the server is unable to
provide service:
[Initial connection set-up completed.]
[S] 400 NNTP Service temporarily unavailable
[Server closes connection.]
5.2. CAPABILITIES
5.2.1. Usage
This command is mandatory.
Syntax
CAPABILITIES [keyword]
Responses
101 Capability list follows (multi-line)
Feather Standards Track [Page 29]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Parameters
keyword additional feature, see description
5.2.2. Description
The CAPABILITIES command allows a client to determine the
capabilities of the server at any given time.
This command MAY be issued at any time; the server MUST NOT require
it to be issued in order to make use of any capability. The response
generated by this command MAY change during a session because of
other state information (which, in turn, may be changed by the
effects of other commands or by external events). An NNTP client is
only able to get the current and correct information concerning
available capabilities at any point during a session by issuing a
CAPABILITIES command at that point of that session and processing the
response.
The capability list is returned as a multi-line data block following
the 101 response code. Each capability is described by a separate
capability line. The server MUST NOT list the same capability twice
in the response, even with different arguments. Except that the
VERSION capability MUST be the first line, the order in which the
capability lines appears is not significant; the server need not even
consistently return the same order.
While some capabilities are likely to be always available or never
available, others (notably extensions) will appear and disappear
depending on server state changes within the session or on external
events between sessions. An NNTP client MAY cache the results of
this command, but MUST NOT rely on the correctness of any cached
results, whether from earlier in this session or from a previous
session, MUST cope gracefully with the cached status being out of
date, and SHOULD (if caching results) provide a way to force the
cached information to be refreshed. Furthermore, a client MUST NOT
use cached results in relation to security, privacy, and
authentication extensions. See Section 12.6 for further discussion
of this topic.
The keyword argument is not used by this specification. It is
provided so that extensions or revisions to this specification can
include extra features for this command without requiring the
CAPABILITIES command to be used twice (once to determine if the extra
features are available, and a second time to make use of them). If
the server does not recognise the argument (and it is a keyword), it
MUST respond with the 101 response code as if the argument had been
omitted. If an argument is provided that the server does recognise,
it MAY use the 101 response code or MAY use some other response code
Feather Standards Track [Page 30]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
(which will be defined in the specification of that feature). If the
argument is not a keyword, the 501 generic response code MUST be
returned. The server MUST NOT generate any other response code to
the CAPABILITIES command.
5.2.3. Examples
Example of a minimal response (a read-only server):
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] LIST ACTIVE NEWSGROUPS
[S] .
Example of a response from a server that has a range of facilities
and that also describes itself:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] IHAVE
[S] POST
[S] NEWNEWS
[S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES OVERVIEW.FMT
[S] IMPLEMENTATION INN 4.2 2004-12-25
[S] OVER MSGID
[S] STREAMING
[S] XSECRET
[S] .
Example of a server that supports more than one version of NNTP:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2 3
[S] READER
[S] LIST ACTIVE NEWSGROUPS
[S] .
Feather Standards Track [Page 31]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of a client attempting to use a feature of the CAPABILITIES
command that the server does not support:
[C] CAPABILITIES AUTOUPDATE
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] IHAVE
[S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT HEADERS
[S] OVER MSGID
[S] HDR
[S] NEWNEWS
[S] .
5.3. MODE READER
5.3.1. Usage
Indicating capability: MODE-READER
This command MUST NOT be pipelined.
Syntax
MODE READER
Responses
200 Posting allowed
201 Posting prohibited
502 Reading service permanently unavailable [1]
[1] Following a 502 response the server MUST immediately close the
connection.
5.3.2. Description
The MODE READER command instructs a mode-switching server to switch
modes, as described in Section 3.4.2.
If the server is mode-switching, it switches from its transit mode to
its reader mode, indicating this by changing the capability list
accordingly. It MUST then return a 200 or 201 response with the same
meaning as for the initial greeting (as described in Section 5.1.1).
Note that the response need not be the same as that presented during
the initial greeting. The client MUST NOT issue MODE READER more
than once in a session or after any security or privacy commands are
issued. When the MODE READER command is issued, the server MAY reset
its state to that immediately after the initial connection before
switching mode.
Feather Standards Track [Page 32]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
If the server is not mode-switching, then the following apply:
o If it advertises the READER capability, it MUST return a 200 or
201 response with the same meaning as for the initial greeting; in
this case, the command MUST NOT affect the server state in any
way.
o If it does not advertise the READER capability, it MUST return a
502 response and then immediately close the connection.
5.3.3. Examples
Example of use of the MODE READER command on a transit-only server
(which therefore does not providing reading facilities):
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] IHAVE
[S] .
[C] MODE READER
[S] 502 Transit service only
[Server closes connection.]
Example of use of the MODE READER command on a server that provides
reading facilities:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] LIST ACTIVE NEWSGROUPS
[S] .
[C] MODE READER
[S] 200 Reader mode, posting permitted
[C] IHAVE <i.am.an.article.you.have@example.com>
[S] 500 Permission denied
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
Note that in both of these situations, the client SHOULD NOT use MODE
READER.
Feather Standards Track [Page 33]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of use of the MODE READER command on a mode-switching server:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] IHAVE
[S] MODE-READER
[S] .
[C] MODE READER
[S] 200 Reader mode, posting permitted
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] NEWNEWS
[S] LIST ACTIVE NEWSGROUPS
[S] STARTTLS
[S] .
In this case, the server offers (but does not require) TLS privacy in
its reading mode but not in its transit mode.
Example of use of the MODE READER command where the client is not
permitted to post:
[C] MODE READER
[S] 201 NNTP Service Ready, posting prohibited
5.4. QUIT
5.4.1. Usage
This command is mandatory.
Syntax
QUIT
Responses
205 Connection closing
5.4.2. Description
The client uses the QUIT command to terminate the session. The
server MUST acknowledge the QUIT command and then close the
connection to the client. This is the preferred method for a client
to indicate that it has finished all of its transactions with the
NNTP server.
Feather Standards Track [Page 34]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
If a client simply disconnects (or if the connection times out or
some other fault occurs), the server MUST gracefully cease its
attempts to service the client, disconnecting from its end if
necessary.
The server MUST NOT generate any response code to the QUIT command
other than 205 or, if any arguments are provided, 501.
5.4.3. Examples
[C] QUIT
[S] 205 closing connection
[Server closes connection.]
6. Article Posting and Retrieval
News-reading clients have available a variety of mechanisms to
retrieve articles via NNTP. The news articles are stored and indexed
using three types of keys. The first type of key is the message-id
of an article and is globally unique. The second type of key is
composed of a newsgroup name and an article number within that
newsgroup. On a particular server, there MUST only be one article
with a given number within any newsgroup, and an article MUST NOT
have two different numbers in the same newsgroup. An article can be
cross-posted to multiple newsgroups, so there may be multiple keys
that point to the same article on the same server; these MAY have
different numbers in each newsgroup. However, this type of key is
not required to be globally unique, so the same key MAY refer to
different articles on different servers. (Note that the terms
"group" and "newsgroup" are equivalent.)
The final type of key is the arrival timestamp, giving the time that
the article arrived at the server. The server MUST ensure that
article numbers are issued in order of arrival timestamp; that is,
articles arriving later MUST have higher numbers than those that
arrive earlier. The server SHOULD allocate the next sequential
unused number to each new article.
Article numbers MUST lie between 1 and 2,147,483,647, inclusive. The
client and server MAY use leading zeroes in specifying article
numbers but MUST NOT use more than 16 digits. In some situations,
the value zero replaces an article number to show some special
situation.
Note that it is likely that the article number limit of 2,147,483,647
will be increased by a future revision or extension to this
specification. While servers MUST NOT send article numbers greater
than this current limit, client and server developers are advised to
Feather Standards Track [Page 35]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
use internal structures and datatypes capable of handling larger
values in anticipation of such a change.
6.1. Group and Article Selection
The following commands are used to set the "currently selected
newsgroup" and the "current article number", which are used by
various commands. At the start of an NNTP session, both of these
values are set to the special value "invalid".
6.1.1. GROUP
6.1.1.1. Usage
Indicating capability: READER
Syntax
GROUP group
Responses
211 number low high group Group successfully selected
411 No such newsgroup
Parameters
group Name of newsgroup
number Estimated number of articles in the group
low Reported low water mark
high Reported high water mark
6.1.1.2. Description
The GROUP command selects a newsgroup as the currently selected
newsgroup and returns summary information about it.
The required argument is the name of the newsgroup to be selected
(e.g., "news.software.nntp"). A list of valid newsgroups may be
obtained by using the LIST ACTIVE command (see Section 7.6.3).
The successful selection response will return the article numbers of
the first and last articles in the group at the moment of selection
(these numbers are referred to as the "reported low water mark" and
the "reported high water mark") and an estimate of the number of
articles in the group currently available.
If the group is not empty, the estimate MUST be at least the actual
number of articles available and MUST be no greater than one more
than the difference between the reported low and high water marks.
(Some implementations will actually count the number of articles
Feather Standards Track [Page 36]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
currently stored. Others will just subtract the low water mark from
the high water mark and add one to get an estimate.)
If the group is empty, one of the following three situations will
occur. Clients MUST accept all three cases; servers MUST NOT
represent an empty group in any other way.
o The high water mark will be one less than the low water mark, and
the estimated article count will be zero. Servers SHOULD use this
method to show an empty group. This is the only time that the
high water mark can be less than the low water mark.
o All three numbers will be zero.
o The high water mark is greater than or equal to the low water
mark. The estimated article count might be zero or non-zero; if
it is non-zero, the same requirements apply as for a non-empty
group.
The set of articles in a group may change after the GROUP command is
carried out:
o Articles may be removed from the group.
o Articles may be reinstated in the group with the same article
number, but those articles MUST have numbers no less than the
reported low water mark (note that this is a reinstatement of the
previous article, not a new article reusing the number).
o New articles may be added with article numbers greater than the
reported high water mark. (If an article that was the one with
the highest number has been removed and the high water mark has
been adjusted accordingly, the next new article will not have the
number one greater than the reported high water mark.)
Except when the group is empty and all three numbers are zero,
whenever a subsequent GROUP command for the same newsgroup is issued,
either by the same client or a different client, the reported low
water mark in the response MUST be no less than that in any previous
response for that newsgroup in this session, and it SHOULD be no less
than that in any previous response for that newsgroup ever sent to
any client. Any failure to meet the latter condition SHOULD be
transient only. The client may make use of the low water mark to
remove all remembered information about articles with lower numbers,
as these will never recur. This includes the situation when the high
water mark is one less than the low water mark. No similar
assumption can be made about the high water mark, as this can
Feather Standards Track [Page 37]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
decrease if an article is removed and then increase again if it is
reinstated or if new articles arrive.
When a valid group is selected by means of this command, the
currently selected newsgroup MUST be set to that group, and the
current article number MUST be set to the first article in the group
(this applies even if the group is already the currently selected
newsgroup). If an empty newsgroup is selected, the current article
number is made invalid. If an invalid group is specified, the
currently selected newsgroup and current article number MUST NOT be
changed.
The GROUP or LISTGROUP command (see Section 6.1.2) MUST be used by a
client, and a successful response received, before any other command
is used that depends on the value of the currently selected newsgroup
or current article number.
If the group specified is not available on the server, a 411 response
MUST be returned.
6.1.1.3. Examples
Example for a group known to the server:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
Example for a group unknown to the server:
[C] GROUP example.is.sob.bradner.or.barber
[S] 411 example.is.sob.bradner.or.barber is unknown
Example of an empty group using the preferred response:
[C] GROUP example.currently.empty.newsgroup
[S] 211 0 4000 3999 example.currently.empty.newsgroup
Example of an empty group using an alternative response:
[C] GROUP example.currently.empty.newsgroup
[S] 211 0 0 0 example.currently.empty.newsgroup
Example of an empty group using a different alternative response:
[C] GROUP example.currently.empty.newsgroup
[S] 211 0 4000 4321 example.currently.empty.newsgroup
Feather Standards Track [Page 38]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example reselecting the currently selected newsgroup:
[C] GROUP misc.test
[S] 211 1234 234 567 misc.test
[C] STAT 444
[S] 223 444 <123456@example.net> retrieved
[C] GROUP misc.test
[S] 211 1234 234 567 misc.test
[C] STAT
[S] 223 234 <different@example.net> retrieved
6.1.2. LISTGROUP
6.1.2.1. Usage
Indicating capability: READER
Syntax
LISTGROUP [group [range]]
Responses
211 number low high group Article numbers follow (multi-line)
411 No such newsgroup
412 No newsgroup selected [1]
Parameters
group Name of newsgroup
range Range of articles to report
number Estimated number of articles in the group
low Reported low water mark
high Reported high water mark
[1] The 412 response can only occur if no group has been specified.
6.1.2.2. Description
The LISTGROUP command selects a newsgroup in the same manner as the
GROUP command (see Section 6.1.1) but also provides a list of article
numbers in the newsgroup. If no group is specified, the currently
selected newsgroup is used.
On success, a list of article numbers is returned as a multi-line
data block following the 211 response code (the arguments on the
initial response line are the same as for the GROUP command). The
list contains one number per line and is in numerical order. It
lists precisely those articles that exist in the group at the moment
of selection (therefore, an empty group produces an empty list). If
the optional range argument is specified, only articles within the
Feather Standards Track [Page 39]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
range are included in the list (therefore, the list MAY be empty even
if the group is not).
The range argument may be any of the following:
o An article number.
o An article number followed by a dash to indicate all following.
o An article number followed by a dash followed by another article
number.
In the last case, if the second number is less than the first number,
then the range contains no articles. Omitting the range is
equivalent to the range 1- being specified.
If the group specified is not available on the server, a 411 response
MUST be returned. If no group is specified and the currently
selected newsgroup is invalid, a 412 response MUST be returned.
Except that the group argument is optional, that a range argument can
be specified, and that a multi-line data block follows the 211
response code, the LISTGROUP command is identical to the GROUP
command. In particular, when successful, the command sets the
current article number to the first article in the group, if any,
even if this is not within the range specified by the second
argument.
Note that the range argument is a new feature in this specification
and servers that do not support CAPABILITIES (and therefore do not
conform to this specification) are unlikely to support it.
6.1.2.3. Examples
Example of LISTGROUP being used to select a group:
[C] LISTGROUP misc.test
[S] 211 2000 3000234 3002322 misc.test list follows
[S] 3000234
[S] 3000237
[S] 3000238
[S] 3000239
[S] 3002322
[S] .
Feather Standards Track [Page 40]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of LISTGROUP on an empty group:
[C] LISTGROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup list follows
[S] .
Example of LISTGROUP on a valid, currently selected newsgroup:
[C] GROUP misc.test
[S] 211 2000 3000234 3002322 misc.test
[C] LISTGROUP
[S] 211 2000 3000234 3002322 misc.test list follows
[S] 3000234
[S] 3000237
[S] 3000238
[S] 3000239
[S] 3002322
[S] .
Example of LISTGROUP with a range:
[C] LISTGROUP misc.test 3000238-3000248
[S] 211 2000 3000234 3002322 misc.test list follows
[S] 3000238
[S] 3000239
[S] .
Example of LISTGROUP with an empty range:
[C] LISTGROUP misc.test 12345678-
[S] 211 2000 3000234 3002322 misc.test list follows
[S] .
Example of LISTGROUP with an invalid range:
[C] LISTGROUP misc.test 9999-111
[S] 211 2000 3000234 3002322 misc.test list follows
[S] .
Feather Standards Track [Page 41]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.1.3. LAST
6.1.3.1. Usage
Indicating capability: READER
Syntax
LAST
Responses
223 n message-id Article found
412 No newsgroup selected
420 Current article number is invalid
422 No previous article in this group
Parameters
n Article number
message-id Article message-id
6.1.3.2. Description
If the currently selected newsgroup is valid, the current article
number MUST be set to the previous article in that newsgroup (that
is, the highest existing article number less than the current article
number). If successful, a response indicating the new current
article number and the message-id of that article MUST be returned.
No article text is sent in response to this command.
There MAY be no previous article in the group, although the current
article number is not the reported low water mark. There MUST NOT be
a previous article when the current article number is the reported
low water mark.
Because articles can be removed and added, the results of multiple
LAST and NEXT commands MAY not be consistent over the life of a
particular NNTP session.
If the current article number is already the first article of the
newsgroup, a 422 response MUST be returned. If the current article
number is invalid, a 420 response MUST be returned. If the currently
selected newsgroup is invalid, a 412 response MUST be returned. In
all three cases, the currently selected newsgroup and current article
number MUST NOT be altered.
Feather Standards Track [Page 42]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.1.3.3. Examples
Example of a successful article retrieval using LAST:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] NEXT
[S] 223 3000237 <668929@example.org> retrieved
[C] LAST
[S] 223 3000234 <45223423@example.com> retrieved
Example of an attempt to retrieve an article without having selected
a group (via the GROUP command) first:
[Assumes currently selected newsgroup is invalid.]
[C] LAST
[S] 412 no newsgroup selected
Example of an attempt to retrieve an article using the LAST command
when the current article number is that of the first article in the
group:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] LAST
[S] 422 No previous article to retrieve
Example of an attempt to retrieve an article using the LAST command
when the currently selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] LAST
[S] 420 No current article selected
Feather Standards Track [Page 43]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.1.4. NEXT
6.1.4.1. Usage
Indicating capability: READER
Syntax
NEXT
Responses
223 n message-id Article found
412 No newsgroup selected
420 Current article number is invalid
421 No next article in this group
Parameters
n Article number
message-id Article message-id
6.1.4.2. Description
If the currently selected newsgroup is valid, the current article
number MUST be set to the next article in that newsgroup (that is,
the lowest existing article number greater than the current article
number). If successful, a response indicating the new current
article number and the message-id of that article MUST be returned.
No article text is sent in response to this command.
If the current article number is already the last article of the
newsgroup, a 421 response MUST be returned. In all other aspects
(apart, of course, from the lack of 422 response), this command is
identical to the LAST command (Section 6.1.3).
6.1.4.3. Examples
Example of a successful article retrieval using NEXT:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] NEXT
[S] 223 3000237 <668929@example.org> retrieved
Feather Standards Track [Page 44]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an attempt to retrieve an article without having selected
a group (via the GROUP command) first:
[Assumes currently selected newsgroup is invalid.]
[C] NEXT
[S] 412 no newsgroup selected
Example of an attempt to retrieve an article using the NEXT command
when the current article number is that of the last article in the
group:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] STAT 3002322
[S] 223 3002322 <411@example.net> retrieved
[C] NEXT
[S] 421 No next article to retrieve
Example of an attempt to retrieve an article using the NEXT command
when the currently selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] NEXT
[S] 420 No current article selected
6.2. Retrieval of Articles and Article Sections
The ARTICLE, BODY, HEAD, and STAT commands are very similar. They
differ only in the parts of the article that are presented to the
client and in the successful response code. The ARTICLE command is
described here in full, while the other three commands are described
in terms of the differences. As specified in Section 3.6, an article
consists of two parts: the article headers and the article body.
When responding to one of these commands, the server MUST present the
entire article or appropriate part and MUST NOT attempt to alter or
translate it in any way.
Feather Standards Track [Page 45]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.2.1. ARTICLE
6.2.1.1. Usage
Indicating capability: READER
Syntax
ARTICLE message-id
ARTICLE number
ARTICLE
Responses
First form (message-id specified)
220 0|n message-id Article follows (multi-line)
430 No article with that message-id
Second form (article number specified)
220 n message-id Article follows (multi-line)
412 No newsgroup selected
423 No article with that number
Third form (current article number used)
220 n message-id Article follows (multi-line)
412 No newsgroup selected
420 Current article number is invalid
Parameters
number Requested article number
n Returned article number
message-id Article message-id
6.2.1.2. Description
The ARTICLE command selects an article according to the arguments and
presents the entire article (that is, the headers, an empty line, and
the body, in that order) to the client. The command has three forms.
In the first form, a message-id is specified, and the server presents
the article with that message-id. In this case, the server MUST NOT
alter the currently selected newsgroup or current article number.
This is both to facilitate the presentation of articles that may be
referenced within another article being read, and because of the
semantic difficulties of determining the proper sequence and
membership of an article that may have been cross-posted to more than
one newsgroup.
Feather Standards Track [Page 46]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
In the response, the article number MUST be replaced with zero,
unless there is a currently selected newsgroup and the article is
present in that group, in which case the server MAY use the article's
number in that group. (The server is not required to determine
whether the article is in the currently selected newsgroup or, if so,
what article number it has; the client MUST always be prepared for
zero to be specified.) The server MUST NOT provide an article number
unless use of that number in a second ARTICLE command immediately
following this one would return the same article. Even if the server
chooses to return article numbers in these circumstances, it need not
do so consistently; it MAY return zero to any such command (also see
the STAT examples, Section 6.2.4.3).
In the second form, an article number is specified. If there is an
article with that number in the currently selected newsgroup, the
server MUST set the current article number to that number.
In the third form, the article indicated by the current article
number in the currently selected newsgroup is used.
Note that a previously valid article number MAY become invalid if the
article has been removed. A previously invalid article number MAY
become valid if the article has been reinstated, but this article
number MUST be no less than the reported low water mark for that
group.
The server MUST NOT change the currently selected newsgroup as a
result of this command. The server MUST NOT change the current
article number except when an article number argument was provided
and the article exists; in particular, it MUST NOT change it
following an unsuccessful response.
Since the message-id is unique for each article, it may be used by a
client to skip duplicate displays of articles that have been posted
more than once, or to more than one newsgroup.
The article is returned as a multi-line data block following the 220
response code.
If the argument is a message-id and no such article exists, a 430
response MUST be returned. If the argument is a number or is omitted
and the currently selected newsgroup is invalid, a 412 response MUST
be returned. If the argument is a number and that article does not
exist in the currently selected newsgroup, a 423 response MUST be
returned. If the argument is omitted and the current article number
is invalid, a 420 response MUST be returned.
Feather Standards Track [Page 47]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.2.1.3. Examples
Example of a successful retrieval of an article (explicitly not using
an article number):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] ARTICLE
[S] 220 3000234 <45223423@example.com>
[S] Path: pathost!demo!whitehouse!not-for-mail
[S] From: "Demo User" <nobody@example.net>
[S] Newsgroups: misc.test
[S] Subject: I am just a test article
[S] Date: 6 Oct 1998 04:38:40 -0500
[S] Organization: An Example Net, Uncertain, Texas
[S] Message-ID: <45223423@example.com>
[S]
[S] This is just a test article.
[S] .
Example of a successful retrieval of an article by message-id:
[C] ARTICLE <45223423@example.com>
[S] 220 0 <45223423@example.com>
[S] Path: pathost!demo!whitehouse!not-for-mail
[S] From: "Demo User" <nobody@example.net>
[S] Newsgroups: misc.test
[S] Subject: I am just a test article
[S] Date: 6 Oct 1998 04:38:40 -0500
[S] Organization: An Example Net, Uncertain, Texas
[S] Message-ID: <45223423@example.com>
[S]
[S] This is just a test article.
[S] .
Example of an unsuccessful retrieval of an article by message-id:
[C] ARTICLE <i.am.not.there@example.com>
[S] 430 No Such Article Found
Example of an unsuccessful retrieval of an article by number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 news.groups
[C] ARTICLE 300256
[S] 423 No article with that number
Feather Standards Track [Page 48]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an unsuccessful retrieval of an article by number because
no newsgroup was selected first:
[Assumes currently selected newsgroup is invalid.]
[C] ARTICLE 300256
[S] 412 No newsgroup selected
Example of an attempt to retrieve an article when the currently
selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] ARTICLE
[S] 420 No current article selected
6.2.2. HEAD
6.2.2.1. Usage
This command is mandatory.
Syntax
HEAD message-id
HEAD number
HEAD
Responses
First form (message-id specified)
221 0|n message-id Headers follow (multi-line)
430 No article with that message-id
Second form (article number specified)
221 n message-id Headers follow (multi-line)
412 No newsgroup selected
423 No article with that number
Third form (current article number used)
221 n message-id Headers follow (multi-line)
412 No newsgroup selected
420 Current article number is invalid
Parameters
number Requested article number
n Returned article number
message-id Article message-id
Feather Standards Track [Page 49]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.2.2.2. Description
The HEAD command behaves identically to the ARTICLE command except
that, if the article exists, the response code is 221 instead of 220
and only the headers are presented (the empty line separating the
headers and body MUST NOT be included).
6.2.2.3. Examples
Example of a successful retrieval of the headers of an article
(explicitly not using an article number):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HEAD
[S] 221 3000234 <45223423@example.com>
[S] Path: pathost!demo!whitehouse!not-for-mail
[S] From: "Demo User" <nobody@example.net>
[S] Newsgroups: misc.test
[S] Subject: I am just a test article
[S] Date: 6 Oct 1998 04:38:40 -0500
[S] Organization: An Example Net, Uncertain, Texas
[S] Message-ID: <45223423@example.com>
[S] .
Example of a successful retrieval of the headers of an article by
message-id:
[C] HEAD <45223423@example.com>
[S] 221 0 <45223423@example.com>
[S] Path: pathost!demo!whitehouse!not-for-mail
[S] From: "Demo User" <nobody@example.net>
[S] Newsgroups: misc.test
[S] Subject: I am just a test article
[S] Date: 6 Oct 1998 04:38:40 -0500
[S] Organization: An Example Net, Uncertain, Texas
[S] Message-ID: <45223423@example.com>
[S] .
Example of an unsuccessful retrieval of the headers of an article by
message-id:
[C] HEAD <i.am.not.there@example.com>
[S] 430 No Such Article Found
Feather Standards Track [Page 50]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an unsuccessful retrieval of the headers of an article by
number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HEAD 300256
[S] 423 No article with that number
Example of an unsuccessful retrieval of the headers of an article by
number because no newsgroup was selected first:
[Assumes currently selected newsgroup is invalid.]
[C] HEAD 300256
[S] 412 No newsgroup selected
Example of an attempt to retrieve the headers of an article when the
currently selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] HEAD
[S] 420 No current article selected
6.2.3. BODY
6.2.3.1. Usage
Indicating capability: READER
Syntax
BODY message-id
BODY number
BODY
Responses
First form (message-id specified)
222 0|n message-id Body follows (multi-line)
430 No article with that message-id
Second form (article number specified)
222 n message-id Body follows (multi-line)
412 No newsgroup selected
423 No article with that number
Feather Standards Track [Page 51]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Third form (current article number used)
222 n message-id Body follows (multi-line)
412 No newsgroup selected
420 Current article number is invalid
Parameters
number Requested article number
n Returned article number
message-id Article message-id
6.2.3.2. Description
The BODY command behaves identically to the ARTICLE command except
that, if the article exists, the response code is 222 instead of 220
and only the body is presented (the empty line separating the headers
and body MUST NOT be included).
6.2.3.3. Examples
Example of a successful retrieval of the body of an article
(explicitly not using an article number):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] BODY
[S] 222 3000234 <45223423@example.com>
[S] This is just a test article.
[S] .
Example of a successful retrieval of the body of an article by
message-id:
[C] BODY <45223423@example.com>
[S] 222 0 <45223423@example.com>
[S] This is just a test article.
[S] .
Example of an unsuccessful retrieval of the body of an article by
message-id:
[C] BODY <i.am.not.there@example.com>
[S] 430 No Such Article Found
Feather Standards Track [Page 52]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an unsuccessful retrieval of the body of an article by
number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] BODY 300256
[S] 423 No article with that number
Example of an unsuccessful retrieval of the body of an article by
number because no newsgroup was selected first:
[Assumes currently selected newsgroup is invalid.]
[C] BODY 300256
[S] 412 No newsgroup selected
Example of an attempt to retrieve the body of an article when the
currently selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] BODY
[S] 420 No current article selected
6.2.4. STAT
6.2.4.1. Usage
This command is mandatory.
Syntax
STAT message-id
STAT number
STAT
Responses
First form (message-id specified)
223 0|n message-id Article exists
430 No article with that message-id
Second form (article number specified)
223 n message-id Article exists
412 No newsgroup selected
423 No article with that number
Feather Standards Track [Page 53]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Third form (current article number used)
223 n message-id Article exists
412 No newsgroup selected
420 Current article number is invalid
Parameters
number Requested article number
n Returned article number
message-id Article message-id
6.2.4.2. Description
The STAT command behaves identically to the ARTICLE command except
that, if the article exists, it is NOT presented to the client and
the response code is 223 instead of 220. Note that the response is
NOT multi-line.
This command allows the client to determine whether an article exists
and, in the second and third forms, what its message-id is, without
having to process an arbitrary amount of text.
6.2.4.3. Examples
Example of STAT on an existing article (explicitly not using an
article number):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] STAT
[S] 223 3000234 <45223423@example.com>
Example of STAT on an existing article by message-id:
[C] STAT <45223423@example.com>
[S] 223 0 <45223423@example.com>
Example of STAT on an article not on the server by message-id:
[C] STAT <i.am.not.there@example.com>
[S] 430 No Such Article Found
Example of STAT on an article not in the server by number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] STAT 300256
[S] 423 No article with that number
Feather Standards Track [Page 54]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of STAT on an article by number when no newsgroup was
selected first:
[Assumes currently selected newsgroup is invalid.]
[C] STAT 300256
[S] 412 No newsgroup selected
Example of STAT on an article when the currently selected newsgroup
is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] STAT
[S] 420 No current article selected
Example of STAT by message-id on a server that sometimes reports the
actual article number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] STAT
[S] 223 3000234 <45223423@example.com>
[C] STAT <45223423@example.com>
[S] 223 0 <45223423@example.com>
[C] STAT <45223423@example.com>
[S] 223 3000234 <45223423@example.com>
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] STAT <45223423@example.com>
[S] 223 0 <45223423@example.com>
[C] GROUP alt.crossposts
[S] 211 9999 111111 222222 alt.crossposts
[C] STAT <45223423@example.com>
[S] 223 123456 <45223423@example.com>
[C] STAT
[S] 223 111111 <23894720@example.com>
The first STAT command establishes the identity of an article in the
group. The second and third show that the server may, but need not,
give the article number when the message-id is specified. The fourth
STAT command shows that zero must be specified if the article isn't
in the currently selected newsgroup. The fifth shows that the
number, if provided, must be that relating to the currently selected
newsgroup. The last one shows that the current article number is
still not changed by the use of STAT with a message-id even if it
returns an article number.
Feather Standards Track [Page 55]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.3. Article Posting
Article posting is done in one of two ways: individual article
posting from news-reading clients using POST, and article transfer
from other news servers using IHAVE.
6.3.1. POST
6.3.1.1. Usage
Indicating capability: POST
This command MUST NOT be pipelined.
Syntax
POST
Responses
Initial responses
340 Send article to be posted
440 Posting not permitted
Subsequent responses
240 Article received OK
441 Posting failed
6.3.1.2. Description
If posting is allowed, a 340 response MUST be returned to indicate
that the article to be posted should be sent. If posting is
prohibited for some installation-dependent reason, a 440 response
MUST be returned.
If posting is permitted, the article MUST be in the format specified
in Section 3.6 and MUST be sent by the client to the server as a
multi-line data block (see Section 3.1.1). Thus a single dot (".")
on a line indicates the end of the text, and lines starting with a
dot in the original text have that dot doubled during transmission.
Following the presentation of the termination sequence by the client,
the server MUST return a response indicating success or failure of
the article transfer. Note that response codes 340 and 440 are used
in direct response to the POST command while 240 and 441 are returned
after the article is sent.
Feather Standards Track [Page 56]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
A response of 240 SHOULD indicate that, barring unforeseen server
errors, the posted article will be made available on the server
and/or transferred to other servers, as appropriate, possibly
following further processing. In other words, articles not wanted by
the server SHOULD be rejected with a 441 response, rather than being
accepted and then discarded silently. However, the client SHOULD NOT
assume that the article has been successfully transferred unless it
receives an affirmative response from the server and SHOULD NOT
assume that it is being made available to other clients without
explicitly checking (for example, using the STAT command).
If the session is interrupted before the response is received, it is
possible that an affirmative response was sent but has been lost.
Therefore, in any subsequent session, the client SHOULD either check
whether the article was successfully posted before resending or
ensure that the server will allocate the same message-id to the new
attempt (see Appendix A.2). The latter approach is preferred since
the article might not have been made available for reading yet (for
example, it may have to go through a moderation process).
6.3.1.3. Examples
Example of a successful posting:
[C] POST
[S] 340 Input article; end with <CR-LF>.<CR-LF>
[C] From: "Demo User" <nobody@example.net>
[C] Newsgroups: misc.test
[C] Subject: I am just a test article
[C] Organization: An Example Net
[C]
[C] This is just a test article.
[C] .
[S] 240 Article received OK
Example of an unsuccessful posting:
[C] POST
[S] 340 Input article; end with <CR-LF>.<CR-LF>
[C] From: "Demo User" <nobody@example.net>
[C] Newsgroups: misc.test
[C] Subject: I am just a test article
[C] Organization: An Example Net
[C]
[C] This is just a test article.
[C] .
[S] 441 Posting failed
Feather Standards Track [Page 57]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an attempt to post when posting is not allowed:
[Initial connection set-up completed.]
[S] 201 NNTP Service Ready, posting prohibited
[C] POST
[S] 440 Posting not permitted
6.3.2. IHAVE
6.3.2.1. Usage
Indicating capability: IHAVE
This command MUST NOT be pipelined.
Syntax
IHAVE message-id
Responses
Initial responses
335 Send article to be transferred
435 Article not wanted
436 Transfer not possible; try again later
Subsequent responses
235 Article transferred OK
436 Transfer failed; try again later
437 Transfer rejected; do not retry
Parameters
message-id Article message-id
6.3.2.2. Description
The IHAVE command informs the server that the client has an article
with the specified message-id. If the server desires a copy of that
article, a 335 response MUST be returned, instructing the client to
send the entire article. If the server does not want the article
(if, for example, the server already has a copy of it), a 435
response MUST be returned, indicating that the article is not wanted.
Finally, if the article isn't wanted immediately but the client
should retry later if possible (if, for example, another client is in
the process of sending the same article to the server), a 436
response MUST be returned.
Feather Standards Track [Page 58]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
If transmission of the article is requested, the client MUST send the
entire article, including headers and body, to the server as a
multi-line data block (see Section 3.1.1). Thus, a single dot (".")
on a line indicates the end of the text, and lines starting with a
dot in the original text have that dot doubled during transmission.
The server MUST return a 235 response, indicating that the article
was successfully transferred; a 436 response, indicating that the
transfer failed but should be tried again later; or a 437 response,
indicating that the article was rejected.
This function differs from the POST command in that it is intended
for use in transferring already-posted articles between hosts. It
SHOULD NOT be used when the client is a personal news-reading
program, since use of this command indicates that the article has
already been posted at another site and is simply being forwarded
from another host. However, despite this, the server MAY elect not
to post or forward the article if, after further examination of the
article, it deems it inappropriate to do so. Reasons for such
subsequent rejection of an article may include problems such as
inappropriate newsgroups or distributions, disc space limitations,
article lengths, garbled headers, and the like. These are typically
restrictions enforced by the server host's news software and not
necessarily by the NNTP server itself.
The client SHOULD NOT assume that the article has been successfully
transferred unless it receives an affirmative response from the
server. A lack of response (such as a dropped network connection or
a network timeout) SHOULD be treated the same as a 436 response.
Because some news server software may not immediately be able to
determine whether an article is suitable for posting or forwarding,
an NNTP server MAY acknowledge the successful transfer of the article
(with a 235 response) but later silently discard it.
Feather Standards Track [Page 59]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
6.3.2.3. Examples
Example of successfully sending an article to another site:
[C] IHAVE <i.am.an.article.you.will.want@example.com>
[S] 335 Send it; end with <CR-LF>.<CR-LF>
[C] Path: pathost!demo!somewhere!not-for-mail
[C] From: "Demo User" <nobody@example.com>
[C] Newsgroups: misc.test
[C] Subject: I am just a test article
[C] Date: 6 Oct 1998 04:38:40 -0500
[C] Organization: An Example Com, San Jose, CA
[C] Message-ID: <i.am.an.article.you.will.want@example.com>
[C]
[C] This is just a test article.
[C] .
[S] 235 Article transferred OK
Example of sending an article to another site that rejects it. Note
that the message-id in the IHAVE command is not the same as the one
in the article headers; while this is bad practice and SHOULD NOT be
done, it is not forbidden.
[C] IHAVE <i.am.an.article.you.will.want@example.com>
[S] 335 Send it; end with <CR-LF>.<CR-LF>
[C] Path: pathost!demo!somewhere!not-for-mail
[C] From: "Demo User" <nobody@example.com>
[C] Newsgroups: misc.test
[C] Subject: I am just a test article
[C] Date: 6 Oct 1998 04:38:40 -0500
[C] Organization: An Example Com, San Jose, CA
[C] Message-ID: <i.am.an.article.you.have@example.com>
[C]
[C] This is just a test article.
[C] .
[S] 437 Article rejected; don't send again
Feather Standards Track [Page 60]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of sending an article to another site where the transfer
fails:
[C] IHAVE <i.am.an.article.you.will.want@example.com>
[S] 335 Send it; end with <CR-LF>.<CR-LF>
[C] Path: pathost!demo!somewhere!not-for-mail
[C] From: "Demo User" <nobody@example.com>
[C] Newsgroups: misc.test
[C] Subject: I am just a test article
[C] Date: 6 Oct 1998 04:38:40 -0500
[C] Organization: An Example Com, San Jose, CA
[C] Message-ID: <i.am.an.article.you.will.want@example.com>
[C]
[C] This is just a test article.
[C] .
[S] 436 Transfer failed
Example of sending an article to a site that already has it:
[C] IHAVE <i.am.an.article.you.have@example.com>
[S] 435 Duplicate
Example of sending an article to a site that requests that the
article be tried again later:
[C] IHAVE <i.am.an.article.you.defer@example.com>
[S] 436 Retry later
7. Information Commands
This section lists other commands that may be used at any time
between the beginning of a session and its termination. Using these
commands does not alter any state information, but the response
generated from their use may provide useful information to clients.
7.1. DATE
7.1.1. Usage
Indicating capability: READER
Syntax
DATE
Responses
111 yyyymmddhhmmss Server date and time
Feather Standards Track [Page 61]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Parameters
yyyymmddhhmmss Current UTC date and time on server
7.1.2. Description
This command exists to help clients find out the current Coordinated
Universal Time [TF.686-1] from the server's perspective. This
command SHOULD NOT be used as a substitute for NTP [RFC1305] but to
provide information that might be useful when using the NEWNEWS
command (see Section 7.4).
The DATE command MUST return a timestamp from the same clock as is
used for determining article arrival and group creation times (see
Section 6). This clock SHOULD be monotonic, and adjustments SHOULD
be made by running it fast or slow compared to "real" time rather
than by making sudden jumps. A system providing NNTP service SHOULD
keep the system clock as accurate as possible, either with NTP or by
some other method.
The server MUST return a 111 response specifying the date and time on
the server in the form yyyymmddhhmmss. This date and time is in
Coordinated Universal Time.
7.1.3. Examples
[C] DATE
[S] 111 19990623135624
7.2. HELP
7.2.1. Usage
This command is mandatory.
Syntax
HELP
Responses
100 Help text follows (multi-line)
7.2.2. Description
This command provides a short summary of the commands that are
understood by this implementation of the server. The help text will
be presented as a multi-line data block following the 100 response
code.
Feather Standards Track [Page 62]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
This text is not guaranteed to be in any particular format (but must
be UTF-8) and MUST NOT be used by clients as a replacement for the
CAPABILITIES command described in Section 5.2.
7.2.3. Examples
[C] HELP
[S] 100 Help text follows
[S] This is some help text. There is no specific
[S] formatting requirement for this test, though
[S] it is customary for it to list the valid commands
[S] and give a brief definition of what they do.
[S] .
7.3. NEWGROUPS
7.3.1. Usage
Indicating capability: READER
Syntax
NEWGROUPS date time [GMT]
Responses
231 List of new newsgroups follows (multi-line)
Parameters
date Date in yymmdd or yyyymmdd format
time Time in hhmmss format
7.3.2. Description
This command returns a list of newsgroups created on the server since
the specified date and time. The results are in the same format as
the LIST ACTIVE command (see Section 7.6.3). However, they MAY
include groups not available on the server (and so not returned by
LIST ACTIVE) and MAY omit groups for which the creation date is not
available.
The date is specified as 6 or 8 digits in the format [xx]yymmdd,
where xx is the first two digits of the year (19-99), yy is the last
two digits of the year (00-99), mm is the month (01-12), and dd is
the day of the month (01-31). Clients SHOULD specify all four digits
of the year. If the first two digits of the year are not specified
(this is supported only for backward compatibility), the year is to
be taken from the current century if yy is smaller than or equal to
the current year, and the previous century otherwise.
Feather Standards Track [Page 63]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The time is specified as 6 digits in the format hhmmss, where hh is
the hours in the 24-hour clock (00-23), mm is the minutes (00-59),
and ss is the seconds (00-60, to allow for leap seconds). The token
"GMT" specifies that the date and time are given in Coordinated
Universal Time [TF.686-1]; if it is omitted, then the date and time
are specified in the server's local timezone. Note that there is no
way of using the protocol specified in this document to establish the
server's local timezone.
Note that an empty list is a possible valid response and indicates
that there are no new newsgroups since that date-time.
Clients SHOULD make all queries using Coordinated Universal Time
(i.e., by including the "GMT" argument) when possible.
7.3.3. Examples
Example where there are new groups:
[C] NEWGROUPS 19990624 000000 GMT
[S] 231 list of new newsgroups follows
[S] alt.rfc-writers.recovery 4 1 y
[S] tx.natives.recovery 89 56 y
[S] .
Example where there are no new groups:
[C] NEWGROUPS 19990624 000000 GMT
[S] 231 list of new newsgroups follows
[S] .
7.4. NEWNEWS
7.4.1. Usage
Indicating capability: NEWNEWS
Syntax
NEWNEWS wildmat date time [GMT]
Responses
230 List of new articles follows (multi-line)
Parameters
wildmat Newsgroups of interest
date Date in yymmdd or yyyymmdd format
time Time in hhmmss format
Feather Standards Track [Page 64]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
7.4.2. Description
This command returns a list of message-ids of articles posted or
received on the server, in the newsgroups whose names match the
wildmat, since the specified date and time. One message-id is sent
on each line; the order of the response has no specific significance
and may vary from response to response in the same session. A
message-id MAY appear more than once; if it does, it has the same
meaning as if it appeared only once.
Date and time are in the same format as the NEWGROUPS command (see
Section 7.3).
Note that an empty list is a possible valid response and indicates
that there is currently no new news in the relevant groups.
Clients SHOULD make all queries in Coordinated Universal Time (i.e.,
by using the "GMT" argument) when possible.
7.4.3. Examples
Example where there are new articles:
[C] NEWNEWS news.*,sci.* 19990624 000000 GMT
[S] 230 list of new articles by message-id follows
[S] <i.am.a.new.article@example.com>
[S] <i.am.another.new.article@example.com>
[S] .
Example where there are no new articles:
[C] NEWNEWS alt.* 19990624 000000 GMT
[S] 230 list of new articles by message-id follows
[S] .
7.5. Time
As described in Section 6, each article has an arrival timestamp.
Each newsgroup also has a creation timestamp. These timestamps are
used by the NEWNEWS and NEWGROUP commands to construct their
responses.
Clients can ensure that they do not have gaps in lists of articles or
groups by using the DATE command in the following manner:
First session:
Issue DATE command and record result.
Issue NEWNEWS command using a previously chosen timestamp.
Feather Standards Track [Page 65]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Subsequent sessions:
Issue DATE command and hold result in temporary storage.
Issue NEWNEWS command using timestamp saved from previous session.
Overwrite saved timestamp with that currently in temporary
storage.
In order to allow for minor errors, clients MAY want to adjust the
timestamp back by two or three minutes before using it in NEWNEWS.
7.5.1. Examples
First session:
[C] DATE
[S] 111 20010203112233
[C] NEWNEWS local.chat 20001231 235959 GMT
[S] 230 list follows
[S] <article.1@local.service>
[S] <article.2@local.service>
[S] <article.3@local.service>
[S] .
Second session (the client has subtracted 3 minutes from the
timestamp returned previously):
[C] DATE
[S] 111 20010204003344
[C] NEWNEWS local.chat 20010203 111933 GMT
[S] 230 list follows
[S] <article.3@local.service>
[S] <article.4@local.service>
[S] <article.5@local.service>
[S] .
Note how <article.3@local.service> arrived in the 3 minute gap and so
is listed in both responses.
7.6. The LIST Commands
The LIST family of commands all return information that is multi-line
and that can, in general, be expected not to change during the
session. Often the information is related to newsgroups, in which
case the response has one line per newsgroup and a wildmat MAY be
provided to restrict the groups for which information is returned.
The set of available keywords (including those provided by
extensions) is given in the capability list with capability label
LIST.
Feather Standards Track [Page 66]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
7.6.1. LIST
7.6.1.1. Usage
Indicating capability: LIST
Syntax
LIST [keyword [wildmat|argument]]
Responses
215 Information follows (multi-line)
Parameters
keyword Information requested [1]
argument Specific to keyword
wildmat Groups of interest
[1] If no keyword is provided, it defaults to ACTIVE.
7.6.1.2. Description
The LIST command allows the server to provide blocks of information
to the client. This information may be global or may be related to
newsgroups; in the latter case, the information may be returned
either for all groups or only for those matching a wildmat. Each
block of information is represented by a different keyword. The
command returns the specific information identified by the keyword.
If the information is available, it is returned as a multi-line data
block following the 215 response code. The format of the information
depends on the keyword. The information MAY be affected by the
additional argument, but the format MUST NOT be.
If the information is based on newsgroups and the optional wildmat
argument is specified, the response is limited to only the groups (if
any) whose names match the wildmat and for which the information is
available.
Note that an empty list is a possible valid response; for a
newsgroup-based keyword, it indicates that there are no groups
meeting the above criteria.
If the keyword is not recognised, or if an argument is specified and
the keyword does not expect one, a 501 response code MUST BE
returned. If the keyword is recognised but the server does not
maintain the information, a 503 response code MUST BE returned.
Feather Standards Track [Page 67]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The LIST command MUST NOT change the visible state of the server in
any way; that is, the behaviour of subsequent commands MUST NOT be
affected by whether the LIST command was issued. For example, it
MUST NOT make groups available that otherwise would not have been.
7.6.1.3. Examples
Example of LIST with the ACTIVE keyword:
[C] LIST ACTIVE
[S] 215 list of newsgroups follows
[S] misc.test 3002322 3000234 y
[S] comp.risks 442001 441099 m
[S] alt.rfc-writers.recovery 4 1 y
[S] tx.natives.recovery 89 56 y
[S] tx.natives.recovery.d 11 9 n
[S] .
Example of LIST with no keyword:
[C] LIST
[S] 215 list of newsgroups follows
[S] misc.test 3002322 3000234 y
[S] comp.risks 442001 441099 m
[S] alt.rfc-writers.recovery 4 1 y
[S] tx.natives.recovery 89 56 y
[S] tx.natives.recovery.d 11 9 n
[S] .
The output is identical to that of the previous example.
Example of LIST on a newsgroup-based keyword with and without
wildmat:
[C] LIST ACTIVE.TIMES
[S] 215 information follows
[S] misc.test 930445408 <creatme@isc.org>
[S] alt.rfc-writers.recovery 930562309 <m@example.com>
[S] tx.natives.recovery 930678923 <sob@academ.com>
[S] .
[C] LIST ACTIVE.TIMES tx.*
[S] 215 information follows
[S] tx.natives.recovery 930678923 <sob@academ.com>
[S] .
Feather Standards Track [Page 68]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of LIST returning an error where the keyword is recognized
but the software does not maintain this information:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES XTRA.DATA
[S] .
[C] LIST XTRA.DATA
[S] 503 Data item not stored
Example of LIST where the keyword is not recognised:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES XTRA.DATA
[S] .
[C] LIST DISTRIB.PATS
[S] 501 Syntax Error
7.6.2. Standard LIST Keywords
This specification defines the following LIST keywords:
+--------------+---------------+------------------------------------+
| Keyword | Definition | Status |
+--------------+---------------+------------------------------------+
| ACTIVE | Section 7.6.3 | Mandatory if the READER capability |
| | | is advertised |
| | | |
| ACTIVE.TIMES | Section 7.6.4 | Optional |
| | | |
| DISTRIB.PATS | Section 7.6.5 | Optional |
| | | |
| HEADERS | Section 8.6 | Mandatory if the HDR capability is |
| | | advertised |
| | | |
| NEWSGROUPS | Section 7.6.6 | Mandatory if the READER capability |
| | | is advertised |
| | | |
| OVERVIEW.FMT | Section 8.4 | Mandatory if the OVER capability |
| | | is advertised |
+--------------+---------------+------------------------------------+
Feather Standards Track [Page 69]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Where one of these LIST keywords is supported by a server, it MUST
have the meaning given in the relevant sub-section.
7.6.3. LIST ACTIVE
This keyword MUST be supported by servers advertising the READER
capability.
LIST ACTIVE returns a list of valid newsgroups and associated
information. If no wildmat is specified, the server MUST include
every group that the client is permitted to select with the GROUP
command (Section 6.1.1). Each line of this list consists of four
fields separated from each other by one or more spaces:
o The name of the newsgroup.
o The reported high water mark for the group.
o The reported low water mark for the group.
o The current status of the group on this server.
The reported high and low water marks are as described in the GROUP
command (see Section 6.1.1), but note that they are in the opposite
order to the 211 response to that command.
The status field is typically one of the following:
"y" Posting is permitted.
"n" Posting is not permitted.
"m" Postings will be forwarded to the newsgroup moderator.
The server SHOULD use these values when these meanings are required
and MUST NOT use them with any other meaning. Other values for the
status may exist; the definition of these other values and the
circumstances under which they are returned may be specified in an
extension or may be private to the server. A client SHOULD treat an
unrecognized status as giving no information.
The status of a newsgroup only indicates how posts to that newsgroup
are normally processed and is not necessarily customised to the
specific client. For example, if the current client is forbidden
from posting, then this will apply equally to groups with status "y".
Conversely, a client with special privileges (not defined by this
specification) might be able to post to a group with status "n".
Feather Standards Track [Page 70]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
For example:
[C] LIST ACTIVE
[S] 215 list of newsgroups follows
[S] misc.test 3002322 3000234 y
[S] comp.risks 442001 441099 m
[S] alt.rfc-writers.recovery 4 1 y
[S] tx.natives.recovery 89 56 y
[S] tx.natives.recovery.d 11 9 n
[S] .
or, on an implementation that includes leading zeroes:
[C] LIST ACTIVE
[S] 215 list of newsgroups follows
[S] misc.test 0003002322 0003000234 y
[S] comp.risks 0000442001 0000441099 m
[S] alt.rfc-writers.recovery 0000000004 0000000001 y
[S] tx.natives.recovery 0000000089 0000000056 y
[S] tx.natives.recovery.d 0000000011 0000000009 n
[S] .
The information is newsgroup based, and a wildmat MAY be specified,
in which case the response is limited to only the groups (if any)
whose names match the wildmat. For example:
[C] LIST ACTIVE *.recovery
[S] 215 list of newsgroups follows
[S] alt.rfc-writers.recovery 4 1 y
[S] tx.natives.recovery 89 56 y
[S] .
7.6.4. LIST ACTIVE.TIMES
This keyword is optional.
The active.times list is maintained by some NNTP servers to contain
information about who created a particular newsgroup and when. Each
line of this list consists of three fields separated from each other
by one or more spaces. The first field is the name of the newsgroup.
The second is the time when this group was created on this news
server, measured in seconds since the start of January 1, 1970. The
third is plain text intended to describe the entity that created the
newsgroup; it is often a mailbox as defined in RFC 2822 [RFC2822].
For example:
Feather Standards Track [Page 71]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
[C] LIST ACTIVE.TIMES
[S] 215 information follows
[S] misc.test 930445408 <creatme@isc.org>
[S] alt.rfc-writers.recovery 930562309 <m@example.com>
[S] tx.natives.recovery 930678923 <sob@academ.com>
[S] .
The list MAY omit newsgroups for which the information is unavailable
and MAY include groups not available on the server; in particular, it
MAY omit all groups created before the date and time of the oldest
entry. The client MUST NOT assume that the list is complete or that
it matches the list returned by the LIST ACTIVE command
(Section 7.6.3). The NEWGROUPS command (Section 7.3) may provide a
better way to access this information, and the results of the two
commands SHOULD be consistent except that, if the latter is invoked
with a date and time earlier than the oldest entry in active.times
list, its result may include extra groups.
The information is newsgroup based, and a wildmat MAY be specified,
in which case the response is limited to only the groups (if any)
whose names match the wildmat.
7.6.5. LIST DISTRIB.PATS
This keyword is optional.
The distrib.pats list is maintained by some NNTP servers to assist
clients to choose a value for the content of the Distribution header
of a news article being posted. Each line of this list consists of
three fields separated from each other by a colon (":"). The first
field is a weight, the second field is a wildmat (which may be a
simple newsgroup name), and the third field is a value for the
Distribution header content. For example:
[C] LIST DISTRIB.PATS
[S] 215 information follows
[S] 10:local.*:local
[S] 5:*:world
[S] 20:local.here.*:thissite
[S] .
The client MAY use this information to construct an appropriate
Distribution header given the name of a newsgroup. To do so, it
should determine the lines whose second field matches the newsgroup
name, select from among them the line with the highest weight (with 0
being the lowest), and use the value of the third field to construct
the Distribution header.
Feather Standards Track [Page 72]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
The information is not newsgroup based, and an argument MUST NOT be
specified.
7.6.6. LIST NEWSGROUPS
This keyword MUST be supported by servers advertising the READER
capability.
The newsgroups list is maintained by NNTP servers to contain the name
of each newsgroup that is available on the server and a short
description about the purpose of the group. Each line of this list
consists of two fields separated from each other by one or more space
or TAB characters (the usual practice is a single TAB). The first
field is the name of the newsgroup, and the second is a short
description of the group. For example:
[C] LIST NEWSGROUPS
[S] 215 information follows
[S] misc.test General Usenet testing
[S] alt.rfc-writers.recovery RFC Writers Recovery
[S] tx.natives.recovery Texas Natives Recovery
[S] .
The list MAY omit newsgroups for which the information is unavailable
and MAY include groups not available on the server. The client MUST
NOT assume that the list is complete or that it matches the list
returned by LIST ACTIVE.
The description SHOULD be in UTF-8. However, servers often obtain
the information from external sources. These sources may have used
different encodings (ones that use octets in the range 128 to 255 in
some other manner) and, in that case, the server MAY pass it on
unchanged. Therefore, clients MUST be prepared to receive such
descriptions.
The information is newsgroup based, and a wildmat MAY be specified,
in which case the response is limited to only the groups (if any)
whose names match the wildmat.
8. Article Field Access Commands
This section lists commands that may be used to access specific
article fields; that is, headers of articles and metadata about
articles. These commands typically fetch data from an "overview
database", which is a database of headers extracted from incoming
articles plus metadata determined as the article arrives. Only
certain fields are included in the database.
Feather Standards Track [Page 73]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
This section is based on the Overview/NOV database [ROBE1995]
developed by Geoff Collyer.
8.1. Article Metadata
Article "metadata" is data about articles that does not occur within
the article itself. Each metadata item has a name that MUST begin
with a colon (and that MUST NOT contain a colon elsewhere within it).
As with header names, metadata item names are not case sensitive.
When generating a metadata item, the server MUST compute it for
itself and MUST NOT trust any related value provided in the article.
(In particular, a Lines or Bytes header in the article MUST NOT be
assumed to specify the correct number of lines or bytes in the
article.) If the server has access to several non-identical copies
of an article, the value returned MUST be correct for any copy of
that article retrieved during the same session.
This specification defines two metadata items: ":bytes" and ":lines".
Other metadata items may be defined by extensions. The names of
metadata items defined by registered extensions MUST NOT begin with
":x-". To avoid the risk of a clash with a future registered
extension, the names of metadata items defined by private extensions
SHOULD begin with ":x-".
8.1.1. The :bytes Metadata Item
The :bytes metadata item for an article is a decimal integer. It
SHOULD equal the number of octets in the entire article: headers,
body, and separating empty line (counting a CRLF pair as two octets,
and excluding both the "." CRLF terminating the response and any "."
added for "dot-stuffing" purposes).
Note to client implementers: some existing servers return a value
different from that above. The commonest reasons for this are as
follows:
o Counting a CRLF pair as one octet.
o Including the "." character used for dot-stuffing in the number.
o Including the terminating "." CRLF in the number.
o Using one copy of an article for counting the octets but then
returning another one that differs in some (permitted) manner.
Implementations should be prepared for such variation and MUST NOT
rely on the value being accurate.
Feather Standards Track [Page 74]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.1.2. The :lines Metadata Item
The :lines metadata item for an article is a decimal integer. It
MUST equal the number of lines in the article body (excluding the
empty line separating headers and body). Equivalently, it is two
less than the number of CRLF pairs that the BODY command would return
for that article (the extra two are those following the response code
and the termination octet).
8.2. Database Consistency
The information stored in the overview database may change over time.
If the database records the content or absence of a given field (that
is, a header or metadata item) for all articles, it is said to be
"consistent" for that field. If it records the content of a header
for some articles but not for others that nevertheless included that
header, or if it records a metadata item for some articles but not
for others to which that item applies, it is said to be
"inconsistent" for that field.
The LIST OVERVIEW.FMT command SHOULD list all the fields for which
the database is consistent at that moment. It MAY omit such fields
(for example, if it is not known whether the database is consistent
or inconsistent). It MUST NOT include fields for which the database
is inconsistent or that are not stored in the database. Therefore,
if a header appears in the LIST OVERVIEW.FMT output but not in the
OVER output for a given article, that header does not appear in the
article (similarly for metadata items).
These rules assume that the fields being stored in the database
remain constant for long periods of time, and therefore the database
will be consistent. When the set of fields to be stored is changed,
it will be inconsistent until either the database is rebuilt or the
only articles remaining are those received since the change.
Therefore, the output from LIST OVERVIEW.FMT needs to be altered
twice. Firstly, before any fields stop being stored they MUST be
removed from the output; then, when the database is once more known
to be consistent, the new fields SHOULD be added to the output.
If the HDR command uses the overview database rather than taking
information directly from the articles, the same issues of
consistency and inconsistency apply, and the LIST HEADERS command
SHOULD take the same approach as the LIST OVERVIEW.FMT command in
resolving them.
Feather Standards Track [Page 75]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.3. OVER
8.3.1. Usage
Indicating capability: OVER
Syntax
OVER message-id
OVER range
OVER
Responses
First form (message-id specified)
224 Overview information follows (multi-line)
430 No article with that message-id
Second form (range specified)
224 Overview information follows (multi-line)
412 No newsgroup selected
423 No articles in that range
Third form (current article number used)
224 Overview information follows (multi-line)
412 No newsgroup selected
420 Current article number is invalid
Parameters
range Number(s) of articles
message-id Message-id of article
8.3.2. Description
The OVER command returns the contents of all the fields in the
database for an article specified by message-id, or from a specified
article or range of articles in the currently selected newsgroup.
The message-id argument indicates a specific article. The range
argument may be any of the following:
o An article number.
o An article number followed by a dash to indicate all following.
o An article number followed by a dash followed by another article
number.
If neither is specified, the current article number is used.
Feather Standards Track [Page 76]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Support for the first (message-id) form is optional. If it is
supported, the OVER capability line MUST include the argument
"MSGID". Otherwise, the capability line MUST NOT include this
argument, and the OVER command MUST return the generic response code
503 when this form is used.
If the information is available, it is returned as a multi-line data
block following the 224 response code and contains one line per
article, sorted in numerical order of article number. (Note that
unless the argument is a range including a dash, there will be
exactly one line in the data block.) Each line consists of a number
of fields separated by a TAB. A field may be empty (in which case
there will be two adjacent TABs), and a sequence of trailing TABs may
be omitted.
The first 8 fields MUST be the following, in order:
"0" or article number (see below)
Subject header content
From header content
Date header content
Message-ID header content
References header content
:bytes metadata item
:lines metadata item
If the article is specified by message-id (the first form of the
command), the article number MUST be replaced with zero, except that
if there is a currently selected newsgroup and the article is present
in that group, the server MAY use the article's number in that group.
(See the ARTICLE command (Section 6.2.1) and STAT examples
(Section 6.2.4.3) for more details.) In the other two forms of the
command, the article number MUST be returned.
Any subsequent fields are the contents of the other headers and
metadata held in the database.
For the five mandatory headers, the content of each field MUST be
based on the content of the header (that is, with the header name and
following colon and space removed). If the article does not contain
that header, or if the content is empty, the field MUST be empty.
For the two mandatory metadata items, the content of the field MUST
be just the value, with no other text.
For all subsequent fields that contain headers, the content MUST be
the entire header line other than the trailing CRLF. For all
subsequent fields that contain metadata, the field consists of the
metadata name, a single space, and then the value.
Feather Standards Track [Page 77]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
For all fields, the value is processed by first removing all CRLF
pairs (that is, undoing any folding and removing the terminating
CRLF) and then replacing each TAB with a single space. If there is
no such header in the article, no such metadata item, or no header or
item stored in the database for that article, the corresponding field
MUST be empty.
Note that, after unfolding, the characters NUL, LF, and CR cannot
occur in the header of an article offered by a conformant server.
Nevertheless, servers SHOULD check for these characters and replace
each one by a single space (so that, for example, CR LF LF TAB will
become two spaces, since the CR and first LF will be removed by the
unfolding process). This will encourage robustness in the face of
non-conforming data; it is also possible that future versions of this
specification could permit these characters to appear in articles.
The server SHOULD NOT produce output for articles that no longer
exist.
If the argument is a message-id and no such article exists, a 430
response MUST be returned. If the argument is a range or is omitted
and the currently selected newsgroup is invalid, a 412 response MUST
be returned. If the argument is a range and no articles in that
number range exist in the currently selected newsgroup, including the
case where the second number is less than the first one, a 423
response MUST be returned. If the argument is omitted and the
current article number is invalid, a 420 response MUST be returned.
8.3.3. Examples
In the first four examples, TAB has been replaced by vertical bar and
some lines have been folded for readability.
Example of a successful retrieval of overview information for an
article (explicitly not using an article number):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] OVER
[S] 224 Overview information follows
[S] 3000234|I am just a test article|"Demo User"
<nobody@example.com>|6 Oct 1998 04:38:40 -0500|
<45223423@example.com>|<45454@example.net>|1234|
17|Xref: news.example.com misc.test:3000363
[S] .
Feather Standards Track [Page 78]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of a successful retrieval of overview information for an
article by message-id:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] OVER MSGID
[S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT
[S] .
[C] OVER <45223423@example.com>
[S] 224 Overview information follows
[S] 0|I am just a test article|"Demo User"
<nobody@example.com>|6 Oct 1998 04:38:40 -0500|
<45223423@example.com>|<45454@example.net>|1234|
17|Xref: news.example.com misc.test:3000363
[S] .
Note that the article number has been replaced by "0".
Example of the same commands on a system that does not implement
retrieval by message-id:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] OVER
[S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT
[S] .
[C] OVER <45223423@example.com>
[S] 503 Overview by message-id unsupported
Feather Standards Track [Page 79]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of a successful retrieval of overview information for a range
of articles:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] OVER 3000234-3000240
[S] 224 Overview information follows
[S] 3000234|I am just a test article|"Demo User"
<nobody@example.com>|6 Oct 1998 04:38:40 -0500|
<45223423@example.com>|<45454@example.net>|1234|
17|Xref: news.example.com misc.test:3000363
[S] 3000235|Another test article|nobody@nowhere.to
(Demo User)|6 Oct 1998 04:38:45 -0500|<45223425@to.to>||
4818|37||Distribution: fi
[S] 3000238|Re: I am just a test article|somebody@elsewhere.to|
7 Oct 1998 11:38:40 +1200|<kfwer3v@elsewhere.to>|
<45223423@to.to>|9234|51
[S] .
Note the missing "References" and Xref headers in the second line,
the missing trailing fields in the first and last lines, and that
there are only results for those articles that still exist.
Example of an unsuccessful retrieval of overview information on an
article by number:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] OVER 300256
[S] 423 No such article in this group
Example of an invalid range:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] OVER 3000444-3000222
[S] 423 Empty range
Example of an unsuccessful retrieval of overview information by
number because no newsgroup was selected first:
[Assumes currently selected newsgroup is invalid.]
[C] OVER
[S] 412 No newsgroup selected
Feather Standards Track [Page 80]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an attempt to retrieve information when the currently
selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] OVER
[S] 420 No current article selected
8.4. LIST OVERVIEW.FMT
8.4.1. Usage
Indicating capability: OVER
Syntax
LIST OVERVIEW.FMT
Responses
215 Information follows (multi-line)
8.4.2. Description
See Section 7.6.1 for general requirements of the LIST command.
The LIST OVERVIEW.FMT command returns a description of the fields in
the database for which it is consistent (as described above). The
information is returned as a multi-line data block following the 215
response code. The information contains one line per field in the
order in which they are returned by the OVER command; the first 7
lines MUST (except for the case of letters) be exactly as follows:
Subject:
From:
Date:
Message-ID:
References:
:bytes
:lines
For compatibility with existing implementations, the last two lines
MAY instead be:
Bytes:
Lines:
even though they refer to metadata, not headers.
Feather Standards Track [Page 81]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
All subsequent lines MUST consist of either a header name followed by
":full", or the name of a piece of metadata.
There are no leading or trailing spaces in the output.
Note that the 7 fixed lines describe the 2nd to 8th fields of the
OVER output. The "full" suffix (which may use either uppercase,
lowercase, or a mix) is a reminder that the corresponding fields
include the header name.
This command MAY generate different results if it is used more than
once in a session.
If the OVER command is not implemented, the meaning of the output
from this command is not specified, but it must still meet the above
syntactic requirements.
8.4.3. Examples
Example of LIST OVERVIEW.FMT output corresponding to the example OVER
output above, in the preferred format:
[C] LIST OVERVIEW.FMT
[S] 215 Order of fields in overview database.
[S] Subject:
[S] From:
[S] Date:
[S] Message-ID:
[S] References:
[S] :bytes
[S] :lines
[S] Xref:full
[S] Distribution:full
[S] .
Feather Standards Track [Page 82]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of LIST OVERVIEW.FMT output corresponding to the example OVER
output above, in the alternative format:
[C] LIST OVERVIEW.FMT
[S] 215 Order of fields in overview database.
[S] Subject:
[S] From:
[S] Date:
[S] Message-ID:
[S] References:
[S] Bytes:
[S] Lines:
[S] Xref:FULL
[S] Distribution:FULL
[S] .
8.5. HDR
8.5.1. Usage
Indicating capability: HDR
Syntax
HDR field message-id
HDR field range
HDR field
Responses
First form (message-id specified)
225 Headers follow (multi-line)
430 No article with that message-id
Second form (range specified)
225 Headers follow (multi-line)
412 No newsgroup selected
423 No articles in that range
Third form (current article number used)
225 Headers follow (multi-line)
412 No newsgroup selected
420 Current article number is invalid
Parameters
field Name of field
range Number(s) of articles
message-id Message-id of article
Feather Standards Track [Page 83]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.5.2. Description
The HDR command provides access to specific fields from an article
specified by message-id, or from a specified article or range of
articles in the currently selected newsgroup. It MAY take the
information directly from the articles or from the overview database.
In the case of headers, an implementation MAY restrict the use of
this command to a specific list of headers or MAY allow it to be used
with any header; it may behave differently when it is used with a
message-id argument and when it is used with a range or no argument.
The required field argument is the name of a header with the colon
omitted (e.g., "subject") or the name of a metadata item including
the leading colon (e.g., ":bytes"), and is case insensitive.
The message-id argument indicates a specific article. The range
argument may be any of the following:
o An article number.
o An article number followed by a dash to indicate all following.
o An article number followed by a dash followed by another article
number.
If neither is specified, the current article number is used.
If the information is available, it is returned as a multi-line data
block following the 225 response code and contains one line for each
article in the range that exists. (Note that unless the argument is
a range including a dash, there will be exactly one line in the data
block.) The line consists of the article number, a space, and then
the contents of the field. In the case of a header, the header name,
the colon, and the first space after the colon are all omitted.
If the article is specified by message-id (the first form of the
command), the article number MUST be replaced with zero, except that
if there is a currently selected newsgroup and the article is present
in that group, the server MAY use the article's number in that group.
(See the ARTICLE command (Section 6.2.1) and STAT examples
(Section 6.2.4.3) for more details.) In the other two forms of the
command, the article number MUST be returned.
Header contents are modified as follows: all CRLF pairs are removed,
and then each TAB is replaced with a single space. (Note that this
is the same transformation as is performed by the OVER command
(Section 8.3.2), and the same comment concerning NUL, CR, and LF
applies.)
Feather Standards Track [Page 84]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Note the distinction between headers and metadata appearing to have
the same meaning. Headers are always taken unchanged from the
article; metadata are always calculated. For example, a request for
"Lines" returns the contents of the "Lines" header of the specified
articles, if any, no matter whether they accurately state the number
of lines, while a request for ":lines" returns the line count
metadata, which is always the actual number of lines irrespective of
what any header may state.
If the requested header is not present in the article, or if it is
present but empty, a line for that article is included in the output,
but the header content portion of the line is empty (the space after
the article number MAY be retained or omitted). If the header occurs
in a given article more than once, only the content of the first
occurrence is returned by HDR. If any article number in the provided
range does not exist in the group, no line for that article number is
included in the output.
If the second argument is a message-id and no such article exists, a
430 response MUST be returned. If the second argument is a range or
is omitted and the currently selected newsgroup is invalid, a 412
response MUST be returned. If the second argument is a range and no
articles in that number range exist in the currently selected
newsgroup, including the case where the second number is less than
the first one, a 423 response MUST be returned. If the second
argument is omitted and the current article number is invalid, a 420
response MUST be returned.
A server MAY only allow HDR commands for a limited set of fields; it
may behave differently in this respect for the first (message-id)
form from how it would for the other forms. If so, it MUST respond
with the generic 503 response to attempts to request other fields,
rather than return erroneous results, such as a successful empty
response.
If HDR uses the overview database and it is inconsistent for the
requested field, the server MAY return what results it can, or it MAY
respond with the generic 503 response. In the latter case, the field
MUST NOT appear in the output from LIST HEADERS.
Feather Standards Track [Page 85]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.5.3. Examples
Example of a successful retrieval of subject lines from a range of
articles (3000235 has no Subject header, and 3000236 is missing):
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HDR Subject 3000234-3000238
[S] 225 Headers follow
[S] 3000234 I am just a test article
[S] 3000235
[S] 3000237 Re: I am just a test article
[S] 3000238 Ditto
[S] .
Example of a successful retrieval of line counts from a range of
articles:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HDR :lines 3000234-3000238
[S] 225 Headers follow
[S] 3000234 42
[S] 3000235 5
[S] 3000237 11
[S] 3000238 2378
[S] .
Example of a successful retrieval of the subject line from an article
by message-id:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HDR subject <i.am.a.test.article@example.com>
[S] 225 Header information follows
[S] 0 I am just a test article
[S] .
Example of a successful retrieval of the subject line from the
current article:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HDR subject
[S] 225 Header information follows
[S] 3000234 I am just a test article
[S] .
Feather Standards Track [Page 86]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an unsuccessful retrieval of a header from an article by
message-id:
[C] HDR subject <i.am.not.there@example.com>
[S] 430 No Such Article Found
Example of an unsuccessful retrieval of headers from articles by
number because no newsgroup was selected first:
[Assumes currently selected newsgroup is invalid.]
[C] HDR subject 300256-
[S] 412 No newsgroup selected
Example of an unsuccessful retrieval of headers because the currently
selected newsgroup is empty:
[C] GROUP example.empty.newsgroup
[S] 211 0 0 0 example.empty.newsgroup
[C] HDR subject 1-
[S] 423 No articles in that range
Example of an unsuccessful retrieval of headers because the server
does not allow HDR commands for that header:
[C] GROUP misc.test
[S] 211 1234 3000234 3002322 misc.test
[C] HDR Content-Type 3000234-3000238
[S] 503 HDR not permitted on Content-Type
8.6. LIST HEADERS
8.6.1. Usage
Indicating capability: HDR
Syntax
LIST HEADERS [MSGID|RANGE]
Responses
215 Field list follows (multi-line)
Parameters
MSGID Requests list for access by message-id
RANGE Requests list for access by range
Feather Standards Track [Page 87]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.6.2. Description
See Section 7.6.1 for general requirements of the LIST command.
The LIST HEADERS command returns a list of fields that may be
retrieved using the HDR command.
The information is returned as a multi-line data block following the
215 response code and contains one line for each field name
(excluding the trailing colon for headers and including the leading
colon for metadata items). If the implementation allows any header
to be retrieved, it MUST NOT include any header names in the list but
MUST include the special entry ":" (a single colon on its own). It
MUST still explicitly list any metadata items that are available.
The order of items in the list is not significant; the server need
not even consistently return the same order. The list MAY be empty
(though in this circumstance there is little point in providing the
HDR command).
An implementation that also supports the OVER command SHOULD at least
permit all the headers and metadata items listed in the output from
the LIST OVERVIEW.FMT command.
If the server treats the first form of the HDR command (message-id
specified) differently from the other two forms (range specified or
current article number used) in respect of which headers or metadata
items are available, then the following apply:
o If the MSGID argument is specified, the results MUST be those
available for the first form of the HDR command.
o If the RANGE argument is specified, the results MUST be those
available for the second and third forms of the HDR command.
o If no argument is specified, the results MUST be those available
in all forms of the HDR command (that is, it MUST only list those
items listed in both the previous cases).
If the server does not treat the various forms differently, then it
MUST ignore any argument and always produce the same results (though
not necessarily always in the same order).
If the HDR command is not implemented, the meaning of the output from
this command is not specified, but it must still meet the above
syntactic requirements.
Feather Standards Track [Page 88]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
8.6.3. Examples
Example of an implementation providing access to only a few headers:
[C] LIST HEADERS
[S] 215 headers supported:
[S] Subject
[S] Message-ID
[S] Xref
[S] .
Example of an implementation providing access to the same fields as
the first example in Section 8.4.3:
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] OVER
[S] HDR
[S] LIST ACTIVE NEWSGROUPS HEADERS OVERVIEW.FMT
[S] .
[C] LIST HEADERS
[S] 215 headers and metadata items supported:
[S] Date
[S] Distribution
[S] From
[S] Message-ID
[S] References
[S] Subject
[S] Xref
[S] :bytes
[S] :lines
[S] .
Example of an implementation providing access to all headers:
[C] LIST HEADERS
[S] 215 metadata items supported:
[S] :
[S] :lines
[S] :bytes
[S] :x-article-number
[S] .
Feather Standards Track [Page 89]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Example of an implementation distinguishing the first form of the HDR
command from the other two forms:
[C] LIST HEADERS RANGE
[S] 215 metadata items supported:
[S] :
[S] :lines
[S] :bytes
[S] .
[C] LIST HEADERS MSGID
[S] 215 headers and metadata items supported:
[S] Date
[S] Distribution
[S] From
[S] Message-ID
[S] References
[S] Subject
[S] :lines
[S] :bytes
[S] :x-article-number
[S] .
[C] LIST HEADERS
[S] 215 headers and metadata items supported:
[S] Date
[S] Distribution
[S] From
[S] Message-ID
[S] References
[S] Subject
[S] :lines
[S] :bytes
[S] .
Note that :x-article-number does not appear in the last set of
output.
9. Augmented BNF Syntax for NNTP
9.1. Introduction
Each of the following sections describes the syntax of a major
element of NNTP. This syntax extends and refines the descriptions
elsewhere in this specification and should be given precedence when
resolving apparent conflicts. Note that ABNF [RFC4234] strings are
case insensitive. Non-terminals used in several places are defined
in a separate section at the end.
Feather Standards Track [Page 90]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Between them, the non-terminals <command-line>, <command-datastream>,
<command-continuation>, and <response> specify the text that flows
between client and server. A consistent naming scheme is used in
this document for the non-terminals relating to each command, and
SHOULD be used by the specification of registered extensions.
For each command, the sequence is as follows:
o The client sends an instance of <command-line>; the syntax for the
EXAMPLE command is <example-command>.
o If the client is one that immediately streams data, it sends an
instance of <command-datastream>; the syntax for the EXAMPLE
command is <example-datastream>.
o The server sends an instance of <response>.
* The initial response line is independent of the command that
generated it; if the 000 response has arguments, the syntax of
the initial line is <response-000-content>.
* If the response is multi-line, the initial line is followed by
a <multi-line-data-block>. The syntax for the contents of this
block after "dot-stuffing" has been removed is (for the 000
response to the EXAMPLE command) <example-000-ml-content> and
is an instance of <multi-line-response-content>.
o While the latest response is one that indicates more data is
required (in general, a 3xx response):
* the client sends an instance of <command-continuation>; the
syntax for the EXAMPLE continuation following a 333 response is
<example-333-continuation>;
* the server sends another instance of <response>, as above.
(There are no commands in this specification that immediately stream
data, but this non-terminal is defined for the convenience of
extensions.)
Feather Standards Track [Page 91]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
9.2. Commands
This syntax defines the non-terminal <command-line>, which represents
what is sent from the client to the server (see section 3.1 for
limits on lengths).
command-line = command EOL
command = X-command
X-command = keyword *(WS token)
command =/ article-command /
body-command /
capabilities-command /
date-command /
group-command /
hdr-command /
head-command /
help-command /
ihave-command /
last-command /
list-command /
listgroup-command /
mode-reader-command /
newgroups-command /
newnews-command /
next-command /
over-command /
post-command /
quit-command /
stat-command
article-command = "ARTICLE" [WS article-ref]
body-command = "BODY" [WS article-ref]
capabilities-command = "CAPABILITIES" [WS keyword]
date-command = "DATE"
group-command = "GROUP" [WS newsgroup-name]
hdr-command = "HDR" WS header-meta-name [WS range-ref]
head-command = "HEAD" [WS article-ref]
help-command = "HELP"
ihave-command = "IHAVE" WS message-id
last-command = "LAST"
list-command = "LIST" [WS list-arguments]
listgroup-command = "LISTGROUP" [WS newsgroup-name [WS range]]
mode-reader-command = "MODE" WS "READER"
newgroups-command = "NEWGROUPS" WS date-time
newnews-command = "NEWNEWS" WS wildmat WS date-time
next-command = "NEXT"
over-command = "OVER" [WS range-ref]
Feather Standards Track [Page 92]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
post-command = "POST"
quit-command = "QUIT"
stat-command = "STAT" [WS article-ref]
article-ref = article-number / message-id
date = date2y / date4y
date4y = 4DIGIT 2DIGIT 2DIGIT
date2y = 2DIGIT 2DIGIT 2DIGIT
date-time = date WS time [WS "GMT"]
header-meta-name = header-name / metadata-name
list-arguments = keyword [WS token]
metadata-name = ":" 1*A-NOTCOLON
range = article-number ["-" [article-number]]
range-ref = range / message-id
time = 2DIGIT 2DIGIT 2DIGIT
9.3. Command Continuation
This syntax defines the further material sent by the client in the
case of multi-stage commands and those that stream data.
command-datastream = UNDEFINED
; not used, provided as a hook for extensions
command-continuation = ihave-335-continuation /
post-340-continuation
ihave-335-continuation = encoded-article
post-340-continuation = encoded-article
encoded-article = multi-line-data-block
; after undoing the "dot-stuffing", this MUST match <article>
9.4. Responses
9.4.1. Generic Responses
This syntax defines the non-terminal <response>, which represents the
generic form of responses; that is, what is sent from the server to
the client in response to a <command> or a <command-continuation>.
response = simple-response / multi-line-response
simple-response = initial-response-line
multi-line-response = initial-response-line multi-line-data-block
initial-response-line =
initial-response-content [SP trailing-comment] CRLF
initial-response-content = X-initial-response-content
X-initial-response-content = 3DIGIT *(SP response-argument)
Feather Standards Track [Page 93]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
response-argument = 1*A-CHAR
trailing-comment = *U-CHAR
9.4.2. Initial Response Line Contents
This syntax defines the specific initial response lines for the
various commands in this specification (see section 3.1 for limits on
lengths). Only those response codes with arguments are listed.
initial-response-content =/ response-111-content /
response-211-content /
response-220-content /
response-221-content /
response-222-content /
response-223-content /
response-401-content
response-111-content = "111" SP date4y time
response-211-content = "211" 3(SP article-number) SP newsgroup-name
response-220-content = "220" SP article-number SP message-id
response-221-content = "221" SP article-number SP message-id
response-222-content = "222" SP article-number SP message-id
response-223-content = "223" SP article-number SP message-id
response-401-content = "401" SP capability-label
9.4.3. Multi-line Response Contents
This syntax defines the content of the various multi-line responses;
more precisely, it defines the part of the response in the multi-line
data block after any "dot-stuffing" has been undone. The numeric
portion of each non-terminal name indicates the response code that is
followed by this data.
multi-line-response-content = article-220-ml-content /
body-222-ml-content /
capabilities-101-ml-content /
hdr-225-ml-content /
head-221-ml-content /
help-100-ml-content /
list-215-ml-content /
listgroup-211-ml-content /
newgroups-231-ml-content /
newnews-230-ml-content /
over-224-ml-content
article-220-ml-content = article
body-222-ml-content = body
capabilities-101-ml-content = version-line CRLF
Feather Standards Track [Page 94]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
*(capability-line CRLF)
hdr-225-ml-content = *(article-number SP hdr-content CRLF)
head-221-ml-content = 1*header
help-100-ml-content = *(*U-CHAR CRLF)
list-215-ml-content = list-content
listgroup-211-ml-content = *(article-number CRLF)
newgroups-231-ml-content = active-groups-list
newnews-230-ml-content = *(message-id CRLF)
over-224-ml-content = *(article-number over-content CRLF)
active-groups-list = *(newsgroup-name SPA article-number
SPA article-number SPA newsgroup-status CRLF)
hdr-content = *S-NONTAB
hdr-n-content = [(header-name ":" / metadata-name) SP hdr-content]
list-content = body
newsgroup-status = %x79 / %x6E / %x6D / private-status
over-content = 1*6(TAB hdr-content) /
7(TAB hdr-content) *(TAB hdr-n-content)
private-status = token ; except the values in newsgroup-status
9.5. Capability Lines
This syntax defines the generic form of a capability line in the
capabilities list (see Section 3.3.1).
capability-line = capability-entry
capability-entry = X-capability-entry
X-capability-entry = capability-label *(WS capability-argument)
capability-label = keyword
capability-argument = token
This syntax defines the specific capability entries for the
capabilities in this specification.
capability-entry =/
hdr-capability /
ihave-capability /
implementation-capability /
list-capability /
mode-reader-capability /
newnews-capability /
over-capability /
post-capability /
reader-capability
hdr-capability = "HDR"
ihave-capability = "IHAVE"
implementation-capability = "IMPLEMENTATION" *(WS token)
Feather Standards Track [Page 95]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
list-capability = "LIST" 1*(WS keyword)
mode-reader-capability = "MODE-READER"
newnews-capability = "NEWNEWS"
over-capability = "OVER" [WS "MSGID"]
post-capability = "POST"
reader-capability = "READER"
version-line = "VERSION" 1*(WS version-number)
version-number = nzDIGIT *5DIGIT
9.6. LIST Variants
This section defines more specifically the keywords for the LIST
command and the syntax of the corresponding response contents.
; active
list-arguments =/ "ACTIVE" [WS wildmat]
list-content =/ list-active-content
list-active-content = active-groups-list
; active.times
list-arguments =/ "ACTIVE.TIMES" [WS wildmat]
list-content =/ list-active-times-content
list-active-times-content =
*(newsgroup-name SPA 1*DIGIT SPA newsgroup-creator CRLF)
newsgroup-creator = U-TEXT
; distrib.pats
list-arguments =/ "DISTRIB.PATS"
list-content =/ list-distrib-pats-content
list-distrib-pats-content =
*(1*DIGIT ":" wildmat ":" distribution CRLF)
distribution = token
; headers
list-arguments =/ "HEADERS" [WS ("MSGID" / "RANGE")]
list-content =/ list-headers-content
list-headers-content = *(header-meta-name CRLF) /
*((metadata-name / ":") CRLF)
; newsgroups
list-arguments =/ "NEWSGROUPS" [WS wildmat]
list-content =/ list-newsgroups-content
list-newsgroups-content =
Feather Standards Track [Page 96]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
*(newsgroup-name WS newsgroup-description CRLF)
newsgroup-description = S-TEXT
; overview.fmt
list-arguments =/ "OVERVIEW.FMT"
list-content =/ list-overview-fmt-content
list-overview-fmt-content = "Subject:" CRLF
"From:" CRLF
"Date:" CRLF
"Message-ID:" CRLF
"References:" CRLF
( ":bytes" CRLF ":lines" / "Bytes:" CRLF "Lines:") CRLF
*((header-name ":full" / metadata-name) CRLF)
9.7. Articles
This syntax defines the non-terminal <article>, which represents the
format of an article as described in Section 3.6.
article = 1*header CRLF body
header = header-name ":" [CRLF] SP header-content CRLF
header-content = *(S-CHAR / [CRLF] WS)
body = *(*B-CHAR CRLF)
9.8. General Non-terminals
These non-terminals are used at various places in the syntax and are
collected here for convenience. A few of these non-terminals are not
used in this specification but are provided for the consistency and
convenience of extension authors.
multi-line-data-block = content-lines termination
content-lines = *([content-text] CRLF)
content-text = (".." / B-NONDOT) *B-CHAR
termination = "." CRLF
article-number = 1*16DIGIT
header-name = 1*A-NOTCOLON
keyword = ALPHA 2*(ALPHA / DIGIT / "." / "-")
message-id = "<" 1*248A-NOTGT ">"
newsgroup-name = 1*wildmat-exact
token = 1*P-CHAR
wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
wildmat-pattern = 1*wildmat-item
wildmat-item = wildmat-exact / wildmat-wild
wildmat-exact = %x22-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E /
Feather Standards Track [Page 97]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
UTF8-non-ascii ; exclude ! * , ? [ \ ]
wildmat-wild = "*" / "?"
base64 = *(4base64-char) [base64-terminal]
base64-char = UPPER / LOWER / DIGIT / "+" / "/"
base64-terminal = 2base64-char "==" / 3base64-char "="
; Assorted special character sets
; A- means based on US-ASCII, excluding controls and SP
; P- means based on UTF-8, excluding controls and SP
; U- means based on UTF-8, excluding NUL CR and LF
; B- means based on bytes, excluding NUL CR and LF
A-CHAR = %x21-7E
A-NOTCOLON = %x21-39 / %x3B-7E ; exclude ":"
A-NOTGT = %x21-3D / %x3F-7E ; exclude ">"
P-CHAR = A-CHAR / UTF8-non-ascii
U-CHAR = CTRL / TAB / SP / A-CHAR / UTF8-non-ascii
U-NONTAB = CTRL / SP / A-CHAR / UTF8-non-ascii
U-TEXT = P-CHAR *U-CHAR
B-CHAR = CTRL / TAB / SP / %x21-FF
B-NONDOT = CTRL / TAB / SP / %x21-2D / %x2F-FF ; exclude "."
ALPHA = UPPER / LOWER ; use only when case-insensitive
CR = %x0D
CRLF = CR LF
CTRL = %x01-08 / %x0B-0C / %x0E-1F
DIGIT = %x30-39
nzDIGIT = %x31-39
EOL = *(SP / TAB) CRLF
LF = %x0A
LOWER = %x61-7A
SP = %x20
SPA = 1*SP
TAB = %x09
UPPER = %x41-5A
UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2UTF8-tail /
%xED %x80-9F UTF8-tail / %xEE-EF 2UTF8-tail
UTF8-4 = %xF0 %x90-BF 2UTF8-tail / %xF1-F3 3UTF8-tail /
%xF4 %x80-8F 2UTF8-tail
UTF8-tail = %x80-BF
WS = 1*(SP / TAB)
The following non-terminals require special consideration. They
represent situations where material SHOULD be restricted to UTF-8,
but implementations MUST be able to cope with other character
encodings. Therefore, there are two sets of definitions for them.
Feather Standards Track [Page 98]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Implementations MUST accept any content that meets this syntax:
S-CHAR = %x21-FF
S-NONTAB = CTRL / SP / S-CHAR
S-TEXT = (CTRL / S-CHAR) *B-CHAR
and MAY pass such content on unaltered.
When generating new content or re-encoding existing content,
implementations SHOULD conform to this syntax:
S-CHAR = P-CHAR
S-NONTAB = U-NONTAB
S-TEXT = U-TEXT
9.9. Extensions and Validation
The specification of a registered extension MUST include formal
syntax that defines additional forms for the following non-terminals:
command
for each new command other than a variant of the LIST command -
the syntax of each command MUST be compatible with the definition
of <X-command>;
command-datastream
for each new command that immediately streams data;
command-continuation
for each new command that sends further material after the initial
command line - the syntax of each continuation MUST be exactly
what is sent to the server, including any escape mechanisms such
as "dot-stuffing";
initial-response-content
for each new response code that has arguments - the syntax of each
response MUST be compatible with the definition of <X-initial-
response-content>;
multi-line-response-content
for each new response code that has a multi-line response - the
syntax MUST show the response after the lines containing the
response code and the terminating octet have been removed and any
"dot-stuffing" undone;
capability-entry
for each new capability label - the syntax of each entry MUST be
compatible with the definition of <X-capability-entry>;
Feather Standards Track [Page 99]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
list-arguments
for each new variant of the LIST command - the syntax of each
entry MUST be compatible with the definition of <X-command>;
list-content
for each new variant of the LIST command - the syntax MUST show
the response after the lines containing the 215 response code and
the terminating octet have been removed and any "dot-stuffing"
undone.
The =/ notation of ABNF [RFC4234] and the naming conventions
described in Section 9.1 SHOULD be used for this.
When the syntax in this specification, or syntax based on it, is
validated, it should be noted that:
o the non-terminals <command-line>, <command-datastream>,
<command-continuation>, <response>, and
<multi-line-response-content> describe basic concepts of the
protocol and are not referred to by any other rule;
o the non-terminal <base64> is provided for the convenience of
extension authors and is not referred to by any rule in this
specification;
o for the reasons given above, the non-terminals <S-CHAR>,
<S-NONTAB>, and <S-TEXT> each have two definitions; and
o the non-terminal <UNDEFINED> is deliberately not defined.
10. Internationalisation Considerations
10.1. Introduction and Historical Situation
RFC 977 [RFC977] was written at a time when internationalisation was
not seen as a significant issue. As such, it was written on the
assumption that all communication would be in ASCII and use only a
7-bit transport layer, although in practice just about all known
implementations are 8-bit clean.
Since then, Usenet and NNTP have spread throughout the world. In the
absence of standards for handling the issues of language and
character sets, countries, newsgroup hierarchies, and individuals
have found a variety of solutions that work for them but that are not
necessarily appropriate elsewhere. For example, some have adopted a
default 8-bit character set appropriate to their needs (such as
ISO/IEC 8859-1 in Western Europe or KOI-8 in Russia), others have
used ASCII (either US-ASCII or national variants) in headers but
Feather Standards Track [Page 100]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
local 16-bit character sets in article bodies, and still others have
gone for a combination of MIME [RFC2045] and UTF-8. With the
increased use of MIME in email, it is becoming more common to find
NNTP articles containing MIME headers that identify the character set
of the body, but this is far from universal.
The resulting confusion does not help interoperability.
One point that has been generally accepted is that articles can
contain octets with the top bit set, and NNTP is only expected to
operate on 8-bit clean transport paths.
10.2. This Specification
Part of the role of this present specification is to eliminate this
confusion and promote interoperability as far as possible. At the
same time, it is necessary to accept the existence of the present
situation and not break existing implementations and arrangements
gratuitously, even if they are less than optimal. Therefore, the
current practice described above has been taken into consideration in
producing this specification.
This specification extends NNTP from US-ASCII [ANSI1986] to UTF-8
[RFC3629]. Except in the two areas discussed below, UTF-8 (which is
a superset of US-ASCII) is mandatory, and implementations MUST NOT
use any other encoding.
Firstly, the use of MIME for article headers and bodies is strongly
recommended. However, given widely divergent existing practices, an
attempt to require a particular encoding and tagging standard would
be premature at this time. Accordingly, this specification allows
the use of arbitrary 8-bit data in articles subject to the following
requirements and recommendations.
o The names of headers (e.g., "From" or "Subject") MUST be in
US-ASCII.
o Header values SHOULD use US-ASCII or an encoding based on it, such
as RFC 2047 [RFC2047], until such time as another approach has
been standardised. At present, 8-bit encodings (including UTF-8)
SHOULD NOT be used because they are likely to cause
interoperability problems.
o The character set of article bodies SHOULD be indicated in the
article headers, and this SHOULD be done in accordance with MIME.
o Where an article is obtained from an external source, an
implementation MAY pass it on and derive data from it (such as the
Feather Standards Track [Page 101]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
response to the HDR command), even though the article or the data
does not meet the above requirements. Implementations MUST
transfer such articles and data correctly and unchanged; they MUST
NOT attempt to convert or re-encode the article or derived data.
(Nevertheless, a client or server MAY elect not to post or forward
the article if, after further examination of the article, it deems
it inappropriate to do so.)
This requirement affects the ARTICLE (Section 6.2.1), BODY
(Section 6.2.3), HDR (Section 8.5), HEAD (Section 6.2.2), IHAVE
(Section 6.3.2), OVER (Section 8.3), and POST (Section 6.3.1)
commands.
Secondly, the following requirements are placed on the newsgroups
list returned by the LIST NEWSGROUPS command (Section 7.6.6):
o Although this specification allows UTF-8 for newsgroup names, they
SHOULD be restricted to US-ASCII until a successor to RFC 1036
[RFC1036] standardises another approach. 8-bit encodings SHOULD
NOT be used because they are likely to cause interoperability
problems.
o The newsgroup description SHOULD be in US-ASCII or UTF-8 unless
and until a successor to RFC 1036 standardises other encoding
arrangements. 8-bit encodings other than UTF-8 SHOULD NOT be used
because they are likely to cause interoperability problems.
o Implementations that obtain this data from an external source MUST
handle it correctly even if it does not meet the above
requirements. Implementations (in particular, clients) MUST
handle such data correctly.
10.3. Outstanding Issues
While the primary use of NNTP is for transmitting articles that
conform to RFC 1036 (Netnews articles), it is also used for other
formats (see Appendix A). It is therefore most appropriate that
internationalisation issues related to article formats be addressed
in the relevant specifications. For Netnews articles, this is any
successor to RFC 1036. For email messages, it is RFC 2822 [RFC2822].
Of course, any article transmitted via NNTP needs to conform to this
specification as well.
Restricting newsgroup names to UTF-8 is not a complete solution. In
particular, when new newsgroup names are created or a user is asked
to enter a newsgroup name, some scheme of canonicalisation will need
to take place. This specification does not attempt to define that
Feather Standards Track [Page 102]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
canonicalization; further work is needed in this area, in conjunction
with the article format specifications. Until such specifications
are published, implementations SHOULD match newsgroup names octet by
octet. It is anticipated that any approved scheme will be applied
"at the edges", and therefore octet-by-octet comparison will continue
to apply to most, if not all, uses of newsgroup names in NNTP.
In the meantime, any implementation experimenting with UTF-8
newsgroup names is strongly cautioned that a future specification may
require that those names be canonicalized when used with NNTP in a
way that is not compatible with their experiments.
Since the primary use of NNTP is with Netnews, and since newsgroup
descriptions are normally distributed through specially formatted
articles, it is recommended that the internationalisation issues
related to them be addressed in any successor to RFC 1036.
11. IANA Considerations
This specification requires IANA to keep a registry of capability
labels. The initial contents of this registry are specified in
Section 3.3.4. As described in Section 3.3.3, labels beginning with
X are reserved for private use, while all other names are expected to
be associated with a specification in an RFC on the standards track
or defining an IESG-approved experimental protocol.
Different entries in the registry MUST use different capability
labels.
Different entries in the registry MUST NOT use the same command name.
For this purpose, variants distinguished by a second or subsequent
keyword (e.g., "LIST HEADERS" and "LIST OVERVIEW.FMT") count as
different commands. If there is a need for two extensions to use the
same command, a single harmonised specification MUST be registered.
12. Security Considerations
This section is meant to inform application developers, information
providers, and users of the security limitations in NNTP as described
by this document. The discussion does not include definitive
solutions to the problems revealed, though it does make some
suggestions for reducing security risks.
Feather Standards Track [Page 103]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
12.1. Personal and Proprietary Information
NNTP, because it was created to distribute network news articles,
will forward whatever information is stored in those articles.
Specification of that information is outside this scope of this
document, but it is likely that some personal and/or proprietary
information is available in some of those articles. It is very
important that designers and implementers provide informative
warnings to users so that personal and/or proprietary information in
material that is added automatically to articles (e.g., in headers)
is not disclosed inadvertently. Additionally, effective and easily
understood mechanisms to manage the distribution of news articles
SHOULD be provided to NNTP Server administrators, so that they are
able to report with confidence the likely spread of any particular
set of news articles.
12.2. Abuse of Server Log Information
A server is in the position to save session data about a user's
requests that might identify their reading patterns or subjects of
interest. This information is clearly confidential in nature, and
its handling can be constrained by law in certain countries. People
using this protocol to provide data are responsible for ensuring that
such material is not distributed without the permission of any
individuals that are identifiable by the published results.
12.3. Weak Authentication and Access Control
There is no user-based or token-based authentication in the basic
NNTP specification. Access is normally controlled by server
configuration files. Those files specify access by using domain
names or IP addresses. However, this specification does permit the
creation of extensions to NNTP for such purposes; one such extension
is [NNTP-AUTH]. While including such mechanisms is optional, doing
so is strongly encouraged.
Other mechanisms are also available. For example, a proxy server
could be put in place that requires authentication before connecting
via the proxy to the NNTP server.
12.4. DNS Spoofing
Many existing NNTP implementations authorize incoming connections by
checking the IP address of that connection against the IP addresses
obtained via DNS lookups of lists of domain names given in local
configuration files. Servers that use this type of authentication
and clients that find a server by doing a DNS lookup of the server
name rely very heavily on the Domain Name Service, and are thus
Feather Standards Track [Page 104]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
generally prone to security attacks based on the deliberate
misassociation of IP addresses and DNS names. Clients and servers
need to be cautious in assuming the continuing validity of an IP
number/DNS name association.
In particular, NNTP clients and servers SHOULD rely on their name
resolver for confirmation of an IP number/DNS name association,
rather than cache the result of previous host name lookups. Many
platforms already can cache host name lookups locally when
appropriate, and they SHOULD be configured to do so. It is proper
for these lookups to be cached, however, only when the TTL (Time To
Live) information reported by the name server makes it likely that
the cached information will remain useful.
If NNTP clients or servers cache the results of host name lookups in
order to achieve a performance improvement, they MUST observe the TTL
information reported by DNS. If NNTP clients or servers do not
observe this rule, they could be spoofed when a previously accessed
server's IP address changes. As network renumbering is expected to
become increasingly common, the possibility of this form of attack
will increase. Observing this requirement thus reduces this
potential security vulnerability.
This requirement also improves the load-balancing behaviour of
clients for replicated servers using the same DNS name and reduces
the likelihood of a user's experiencing failure in accessing sites
that use that strategy.
12.5. UTF-8 Issues
UTF-8 [RFC3629] permits only certain sequences of octets and
designates others as either malformed or "illegal". The Unicode
standard identifies a number of security issues related to illegal
sequences and forbids their generation by conforming implementations.
Implementations of this specification MUST NOT generate malformed or
illegal sequences and SHOULD detect them and take some appropriate
action. This could include the following:
o Generating a 501 response code.
o Replacing such sequences by the sequence %xEF.BF.BD, which encodes
the "replacement character" U+FFFD.
o Closing the connection.
o Replacing such sequences by a "guessed" valid sequence (based on
properties of the UTF-8 encoding).
Feather Standards Track [Page 105]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
In the last case, the implementation MUST ensure that any replacement
cannot be used to bypass validity or security checks. For example,
the illegal sequence %xC0.A0 is an over-long encoding for space
(%x20). If it is replaced by the correct encoding in a command line,
this needs to happen before the command line is parsed into
individual arguments. If the replacement came after parsing, it
would be possible to generate an argument with an embedded space,
which is forbidden. Use of the "replacement character" does not have
this problem, since it is permitted wherever non-US-ASCII characters
are. Implementations SHOULD use one of the first two solutions where
the general structure of the NNTP stream remains intact and SHOULD
close the connection if it is no longer possible to parse it
sensibly.
12.6. Caching of Capability Lists
The CAPABILITIES command provides a capability list, which is
information about the current capabilities of the server. Whenever
there is a relevant change to the server state, the results of this
command are required to change accordingly.
In most situations, the capabilities list in a given server state
will not change from session to session; for example, a given
extension will be installed permanently on a server. Some clients
may therefore wish to remember which extensions a server supports to
avoid the delay of an additional command and response, particularly
if they open multiple connections in the same session.
However, information about extensions related to security and privacy
MUST NOT be cached, since this could allow a variety of attacks.
For example, consider a server that permits the use of cleartext
passwords on links that are encrypted but not otherwise:
[Initial connection set-up completed.]
[S] 200 NNTP Service Ready, posting permitted
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] NEWNEWS
[S] POST
[S] XENCRYPT
[S] LIST ACTIVE NEWSGROUPS
[S] .
[C] XENCRYPT
[Client and server negotiate encryption on the link]
[S] 283 Encrypted link established
Feather Standards Track [Page 106]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] NEWNEWS
[S] POST
[S] XSECRET
[S] LIST ACTIVE NEWSGROUPS
[S] .
[C] XSECRET fred flintstone
[S] 290 Password for fred accepted
If the client caches the last capabilities list, then on the next
session it will attempt to use XSECRET on an unencrypted link:
[Initial connection set-up completed.]
[S] 200 NNTP Service Ready, posting permitted
[C] XSECRET fred flintstone
[S] 483 Only permitted on secure links
This exposes the password to any eavesdropper. While the primary
cause of this is passing a secret without first checking the security
of the link, caching of capability lists can increase the risk.
Any security extension should include requirements to check the
security state of the link in a manner appropriate to that extension.
Caching should normally only be considered for anonymous clients that
do not use any security or privacy extensions and for which the time
required for an additional command and response is a noticeable
issue.
13. Acknowledgements
This document is the result of much effort by the present and past
members of the NNTP Working Group, chaired by Russ Allbery and Ned
Freed. It could not have been produced without them.
The author acknowledges the original authors of NNTP as documented in
RFC 977 [RFC977]: Brian Kantor and Phil Lapsey.
The author gratefully acknowledges the following:
o The work of the NNTP committee chaired by Eliot Lear. The
organization of this document was influenced by the last available
version from this working group. A special thanks to Eliot for
generously providing the original machine-readable sources for
that document.
Feather Standards Track [Page 107]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
o The work of the DRUMS working group, specifically RFC 1869
[RFC1869], that drove the original thinking that led to the
CAPABILITIES command and the extensions mechanism detailed in this
document.
o The authors of RFC 2616 [RFC2616] for providing specific and
relevant examples of security issues that should be considered for
HTTP. Since many of the same considerations exist for NNTP, those
examples that are relevant have been included here with some minor
rewrites.
o The comments and additional information provided by the following
individuals in preparing one or more of the progenitors of this
document:
Russ Allbery <rra@stanford.edu>
Wayne Davison <davison@armory.com>
Chris Lewis <clewis@bnr.ca>
Tom Limoncelli <tal@mars.superlink.net>
Eric Schnoebelen <eric@egsner.cirr.com>
Rich Salz <rsalz@osf.org>
This work was motivated by the work of various news reader authors
and news server authors, including those listed below:
Rick Adams
Original author of the NNTP extensions to the RN news reader and
last maintainer of Bnews.
Stan Barber
Original author of the NNTP extensions to the news readers that
are part of Bnews.
Geoff Collyer
Original author of the OVERVIEW database proposal and one of the
original authors of CNEWS.
Dan Curry
Original author of the xvnews news reader.
Wayne Davison
Author of the first threading extensions to the RN news reader
(commonly called TRN).
Geoff Huston
Original author of ANU NEWS.
Feather Standards Track [Page 108]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Phil Lapsey
Original author of the UNIX reference implementation for NNTP.
Iain Lea
Original maintainer of the TIN news reader.
Chris Lewis
First known implementer of the AUTHINFO GENERIC extension.
Rich Salz
Original author of INN.
Henry Spencer
One of the original authors of CNEWS.
Kim Storm
Original author of the NN news reader.
Other people who contributed to this document include:
Matthias Andree
Greg Andruk
Daniel Barclay
Maurizio Codogno
Mark Crispin
Andrew Gierth
Juergen Helbing
Scott Hollenbeck
Urs Janssen
Charles Lindsey
Ade Lovett
David Magda
Ken Murchison
Francois Petillon
Peter Robinson
Rob Siemborski
Howard Swinehart
Ruud van Tol
Jeffrey Vinocur
Erik Warmelink
The author thanks them all and apologises to anyone omitted.
Finally, the present author gratefully acknowledges the vast amount
of work put into previous versions by the previous author:
Stan Barber <sob@academ.com>
Feather Standards Track [Page 109]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
14. References
14.1. Normative References
[ANSI1986] American National Standards Institute, "Coded Character
Set - 7-bit American Standard Code for Information
Interchange", ANSI X3.4, 1986.
[RFC977] Kantor, B. and P. Lapsley, "Network News Transfer
Protocol", RFC 977, February 1986.
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet
Mail Extensions (MIME) Part One: Format of Internet
Message Bodies", RFC 2045, November 1996.
[RFC2047] Moore, K., "MIME (Multipurpose Internet Mail
Extensions) Part Three: Message Header Extensions for
Non-ASCII Text", RFC 2047, November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, November 2003.
[RFC4234] Crocker, D., Ed. and P. Overell, "Augmented BNF for
Syntax Specifications: ABNF", RFC 4234, October 2005.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, October 2006.
[TF.686-1] International Telecommunications Union - Radio,
"Glossary, ITU-R Recommendation TF.686-1",
ITU-R Recommendation TF.686-1, October 1997.
14.2. Informative References
[NNTP-AUTH] Vinocur, J., Murchison, K., and C. Newman, "Network
News Transfer Protocol (NNTP) Extension for
Authentication",
RFC 4643, October 2006.
[NNTP-STREAM] Vinocur, J. and K. Murchison, "Network News Transfer
Protocol (NNTP) Extension for Streaming Feeds",
RFC 4644, October 2006.
Feather Standards Track [Page 110]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
[NNTP-TLS] Murchison, K., Vinocur, J., and C. Newman, "Using
Transport Layer Security (TLS) with Network News
Transfer Protocol (NNTP)", RFC 4642, October 2006.
[RFC1036] Horton, M. and R. Adams, "Standard for interchange of
USENET messages", RFC 1036, December 1987.
[RFC1305] Mills, D., "Network Time Protocol (Version 3)
Specification, Implementation and Analysis", RFC 1305,
March 1992.
[RFC1869] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D.
Crocker, "SMTP Service Extensions", STD 10, RFC 1869,
November 1995.
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
[RFC2629] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629,
June 1999.
[RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April
2001.
[RFC2980] Barber, S., "Common NNTP Extensions", RFC 2980, October
2000.
[ROBE1995] Robertson, R., "FAQ: Overview database / NOV General
Information", January 1995.
There is no definitive copy of this document known to
the author. It was previously posted as the Usenet
article <news:nov-faq-1-930909720@agate.Berkeley.EDU>
[SALZ1992] Salz, R., "Manual Page for wildmat(3) from the INN 1.4
distribution, Revision 1.10", April 1992.
There is no definitive copy of this document known to
the author.
Feather Standards Track [Page 111]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Appendix A. Interaction with Other Specifications
NNTP is most often used for transferring articles that conform to
RFC 1036 [RFC1036] (such articles are called "Netnews articles"
here). It is also sometimes used for transferring email messages
that conform to RFC 2822 [RFC2822] (such articles are called "email
articles" here). In this situation, articles must conform both to
this specification and to that other one; this appendix describes
some relevant issues.
A.1. Header Folding
NNTP allows a header line to be folded (by inserting a CRLF pair)
before any space or TAB character.
Both email and Netnews articles are required to have at least one
octet other than space or TAB on each header line. Thus, folding can
only happen at one point in each sequence of consecutive spaces or
TABs. Netnews articles are further required to have the header name,
colon, and following space all on the first line; folding may only
happen beyond that space. Finally, some non-conforming software will
remove trailing spaces and TABs from a line. Therefore, it might be
inadvisable to fold a header after a space or TAB.
For maximum safety, header lines SHOULD conform to the following
syntax rather than to that in Section 9.7.
header = header-name ":" SP [header-content] CRLF
header-content = [WS] token *( [CRLF] WS token )
A.2. Message-IDs
Every article handled by an NNTP server MUST have a unique
message-id. For the purposes of this specification, a message-id is
an arbitrary opaque string that merely needs to meet certain
syntactic requirements and is just a way to refer to the article.
Because there is a significant risk that old articles will be
reinjected into the global Usenet system, RFC 1036 [RFC1036] requires
that message-ids are globally unique for all time.
This specification states that message-ids are the same if and only
if they consist of the same sequence of octets. Other specifications
may define two different sequences as being equal because they are
putting an interpretation on particular characters. RFC 2822
[RFC2822] has a concept of "quoted" and "escaped" characters. It
therefore considers the three message-ids:
Feather Standards Track [Page 112]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
<ab.cd@example.com>
<"ab.cd"@example.com>
<"ab.\cd"@example.com>
as being identical. Therefore, an NNTP implementation handing email
articles must ensure that only one of these three appears in the
protocol and that the other two are converted to it as and when
necessary, such as when a client checks the results of a NEWNEWS
command against an internal database of message-ids. Note that
RFC 1036 [RFC1036] never treats two different strings as being
identical. Its successor (as of the time of writing) restricts the
syntax of message-ids so that, whenever RFC 2822 would treat two
strings as equivalent, only one of them is valid (in the above
example, only the first string is valid).
This specification does not describe how the message-id of an article
is determined; it may be deduced from the contents of the article or
derived from some external source. If the server is also conforming
to another specification that contains a definition of message-id
compatible with this one, the server SHOULD use those message-ids. A
common approach, and one that SHOULD be used for email and Netnews
articles, is to extract the message-id from the contents of a header
with name "Message-ID". This may not be as simple as copying the
entire header contents; it may be necessary to strip off comments and
undo quoting, or to reduce "equivalent" message-ids to a canonical
form.
If an article is obtained through the IHAVE command, there will be a
message-id provided with the command. The server MAY either use it
or determine one from the article contents. However, whichever it
does, it SHOULD ensure that, if the IHAVE command is repeated with
the same argument and article, it will be recognized as a duplicate.
If an article does not contain a message-id that the server can
identify, it MUST synthesize one. This could, for example, be a
simple sequence number or be based on the date and time when the
article arrived. When email or Netnews articles are handled, a
Message-ID header SHOULD be added to ensure global consistency and
uniqueness.
Note that, because the message-id might not have been derived from
the Message-ID header in the article, the following example is
legitimate (though unusual):
Feather Standards Track [Page 113]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
[C] HEAD <45223423@example.com>
[S] 221 0 <45223423@example.com>
[S] Path: pathost!demo!whitehouse!not-for-mail
[S] Message-ID: <1234@example.net>
[S] From: "Demo User" <nobody@example.net>
[S] Newsgroups: misc.test
[S] Subject: I am just a test article
[S] Date: 6 Oct 1998 04:38:40 -0500
[S] Organization: An Example Net, Uncertain, Texas
[S] .
A.3. Article Posting
As far as NNTP is concerned, the POST and IHAVE commands provide the
same basic facilities in a slightly different way. However, they
have rather different intentions.
The IHAVE command is intended for transmitting conforming articles
between a system of NNTP servers, with all articles perhaps also
conforming to another specification (e.g., all articles are Netnews
articles). It is expected that the client will already have done any
necessary validation (or that it has in turn obtained the article
from a third party that has done so); therefore, the contents SHOULD
be left unchanged.
In contrast, the POST command is intended for use when an end-user is
injecting a newly created article into a such a system. The article
being transferred might not be a conforming email or Netnews article,
and the server is expected to validate it and, if necessary, to
convert it to the right form for onward distribution. This is often
done by a separate piece of software on the server installation; if
so, the NNTP server SHOULD pass the incoming article to that software
unaltered, making no attempt to filter characters, to fold or limit
lines, or to process the incoming text otherwise.
The POST command can fail in various ways, and clients should be
prepared to re-send an article. When doing so, however, it is often
important to ensure (as far as possible) that the same message-id is
allocated to both attempts so that the server, or other servers, can
recognize the two articles as duplicates. In the case of email or
Netnews articles, therefore, the posted article SHOULD contain a
header with the name "Message-ID", and the contents of this header
SHOULD be identical on each attempt. The server SHOULD ensure that
two POSTed articles with the same contents for this header are
recognized as identical and that the same message-id is allocated,
whether or not those contents are suitable for use as the message-id.
Feather Standards Track [Page 114]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Appendix B. Summary of Commands
This section contains a list of every command defined in this
document, ordered by command name and by indicating capability.
Ordered by command name:
+-------------------+-----------------------+---------------+
| Command | Indicating capability | Definition |
+-------------------+-----------------------+---------------+
| ARTICLE | READER | Section 6.2.1 |
| BODY | READER | Section 6.2.3 |
| CAPABILITIES | mandatory | Section 5.2 |
| DATE | READER | Section 7.1 |
| GROUP | READER | Section 6.1.1 |
| HDR | HDR | Section 8.5 |
| HEAD | mandatory | Section 6.2.2 |
| HELP | mandatory | Section 7.2 |
| IHAVE | IHAVE | Section 6.3.2 |
| LAST | READER | Section 6.1.3 |
| LIST | LIST | Section 7.6.1 |
| LIST ACTIVE.TIMES | LIST | Section 7.6.4 |
| LIST ACTIVE | LIST | Section 7.6.3 |
| LIST DISTRIB.PATS | LIST | Section 7.6.5 |
| LIST HEADERS | HDR | Section 8.6 |
| LIST NEWSGROUPS | LIST | Section 7.6.6 |
| LIST OVERVIEW.FMT | OVER | Section 8.4 |
| LISTGROUP | READER | Section 6.1.2 |
| MODE READER | MODE-READER | Section 5.3 |
| NEWGROUPS | READER | Section 7.3 |
| NEWNEWS | NEWNEWS | Section 7.4 |
| NEXT | READER | Section 6.1.4 |
| OVER | OVER | Section 8.3 |
| POST | POST | Section 6.3.1 |
| QUIT | mandatory | Section 5.4 |
| STAT | mandatory | Section 6.2.4 |
+-------------------+-----------------------+---------------+
Feather Standards Track [Page 115]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Ordered by indicating capability:
+-------------------+-----------------------+---------------+
| Command | Indicating capability | Definition |
+-------------------+-----------------------+---------------+
| CAPABILITIES | mandatory | Section 5.2 |
| HEAD | mandatory | Section 6.2.2 |
| HELP | mandatory | Section 7.2 |
| QUIT | mandatory | Section 5.4 |
| STAT | mandatory | Section 6.2.4 |
| HDR | HDR | Section 8.5 |
| LIST HEADERS | HDR | Section 8.6 |
| IHAVE | IHAVE | Section 6.3.2 |
| LIST | LIST | Section 7.6.1 |
| LIST ACTIVE | LIST | Section 7.6.3 |
| LIST ACTIVE.TIMES | LIST | Section 7.6.4 |
| LIST DISTRIB.PATS | LIST | Section 7.6.5 |
| LIST NEWSGROUPS | LIST | Section 7.6.6 |
| MODE READER | MODE-READER | Section 5.3 |
| NEWNEWS | NEWNEWS | Section 7.4 |
| OVER | OVER | Section 8.3 |
| LIST OVERVIEW.FMT | OVER | Section 8.4 |
| POST | POST | Section 6.3.1 |
| ARTICLE | READER | Section 6.2.1 |
| BODY | READER | Section 6.2.3 |
| DATE | READER | Section 7.1 |
| GROUP | READER | Section 6.1.1 |
| LAST | READER | Section 6.1.3 |
| LISTGROUP | READER | Section 6.1.2 |
| NEWGROUPS | READER | Section 7.3 |
| NEXT | READER | Section 6.1.4 |
+-------------------+-----------------------+---------------+
Feather Standards Track [Page 116]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Appendix C. Summary of Response Codes
This section contains a list of every response code defined in this
document and indicates whether it is multi-line, which commands can
generate it, what arguments it has, and what its meaning is.
Response code 100 (multi-line)
Generated by: HELP
Meaning: help text follows.
Response code 101 (multi-line)
Generated by: CAPABILITIES
Meaning: capabilities list follows.
Response code 111
Generated by: DATE
1 argument: yyyymmddhhmmss
Meaning: server date and time.
Response code 200
Generated by: initial connection, MODE READER
Meaning: service available, posting allowed.
Response code 201
Generated by: initial connection, MODE READER
Meaning: service available, posting prohibited.
Response code 205
Generated by: QUIT
Meaning: connection closing (the server immediately closes the
connection).
Response code 211
The 211 response code has two completely different forms,
depending on which command generated it:
(not multi-line)
Generated by: GROUP
4 arguments: number low high group
Meaning: group selected.
(multi-line)
Generated by: LISTGROUP
4 arguments: number low high group
Meaning: article numbers follow.
Feather Standards Track [Page 117]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Response code 215 (multi-line)
Generated by: LIST
Meaning: information follows.
Response code 220 (multi-line)
Generated by: ARTICLE
2 arguments: n message-id
Meaning: article follows.
Response code 221 (multi-line)
Generated by: HEAD
2 arguments: n message-id
Meaning: article headers follow.
Response code 222 (multi-line)
Generated by: BODY
2 arguments: n message-id
Meaning: article body follows.
Response code 223
Generated by: LAST, NEXT, STAT
2 arguments: n message-id
Meaning: article exists and selected.
Response code 224 (multi-line)
Generated by: OVER
Meaning: overview information follows.
Response code 225 (multi-line)
Generated by: HDR
Meaning: headers follow.
Response code 230 (multi-line)
Generated by: NEWNEWS
Meaning: list of new articles follows.
Response code 231 (multi-line)
Generated by: NEWGROUPS
Meaning: list of new newsgroups follows.
Response code 235
Generated by: IHAVE (second stage)
Meaning: article transferred OK.
Response code 240
Generated by: POST (second stage)
Meaning: article received OK.
Feather Standards Track [Page 118]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Response code 335
Generated by: IHAVE (first stage)
Meaning: send article to be transferred.
Response code 340
Generated by: POST (first stage)
Meaning: send article to be posted.
Response code 400
Generic response and generated by initial connection
Meaning: service not available or no longer available (the server
immediately closes the connection).
Response code 401
Generic response
1 argument: capability-label
Meaning: the server is in the wrong mode; the indicated capability
should be used to change the mode.
Response code 403
Generic response
Meaning: internal fault or problem preventing action being taken.
Response code 411
Generated by: GROUP, LISTGROUP
Meaning: no such newsgroup.
Response code 412
Generated by: ARTICLE, BODY, GROUP, HDR, HEAD, LAST, LISTGROUP,
NEXT, OVER, STAT
Meaning: no newsgroup selected.
Response code 420
Generated by: ARTICLE, BODY, HDR, HEAD, LAST, NEXT, OVER, STAT
Meaning: current article number is invalid.
Response code 421
Generated by: NEXT
Meaning: no next article in this group.
Response code 422
Generated by: LAST
Meaning: no previous article in this group.
Response code 423
Generated by: ARTICLE, BODY, HDR, HEAD, OVER, STAT
Meaning: no article with that number or in that range.
Feather Standards Track [Page 119]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Response code 430
Generated by: ARTICLE, BODY, HDR, HEAD, OVER, STAT
Meaning: no article with that message-id.
Response code 435
Generated by: IHAVE (first stage)
Meaning: article not wanted.
Response code 436
Generated by: IHAVE (either stage)
Meaning: transfer not possible (first stage) or failed (second
stage); try again later.
Response code 437
Generated by: IHAVE (second stage)
Meaning: transfer rejected; do not retry.
Response code 440
Generated by: POST (first stage)
Meaning: posting not permitted.
Response code 441
Generated by: POST (second stage)
Meaning: posting failed.
Response code 480
Generic response
Meaning: command unavailable until the client has authenticated
itself.
Response code 483
Generic response
Meaning: command unavailable until suitable privacy has been
arranged.
Response code 500
Generic response
Meaning: unknown command.
Response code 501
Generic response
Meaning: syntax error in command.
Feather Standards Track [Page 120]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Response code 502
Generic response and generated by initial connection
Meaning for the initial connection and the MODE READER command:
service permanently unavailable (the server immediately closes the
connection).
Meaning for all other commands: command not permitted (and there
is no way for the client to change this).
Response code 503
Generic response
Meaning: feature not supported.
Response code 504
Generic response
Meaning: error in base64-encoding [RFC4648] of an argument.
Appendix D. Changes from RFC 977
In general every attempt has been made to ensure that the protocol
specification in this document is compatible with the version
specified in RFC 977 [RFC977] and the various facilities adopted from
RFC 2980 [RFC2980]. However, there have been a number of changes,
some compatible and some not.
This appendix lists these changes. It is not guaranteed to be
exhaustive or correct and MUST NOT be relied on.
o A formal syntax specification (Section 9) has been added.
o The default character set is changed from US-ASCII [ANSI1986] to
UTF-8 [RFC3629] (note that US-ASCII is a subset of UTF-8). This
matter is discussed further in Section 10.
o All articles are required to have a message-id, eliminating the
"<0>" placeholder used in RFC 977 in some responses.
o The newsgroup name matching capabilities already documented in
RFC 977 ("wildmats", Section 4) are clarified and extended. The
new facilities (e.g., the use of commas and exclamation marks) are
allowed wherever wildmats appear in the protocol.
o Support for pipelining of commands (Section 3.5) is made
mandatory.
Feather Standards Track [Page 121]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
o The principles behind response codes (Section 3.2) have been
tidied up. In particular:
* the x8x response code family, formerly used for private
extensions, is now reserved for authentication and privacy
extensions;
* the x9x response code family, formerly intended for debugging
facilities, are now reserved for private extensions;
* the 502 and 503 generic response codes (Section 3.2.1) have
been redefined;
* new 401, 403, 480, 483, and 504 generic response codes have
been added.
o The rules for article numbering (Section 6) have been clarified
(also see Section 6.1.1.2).
o The SLAVE command (which was ill-defined) is removed from the
protocol.
o Four-digit years are permitted in the NEWNEWS (Section 7.4) and
NEWGROUPS (Section 7.3) commands (two-digit years are still
permitted). The optional distribution parameter to these commands
has been removed.
o The LIST command (Section 7.6.1) is greatly extended; the original
is available as LIST ACTIVE, while new variants include
ACTIVE.TIMES, DISTRIB.PATS, and NEWSGROUPS. A new "m" status flag
is added to the LIST ACTIVE response.
o A new CAPABILITIES command (Section 5.2) allows clients to
determine what facilities are supported by a server.
o The DATE command (Section 7.1) is adopted from RFC 2980
effectively unchanged.
o The LISTGROUP command (Section 6.1.2) is adopted from RFC 2980.
An optional range argument has been added, and the 211 initial
response line now has the same format as the 211 response from the
GROUP command.
o The MODE READER command (Section 5.3) is adopted from RFC 2980 and
its meaning and effects clarified.
o The XHDR command in RFC 2980 has been formalised as the new HDR
(Section 8.5) and LIST HEADERS (Section 8.6) commands.
Feather Standards Track [Page 122]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
o The XOVER command in RFC 2980 has been formalised as the new OVER
(Section 8.3) and LIST OVERVIEW.FMT (Section 8.4) commands. The
former can be applied to a message-id as well as to a range.
o The concept of article metadata (Section 8.1) has been formalised,
allowing the Bytes and Lines pseudo-headers to be deprecated.
Client authors should note in particular that lack of support for the
CAPABILITIES command is a good indication that the server does not
support this specification.
Feather Standards Track [Page 123]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Author's Address
Clive D.W. Feather
THUS plc
322 Regents Park Road
London
N3 2QQ
United Kingdom
Phone: +44 20 8495 6138
Fax: +44 870 051 9937
EMail: clive@demon.net
URI: http://www.davros.org/
Feather Standards Track [Page 124]
^L
RFC 3977 Network News Transfer Protocol (NNTP) October 2006
Full Copyright Statement
Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at ietf-
ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is provided by the IETF
Administrative Support Activity (IASA).
Feather Standards Track [Page 125]
^L
|