On Wednesday 30 May 2001 20:54, Curtis Poe wrote:
> > > Mark Rowlands wrote:
> > > : ok..this is my first bash at a serious cgi script. it is using DBI
> > > : and CGI to connect to a bunch of databases and edit various fields.
> > > : Problem is all was fine and dandy (more or less) while testing with
> > > : IE5.5. Then I checked with netscape 4.77 and Konqueror 2.1.1 both
> > > : of these just display the html!
> > >
> > > Sounds like a server problem- not setting the right default MIME type
> > > or something. Try explicitly giving the MIME type:
> > >
> > > print $cgi->header (-type => 'text/html');
> > >
> > > -- tdk
> >
> > nope :-(
> >
> > I even went and bought a book!.......that didn't help either.....tried it
> > on another server :-( installed the default apache httpd.conf....
>
> Generally, with a situation like this, I telnet to port 80 and view the
> headers directly. I'm not as familiar with doing this programatically, but
> you can try the following (note where you need to insert your URL!):
>
> #!/usr/bin/perl -w
> use strict;
> use LWP::UserAgent;
> use Data::Dumper;
>
> my $ua = LWP::UserAgent->new;
>
> # insert the URL here
> my $request = HTTP::Request->new( HEAD => 'http://some.server.name/' );
>
> my $response = $ua->request($request);
> $Data::Dumper::Indent = 1;
> print Dumper $response;
>
> The output will be the data contained in the response object. If you have
> difficulty understanding it (it can be a bit confusing), post the output to
> this list and we can take a look at the data for you.
>
> If anyone else knows of a cleaner way of printing just the headers (short
> of using IO::Socket), I'd love to see it!
>
> Cheers,
> Curtis Poe
> "Ovid" on http://www.perlmonks.org/
>
ok here are some headers.... this is with the default type set on the server
to content/html ...(which seems to make no difference to this output btw)
$VAR1 = bless( {
'_request' => bless( {
'_method' => 'HEAD',
'_content' => '',
'_headers' => bless( {
'user-agent' => 'libwww-perl/5.53'
}, 'HTTP::Headers' ),
'_uri' => bless( [
bless( do{\(my $o = 'http://localhost/cgi-bin/admin2.cgi')},
'URI::http' ),
undef
], 'URI::URL' )
}, 'HTTP::Request' ),
'_protocol' => 'HTTP/1.1',
'_content' => '',
'_headers' => bless( {
'client-peer' => '127.0.0.1:80',
'connection' => 'close',
'client-date' => 'Thu, 31 May 2001 05:09:48 GMT',
'content-type' => 'text/plain', # interesting ? #
'date' => 'Thu, 31 May 2001 05:09:47 GMT',
'dbi' => 'mysql:uptime:hostname=pcmob.tninet.seContent-Type: text/html',
'server' => 'Apache/1.3.20 (Unix) PHP/4.0.5' line above looks odd?
}, 'HTTP::Headers' ),
'_rc' => 200,
'_msg' => 'OK'
}, 'HTTP::Response' );