Response header name ' Content- type' contains invalid characters, after running a Perl_CGI script.
Hello ! Everyone, I am back here again to get your help.
Sorry, sorry for getting help alone and not helping other people's post.
But I will try to help others in another way, so please generous.
O.K. let me get started. I got weird error message as shown at the title, while I am reviewing the error_log at /var/log/httpd/ error_log. I never encountered this error message, so I can't figure the point of the error message. Does anyone has any clue to fix this error?
I will post the references.
==== httpd error_log about 10 lines ================
"error_log" 30085L, 10087905B
Entering Ex mode. Type "visual" to go to Normal mode.
[Fri May 19 08:09:31.243913 2023] [http:error] [pid 563189:tid 563250] [client 106.154.124.30:35684] AH02429: Response header name ' Content-
type' contains invalid characters, aborting request, referer: http://110.3.33.130/cgi-bin/cgi53_1_us01.pl?performer_name=alfred_brendel
[Fri May 19 08:10:08.223604 2023] [http:error] [pid 563189:tid 563253] [client 106.154.124.30:35696] AH02429: Response header name ' Content-
type' contains invalid characters, aborting request, referer: http://110.3.33.130/cgi-bin/cgi53_1_us01.pl?performer_name=alfred_brendel
[Fri May 19 08:11:59.726934 2023] [http:error] [pid 563189:tid 563236] [client 106.154.124.30:35710] AH02429: Response header name ' Content-
type' contains invalid characters, aborting request, referer: http://110.3.33.130/cgi-bin/cgi53_1_us01.pl?performer_name=alicia_de_larrocha
[Fri May 19 08:26:02.674690 2023] [http:error] [pid 563189:tid 563241] [client 106.154.124.30:35714] AH02429: Response header name ' Content-
type' contains invalid characters, aborting request, referer: http://110.3.33.130/cgi-bin/cgi53_1_us01.pl?performer_name=alicia_de_larrocha
[Fri May 19 08:26:10.607154 2023] [http:error] [pid 563189:tid 563243] [client 106.154.124.30:35716] AH02429: Response header name ' Content-
type' contains invalid characters, aborting request, referer: http://110.3.33.130/cgi-bin/cgi53_1_us01.pl?performer_name=alicia_de_larrocha
=== CODE ===================
# BEGINNING of cgi53_search_header_us01.pl
print "Content-type: text/html \n\n";
print "
<html>
<head><title>Search Reuslt of $query_performer_name.</title></head>
<body bgcolor=\"#ffffff\">
";
print "
<table>
<tr>
<td width=\"50\"> </td>
<td width=\"600\"><font size=\"5\"><b> $query_performer_name </b></font> </td>
</tr>
</table>
<hr />
";
# Here is border line ===========================================================
Hello ! Everyone. I just got fixed the problem right now. There is a BLANK (white space) in front of ' Content-type ...' like this, that resulted the httpd error mentioned above.
So stupid to myself. But this is the daily life of not-so-bright programmer. Thanks so much !!
I posted another CODE, the CODE which caused the above mentioned error is here below.
=== CODE ======
# BEGINNING of cgi52_search_header_us01.pl
#
print " Content-type: text/html\n\n" ;
print "
Search Result of $query_performer_name.
" ;
print "
$query_performer_name
";
# Here is border line ===========================================================
Sorry I can't add a good posting of HTML tag containing CODE, but it was becuase of cgi52_search_header_us01.pl, not because of cgi53_search_header_us01.pl. And in cgi52_xxx there was a BLANK (white space) like print " Content-type: text/html\n\n" ;
Thanks.
Sometimes just explaining a problem you can't figure out enables you to figure it out. Strange, but true.
I would note that posting something like this on https://stackoverflow.com/ and tagging it with #perl will get you helpful feedback quite quickly.