LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-05-2009, 11:00 PM   #1
irkkaaja
Member
 
Registered: Oct 2008
Posts: 43

Rep: Reputation: 16
fastcgi issues


I'm working on a fastcgi program (actually, a binding to lua), and I'm running into trouble trying to receive data from stdin:

Code:
char *s, *l = getenv("CONTENT_LENGTH");	
	int k = atoi(l);
	fprintf(stderr, "Integer conversion successful."); 
	s = malloc(k);
	fgets(s, k, stdin);
I'm pretty damn sure that somewhere in here, fastcgi is crashing; all I do after this is print s to stdout with the appropriate headers (so far, at least).

error.log looks like this:

2009-09-05 23:54:57: (mod_fastcgi.c.2494) unexpected end-of-file (perhaps the fastcgi process died): pid: 523 socket: unix:/var/run/lighttpd/lua-fastcgi.socket-3
2009-09-05 23:54:57: (mod_fastcgi.c.3326) response not received, request sent: 899 on socket: unix:/var/run/lighttpd/lua-fastcgi.socket-3 for /new_test.lua , closing connection

Anyone have any idea what's going wrong?

EDIT: WOW, I'm a moron. malloc(k * sizeof(char)), durr.
Anyone see any other problems with that code?

EDIT2: seeing as it's still not working, I assume there *are* other problems with it. I haven't used C in far too long, obviously.

Last edited by irkkaaja; 09-05-2009 at 11:04 PM.
 
  


Reply

Tags
fastcgi


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lighttpd + Fastcgi + ruby How? chutsu Linux - Server 0 08-17-2009 05:12 PM
FastCGI installation I_AM Linux - General 1 05-10-2009 05:30 AM
FastCGI etrader Linux - Newbie 0 03-28-2009 02:25 PM
PHP FastCGI security robertjinx Linux - Security 1 08-22-2008 02:56 AM
Ruby / Fastcgi Problem I_AM Linux - Software 1 03-09-2008 07:15 AM


All times are GMT -5. The time now is 12:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration