Giter VIP home page Giter VIP logo

erlang-amf's People

Contributors

abuibrahim avatar lemenkov avatar qianthinking avatar rboyd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

erlang-amf's Issues

Cannot decode

I tried to use amf3:decode to decode AMF content which I have captured in a file named /tmp/tsung_recorder20130311-1025-10.bin. However, it seems to me that the result is not decoded.

Below is what I captured from my erl shell.

juacompe@horus:~/projects/herffjones/erlang-amf/src$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.1  (abort with ^G)
1> c(amf3).
{ok,amf3}
2> {ok, Content} = file:read_file("/tmp/tsung_recorder20130311-1025-10.bin").
{ok,<<0,3,0,0,0,1,0,4,110,117,108,108,0,3,47,49,51,0,0,1,
      242,10,0,0,0,1,17,...>>}
3> {_, Rest} = amf3:decode(Content).
{undefined,<<3,0,0,0,1,0,4,110,117,108,108,0,3,47,49,51,
             0,0,1,242,10,0,0,0,1,17,10,...>>}
4> io:format("~s", [Rest]).
^C^@^@^@^A^@^Dnull^@^C/13^@^@^Aò
^@^@^@^A^Q
source^Soperation^UtimeToLive   body^QclientId^Oheaders^SmessageId^Stimestamp^Wdestination^A^F^Operform^D^@     ^C^A
loaded^F^Y59D88D9A318A^F-retrieveFinePaperItems^FOproductGlobalValueInitializationService       ^A^A^B^B^FIC85A1B2C-7D09-9B2B-B1D2-DC011356C968
^K^A^UDSEndpoint^A      DSId^FIC85A1717-9118-81F4-D237-5DAB430FE859^A^FI6017787D-86CB-859D-B834-59D8D75F2280^D^@^F�blazeEndpointok
5> 

I also tried similar approach in Python using pyamf library.

juacompe@horus:~/projects/herffjones/tsung_recorder/tsung_recorder20130311-1025$ ipython 
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from pyamf import remoting

In [2]: content = file('/tmp/tsung_recorder20130311-1025-10.bin','rb')

In [3]: envelope = remoting.decode(content)

In [4]: print envelope
<Envelope amfVersion=3>
 (u'/13', <Request target=u'null'>[<RemotingMessage  body=[{u'dispatchEvents': False, u'methodName': u'retrieveFinePaperItems', u'subSessionId': u'59D88D9A318A', u'loaded': False, u'serviceName': u'productGlobalValueInitializationService', u'methodArgs': []}] source=None timestamp=0 destination=u'blazeEndpoint' clientId=u'C85A1B2C-7D09-9B2B-B1D2-DC011356C968' headers={'DSId': u'C85A1717-9118-81F4-D237-5DAB430FE859', 'DSEndpoint': None} timeToLive=0 messageId=u'6017787D-86CB-859D-B834-59D8D75F2280' operation=u'perform' />]</Request>)
</Envelope>

The binary I used in my repro steps can be downloaded at tsung_recorder20130311-1025-10.bin.

Any comments or suggestions would be highly appreciated.

Examples

Hi,

Do you have some examples of utilization ?

Thank you,
Alexandre

amf3:decode/1 seems to fail for serialized subclass

I send an object of type "C" which is the third level in a class hierarchy as follows:

Class A (abstract, no properties)
Class B < A
var1:Number = 1
Class C < B
var2:String = "str-value"
var3:Number = 200


stack is something like the following:

** exception error: no function clause matching
amf3:decode(<<5,127,255,255,255,224,0,0,0>>,
{5,
{0,<<"C">>,nil,
{1,<<"var2">>,nil,
{2,<<"var3">>,nil,
{3,<<"var1">>,nil,
{4,<<"str-value">>,nil,nil}}}}}},
{1,
{0,
{object,<<"SentTableActionMsg">>,[]},
nil,nil}},
{1,
{0,
{trait,<<"C">>,false,
false,
[action,amount,table]},
nil,nil}})
in function amf3:decode_dense/6
in call from amf3:decode_object/5
in call from amf3:decode/4
in call from amf3:decode/1

If I cut class C out of the inheritance hierarchy and give it a similar property as class B, then serialize and decode it, it works fine.

Serialize issues

Hi, I'm working with shared objects and got following problem:

Data = <<17,10,11,1,3,97,5,63,211,201,72,133,0,0,0,1>>.
{Arg, <<>>} = amf0:decode(Data). %% {object,<<>>,[{<<"a">>,0.30916035640984774}]}
amf0:encode(Arg).
** exception error: bad argument
in function atom_to_binary/2
called as atom_to_binary(<<"a">>,utf8)
in call from amf0:'-encode/2-lc$^1/1-0-'/1
in call from amf0:encode/2
in call from amf0:encode/1

Issues with references

Hi Ruslan,

I'm hitting a problem with references:

D1 = {date, 123456.45, 1},
D2 = {date, 789456.21, 2},

% happy
D1D2 = amf3:encode([D1,D2]),
D1D1 = amf3:encode([D1,D1]),

% still happy
amf3:decode(D1D2),

% error
amf3:decode(D1D1)

It's hard to tell if the encoding generates wrong references or it's just the decoding part that fails. I have tested with other referentiable (namely: objects) and it fails too, so it's not limited to date references.

Thanks for your help!
D.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.