summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-07-11 14:55:12 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-07-11 14:55:12 +0000
commitf6f1fe1ceefc31f254184684596d84a84f17c67a (patch)
treebb8cf06d95c6372062e7bd24b16f6a8af325ad15 /amiga
parentd5577b64faab7a85af2844f3e38edb5df8e2393d (diff)
downloadnetsurf-f6f1fe1ceefc31f254184684596d84a84f17c67a.tar.gz
netsurf-f6f1fe1ceefc31f254184684596d84a84f17c67a.tar.bz2
Allow browsing directories. Clicking through from the root of a volume doesn't work
(needs some url_to_path translation magic or an #ifdef'd patch in render/directory.c) and the [..] parent link always points to "file:///" for some reason, but other than that it works. svn path=/trunk/netsurf/; revision=10627
Diffstat (limited to 'amiga')
-rwxr-xr-xamiga/fetch_file.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/amiga/fetch_file.c b/amiga/fetch_file.c
index 8624b469a..b443b9b54 100755
--- a/amiga/fetch_file.c
+++ b/amiga/fetch_file.c
@@ -45,6 +45,7 @@ struct ami_file_fetch_info {
char *url; /**< URL of this fetch. */
bool aborted;
bool locked;
+ bool is_dir;
struct nsObject *obj;
int httpcode;
int64 len;
@@ -296,17 +297,49 @@ void ami_fetch_file_poll(const char *scheme_ignored)
}
else
{
+ char header[64];
STRPTR errorstring;
+ struct ExamineData *fib;
+ if(fib = ExamineObjectTags(EX_StringNameInput,fetch->path,TAG_DONE))
+ {
+ if(EXD_IS_DIRECTORY(fib)) fetch->is_dir = true;
+ FreeDosObject(DOS_EXAMINEDATA,fib);
+ }
+
+ if(fetch->is_dir == true)
+ {
+ fetch_set_http_code(fetch->fetch_handle, 200);
+ fetch->mimetype = fetch_mimetype(fetch->path);
+ LOG(("mimetype %s", fetch->mimetype));
+
+ snprintf(header, sizeof header,
+ "Content-Type: %s",
+ fetch->mimetype);
+ ami_fetch_file_send_callback(FETCH_HEADER,
+ fetch, header, strlen(header), errorcode);
- errorstring = ASPrintf("%s %s",messages_get("FileError"),fetch->path);
- fetch_set_http_code(fetch->fetch_handle,404);
+ ami_fetch_file_send_callback(
+ FETCH_DATA, fetch,
+ fetch->path,
+ strlen(fetch->path), errorcode);
+
+ ami_fetch_file_send_callback(FETCH_FINISHED,
+ fetch, NULL, 0,
+ errorcode);
+
+ fetch->aborted = true;
+ }
+ else
+ {
+ errorstring = ASPrintf("%s %s",messages_get("FileError"),fetch->path);
+ fetch_set_http_code(fetch->fetch_handle,404);
- errorcode = FETCH_ERROR_HTTP_NOT2;
- ami_fetch_file_send_callback(FETCH_ERROR, fetch,
- errorstring, 0,
- errorcode);
- fetch->aborted = true;
- FreeVec(errorstring);
+ errorcode = FETCH_ERROR_HTTP_NOT2;
+ ami_fetch_file_send_callback(FETCH_ERROR, fetch,
+ errorstring, 0, errorcode);
+ fetch->aborted = true;
+ FreeVec(errorstring);
+ }
}
}
}