Knowledge (XXG)

Simple Common Gateway Interface

Source 📝

652: 29: 241:
While the SCGI protocol insulates the service programmer from some HTTP considerations, various details (such as interpreting the octets of the message body as per the Transfer-Encoding header, the CONTENT_LENGTH being the number of octets after the body has been encoded for transmission, etc.) still
232:
Duplicate names are not allowed in the request headers; RFC 2616-compliant header combining must already have taken place. The first request header must have the name "CONTENT_LENGTH" and a value that is the length of the body in decimal. The "CONTENT_LENGTH" request header must always be present,
178:
The client connects to a SCGI server over a reliable stream protocol allowing transmission of 8-bit bytes. The client begins by sending a request. When the SCGI server sees the end of the request it sends back a response and closes the connection. The format of the response is not specifically
157:
between a web server and an application server. This is in contrast to CGI, which is an earlier application (gateway) interface designed to let the application programmer avoid the complexity of sockets and long-running service processes when poor scalability and high overhead are acceptable.
161:
The SCGI protocol leverages the fact that the web server has already parsed and validated the HTTP request, and canonically communicates the request to the SCGI server while letting the application programmer avoid parsing ambiguities and protocol edge cases. This avoids the complicated
253:"70:" "CONTENT_LENGTH" <00> "27" <00> "SCGI" <00> "1" <00> "REQUEST_METHOD" <00> "POST" <00> "REQUEST_URI" <00> "/deepthought" <00> "," "What is the answer to life?" 145:
but is designed to be easier to parse. Unlike CGI, it permits a long-running service process to continue serving requests, thus avoiding delays in responding to requests due to setup overhead (such as connecting to a database).
237:
should be provided in SCGI headers for compatibility when converting older CGI programs to SCGI. The body (if any) provided in the request follows the headers; its length is specified by the "CONTENT_LENGTH" request header.
170:
Neil Schemenauer published the original SCGI protocol specification dated October 2001. He developed the first implementations of SCGI and initially published them in April 2002.
798: 788: 46: 780: 684: 250:
The web server (a SCGI client) opens a connection and sends the concatenation of the following strings to the service process (a SCGI server):
93: 835: 65: 218:. These considerations are standard for C strings, but are often confusing for programmers used to other standards for string-handling. 72: 271: 112: 765: 79: 1309: 593: 964: 368: 50: 61: 233:
even if its value is "0". There must also always be a request header with the name "SCGI" and a value of "1". Standard CGI
1103: 512: 440: 415: 410: 298: 830: 677: 508: 333: 984: 840: 820: 492: 488: 430: 425: 386: 373: 134: 575: 1421: 1166: 860: 855: 450: 259:"Status: 200 OK" <0d 0a> "Content-Type: text/plain" <0d 0a> "" <0d 0a> "42" 162:
header-parsing and header-combining rules from RFC 2616, saving significant complexity in the SCGI server process.
39: 1383: 1153: 1066: 960: 358: 745: 465: 338: 138: 86: 1388: 1186: 670: 872: 710: 203: 1108: 1061: 991: 760: 477: 17: 1181: 1049: 1044: 880: 287: 234: 214:, in which case the terminating null still remains. Neither name nor value can contain any embedded 199: 1393: 1176: 1014: 803: 542:
The specification document was placed in the public domain by Neil Schemenauer on 12 January 2006.
1291: 1113: 979: 793: 282: 1304: 935: 480:- A binary protocol intended to proxy requests between a web server and an application server. 207: 1373: 1354: 1319: 1295: 1265: 1255: 850: 1378: 1349: 808: 342: 322: 651: 1171: 1143: 1098: 215: 179:
specified by this protocol, although CGI-equivalent HTTP responses are generally used.
1415: 1400: 1361: 1339: 1226: 1128: 813: 222: 188: 615: 601: 1299: 955: 825: 211: 1196: 1133: 1005: 951: 701: 553: 474:- Attempts to increase scalability by supporting long-running CGI-like processes 28: 1138: 1118: 1093: 920: 900: 522: 348: 326: 1161: 1123: 915: 770: 226: 192: 352: 419: 362: 1344: 1201: 969: 930: 925: 905: 895: 890: 579: 329:. The following is a partial list of languages with known SCGI bindings: 292: 381: 195:-encoded headers and a body. A SCGI response is a normal HTTP response. 1314: 1260: 1076: 1056: 974: 755: 693: 471: 142: 657: 434: 1271: 1211: 1206: 1085: 885: 738: 728: 723: 302: 256:
The SCGI server sends the following response back to the web server:
395: 1239: 1234: 1216: 1039: 1032: 1027: 1022: 733: 307: 662: 1366: 845: 718: 518: 502: 498: 391: 377: 666: 1191: 910: 445: 405: 22: 16:"SCGI" redirects here. For the airport with that code, see 645: 399: 321:
SCGI can be implemented in any language that supports
242:
require knowledge of the HTTP protocol specification.
576:"SCGI: A Simple Common Gateway Interface alternative" 1332: 1284: 1248: 1225: 1152: 1084: 1075: 1013: 1004: 944: 871: 779: 709: 700: 133:) is a protocol for applications to interface with 53:. Unsourced material may be challenged and removed. 229:-encoded. The raw body, if any, is then appended. 272:Comparison of web server software § Features 678: 8: 1081: 1010: 706: 685: 671: 663: 650: 113:Learn how and when to remove this message 202:, where both the name and the value are 566: 484:Application hosts (language-specific): 262:The SCGI server closes the connection. 574:Schemenauer, Neil (October 30, 2001). 468:- Launches a child process per request 598:MNX: MEMS and Nanotechnology Exchange 225:to form a single byte sequence, then 7: 51:adding citations to reliable sources 616:"Althttpd: The Althttpd Webserver" 547: 537: 317:Language bindings for the SCGI API 137:servers, as an alternative to the 14: 596:. Index of /software/files/scgi. 62:"Simple Common Gateway Interface" 600:. April 12, 2002. Archived from 27: 552:For HTTP header combining, see 461:Application/Gateway protocols: 266:Web servers that implement SCGI 127:Simple Common Gateway Interface 38:needs additional citations for 1: 466:Common Gateway Interface(CGI) 299:Internet Information Services 525:web server gateway interface 515:Web Server Gateway Interface 505:Web Server Gateway Interface 658:SCGI protocol specification 277:(this list is not complete) 141:protocol. It is similar to 1438: 269: 198:Each header consists of a 15: 221:All provided headers are 210:). The value can be an 204:null-terminated strings 187:A SCGI request is the 478:Apache JServ Protocol 235:environment variables 18:San Guillermo Airport 495:web server interface 303:ISAPI SCGI extension 47:improve this article 554:RFC2616 section 4.2 980:Application server 283:Apache HTTP Server 1422:Network protocols 1409: 1408: 1328: 1327: 1305:Browser extension 1280: 1279: 1000: 999: 936:Phusion Passenger 594:"scgi-0.1.tar.gz" 123: 122: 115: 97: 1429: 1374:Web API security 1296:Remote scripting 1266:Web SQL Database 1082: 1011: 707: 687: 680: 673: 664: 654: 649: 648: 646:Official website 631: 630: 628: 626: 612: 606: 605: 590: 584: 583: 578:. Archived from 571: 551: 541: 118: 111: 107: 104: 98: 96: 55: 31: 23: 1437: 1436: 1432: 1431: 1430: 1428: 1427: 1426: 1412: 1411: 1410: 1405: 1379:Web application 1324: 1276: 1244: 1221: 1148: 1071: 996: 940: 867: 846:JavaScript JSGI 826:ASP.NET Handler 809:Jakarta Servlet 775: 696: 691: 644: 643: 640: 635: 634: 624: 622: 614: 613: 609: 592: 591: 587: 573: 572: 568: 563: 546: 536: 532: 459: 323:network sockets 319: 274: 268: 260: 254: 248: 200:name–value pair 185: 176: 168: 119: 108: 102: 99: 56: 54: 44: 32: 21: 12: 11: 5: 1435: 1433: 1425: 1424: 1414: 1413: 1407: 1406: 1404: 1403: 1398: 1397: 1396: 1391: 1386: 1376: 1371: 1370: 1369: 1359: 1358: 1357: 1352: 1342: 1336: 1334: 1330: 1329: 1326: 1325: 1323: 1322: 1317: 1312: 1307: 1302: 1288: 1286: 1282: 1281: 1278: 1277: 1275: 1274: 1269: 1268:(formerly W3C) 1263: 1258: 1252: 1250: 1246: 1245: 1243: 1242: 1237: 1231: 1229: 1223: 1222: 1220: 1219: 1214: 1209: 1204: 1199: 1194: 1189: 1184: 1179: 1174: 1169: 1164: 1158: 1156: 1150: 1149: 1147: 1146: 1144:XMLHttpRequest 1141: 1136: 1131: 1126: 1121: 1116: 1111: 1106: 1101: 1096: 1090: 1088: 1079: 1073: 1072: 1070: 1069: 1064: 1059: 1054: 1053: 1052: 1042: 1037: 1036: 1035: 1030: 1019: 1017: 1008: 1002: 1001: 998: 997: 995: 994: 989: 988: 987: 977: 972: 967: 958: 948: 946: 942: 941: 939: 938: 933: 928: 923: 918: 913: 908: 903: 898: 893: 888: 883: 877: 875: 873:Apache modules 869: 868: 866: 865: 864: 863: 853: 848: 843: 838: 833: 828: 823: 818: 817: 816: 806: 801: 796: 791: 785: 783: 777: 776: 774: 773: 768: 763: 758: 753: 748: 743: 742: 741: 736: 731: 726: 715: 713: 704: 698: 697: 694:Web interfaces 692: 690: 689: 682: 675: 667: 661: 660: 655: 639: 638:External links 636: 633: 632: 607: 604:on 2002-10-20. 585: 582:on 2002-04-03. 565: 564: 562: 559: 558: 557: 543: 531: 528: 527: 526: 516: 506: 496: 482: 481: 475: 469: 458: 455: 454: 453: 448: 443: 438: 428: 423: 413: 408: 403: 389: 384: 378:SCGI connector 371: 366: 356: 346: 336: 318: 315: 314: 313: 310: 305: 295: 290: 285: 267: 264: 258: 252: 247: 244: 184: 183:Request format 181: 175: 172: 167: 164: 153:which defines 121: 120: 35: 33: 26: 13: 10: 9: 6: 4: 3: 2: 1434: 1423: 1420: 1419: 1417: 1402: 1401:Web framework 1399: 1395: 1392: 1390: 1387: 1385: 1382: 1381: 1380: 1377: 1375: 1372: 1368: 1365: 1364: 1363: 1362:Web standards 1360: 1356: 1353: 1351: 1348: 1347: 1346: 1343: 1341: 1340:Microservices 1338: 1337: 1335: 1331: 1321: 1318: 1316: 1313: 1311: 1308: 1306: 1303: 1301: 1297: 1293: 1290: 1289: 1287: 1283: 1273: 1270: 1267: 1264: 1262: 1259: 1257: 1254: 1253: 1251: 1247: 1241: 1238: 1236: 1233: 1232: 1230: 1228: 1224: 1218: 1215: 1213: 1210: 1208: 1205: 1203: 1200: 1198: 1195: 1193: 1190: 1188: 1185: 1183: 1180: 1178: 1175: 1173: 1170: 1168: 1165: 1163: 1160: 1159: 1157: 1155: 1151: 1145: 1142: 1140: 1137: 1135: 1132: 1130: 1129:Web messaging 1127: 1125: 1122: 1120: 1117: 1115: 1112: 1110: 1107: 1105: 1102: 1100: 1097: 1095: 1092: 1091: 1089: 1087: 1083: 1080: 1078: 1074: 1068: 1065: 1063: 1060: 1058: 1055: 1051: 1048: 1047: 1046: 1043: 1041: 1038: 1034: 1031: 1029: 1026: 1025: 1024: 1021: 1020: 1018: 1016: 1012: 1009: 1007: 1003: 993: 990: 986: 983: 982: 981: 978: 976: 973: 971: 968: 966: 962: 959: 957: 953: 950: 949: 947: 943: 937: 934: 932: 929: 927: 924: 922: 919: 917: 914: 912: 909: 907: 904: 902: 899: 897: 894: 892: 889: 887: 884: 882: 879: 878: 876: 874: 870: 862: 859: 858: 857: 854: 852: 849: 847: 844: 842: 839: 837: 834: 832: 829: 827: 824: 822: 819: 815: 812: 811: 810: 807: 805: 802: 800: 797: 795: 792: 790: 787: 786: 784: 782: 778: 772: 769: 767: 764: 762: 759: 757: 754: 752: 749: 747: 744: 740: 737: 735: 732: 730: 727: 725: 722: 721: 720: 717: 716: 714: 712: 708: 705: 703: 699: 695: 688: 683: 681: 676: 674: 669: 668: 665: 659: 656: 653: 647: 642: 641: 637: 621: 617: 611: 608: 603: 599: 595: 589: 586: 581: 577: 570: 567: 560: 555: 550: 549: 544: 540: 539: 534: 533: 529: 524: 520: 517: 514: 510: 507: 504: 500: 497: 494: 490: 487: 486: 485: 479: 476: 473: 470: 467: 464: 463: 462: 456: 452: 449: 447: 444: 442: 439: 436: 432: 429: 427: 424: 421: 417: 414: 412: 409: 407: 404: 401: 397: 393: 390: 388: 385: 382: 379: 375: 372: 370: 367: 364: 360: 357: 354: 350: 347: 344: 340: 337: 335: 332: 331: 330: 328: 324: 316: 311: 309: 306: 304: 300: 296: 294: 291: 289: 286: 284: 281: 280: 279: 278: 273: 265: 263: 257: 251: 245: 243: 239: 236: 230: 228: 224: 219: 217: 213: 209: 205: 201: 196: 194: 190: 189:concatenation 182: 180: 174:Specification 173: 171: 165: 163: 159: 156: 155:communication 152: 147: 144: 140: 136: 132: 128: 117: 114: 106: 95: 92: 88: 85: 81: 78: 74: 71: 67: 64: –  63: 59: 58:Find sources: 52: 48: 42: 41: 36:This article 34: 30: 25: 24: 19: 1015:Browser APIs 956:Web resource 750: 623:. Retrieved 619: 610: 602:the original 597: 588: 580:the original 569: 548: 538: 483: 460: 380:or with the 320: 276: 275: 261: 255: 249: 240: 231: 223:concatenated 220: 212:empty string 197: 186: 177: 169: 160: 154: 150: 148: 130: 126: 124: 109: 103:October 2017 100: 90: 83: 76: 69: 57: 45:Please help 40:verification 37: 1394:Progressive 1389:Single-page 1197:WebAssembly 1177:Geolocation 1134:Web storage 1040:C NPRuntime 1028:LiveConnect 1006:Client-side 952:Web service 881:mod_include 836:Python ASGI 831:Python WSGI 781:Server APIs 702:Server-side 433:, with the 418:, with the 398:package or 394:, with the 376:, with the 361:, with the 351:, with the 341:, with the 1162:DOM events 1139:Web worker 1124:WebSockets 985:comparison 921:mod_python 901:mod_parrot 734:Encryption 620:sqlite.org 561:References 523:JavaScript 435:tokio-scgi 349:Emacs Lisp 327:netstrings 297:Microsoft 270:See also: 216:null bytes 149:SCGI is a 73:newspapers 1320:Scripting 1182:IndexedDB 1033:XPConnect 992:Scripting 916:mod_proxy 861:container 851:Perl PSGI 841:Ruby Rack 814:container 771:WebSocket 711:Protocols 402:framework 227:netstring 208:C strings 193:netstring 1416:Category 1345:Web page 1202:WebAuthn 1077:Web APIs 970:Open API 931:mod_ruby 926:mod_wsgi 906:mod_perl 896:mod_mono 891:mod_lisp 821:CLI OWIN 457:See also 353:url-scgi 343:arsd.cgi 312:Althttpd 293:Lighttpd 288:Cherokee 151:protocol 1355:Dynamic 1315:Web IDL 1261:GraphQL 1227:Khronos 1057:ActiveX 1045:C PPAPI 1023:C NPAPI 975:Webhook 911:mod_php 856:Portlet 804:COM ASP 799:C ISAPI 794:C ASAPI 789:C NSAPI 472:FastCGI 422:library 383:library 369:Haskell 365:package 355:library 345:library 246:Example 166:History 143:FastCGI 87:scholar 1350:Static 1333:Topics 1310:Mashup 1285:Topics 1272:WebUSB 1249:Others 1212:WebRTC 1207:WebGPU 1099:Canvas 1086:WHATWG 945:Topics 886:mod_jk 739:WebDAV 625:19 May 513:Python 441:Scheme 416:Racket 411:Python 89:  82:  75:  68:  60:  1300:DHTML 1256:Gears 1240:WebGL 1235:WebCL 1217:WebXR 1119:Video 1094:Audio 530:Notes 437:crate 400:Plack 334:Cobra 308:nginx 301:with 94:JSTOR 80:books 1384:Rich 1367:REST 1298:vs. 1294:and 1292:Ajax 1172:File 1104:CORS 1067:XBAP 1050:NaCl 963:vs. 954:vs. 766:WSRP 756:FCGI 751:SCGI 719:HTTP 627:2023 519:JSGI 509:WSGI 503:Perl 499:PSGI 493:Ruby 489:Rack 431:Rust 426:Ruby 420:scgi 396:SCGI 392:Perl 387:Lisp 374:Java 363:scgi 325:and 135:HTTP 131:SCGI 125:The 66:news 1192:SVG 1187:MSE 1167:EME 1154:W3C 1114:SSE 1109:DOM 1062:BHO 965:ROA 961:WOA 761:AJP 746:CGI 451:Nim 446:Tcl 406:PHP 191:of 139:CGI 49:by 1418:: 729:v3 724:v2 618:. 545:2. 535:1. 521:– 511:- 501:- 491:- 359:Go 686:e 679:t 672:v 629:. 556:. 339:D 206:( 129:( 116:) 110:( 105:) 101:( 91:· 84:· 77:· 70:· 43:. 20:.

Index

San Guillermo Airport

verification
improve this article
adding citations to reliable sources
"Simple Common Gateway Interface"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
HTTP
CGI
FastCGI
concatenation
netstring
name–value pair
null-terminated strings
C strings
empty string
null bytes
concatenated
netstring
environment variables
Comparison of web server software § Features
Apache HTTP Server
Cherokee
Lighttpd
Internet Information Services

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.