nodepp icon indicating copy to clipboard operation
nodepp copied to clipboard

Problem receiving responses more than 1024 bytes long

Open somebee opened this issue 8 years ago • 8 comments

Hi. I'm having problems receiving responses that are more than 2014 bytes long. I guess they spill over into multiple chunks, and as far as I can see - nodepp does not handle this at all? https://github.com/heytrav/nodepp/blob/master/lib/connection.js#L68-L74

somebee avatar Sep 07 '15 07:09 somebee

I'll have to investigate this. Thanks for bringing it to my attention.

Could you give me some details about which epp command you are using and what kind of data the response has? That would help me debug this.

On 7 September 2015 7:53:04 pm NZST, Sindre Aarsaether [email protected] wrote:

Hi. I'm having problems receiving responses that are more than 2014 bytes long. I guess they spill over into multiple chunks, and as far as I can see - nodepp does not handle this at all? https://github.com/heytrav/nodepp/blob/master/lib/connection.js#L68-L74


Reply to this email directly or view it on GitHub: https://github.com/heytrav/nodepp/issues/1

Sent from my Android device with K-9 Mail. Please excuse my brevity.

heytrav avatar Sep 07 '15 08:09 heytrav

Any kind of response with more than 1024 characters - but most responses are shorter. It happens with the domain-info command for norwegian domains through Norid - where there are some extra information about the owner etc.

somebee avatar Sep 07 '15 09:09 somebee

I'm working on a fix right now with some other stuff that I'm in the process of refactoring. If you would like to try checking out the refactor-deploy branch and testing yourself you are welcome to.

The company I work at doesn't actually do any of its own direct registration with EPP registries so I have to test with the provider that we use that has it's own interface.

heytrav avatar Sep 09 '15 03:09 heytrav

I was testing this code for making my own epp client code, and the fix seem working. The only thing is i'm using strict mode and the latest nodejs.

I had to change some things:

var streamBuffer = stream.read();
    if (streamBuffer !== null) {
        if (this.buffer === undefined) {
            this.buffer = streamBuffer;
        } else {
            this.buffer = Buffer.concat([this.buffer, streamBuffer]);
        }
        var bigEndian = this.buffer.slice(0, 4);
        var totalLength = new Buffer(bigEndian).readUInt32BE(0);
        var restOfBuffer = this.buffer.slice(4);
        var currentLength = this.buffer.length;
        console.log("endian length: ", totalLength);
        console.log("current buffer length", currentLength);
        if (this.buffer.length === totalLength || restOfBuffer.length === totalLength) {
            console.log(restOfBuffer.toString());
            this.buffer = undefined;
        }
    }

gcmartijn avatar Nov 10 '15 10:11 gcmartijn

@gcmartijn Would you mind creating a pull request with what you have changed?

heytrav avatar Nov 10 '15 18:11 heytrav

lol i dont know how, i dont use github like that Op 10 nov. 2015 19:45 schreef "William Travis Holton" < [email protected]>:

@gcmartijn Would you mind creating a pull request with what you have changed?

— Reply to this email directly or view it on GitHub.

gcmartijn avatar Nov 10 '15 19:11 gcmartijn

@gcmartijn fair enough. Can you paste the output of git diff with my branch?

heytrav avatar Nov 10 '15 19:11 heytrav

sorry, i'm not using git that way, and only take a small part of your big/little endian code. the read socket part. :-) using copy/past. for a local test script Op 10 nov. 2015 20:53 schreef "William Travis Holton" < [email protected]>:

@gcmartijn https://github.com/gcmartijn fair enough. Can you paste the output of git diff with my branch?

— Reply to this email directly or view it on GitHub https://github.com/heytrav/nodepp/issues/1#issuecomment-155547482.

gcmartijn avatar Nov 10 '15 20:11 gcmartijn