[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9859: add support for properly creat
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9859: add support for properly creating the response packet for the red5 echo_test. |
Date: |
Thu, 18 Dec 2008 11:48:48 -0700 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9859
committer: address@hidden
branch nick: rtmp
timestamp: Thu 2008-12-18 11:48:48 -0700
message:
add support for properly creating the response packet for the red5 echo_test.
modified:
libnet/http.cpp
libnet/http.h
=== modified file 'libnet/http.cpp'
--- a/libnet/http.cpp 2008-12-18 17:33:31 +0000
+++ b/libnet/http.cpp 2008-12-18 18:48:48 +0000
@@ -1110,19 +1110,35 @@
// is only used for testing by developers. The format appears to be
// two strings, followed by a double, followed by the "onResult".
amf::Buffer &
+HTTP::formatEchoResponse(const std::string &num, amf::Element &el)
+{
+ GNASH_REPORT_FUNCTION;
+
+ boost::shared_ptr<amf::Buffer> data = amf::AMF::encodeElement(el);
+ return formatEchoResponse(num, data->reference(), data->size());
+}
+
+amf::Buffer &
HTTP::formatEchoResponse(const std::string &num, amf::Buffer &data)
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *tmpptr = data.reference();
- amf::Buffer fixme("00 00 00 00 00 01 00 0b");
- amf::Buffer fixme1("00 04");
+ return formatEchoResponse(num, data.reference(), data.size());
+}
+
+amf::Buffer &
+HTTP::formatEchoResponse(const std::string &num, boost::uint8_t *data, size_t
size)
+{
+ GNASH_REPORT_FUNCTION;
+
+ Network::byte_t *tmpptr = data;
+
+ // FIXME: temporary hacks while debugging
+ amf::Buffer fixme("00 00 00 00 00 01");
amf::Buffer fixme2("ff ff ff ff");
- amf::Buffer fixme3("01 00");
- string null = "null";
_buffer = "HTTP/1.1 200 OK\r\n";
formatContentType(DiskStream::FILETYPE_AMF);
- formatContentLength(data.size());
+ formatContentLength(size);
// Pretend to be Red5 server
formatServer("Jetty(6.1.7)");
@@ -1130,23 +1146,25 @@
// All HTTP messages are followed by a blank line.
terminateHeader();
- // Add the binary blob
+ // Add the binary blob for the header
_buffer += fixme;
- // Add the response
-// _buffer += res;
-
- // Add the NULL name for this property
- _buffer += fixme1;
- _buffer += null;
-
+ // Make the result response, which is the 2nd data item passed in
+ // the request, a slash followed by a number like "/2".
+ string result = num;
+ result += "/onResult";
+ boost::shared_ptr<amf::Buffer> res = amf::AMF::encodeString(result);
+ _buffer.append(res->begin()+1, res->size()-1);
+
+ // Add the null data item
+ boost::shared_ptr<amf::Buffer> null = amf::AMF::encodeString("null");
+ _buffer.append(null->begin()+1, null->size()-1);
+
// Add the other binary blob
_buffer += fixme2;
-// cerr << "FIXME: " << hexify(tmpptr, 6, false) << endl;
// Add the AMF data we're echoing back
-// _buffer.append(tmpptr, insize);
-// _buffer += fixme3;
+ _buffer.append(data, size);
return _buffer;
}
=== modified file 'libnet/http.h'
--- a/libnet/http.h 2008-12-18 17:33:31 +0000
+++ b/libnet/http.h 2008-12-18 18:48:48 +0000
@@ -204,7 +204,9 @@
amf::Buffer &formatHeader(http_status_e type);
amf::Buffer &formatRequest(const std::string &url, http_method_e req);
// format a response to the 'echo' test used for testing Gnash.
+ amf::Buffer &formatEchoResponse(const std::string &num, amf::Element &el);
amf::Buffer &formatEchoResponse(const std::string &num, amf::Buffer &data);
+ amf::Buffer &formatEchoResponse(const std::string &num, boost::uint8_t
*data, size_t size);
amf::Buffer &formatMethod(const std::string &data)
{return formatCommon("Method: " + data); };
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9859: add support for properly creating the response packet for the red5 echo_test.,
rob <=