Giter Club home page Giter Club logo

Comments (5)

DVEfremov avatar DVEfremov commented on August 16, 2024

I've checked the process step by step:

  1. I've got test_file5 for test
    $ ls -l test_file5
    -rw-rw-r-- 1 daniil daniil 425889 Sep 20 19:16 test_file5

  2. run ck push remote-ck-node:: --filename=test_file5

  3. got encoded end of the file at post data:
    ...gZHVtcCBjb21wbGV0ZQotLQoK%22%2C+%22action%22%3A+%22push%22%2C+%22cids%22%3A+%5B%5D%2C+%22out%22%3A+%22con%22%7D

  4. Same end of url decoded JSON (I've compared whole content as well it's the same):
    "file_content_base64":"LS0KLS0gUG9zdGdy...gZHVtcCBjb21wbGV0ZQotLQoK", "action": "push", "cids": [], "out": "con"}

  5. I'v tried to decode manually value of provided file_content_base64
    $ base64 -d file_content_base64 > file_content
    base64: invalid input
    $ ls -l file_content
    -rw-rw-r-- 1 daniil daniil 30038 Sep 21 09:09 file_content
    same size and content as pushed to /tmp/test_file5

so now I see I've got already cut encoded file content at post data marameter ck_json.

So looking into ck push function to find bug ...

from ck-crowdnode.

DVEfremov avatar DVEfremov commented on August 16, 2024

I've printed encoded file at ck/ck/kernel.py:
s=base64.urlsafe_b64encode(s).decode('utf8')
# my debug print out string:
print s

And got at out put
$ck push remote-ck-node:: --filename=test_file5 > ck.out
same cut encoded message already:
...c3RncmVTUUwgZGF0YWJhc2UgZHVtcCBjb21wbGV0ZQotLQoK

But file before encode completely loaded (I've got this from printed "s" value as well)

from ck-crowdnode.

gfursin avatar gfursin commented on August 16, 2024

I now print length of data in the crowdnode server and it's correct.
CK encodes fine - we use this encoding function in all our push/pull files including Android app, various services, etc, and it's compatible with Java implementation (I have checked that before).
HOWEVER, when implementing encoding function, I noticed that there are several standards, and there were recent enhancements to this standard, so old mime functions do not work (I saw it with Java).
You are using C lib from 2003 - I guess it's simply outdated. Can you please search for a newer one
(i.e. the one that will process CK's encoded string correctly) - I saw many discussions on internet about this standard, so I am sure there is something available... Or maybe search for compatible encode function specifically between Python and C ...
BTW, I also added tests directory with _push.sh script ...
Thanks!

from ck-crowdnode.

DVEfremov avatar DVEfremov commented on August 16, 2024

Yes correct. There are different base64 encoding algorithms and Python uses URL safe RFC 3548 version. I've used MIME (RFC 1421) version.
So I've fixed and checked push and pull works now.
Later I''ll try to reproduce my original problem with exact file witch does not come completely for some reason (any way it's out of scope and can be tracked separately)

from ck-crowdnode.

gfursin avatar gfursin commented on August 16, 2024

Yeap, it's working now! Thanks! I close this ticket!

from ck-crowdnode.

Related Issues (11)

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.