From 1a7197074ae3416d377f5a7332577607eb3a694e Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 6 Jun 2010 18:38:36 +0000 Subject: vsource page add title element --- dpi/vsource.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dpi/vsource.c b/dpi/vsource.c index fa43a2f2..ec6f23e2 100644 --- a/dpi/vsource.c +++ b/dpi/vsource.c @@ -96,11 +96,14 @@ void send_numbered_text(Dsh *sh, int data_size) /* * Send source as html text with line numbers */ -void send_html_text(Dsh *sh, int data_size) +void send_html_text(Dsh *sh, const char *url, int data_size) { int bytes_read = 0, old_line = 0, line = 1; char *p, *q, *src_str, line_str[128]; + if (strncmp(url, "dpi:/vsource/:", 14) == 0) + url += 14; + /* Send HTTP header for plain text MIME type */ a_Dpip_dsh_printf(sh, 0, "Content-type: text/html\n\n"); @@ -108,10 +111,11 @@ void send_html_text(Dsh *sh, int data_size) a_Dpip_dsh_printf(sh, 0, "\n" "\n" + "Source for %s\n" "\n" "\n" - "\n\n"); + "\n
\n", url); while (bytes_read < data_size && (src_str = a_Dpip_dsh_read_token(sh, 1))) { @@ -211,7 +215,7 @@ int main(void) /* Choose your flavour */ //send_plain_text(sh, data_size); //send_numbered_text(sh, data_size); - send_html_text(sh, data_size); + send_html_text(sh, url, data_size); } else if (strcmp(cmd2, "DpiError") == 0) { /* Dillo detected an error (other failures just close the socket) */ a_Dpip_dsh_printf(sh, 0, "Content-type: text/plain\n\n"); -- cgit v1.2.3