cgi help
Richard R. Sivernell
res005ru
Mon May 17 11:30:14 PDT 2004
On Sat, 20 Apr 2002 22:39:44 +0000
"Kevin O'Gorman" <kevin at kosmanor.com> wrote:
> It helps if you can hold off setting the reply headers until you
> know whether you have an error or not. If you can, then you can
> force the reply to be plain text, which makes debugging a bit
> easier, in general. It can be hard to do the right thing with
> an error message when you've already output 10,000 bytes of HTML
> and you don't know what part of the page you're on.
>
> In python, which I've used a lot for that purpose, my pattern on
> error goes something like this:
>
> import cgi
>
> def cgiput(s):
> ofile.write("%s\r\n" % s)
>
> try:
> <stuff>
> except Exception, e:
> if <debugging>:
> cgiput("content-type: text/plain")
> cgiput("Status: 500 Internal Server Error")
> cgiput("")
> cgiput("Cannot parse the PATH_INFO: %s" % pi)
> sys.exit(0)
>
> If I'm debugging, this comes out as text, and I usually write
> a whole bunch of other stuff too.
>
> You can play with this in various ways, of course. YMMV.
>
> ++ kevin
>
>
> On Sat, Apr 20, 2002 at 09:46:23PM +0000, Richard R. Sivernell wrote:
> > List
> >
> > I am now able to get access to my cgi program, but the error msgs that
> > are returned are at best pathetic. Does any one know how to set return
> > messages to give detailed info. tring to debug cgi program.
> >
> > cheers
>
> --
> Kevin O'Gorman (805) 650-6274 mailto:kevin at kosmanor.com
> Permanent e-mail forwarder: mailto:Kevin.O'Gorman.64 at Alum.Dartmouth.org
> At school: mailto:kogorman at cs.ucsb.edu
> Web: http://www.cs.ucsb.edu/~kogorman/index.html
> Web: http://kosmanor.com/~kevin/index.html
>
> "Life is short; eat dessert first!"
> _______________________________________________
> Linux-users mailing list - http://linux-sxs.org/mailman/listinfo/linux-users
> Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.
Kevin
Thanks for the reply, basicly that is what I have got it to do.
But this a painf=ull process,<g> I am using c++ and have
a html << #def as cout with goodies.
thanks again cheers
--
Rick Sivernell
Dallas, Texas 75287
972 306-2296
res005ru at gte.net
Caldera Open Linux eWorkStation 3.1.1
Registered Linux User
.~.
/ v \
/( _ )\
^ ^
In Linux we trust!
More information about the Linux-users
mailing list