[Newlug] Linux batch script question
Mike Schwartz
mschw at athenet.net
Fri Apr 8 19:58:47 UTC 2011
This data is being submitted from the web page with a "post". We do have a lot of server-side parsing of the input string.
It turns out there is a little batch file that has to be run between loading the QUERY_STRING and trying to run this web process from a command line.
So, for now, I can continue with my debugging, and I will look at that little batch file in my "spare" time.
Thanks!
Mike Schwartz
> -----Original Message-----
> From: newlug-bounces at newlug.org [mailto:newlug-bounces at newlug.org]
> On Behalf Of Bernard Starzewski
> Sent: Friday, April 08, 2011 2:44 PM
> To: newlug at newlug.org
> Subject: Re: [Newlug] Linux batch script question
>
> Basic tips in sleuthing cgi.
>
> Make sure you understand how the client web page and server interact.
>
> Know the difference between PUT and POST.
>
> I think there is some confusion here between exactly which one is being
> used.
> The main difference is that a PUT puts it all on the command line which
> requires some server side parsing somehow which is consistent with the
> query line you documented.
>
> But the cat & echo lines appear to be expecting a POST operation.
> If no POST is coming then Id expect it to hand which is I think where the
> problem is. ---- incompatibility between client and server or a bug in the
> client said that is preventing the post from coming.
>
> Thats the best I can do without putting my hands on it.
>
> Good luck!
> Bernie
> --- On Fri, 4/8/11, Mike Schwartz <mschw at athenet.net> wrote:
>
> > From: Mike Schwartz <mschw at athenet.net>
> > Subject: Re: [Newlug] Linux batch script question
> > To: newlug at newlug.org
> > Date: Friday, April 8, 2011, 2:07 PM
> > Thanks for
> > all the tips. I'm going to have an interesting weekend playing with
> > code...
> >
> > Mike
> >
> > > -----Original Message-----
> > > From: newlug-bounces at newlug.org
> > [mailto:newlug-bounces at newlug.org]
> > > On Behalf Of S'A'Alis
> > > Sent: Friday, April 08, 2011 11:35 AM
> > > To: newlug at newlug.org
> > > Subject: Re: [Newlug] Linux batch script question
> > >
> > > > My question is: what is the
> > “cat” command actually
> > > > concatenating at this point? Is it expecting
> > another $1 parameter
> > > > after the ./geninvo.cgi command?
> > >
> > > With the cat command (and many others), if you do not
> > specify a filename
> > > for input, then it defaults to STDIN. Normally,
> > as Bernard noted, STDIN
> > is the
> > > keyboard. However, with CGI scripts, STDIN is
> > usually mapped to a data
> > > transfer (so long as the CGI method on the webpage is
> > GET -- see more,
> > > here:
> > > http://www.cs.tut.fi/~jkorpela/forms/methods.html)
> > >
> > > So, the purpose of this script would be to capture
> > what the web page form
> > is
> > > sending to the script at that point, but reading
> > STDIN, which are the form
> > tags
> > > and values.
> > >
> > > PRESUMING that you want data shipped to it so that
> > "cat" actually places
> > this
> > > data in a file (and you're not, instead, trying to do
> > something weird with
> > "cat"
> > > to just *create* an empty file) and since this is a
> > CGI script, I would
> > suggest
> > > that you do something like this to verify what you're
> > receiving and that
> > things
> > > are doing what you
> > > want:
> > >
> > > #!/bin/sh
> > > umask 0
> > > FPWSYS=$$
> > > FPWP2=/tmp/fpwp2.$$
> > > export FPWSYS FPWP2
> > >
> > > # First, let's do some debugging so we know *what* is
> > running, make sure
> > > you can write to /tmp (777) echo "Debug: CGI script
> > called with $# command
> > > line parameters [$*]"
> > > >> /tmp/logfile
> > >
> > > # Let's make sure setglobal isn't causing us problems
> > echo "Debug: Running
> > > setglobal.bat" >> /tmp/logfile . ./setglobal.bat
> > echo "Debug: Setglobal
> > run
> > > with exit code $?" >> /tmp/logfile
> > >
> > > # Create the file, empty (actually, doing this for
> > "safety" as we'll
> > OVERWRITE
> > > if it already exists, which it shouldn't
> > > > $FPWP2
> > > # Now read STDIN line by line, log what we receive and
> > dump the lines to a
> > > file while read dataline do echo "Debug:
> > received [$dataline]" >>
> > > /tmp/logfile echo "$dataline" >> $FPWP2
> > done echo >> $FPWP2
> > >
> > > > /fpmerge/$$.out
> > > > /fpmerge/$$.err
> > > > /fpmerge/$$.frm
> > > > /fpmerge/$$.pcl
> > > > /ptmp/${FPWSYS}.pdf
> >
> >
More information about the Newlug
mailing list