gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9998: read echo request from a file


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9998: read echo request from a file or the network, and send a correct response.
Date: Sat, 21 Feb 2009 10:34:03 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9998
committer: address@hidden
branch nick: rtmp
timestamp: Sat 2009-02-21 10:34:03 -0700
message:
  read echo request from a file or the network, and send a correct response.
modified:
  cygnal/cgi-bin/echo/gateway.cpp
=== modified file 'cygnal/cgi-bin/echo/gateway.cpp'
--- a/cygnal/cgi-bin/echo/gateway.cpp   2009-02-21 15:37:21 +0000
+++ b/cygnal/cgi-bin/echo/gateway.cpp   2009-02-21 17:34:03 +0000
@@ -120,34 +120,43 @@
     
     // Wait for data, and when we get it, process it.
     boost::shared_ptr<amf::Buffer> content;
+    vector<boost::shared_ptr<amf::Element> > headers;
+    int ret = 0;
+    net.setTimeout(30);
     do {
         // See if we have any messages waiting
         if (infile.empty()) {
-            content.reset(new amf::Buffer);
-            if (net.readNet(netfd, *content) == 0) {
+            boost::shared_ptr<amf::Buffer> content = net.readNet();
+            if (!content) {
                 done = true;
             }
+            content->dump();
+            headers = net.parseEchoRequest(*content);
         } else {
-            DiskStream filestream(infile);
+            DiskStream filestream;
+            filestream.open(infile);
             filestream.loadToMem(0);
-//            content.reset(new amf::Buffer(filestream.getPagesize()));
-//            content->copy(filestream.get(), filestream.getPagesize());
+            headers = net.parseEchoRequest(filestream.get(), 
filestream.getPagesize());
+            filestream.close();
+            done = true;
         }
         
-        log_debug("Got CGI echo request in POST");
-//     cerr << "FIXME 2: " << hexify(content->reference(), 
content->allocated(), true) << endl;
-
-       vector<boost::shared_ptr<amf::Element> > headers = 
net.parseEchoRequest(*content);
        //boost::shared_ptr<amf::Element> &el0 = headers[0];
        
-        if (headers.size() >= 4) {
-            if (headers[3]) {
-                amf::Buffer &reply = 
net.formatEchoResponse(headers[1]->getName(), *headers[3]);
-//         cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(), 
true) << endl;
-//         cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(), 
false) << endl;
-               net.writeNet(netfd, reply);
-           }
-       }
+        if (!done) {
+            if (headers.size() >= 4) {
+                if (headers[3]) {
+                    amf::Buffer &reply = 
net.formatEchoResponse(headers[1]->getName(), *headers[3]);
+                    if (infile.empty()) {
+                        net.writeNet(netfd, reply);
+                        reply.dump();
+                        done = true;
+                    } else {
+                        cerr << hexify(reply.reference(), reply.allocated(), 
true) << endl;
+                    }
+                }
+            }
+        }
     } while(done != true);
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]