Firefox says thet connection was reset with cgi-fcgi script

I started this script.c

#include <fcgi_stdio.h>
#include <stdlib.h>
int main (void) {
while (FCGI_Accept() >= 0) {
    printf("Content-type: text/htmlrnrn");
    printf("<!doctype><html><body>Welcome!</body></html>n");
    FCGI_Finish();
}
return EXIT_SUCCESS;
}

in compiled form script.fcgi using this command in terminal

$ sudo cgi-fcgi -start -connect 127.0.0.1:80 script.fcgi

Then, I open Firefox and type localhost in address bar and got a message The connection was reset. How to debug this issue? My script compilation uses gcc script.c -o script.fcgi -lfcgi -O3 -Wall -Wextra -pedantic -std=c11