njh/node-owfs

Directory Listing Payload

Opened this issue · 6 comments

njh commented

The current directory listing code has an example owserver response payload of:

var payloadResult = '/01.A7F1D92A82C8\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0011\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0010\u0000\u0000\u0000\u0000/10.D8FE434D9855\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0011\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0010\u0000\u0000\u0000\u0000/22.8CE2B3471711\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0011\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0010\u0000\u0000\u0000\u0000/29.98542F112D05\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0000\u0000\u0000';

I have never seen anything like this in a real-world situation. And from reading the protocol documentation - I can't se how it is a valid response.

@colinl have you ever seen anything like this in the payload field?

If not, I think I will remove the code and tests that handle this.
I have a feeling that it was due to a bug elsewhere in the code.

I have not actually used it for getting a directory listing, but I can't see why it would look like that.

I suspect the binary stuff is additional headers interspersed between payloads, so caused by the bug in issue #26.

njh commented

Yes, I agree with you @colinl - it looks just like additional headers. I am going to simplify the code and test but then should probably do some testing with hardware before making another release.

Which code in particular do you think can be simplified?

njh commented

This strips out any characters in the range 0x00 - 0x1F:

var exp = new RegExp('[\u0000-\u001F]', 'g')

I am going to change it to just remove a trailing NULL.

Ah right, I am with you now. I think you are correct, the fix for #26 should stop the headers from being there at that point in the code. Which is what I already said a few days ago, I am getting old.