QWebView+cgi
-
Hi,
i have a cgi, firefox, konqueror and chrome showing is in correct mode, instead QWebVIew show nothing! QWebInspector report blank page.
My cgi code is:
@
printf("Content-Type:text/html\n\n");
fid=fopen("/usr/lib/cgi-bin/top_template.html","r");
while(fgets(string,256,fid)!=NULL)
printf("%s",string);
fclose(fid);printf("<br>\n");
printf("<form name="dcontrol" action="/cgi-bin/dcontrol" method="GET">\n");
printf("<input type="hidden" name="NoData" value="1"/>\n");
//printf("<input type="text" value=" Monitor off"/>\n");
printf("<p><strong>");
printf("my string ");
printf("</strong></p>\n");
printf("<input type="submit" value="Update"/>\n");
printf("</form>\n");fid=fopen("bottom_template.html","r");
while(fgets(string,256,fid)!=NULL)
printf("%s",string);
fclose(fid);
@What's happen?
-
@
GET /cgi-bin/dcontrol
Monitor Spento.
Content-Type:text/html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Presidium</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<!-- start header -->
<div id="logo">
<h1>  <a href="/tm_ui/main_page.html"><img src="/images/logo_presidium.png"></a></h1>
</div>
<div id="header">
<div id="menu">
<ul>
<li><a href="/terminal.html">Home</a></li>
<li><a href="/cgi-bin/ccontrol">Dati</a></li>
<li><a href="/cgi-bin/dcontrol">V100</a></li>
<li><a href="/tm_ui/main_page.html">Menu</a></li>
</ul>
</div>
</div>
<!-- end header -->
</div>
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<br>
<form name="dcontrol" action="/cgi-bin/dcontrol" method="GET">
<input type="hidden" name="NoData" value="1"/>
<p><strong>Spiacenti Monitor spento </strong></p>
<input type="submit" value="Aggiorna"/>
</form>
</div></div> <!-- end content --> <div style="clear: both;"> </div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer"></div>
<!-- end footer -->
</body>
</html>@
-
Hello,
[quote author="nicola1" date="1293138310"]I solved, the problem was boa webserver and cgi. In the cgi i have a printf before @ printf("Content-Type:text/html\n\n");@ In this boa behaviour is different from apache.[/quote]
As far I can go the problem is not a matter of Apache but the way the OS determine the string end.
A few months ago I implemented my own version of the HttpRequestHeader parsing al the content to Hash POST and GET vars. Looking at the original implementation I could find a very interesting and simple OS strind end detector. Have a look to the source code:
@void HttpRequestHeader::setOSCharEnd(QString request)
{
this->_osCharEnd = "\n";
int pos = request.indexOf(QLatin1Char('\n'));if (pos > 0 && request.at(pos - 1) == QLatin1Char('\r')) { this->_osCharEnd = "\r\n"; }
}@
request is a raw http request sended by a browser to my server...