Solved

header problem

Posted on 1998-03-19
11
206 Views
Last Modified: 2013-12-25
Without the header content-type my CGI program works!. None of the other headers (Pragma , expire) work. Please suggest a solution.
0
Comment
Question by:jas_jan
11 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1832179
Check your web server configuration?!
0
 
LVL 5

Expert Comment

by:icd
ID: 1832180
Hang on, a cgi with a content-type header? Do you mean the scripts first few lines have the text 'Content-type...' or do you mean the script outputs (ie prints) the text 'Content-type'? Apologies if this seems a silly question, but one never knows...

Assuming the latter, could you show us the few lines around the part of your script that outputs the text 'Content-type'.


0
 
LVL 8

Expert Comment

by:MaDdUCK
ID: 1832181
??? how does that work? ???
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:jas_jan
ID: 1832182
use AnyDBM_File;
use CGI;

$size=$ENV{'CONTENT_LENGTH'};
read(STDIN,$form,$size);
@form=split(/&/,$form);
$no = 1;
foreach $val(@form)
      {
      ($name,$value)=split(/=/,$val);
      $name =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
      $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
      $fac{$no} = $value;
      $no++;
      }


$query = new CGI;
print "<html>";
print "<body bgcolor=biege>";
print "<center><img src=logo.gif></center>";
print "<br><h2><center><font color=red>PERL Test</font></center></h2><br><br>";
&admin($query);


sub admin{
      print "<br><h3><center>For Administrator</h3><br><br>";
      print $query->startform("POST","show.pl");
      print "<b>Duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> ";
      print $query->textfield('time');
      print "<br><br><b>No.of Questions  :</b> ";
      print $query->textfield('noq');
      print $query->hidden('fname' , $fac{1});
      print "<br><br>",$query->submit('form1','Submit'),"</center>";
      print $query->endform;
      print $query->end_html;
      }
This is my CGI program. If I attach any header it prints it as it is. Without the headers it works. But I need pragma/Expire header desperately. Pl give me solution.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1832183
How do you attach any header?
Someting like this?
 print $query->header(-expires=>'+3d');
 print $query->start_html(-meta=>{'Pragma' =>'no-cache'});


0
 

Author Comment

by:jas_jan
ID: 1832184
I attached header as follows.

print "Content-Type: text/html\r\n";
print "Expires: Sat, 30 Mar 1998 10:29:02 GMT\r\n\r\n";

Pl give me solution. It is very urgent.
0
 

Author Comment

by:jas_jan
ID: 1832185
I didn't use CGI module at all. Headers didn't work even in a very simple program.
0
 
LVL 8

Expert Comment

by:MaDdUCK
ID: 1832186
I don't follow this...You gott to be more specific.
0
 

Author Comment

by:jas_jan
ID: 1832187
If I attach header as
print "Content-Type: text/html\r\n";
print "Expires: Sat, 30 Nov 1996 10:29:02 GMT\r\n\r\n";
it prints the two lines as it is. I'm desperate to use either pragma or expire header. My page has to expire immediately. Even in a very simple program the two lines are displayed in the browser. It is very urgent. Pl give me solution.
0
 
LVL 8

Accepted Solution

by:
MaDdUCK earned 50 total points
ID: 1832188
Aha,
the syntax here is wrong. You have to use:

print "Content-type: text/html\n\n";
(don't capitalize '-type')

and then after the head tag, use

print "<meta http-equiv=\"expires\" content=\"0\">\n\n";

this should work. Also, don't rely on the output of your browser because it may be cached. Either use lnyx or a text viewer to view the output, and your brain to translate it ;-)
0
 

Author Comment

by:jas_jan
ID: 1832189
Sorry. I've given the correct syntax only in my program.I've referred so many books regarding this and I've used all the methods. But still it is is not working.  

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Make a file test.vbs using vbscript 5 80
Need to Modify a Script I found 5 108
Transform normalized CSV to line in powershell 7 46
BATCH to EXE Converter 2 35
If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question