1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

STRING_DIR_SEP in file redirects

This commit is contained in:
Witold Filipczyk 2006-07-02 09:01:14 +02:00 committed by Witold Filipczyk
parent 7934d3c7d6
commit 3fd1ac87bd
2 changed files with 4 additions and 2 deletions

3
src/cache/cache.c vendored
View File

@ -15,6 +15,7 @@
#include "main/main.h"
#include "main/object.h"
#include "network/connection.h"
#include "osdep/osdep.h"
#include "protocol/protocol.h"
#include "protocol/proxy.h"
#include "protocol/uri.h"
@ -694,7 +695,7 @@ redirect_cache(struct cache_entry *cached, unsigned char *location,
/* XXX: We are assuming here that incomplete will only be zero when
* doing these fake redirects which only purpose is to add an ending
* slash *cough* dirseparator to the end of the URI. */
if (incomplete == 0 && location[0] == '/' && location[1] == 0) {
if (incomplete == 0 && dir_sep(location[0]) && location[1] == 0) {
/* To be sure use get_uri_string() to get rid of post data */
uristring = get_uri_string(cached->uri, URI_ORIGINAL);
if (uristring) add_to_strn(&uristring, location);

View File

@ -26,6 +26,7 @@
#include "main/module.h"
#include "network/connection.h"
#include "network/socket.h"
#include "osdep/osdep.h"
#include "protocol/common.h"
#include "protocol/file/cgi.h"
#include "protocol/file/file.h"
@ -274,7 +275,7 @@ file_protocol_handler(struct connection *connection)
* function properly the directory url must end with a
* directory separator. */
if (name.source[0] && !dir_sep(name.source[name.length - 1])) {
redirect_location = "/";
redirect_location = STRING_DIR_SEP;
state = S_OK;
} else {
state = list_directory(connection, name.source, &page);