Re: Suggestions for custom application-layer protocol?
From: James Antill (james-netnews_at_and.org)
Date: 05/27/05
- Next message: Paul Keinanen: "Re: Suggestions for custom application-layer protocol?"
- Previous message: James Antill: "Re: Suggestions for custom application-layer protocol?"
- In reply to: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Next in thread: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Reply: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 27 May 2005 13:04:09 -0400
On Fri, 27 May 2005 14:59:49 +0000, Grant Edwards wrote:
> On 2005-05-27, James Antill <james-netnews@and.org> wrote:
>
>>> If you're using a text-based protocol, you don't nead a header
>>> with a payload count to tell you where the message ends. Use
>>> an end-of-message character or string. The cr/lf pair is used
>>> as the end-of-message delimiter by a lot of text-based
>>> runs-on-top of TCP protocols. That approach works wonderfully
>>> with line-oriented high-level text-handling libraries and
>>> utilties -- you can do all sorts of useful stuff using nothing
>>> but a few utilities like netcat, expect, and so on.
>>
>> It interacts well with telnet,
>
> If you handle IAC seqeunces -- at least well enough to ignore
> them.
I don't know of any HTTP, SMTP, NNTP, POP3, IMAP, etc. server that does
anything with IAC sequences. Generally servers that care initiate by
sending IAC commands EOR, NAWS and TTYPE etc to the client.
>> which is about the best thing that can be said for it.
>
> And it's a pretty big thing, in my experience.
It's "big" because it's there already so noone has to write a
simple client to test a service with. If SMTP had been written
using netstrings, then a telnetstr command would be available
everywhere and this "big" thing would be worth nothing.
A similar thing is happening with HTTP, it's not "good"[1] but there are
a significant number of tools that understand a HTTP stream ... so people
hack it into places it shouldn't be so they can leverage those tools.
>> There are large problems with how you limit "too long" lines,
>
> What problems?
Say I connect to an SMTP service and keep sending 'a', the other end has
to keep accepting data and parsing it upto the amount it limits itself to
accepting for a single line. With something like a netstring the remote
end can decide within 10 characters if it's going to just drop the
connection/message or handle it.
>> and what happens when you hit a CR or LF on it's own.
>
> Yes, that can be a problem if you have to be able to include arbitrary
> strings in the message body. I was under the impression that this
> wasn't the case for the OP's application. I could be wrong.
It isn't just a problem of arbitrary data, but of different
clients/servers parsing the same data in different ways. This is
obviously a bigger problem the more implementations of clients and servers
you have, and how compatible you want to be ... but even with just one
client and one server it wouldn't be unique to have silent bugs where
someone typed \n\r or r\\n or just \n instead of \r\n at one point in the
code.
At which point a third application implementing the protocol, or a
supposedly compatible change to either the server or client can bring out
bugs (often in the edge cases) ... something like netstrings is much
less likely to have this kind of problem.
[1] http://www.and.org/texts/server-http
-- James Antill -- james@and.org http://www.and.org/vstr/httpd
- Next message: Paul Keinanen: "Re: Suggestions for custom application-layer protocol?"
- Previous message: James Antill: "Re: Suggestions for custom application-layer protocol?"
- In reply to: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Next in thread: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Reply: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|