Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e247c9ac
Commit
e247c9ac
authored
Feb 24, 2019
by
antirez
Browse files
Gopher: don't add the Lastline.
parent
8b087dff
Changes
1
Show whitespace changes
Inline
Side-by-side
src/gopher.c
View file @
e247c9ac
...
@@ -27,15 +27,6 @@
...
@@ -27,15 +27,6 @@
* POSSIBILITY OF SUCH DAMAGE.
* 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"
#include "server.h"
/* Emit an item in Gopher directory listing format:
/* Emit an item in Gopher directory listing format:
...
@@ -80,5 +71,27 @@ void processGopherRequest(client *c) {
...
@@ -80,5 +71,27 @@ void processGopherRequest(client *c) {
* will be flagged with CLIENT_CLOSE_AFTER_REPLY, in accordance with the
* will be flagged with CLIENT_CLOSE_AFTER_REPLY, in accordance with the
* Gopher protocol. */
* Gopher protocol. */
if
(
c
->
argc
==
0
)
decrRefCount
(
keyname
);
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.
*/
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment