]> code.citadel.org Git - citadel.git/blobdiff - webcit/downloads.c
* if we need the first urlpart, we musn't move it just left, but add another one...
[citadel.git] / webcit / downloads.c
index f2653746ab1ed4335c32906df94d5b0b8fa49a07..d980ce1d330b674e33d08f4365a9311e6bf21fe0 100644 (file)
@@ -391,7 +391,7 @@ void download_file(void)
        /* Setting to nonzero forces a MIME type of application/octet-stream */
        int force_download = 1;
        
-       safestrncpy(buf, ChrPtr(WC->UrlFragment1), sizeof buf);
+       safestrncpy(buf, ChrPtr(WC->UrlFragment2), sizeof buf);
        unescape_input(buf);
        serv_printf("OPEN %s", buf);
        serv_getln(buf, sizeof buf);
@@ -405,17 +405,17 @@ void download_file(void)
                        extract_token(content_type, &buf[4], 3, '|', sizeof content_type);
                }
                output_headers(0, 0, 0, 0, 0, 0);
-               read_server_binary(content, bytes);
+               read_server_binary(WC->WBuf, bytes);
                serv_puts("CLOS");
                serv_getln(buf, sizeof buf);
-               http_transmit_thing(content, bytes, content_type, 0);
+               http_transmit_thing(content_type, 0);
                free(content);
        } else {
-               wprintf("HTTP/1.1 404 %s\n", &buf[4]);
+               hprintf("HTTP/1.1 404 %s\n", &buf[4]);
                output_headers(0, 0, 0, 0, 0, 0);
-               wprintf("Content-Type: text/plain\r\n");
-               wprintf("\r\n");
+               hprintf("Content-Type: text/plain\r\n");
                wprintf(_("An error occurred while retrieving this file: %s\n"), &buf[4]);
+               end_burst();
        }
 
 }