Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer error #7

Open
chrisschaub opened this issue Nov 4, 2016 · 15 comments
Open

buffer error #7

chrisschaub opened this issue Nov 4, 2016 · 15 comments

Comments

@chrisschaub
Copy link
Collaborator

I am running the nodepp server with a simple login / pass setup. I get a secure connection no problem, but then I get this error right after welcome screen is echoed out ...

buffer.js:680
throw new RangeError('index out of range');
^

RangeError: index out of range
at checkOffset (buffer.js:680:11)
at Buffer.readUInt32BE (buffer.js:754:5)
at ProtocolConnection.readStream (/home/ubuntu/dev/nodepp/lib/connection.js:89:37)
at TLSSocket. (/home/ubuntu/dev/nodepp/lib/connection.js:59:22)
at emitNone (events.js:67:13)
at TLSSocket.emit (events.js:166:7)
at emitReadable_ (_stream_readable.js:419:10)
at emitReadable (_stream_readable.js:413:7)
at readableAddChunk (_stream_readable.js:164:13)
at TLSSocket.Readable.push (_stream_readable.js:111:10)

@chrisschaub
Copy link
Collaborator Author

Get this as it is starting up ...

debug: Calling epp command.
info: Establishing connection..
info: Established a secure connection.
debug: Read event
debug: endian length: 500
debug: current buffer length 4
debug: Read event
debug: endian length: 500
debug: current buffer length 5
debug: Read event
debug: endian length: 500
debug: current buffer length 500
info: Received: <login xml ....>

@heytrav
Copy link
Owner

heytrav commented Nov 4, 2016

Seems like it's calling readStream right after printing out the greeting and the buffer is empty.
I don't have any means to debug this (no registry accounts), but it might be worthwhile to log out what is in the buffer just before it tries to read the totalLength.

@chrisschaub
Copy link
Collaborator Author

chrisschaub commented Nov 4, 2016

info: Established a secure connection.
debug: Read event
<Buffer 00 00 01 f4>
debug: endian length: 500
debug: current buffer length 4
debug: Read event
<Buffer 00 00 01 f4 3c>
debug: endian length: 500
debug: current buffer length 5
debug: Read event

<Buffer 00 00 01 f4 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f 3e 0a 3c 65 70 70 20 78 6d ... >

debug: endian length: 500
debug: current buffer length 500
info: Received:
info:
..... xml here
info: Finished writing to server.
debug: Read event

<Buffer 00>

buffer.js:680
throw new RangeError('index out of range');
^

RangeError: index out of range
at checkOffset (buffer.js:680:11)
at Buffer.readUInt32BE (buffer.js:754:5)
at ProtocolConnection.readStream (/home/ubuntu/dev/nodepp/lib/connection.js:88:37)
at TLSSocket. (/home/ubuntu/dev/nodepp/lib/connection.js:59:22)
at emitNone (events.js:67:13)
at TLSSocket.emit (events.js:166:7)
at emitReadable_ (_stream_readable.js:419:10)
at emitReadable (_stream_readable.js:413:7)
at readableAddChunk (_stream_readable.js:164:13)
at TLSSocket.Readable.push (_stream_readable.js:111:10)

@chrisschaub
Copy link
Collaborator Author

Changing calls from

readUInt32BE

to

readUIntBE

seems to have fixed it. For nodejs greater than .12.

From here:
http://stackoverflow.com/questions/30911185/javascript-reading-3-bytes-buffer-as-an-integer

readUIntBE allows a variable number of bytes.

@chrisschaub
Copy link
Collaborator Author

I'm past that issue, I think. Now all of my requests give ...

{"error":"Not logged in."}

Assuming this means my creds are failing?

@heytrav
Copy link
Owner

heytrav commented Nov 5, 2016

You'd have to log out the xml output to make sure how it's responding to the login. If they are failing you should be getting an error message in response to your login request.

@heytrav
Copy link
Owner

heytrav commented Nov 5, 2016

And would you mind submitting a patch for the fix?

@chrisschaub
Copy link
Collaborator Author

Yes, I'll submit a patch. It seems like our server needs all requests wrapped in epp tag ?

�<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
 <response>
  <result code="2001">
   <msg lang="en-US">Command syntax error</msg>
   <value>
    <text>[Error] :2:45: cvc-elt.1: Cannot find the declaration of element 'epp'.</text>
   </value>
  </result>
 </response>
</epp>

@heytrav
Copy link
Owner

heytrav commented Nov 5, 2016

All the requests should be enclosed in <epp> by default. What does the namespaces part of your config contain?

@chrisschaub
Copy link
Collaborator Author

Yeah, that was up. Making pull reqeust for BigEndian stuff.

On Sat, Nov 5, 2016 at 12:17 PM, William Travis Holton <
[email protected]> wrote:

All the requests should be enclosed in by default. What does the
namespaces part of your config contain?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADKssFe9lr5triP4zWlzZBFOEE7WDLuZks5q7LpBgaJpZM4KpuUW
.

Christopher Schaub
http://chris.schaub.com

@chrisschaub
Copy link
Collaborator Author

#8

@chrisschaub
Copy link
Collaborator Author

One last question. I get back a successful login now on the console. Should I be able to post to port 3000 a command like

{"domain": "something.ga"}

when I do, I get a not logged in error, even though I can see the server running port 3000 got logged in. Do I need to use the nodepp-req library and rabbitmq to test this? Or should posting to a port as json be enough to test? Thanks for your help!

@heytrav
Copy link
Owner

heytrav commented Nov 5, 2016

I assume you mean posting that data structure to something like:

http://localhost:3000/command/<registry in config>/checkDomain

or

http://localhost:3000/command/<registry in config>/infoDomain

Then yes, that should work. The rabbitmq setup is just an alternative way to use the service, but it was intended to work via http requests as well.

@chrisschaub
Copy link
Collaborator Author

chrisschaub commented Nov 8, 2016

Ok, making progress. I needed to add a try / catch to handle cases where the buffer is empty during phases of the connection. But I am still getting this error:

The matching wildcard is strict, but no declaration can be found for element 'domain:check'."

Assuming the issues is with namespaces. For domain they are ...

"domain": {
"xmlns": "urn:ietf:params:xml:ns:domain-1.0",
"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation": "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"
},

That's what I was given. Any ideas what else could be causing this? Thanks!

@heytrav
Copy link
Owner

heytrav commented Nov 8, 2016

What do you have in the services section of your config? This tells the EPP server which types of entity you want to manipulate. Some registries support custom objects and some don't support contacts for example. An example of what I have is

            "services": ["domain", "contact"],

and for namespaces:

            "namespaces":{
                "epp": {
                    "xmlns": "urn:ietf:params:xml:ns:epp-1.0"
                },
                "domain": {
                    "xmlns": "urn:ietf:params:xml:ns:domain-1.0"
                },
                "contact": {
                    "xmlns": "urn:ietf:params:xml:ns:contact-1.0"
                },
                "DNSSEC": {
                    "xmlns": "urn:ietf:params:xml:ns:secDNS-1.1"
                }
            }

It's not really necessary to put xmlns:xsi or xsi:schemaLocation in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants