]> code.citadel.org Git - citadel.git/commitdiff
* Backed out compression of inlines -- not all browsers appear to handle it
authorArt Cancro <ajc@citadel.org>
Sat, 14 Sep 2002 21:33:31 +0000 (21:33 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 14 Sep 2002 21:33:31 +0000 (21:33 +0000)
webcit/ChangeLog
webcit/context_loop.c
webcit/webcit.c

index 48d59b017b920e581c722d9a8fdae1bc731b606b..e87d830068199c1d8030e36ce9e0ae79de470262 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 400.9  2002/09/14 21:33:31  ajc
+* Backed out compression of inlines -- not all browsers appear to handle it
+
 Revision 400.8  2002/09/14 20:20:29  ajc
 * Attempting to push more stuff through compression.  I've introduced some
   sort of deadlock bug that I can't seem to find yet...
@@ -964,3 +967,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 3a9a29178d9dc1fdc604139a72d738c889fdeb5e..99af01990ce2ac12b0aba6725fd610ea65cb98c2 100644 (file)
@@ -232,10 +232,13 @@ void context_loop(int sock)
        int desired_session = 0;
        int got_cookie = 0;
        struct wcsession *TheSession, *sptr;
-       char enc[SIZ];
-       char encodings[SIZ];
        int gzip = 0;
+
+#ifdef WITH_ZLIB
        int i;
+       char enc[SIZ];
+       char encodings[SIZ];
+#endif
 
        /*
         * Find out what it is that the web browser is asking for
index 1af65a1f0489725ba0a753b697408cf441dfc309..277ca76a04d4590329765b9c78fe2776309dff78 100644 (file)
@@ -339,11 +339,13 @@ void output_headers(int controlcode)
 #endif
 
        if (print_standard_html_head > 0) {
-               wprintf("Content-type: text/html\n");
-               wprintf("Server: %s\n", SERVER);
-               wprintf("Connection: close\n");
-               wprintf("Pragma: no-cache\n");
-               wprintf("Cache-Control: no-store\n");
+               wprintf("Content-type: text/html\n"
+                       "Server: %s\n", SERVER
+               );
+               wprintf("Connection: close\n"
+                       "Pragma: no-cache\n"
+                       "Cache-Control: no-store\n"
+               );
 #ifdef WITH_ZLIB
                if (temp_gzfd != NULL) {
                        wprintf("Content-Encoding: gzip\n");
@@ -448,74 +450,25 @@ void check_for_express_messages()
 
 
 /* 
- * Output a piece of content to the web browser, compressing if necessary
+ * Output a piece of content to the web browser
  */
 void http_transmit_thing(char *thing, size_t length, char *content_type) {
-
-       int do_compress = 0;
-       char *compressed_xferbuf = NULL;
-
-#ifdef WITH_ZLIB
-       uLongf compressed_size = 0;
-#endif
-
-#ifdef WITH_ZLIB
-       do_compress = WC->gzcompressed;
-#endif
-
-#ifdef WITH_ZLIB
-       if (do_compress) {
-               /* Write it to the browser -- compressed */
-               compressed_size = (uLongf)
-                               ((length * 101) / 100) + 4096;
-               compressed_xferbuf = malloc(compressed_size);
-               lprintf(9, "uncompressed size: %d\n", length);
-               compress2(compressed_xferbuf, &compressed_size,
-                       thing, (uLong)length, 9);
-               lprintf(9, "  compressed size: %d\n", compressed_size);
-
-               if (compressed_size < length) {
-                       output_headers(0);
-                       wprintf("Content-type: %s\n"
-                               "Content-length: %ld\n"
-                               "Content-Encoding: gzip\n"
-                               "\n",
-                               content_type,
-                               (long) compressed_size
-                       );
-                       http_write(WC->http_sock, compressed_xferbuf,
-                                                       compressed_size);
-               }
-               else {
-                       do_compress = 0;
-               }
-       }
-#endif
-
-       if (!do_compress) {
-               /* Write it to the browser -- no compression */
-               output_headers(0);
-               wprintf("Content-type: %s\n"
-                       "Content-length: %ld\n"
-                       "\n",
+       output_headers(0);
+       wprintf("Content-type: %s\n"
+               "Content-length: %ld\n"
+               "Server: %s\n"
+               "Connection: close\n"
+               "\n",
                content_type,
-               (long) length
-               );
-               http_write(WC->http_sock, thing, length);
-       }
-
-       if (compressed_xferbuf) {
-               free(compressed_xferbuf);
-       }
+               (long) length,
+               SERVER
+       );
+       http_write(WC->http_sock, thing, (size_t)length);
 }
 
 
 
 
-
-
-
-
 void output_static(char *what)
 {
        char buf[4096];
@@ -586,7 +539,6 @@ void output_image()
        off_t thisblock;
        off_t accomplished = 0L;
 
-       lprintf(5, "output_image() called\n");
        serv_printf("OIMG %s|%s", bstr("name"), bstr("parm"));
        serv_gets(buf);
        if (buf[0] == '2') {
@@ -595,7 +547,7 @@ void output_image()
 
                /* Read it from the server */
                while (bytes > (off_t) 0) {
-                       thisblock = (off_t) sizeof(xferbuf);
+                       thisblock = 4096;
                        if (thisblock > bytes) {
                                thisblock = bytes;
                        }
@@ -633,6 +585,7 @@ void output_image()
                free(xferbuf);
        }
 
+
 }
 
 /*
@@ -926,12 +879,14 @@ void session_loop(struct httprequest *req, int gzip)
 
        WC->is_wap = 0;
 
+#ifdef WITH_ZLIB
        if (gzip) {
                WC->gzcompressed = 1;
        }
        else {
                WC->gzcompressed = 0;
        }
+#endif
 
        hptr = req;
        if (hptr == NULL) return;