Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebView+cgi
QtWS25 Last Chance

QWebView+cgi

Scheduled Pinned Locked Moved Qt WebKit
6 Posts 4 Posters 7.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • niqtN Offline
    niqtN Offline
    niqt
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Can you dump (GET -es, telnet, netcat, LiveHTTPHeaders...) and paste here a complete response from the server?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • niqtN Offline
        niqtN Offline
        niqt
        wrote on last edited by
        #3

        @
        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> &nbsp<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>
            &lt;!-- end content --&gt;
        
            <div style="clear: both;">&nbsp;</div>
        

        </div>
        <!-- end page -->
        <!-- start footer -->
        <div id="footer">

        </div>
        <!-- end footer -->
        </body>
        </html>

        @

        1 Reply Last reply
        0
        • B Offline
          B Offline
          baysmith
          wrote on last edited by
          #4

          Try changing the first line to

          @
          printf("Content-Type:text/html\r\n\r\n");
          @

          Nokia Certified Qt Specialist.

          1 Reply Last reply
          0
          • niqtN Offline
            niqtN Offline
            niqt
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DavidGOrtega
              wrote on last edited by
              #6

              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...

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved