aboutsummaryrefslogtreecommitdiffstats
path: root/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend.c')
-rw-r--r--backend.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/backend.c b/backend.c
index 248185b..0bd5965 100644
--- a/backend.c
+++ b/backend.c
@@ -1,4 +1,4 @@
-/* $Id: backend.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
+/* $Id: backend.c,v 1.6 2001/12/27 17:50:56 ukai Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -136,15 +136,21 @@ internal_get(char *url, int flag, FormList *request)
{
Buffer *buf;
- backend_halfdump_str = Strnew_charp("<pre>\n");
+ backend_halfdump_buf = NULL;
do_download = flag;
buf = loadGeneralFile(url, NULL, NO_REFERER, 0, request);
do_download = FALSE;
if (buf != NULL && buf != NO_BUFFER) {
- if (!strcasecmp(buf->type, "text/html")) {
- Strcat(backend_halfdump_str,
- Sprintf("</pre><title>%s</title>\n", buf->buffername));
- print_headers(buf, backend_halfdump_str->length);
+ if (!strcasecmp(buf->type, "text/html") && backend_halfdump_buf) {
+ TextLineListItem *p;
+ Str first, last;
+ int len = 0;
+ for (p = backend_halfdump_buf->first; p; p = p->next)
+ len += p->ptr->line->length + 1;
+ first = Strnew_charp("<pre>\n");
+ last = Strnew_m_charp("</pre><title>", html_quote(buf->buffername),
+ "</title>\n", NULL);
+ print_headers(buf, len + first->length + last->length);
if (buf->formlist) {
FormList *fp;
int fid = 0;
@@ -154,7 +160,10 @@ internal_get(char *url, int flag, FormList *request)
print_formlist(--fid, fp);
}
printf("\n");
- Strfputs(backend_halfdump_str, stdout);
+ printf("%s", first->ptr);
+ for (p = backend_halfdump_buf->first; p; p = p->next)
+ printf("%s\n", p->ptr->line->ptr);
+ printf("%s", last->ptr);
}
else {
if (!strcasecmp(buf->type, "text/plain")) {