projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6e27759
)
Atachment downloading: choose HTTP-Errorcode depending on the server error.
author
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 14 Jan 2012 15:49:56 +0000
(16:49 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 14 Jan 2012 15:49:56 +0000
(16:49 +0100)
webcit/messages.c
patch
|
blob
|
history
diff --git
a/webcit/messages.c
b/webcit/messages.c
index 5ae3eb0d491601d2e4d5c6c51e01a534e715c41e..2915ce1480d5b623c2320395ee8e7cad63830c56 100644
(file)
--- a/
webcit/messages.c
+++ b/
webcit/messages.c
@@
-1721,6
+1721,7
@@
void postpart(StrBuf *partnum, StrBuf *filename, int force_download)
void mimepart(int force_download)
{
long msgnum;
void mimepart(int force_download)
{
long msgnum;
+ long ErrorDetail;
StrBuf *att;
wcsession *WCC = WC;
StrBuf *Buf;
StrBuf *att;
wcsession *WCC = WC;
StrBuf *Buf;
@@
-1734,7
+1735,7
@@
void mimepart(int force_download)
serv_printf("OPNA %ld|%s", msgnum, ChrPtr(att));
StrBuf_ServGetln(Buf);
serv_printf("OPNA %ld|%s", msgnum, ChrPtr(att));
StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf,
NULL
) == 2) {
+ if (GetServerStatus(Buf,
&ErrorDetail
) == 2) {
StrBufCutLeft(Buf, 4);
bytes = StrBufExtract_long(Buf, 0, '|');
if (!force_download) {
StrBufCutLeft(Buf, 4);
bytes = StrBufExtract_long(Buf, 0, '|');
if (!force_download) {
@@
-1758,7
+1759,23
@@
void mimepart(int force_download)
http_transmit_thing(CT, 0);
} else {
StrBufCutLeft(Buf, 4);
http_transmit_thing(CT, 0);
} else {
StrBufCutLeft(Buf, 4);
- hprintf("HTTP/1.1 404 %s\n", ChrPtr(Buf));
+ switch (ErrorDetail) {
+ default:
+ case ERROR + MESSAGE_NOT_FOUND:
+ hprintf("HTTP/1.1 404 %s\n", ChrPtr(Buf));
+ break;
+ case ERROR + NOT_LOGGED_IN:
+ hprintf("HTTP/1.1 401 %s\n", ChrPtr(Buf));
+ break;
+
+ case ERROR + HIGHER_ACCESS_REQUIRED:
+ hprintf("HTTP/1.1 403 %s\n", ChrPtr(Buf));
+ break;
+ case ERROR + INTERNAL_ERROR:
+ case ERROR + TOO_BIG:
+ hprintf("HTTP/1.1 500 %s\n", ChrPtr(Buf));
+ break;
+ }
output_headers(0, 0, 0, 0, 0, 0);
hprintf("Content-Type: text/plain\r\n");
begin_burst();
output_headers(0, 0, 0, 0, 0, 0);
hprintf("Content-Type: text/plain\r\n");
begin_burst();