no $ENV{'CONTENT_LENGTH'}

G

Guy

I haven't done any Perl for about 5 years. I am using Perl to run a web
site according to the information that it receives from HTML forms. I'm sure
I was using the following:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

But it appears that this server is not providing this information. What is
the proper way to get this info.

Thanks for all,
G.Doucet

Here is the information that the server is providing: (PS. I removed the
customer's info.)

DOCUMENT_ROOT =
GATEWAY_INTERFACE = CGI/1.1
GDFONTPATH = /services/share/fonts
HTTP_ACCEPT = */*
HTTP_ACCEPT_ENCODING = gzip, deflate
HTTP_ACCEPT_LANGUAGE = en-us
HTTP_CONNECTION = Keep-Alive
HTTP_HOST =
HTTP_UA_CPU = x86
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 1.1.4322)
MvCONFIG_LIBRARY =
/services/websoftware/miva/Empresa/cgi-bin/libmivaconfig.so
PATH = /usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin
QUERY_STRING = t01=Hello
REMOTE_ADDR =
REMOTE_HOST =
REMOTE_PORT =
REQUEST_METHOD = GET
REQUEST_URI = /cgi-bin/photos.pl?t01=Hello
SCRIPT_FILENAME =
SCRIPT_NAME = /cgi-bin/photos.pl
SERVER_ADDR =
SERVER_ADMIN = or webmaster
SERVER_DOMAIN =
SERVER_NAME =
SERVER_PORT = 80
SERVER_PROTOCOL = HTTP/1.1
SERVER_SIGNATURE =
SERVER_SOFTWARE = Apache
 
G

Gunnar Hjalmarsson

Guy said:
I am using Perl to run a web site according to the information that
it receives from HTML forms. I'm sure I was using the following:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

But it appears that this server is not providing this information.

Data submitted via forms end up in STDIN only when the request method is
POST, and then there is a content-length env variable available. I'd be
very surprised if that's not the case also for your web server.

Here is the information that the server is providing:

QUERY_STRING = t01=Hello

REQUEST_METHOD = GET

You showed us the env variables that are available after a GET request.
 
G

Guy

Glenn Jackman said:
At said:
I was using the following:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

But it appears that this server is not providing this information. What
is
the proper way to get this info.

Here is the information that the server is providing: (PS. I removed
the
customer's info.) [...]
QUERY_STRING = t01=Hello [...]
REQUEST_METHOD = GET

CONTENT_LENGTH is set only for POST submissions.

I had forgotten about GET/POST. I know I was using GET (where the form data
is sent in the URL) so I must not have been using the 'CONTENT_LENGTH'. I
just noticed that the QUERY_STRING contains what I need so I will use it.
Sorry and thanks.
G.Doucet
 
T

Tad J McClellan

Guy said:
Glenn Jackman said:
At said:
I was using the following:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

But it appears that this server is not providing this information. What
is
the proper way to get this info.

Here is the information that the server is providing: (PS. I removed
the
customer's info.) [...]
QUERY_STRING = t01=Hello [...]
REQUEST_METHOD = GET

CONTENT_LENGTH is set only for POST submissions.

I had forgotten about GET/POST.


If you had been using CGI.pm that would not have mattered, as it
would have just done the Right Thing.

I know I was using GET (where the form data
is sent in the URL) so I must not have been using the 'CONTENT_LENGTH'. I
just noticed that the QUERY_STRING contains what I need so I will use it.


Don't use QUERY_STRING.

Let CGI.pm use QUERY_STRING or CONTENT_LENGTH or... as needed.
 
T

Tad J McClellan

A. Sinan Unur said:
Use CGI.pm or CGI::Simple rather than cargo cult code to decode and
process requests.


That was suggested to him 8 years ago.

Time to exercise some intolerance with regard to this OP...
 
G

Gunnar Hjalmarsson

Tad said:
Guy said:
Glenn Jackman said:
At 2009-04-15 08:25PM, "Guy" wrote:
I was using the following:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

But it appears that this server is not providing this information. What
is the proper way to get this info.

Here is the information that the server is providing: (PS. I removed
the
customer's info.)
[...]
QUERY_STRING = t01=Hello
[...]
REQUEST_METHOD = GET

CONTENT_LENGTH is set only for POST submissions.

I had forgotten about GET/POST.

If you had been using CGI.pm that would not have mattered, as it
would have just done the Right Thing.

You imply that, as long as you use CGI.pm, it's ok to write CGI apps
without knowing the basics about CGI. That implication is bad advice IMNSHO.
 
G

Guy

Tad J McClellan said:
That was suggested to him 8 years ago.

Time to exercise some intolerance with regard to this OP...

Ok, I guess it's time to pick up a recent book on Perl and start reading.
But how in God's name can you remember that I asked that 8 years ago? Even
I don't remember that!!
Guy
 
T

Tad J McClellan

[ Please excuse my piggybacking, but Guy's post is not on my server ]



[ nothing that I'm going to quote ]


I have archived all of my Usenet posts for more than a decade now.

Your name seemed familiar, so I grep'd it in my archive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top