mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 18:54:58 +00:00
Gopher: don't add the Lastline.
This commit is contained in:
parent
8b087dff34
commit
e247c9ac6a
33
src/gopher.c
33
src/gopher.c
@ -27,15 +27,6 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
*
|
||||
* - Replace ".<CR><LF>" with ",<CR><LF>" in documents to avoid early stop.
|
||||
* - Allow to configure a gopher-hostname, so that it can be used as default
|
||||
* for streams converted into listings.
|
||||
* - If __gopher_header__ and/or __gopher_footer__ are defined, they are
|
||||
* put before/after directory listings generated by streams.
|
||||
* - Find useful ways to convert the other Redis types to gopher output. */
|
||||
|
||||
#include "server.h"
|
||||
|
||||
/* Emit an item in Gopher directory listing format:
|
||||
@ -80,5 +71,27 @@ void processGopherRequest(client *c) {
|
||||
* will be flagged with CLIENT_CLOSE_AFTER_REPLY, in accordance with the
|
||||
* Gopher protocol. */
|
||||
if (c->argc == 0) decrRefCount(keyname);
|
||||
addReplyProto(c,".\r\n",3);
|
||||
|
||||
/* Note that in theory we should terminate the Gopher request with
|
||||
* ".<CR><LF>" (called Lastline in the RFC) like that:
|
||||
*
|
||||
* addReplyProto(c,".\r\n",3);
|
||||
*
|
||||
* However after examining the current clients landscape, it's probably
|
||||
* going to do more harm than good for several reasons:
|
||||
*
|
||||
* 1. Clients should not have any issue with missing .<CR><LF> as for
|
||||
* specification, and in the real world indeed certain servers
|
||||
* implementations never used to send the terminator.
|
||||
*
|
||||
* 2. Redis does not know if it's serving a text file or a binary file:
|
||||
* at the same time clients will not remove the ".<CR><LF>" bytes at
|
||||
* tne end when downloading a binary file from the server, so adding
|
||||
* the "Lastline" terminator without knowing the content is just
|
||||
* dangerous.
|
||||
*
|
||||
* 3. The utility gopher2redis.rb that we provide for Redis, and any
|
||||
* other similar tool you may use as Gopher authoring system for
|
||||
* Redis, can just add the "Lastline" when needed.
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user