updates.
[silc.git] / lib / silchttp / tests / test_silchttpserver.c
index 859688a70a287bab0015bee9b17cb4a7a3829bc9..a6b1b049f9dec87e7d50e9ef5ad27956261bd3a5 100644 (file)
@@ -19,6 +19,7 @@ static void http_callback(SilcHttpServer httpd, SilcHttpConnection conn,
                            "<html><head></head><body>",
                            silc_http_server_get_header(httpd, conn,
                                                        "User-Agent"),
+                           "<p><img src=\"pr_1995.jpg\">",
                            "<p>OUR DEFAULT PAGE IS THIS: ",
                            silc_time_string(silc_time()),
                            "<P><FORM action=\"/posttest\" method=\"post\"><P>"
@@ -36,6 +37,20 @@ static void http_callback(SilcHttpServer httpd, SilcHttpConnection conn,
       silc_buffer_purge(&page);
       return;
     }
+
+    if (!strcmp(uri, "/pr_1995.jpg")) {
+      SilcUInt32 data_len;
+      unsigned char *data = silc_file_readfile("pr_1995.jpg", &data_len);
+      if (!data) {
+       silc_http_server_send_error(httpd, conn, "404 Not Found", NULL);
+        return;
+      }
+      silc_buffer_set(&page, data, data_len),
+      silc_http_server_add_header(httpd, conn, "Content-Type", "image/jpeg");
+      silc_http_server_send(httpd, conn, &page);
+      silc_buffer_purge(&page);
+      return;
+    }
   }
 
   if (!strcasecmp(method, "POST")) {