473,790 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CGI application misbehaved by not returning a complete set of HTTP headers

37 New Member
Hi
I am trying to setup a form that automatically sends the form values
via email to a specific address.
I have uploaded the script, which when I run loads a page with the following
error message:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.


According to the tutorial I am using the only thing I needed to change was the
$recipient's email address to my own, which I have done.

my $recipient = 'my@name465.fsn et.co.uk';

I also changed this part to my own email address

print MAIL "To: my\@name465.fsn et.co.uk\n";

Is there perhaps something missing from one of the other headers?


#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBr owser fatalsToBrowser );
use strict;

print header;
print start_html("Res ults");

# Set the PATH environment variable to the same path
# # where sendmail is located:
#
$ENV{PATH} = "/usr/sbin";

# open the pipe to sendmail
open (MAIL, "|/usr/sbin/sendmail -oi -t ") or &dienice("Ca n't fork for sendmail: $!\n");

# change this to your own e-mail address
my $recipient = 'my@name465.fsn et.co.uk';

# Start printing the mail headers
# You must specify who it's to, or it won't be delivered:

print MAIL "To: my\@name465.fsn et.co.uk\n";

# From should probably be the webserver, although you could set it
# to the visitor's email address too.

print MAIL "From: nobody\@nobody. com\n";

# print out a subject line so you know it's from your form cgi.

print MAIL "Subject: Form Data\n\n";

# Now print the body of your mail message.

foreach my $p (param()) {
print MAIL "$p = ", param($p), "\n";
}

# Be sure to close the MAIL input stream so that the message
# actually gets mailed.

close(MAIL);

# Now print a thank-you page

print <<EndHTML;
<h2>Thank You</h2>
<p>Thank you for writing!</p>
<p>Return to our <a href="index.htm l">home page</a></p>
EndHTML

print end_html;

# The dienice subroutine handles errors.

sub dienice {
my ($errmsg) = @_;
print "<h2>Error</h2>\n";
print "<p>$errmsg </p>\n";
print end_html;
exit;
}
Mar 25 '08 #1
1 2900
numberwhun
3,509 Recognized Expert Moderator Specialist
Hi
I am trying to setup a form that automatically sends the form values
via email to a specific address.
I have uploaded the script, which when I run loads a page with the following
error message:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.


According to the tutorial I am using the only thing I needed to change was the
$recipient's email address to my own, which I have done.

my $recipient = 'my@name465.fsn et.co.uk';

I also changed this part to my own email address

print MAIL "To: my\@name465.fsn et.co.uk\n";

Is there perhaps something missing from one of the other headers?


#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBr owser fatalsToBrowser );
use strict;

print header;
print start_html("Res ults");

# Set the PATH environment variable to the same path
# # where sendmail is located:
#
$ENV{PATH} = "/usr/sbin";

# open the pipe to sendmail
open (MAIL, "|/usr/sbin/sendmail -oi -t ") or &dienice("Ca n't fork for sendmail: $!\n");

# change this to your own e-mail address
my $recipient = 'my@name465.fsn et.co.uk';

# Start printing the mail headers
# You must specify who it's to, or it won't be delivered:

print MAIL "To: my\@name465.fsn et.co.uk\n";

# From should probably be the webserver, although you could set it
# to the visitor's email address too.

print MAIL "From: nobody\@nobody. com\n";

# print out a subject line so you know it's from your form cgi.

print MAIL "Subject: Form Data\n\n";

# Now print the body of your mail message.

foreach my $p (param()) {
print MAIL "$p = ", param($p), "\n";
}

# Be sure to close the MAIL input stream so that the message
# actually gets mailed.

close(MAIL);

# Now print a thank-you page

print <<EndHTML;
<h2>Thank You</h2>
<p>Thank you for writing!</p>
<p>Return to our <a href="index.htm l">home page</a></p>
EndHTML

print end_html;

# The dienice subroutine handles errors.

sub dienice {
my ($errmsg) = @_;
print "<h2>Error</h2>\n";
print "<p>$errmsg </p>\n";
print end_html;
exit;
}

Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

My appologies for the delay in getting an answer to your question.

Regards,

Jeff
Apr 17 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2145
by: John Smith | last post by:
I'm writing a service which accepts a POST call, updates a database and returns raw HTTP headers as specified below: HTTP/1.1 200 OK Content-type:text/plain Content-length:3 OK The code runs, and returns my headers, but only after its own:
7
2274
by: Pavils Jurjans | last post by:
Hello, I wanted to get some light in the subject. As I develop ASP.NET applications, it's necessary to understand how exactly the server- communication happens. It seems like initially application is "sleeping", and it is not loaded in the memory. Then, after very first request to the app, it is compiled (aspx files), loaded into memory, and executed. Then, a separate thread is issued to serve my page request, and it takes care for me...
3
1382
by: Anil Kripalani | last post by:
I have a .NET Windows Forms application that I launch from a web browser. The user clicks an HTTP link from an ASP.NET page that launches a .NET exe (All .NET 1.1). The application runs fine so long as I change the IIS virtual root "Execute Permissions" to "Scripts and Executables". Under those circumstances however, when the application exits, I get the error: CGI Error The specified CGI application misbehaved by not returning a...
4
404
by: Chris Newby | last post by:
My project currently requires that I integrate an ASP.NET application with an ASP application. One of the issues I'm having is that I have some very long strings being created in an ASP.NET application that need to somehow appear in a classic ASP session. The strings are too long for cookies or URLs and I'd like to avoid using a database or someother temporary server storage. So far what I've come up with is a .NET class that "spoofs" a...
9
6874
by: John Williams | last post by:
How do I load a HTML page (via URL) and parse the DOM in a Console Application? I've successfully done all this in a Windows Application by using the WebBrowser control, calling the Navigate method on the specified URL, and then, within the DocumentComplete event, parsing the HTML page using mshtml.HTMLDocument. I'm writing it as a console app because I don't need to display the HTML, just search for a specific tag and retrieve a href...
2
2250
by: john.lehmann | last post by:
Attacked is a piece of code which first hits the login page successfully and receives back login cookies. But then when I attempt to hit a page which is restricted to logged in users only, I fail. That seems to be because I am not successfully re-attaching the cookies to the header portion of the this request. I have tried 2 methods which should both work I think. The first was to use install_opener to attach the cookie handler back...
0
6928
by: kjheaney | last post by:
Hi, Im new to all this and i have bluffed my through to designing a few websites, but i now have a problem with a form . I am using Matt Wrights formmail.pl, and i have used dreamweaver to build a site. Every time the submit button in pressed i get the CGI Error, The specified CGI application misbehaved by not returning a complete set of HTTP headers. Can some1 tell me what this is and how i could go about fixing it. remember i said im...
24
2468
by: arnuld | last post by:
i want to create a console application in C++ . what can be the 1st step ? NOTE: i did use Google but that gives me some VC++ based links using non-standard libraries.
1
12460
rajiv07
by: rajiv07 | last post by:
Hi to all , I am using windows 2003 IIS 6.0 web server and i have a web application which is developed using perl language.If i run tis application it gives some errors my error The specified CGI application misbehaved by not returning a complete set of HTTP headers Is anything i have to configure in server
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.