diff --git a/MonaCore/include/Mona/QueryReader.h b/MonaCore/include/Mona/QueryReader.h index 212c54c..895a06b 100644 --- a/MonaCore/include/Mona/QueryReader.h +++ b/MonaCore/include/Mona/QueryReader.h @@ -29,10 +29,9 @@ namespace Mona { class QueryReader : public DataReader, public virtual Object { public: - QueryReader(const char* query) : _query(query),_current(_query),_type(END) {} + QueryReader(PacketReader& packet) : DataReader(packet),_type(END) {} - const char* query() const { return _query; } - void reset() { _current = _query; _type = END; } + void reset() { packet.reset(); _type = END; } private: enum { @@ -45,8 +44,6 @@ class QueryReader : public DataReader, public virtual Object { void writeValue(UInt8 type, DataWriter& writer); UInt8 valueType(); - const char* _query; - const char* _current; std::string _property; std::string _value; Date _date; diff --git a/MonaCore/sources/HTTP/HTTPSession.cpp b/MonaCore/sources/HTTP/HTTPSession.cpp index 4b39d58..1bf8ead 100644 --- a/MonaCore/sources/HTTP/HTTPSession.cpp +++ b/MonaCore/sources/HTTP/HTTPSession.cpp @@ -114,7 +114,8 @@ void HTTPSession::receive(const shared_ptr& pPacket) { peer.properties().setString(it.first, it.second); // Create parameters for onConnection or a GET onRead/onWrite/onMessage - QueryReader parameters(peer.query.c_str()); + PacketReader query(BIN peer.query.data(), peer.query.size()); + QueryReader parameters(query); Exception ex; diff --git a/MonaCore/sources/MIME.cpp b/MonaCore/sources/MIME.cpp index 5180bff..e23806d 100644 --- a/MonaCore/sources/MIME.cpp +++ b/MonaCore/sources/MIME.cpp @@ -85,7 +85,7 @@ bool MIME::CreateDataReader(Type type,PacketReader& packet,const PoolBuffers& po pReader.reset(new AMFReader(packet)); return true; case QUERY: - pReader.reset(new QueryReader(STR packet.data())); + pReader.reset(new QueryReader(packet)); return true; } pReader.reset(); diff --git a/MonaCore/sources/QueryReader.cpp b/MonaCore/sources/QueryReader.cpp index 58e6a70..5ed486d 100644 --- a/MonaCore/sources/QueryReader.cpp +++ b/MonaCore/sources/QueryReader.cpp @@ -38,12 +38,14 @@ UInt8 QueryReader::followingType() { _value.assign(value); } else _value = std::move(key); - return false; + return false; // we just want the first following key }); - if (!_current || Util::UnpackQuery(_current, forEach) == 0) + if (!packet.available()) return END; + SCOPED_STRINGIFY(STR packet.current(),packet.available(), if (Util::UnpackQuery(STR packet.current(), forEach) == 0) return END;) + if (hasProperty) _type = OBJECT; else @@ -54,19 +56,25 @@ UInt8 QueryReader::followingType() { bool QueryReader::readOne(UInt8 type, DataWriter& writer) { - + + const UInt8* cur = packet.current(); + const UInt8* end = cur+packet.available(); if (type==OBJECT) { // OBJECT writer.beginObject(); do { + cur = packet.current(); writer.writePropertyName(_property.c_str()); writeValue(valueType(), writer); + // next! - _current = strchr(_current, '&'); + while (cur) SCRIPT_CALLBACK_FIX_INDEX } else if (strcmp(name, "fromQuery") == 0) { - SCRIPT_WRITE_FUNCTION(LUAInvoker::FromQuery) + SCRIPT_WRITE_FUNCTION(LUAInvoker::FromData) SCRIPT_CALLBACK_FIX_INDEX } else if (strcmp(name, "absolutePath") == 0) { SCRIPT_WRITE_FUNCTION(LUAInvoker::AbsolutePath) diff --git a/MonaServer/sources/LUAInvoker.h b/MonaServer/sources/LUAInvoker.h index 451fada..7624a94 100644 --- a/MonaServer/sources/LUAInvoker.h +++ b/MonaServer/sources/LUAInvoker.h @@ -129,7 +129,6 @@ class LUAInvoker { static int FromXML(lua_State *pState); static int ToXML(lua_State *pState); - static int FromQuery(lua_State *pState); static int Time(lua_State *pState); static int ToAMF0(lua_State *pState); diff --git a/clients/samples/Meeting/VideoMeeting.swf b/clients/samples/Meeting/VideoMeeting.swf index 0df0032..e1603b0 100644 Binary files a/clients/samples/Meeting/VideoMeeting.swf and b/clients/samples/Meeting/VideoMeeting.swf differ