RE: Help with this code snippet please (Tom Wood)

[email protected]
Newsgroups gmane.network.tux
Message-ID <81D52920E866FC46ACA560F5F127D47C13809B@AUSXMPC112.aus.amer.dell.com>
From: "Tom Wood" <[email protected]>
To: <[email protected]>
Subject: Help with this code snippet please
Date: Thu, 11 Jul 2002 17:54:56 -0400
Reply-To: [email protected]

> For some reason the gif image review.gif will get blurred or mangled
> when it is sent to the clients browser using this code.
> Can someone tell me what I'm doing wrong?

> if(tux(TUX_ACTION_GET_OBJECT, req) > -1 && !req->error)

this should be

if(tux(TUX_ACTION_GET_OBJECT, req) < 0 || req->error)

> 	strcpy(req->objectname, "REVIEW.GIF");
> 	req->objectlen = strlen(req->objectname);
> 	req->event = 1;
> 	ret = tux(TUX_ACTION_GET_OBJECT, req);
> 	if(ret < 0 || req->error)
> 	{
> 		return tux(TUX_ACTION_FINISH_CLOSE_REQ, req);
> 	}
> 	else
> 	{
> 		return ret;
> 	}

You're missing some vital steps; after GET_OBJECT you must call
TUX_ACTION_SEND_OBJECT and TUX_ACTION_FINISH_CLOSE_REQ, preferably in the
event-driven model (which you haven't used properly here).

Again, demo2.c shows how to do this correctly.

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.