Fossil SCM

Another 304 change: Omit only the Content-Type header. Retain the cache-control header lines.

drh 2020-05-09 21:10 trunk
Commit fff9b6799cf3faa606ce86855ebe50c9c8d11acfe47d14eeb2985eb514f8d814
1 file changed +6 -11
+6 -11
--- src/cgi.c
+++ src/cgi.c
@@ -289,14 +289,10 @@
289289
fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
290290
}else{
291291
assert( rangeEnd==0 );
292292
fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
293293
}
294
- if( iReplyStatus==304 ){
295
- fprintf(g.httpOut, "\r\n");
296
- goto finish_cgi_reply;
297
- }
298294
if( g.isConst ){
299295
/* isConst means that the reply is guaranteed to be invariant, even
300296
** after configuration changes and/or Fossil binary recompiles. */
301297
fprintf(g.httpOut, "Cache-Control: max-age=31536000\r\n");
302298
}else if( etag_tag()!=0 ){
@@ -333,17 +329,17 @@
333329
*/
334330
335331
/* Content intended for logged in users should only be cached in
336332
** the browser, not some shared location.
337333
*/
338
- fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
339
- if( fossil_strcmp(zContentType,"application/x-fossil")==0 ){
340
- cgi_combine_header_and_body();
341
- blob_compress(&cgiContent[0], &cgiContent[0]);
342
- }
343
-
344334
if( iReplyStatus!=304 ) {
335
+ fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
336
+ if( fossil_strcmp(zContentType,"application/x-fossil")==0 ){
337
+ cgi_combine_header_and_body();
338
+ blob_compress(&cgiContent[0], &cgiContent[0]);
339
+ }
340
+
345341
if( is_gzippable() && iReplyStatus!=206 ){
346342
int i;
347343
gzip_begin(0);
348344
for( i=0; i<2; i++ ){
349345
int size = blob_size(&cgiContent[i]);
@@ -383,11 +379,10 @@
383379
rangeStart = 0;
384380
total_size -= n;
385381
}
386382
}
387383
}
388
-finish_cgi_reply:
389384
fflush(g.httpOut);
390385
CGIDEBUG(("-------- END cgi ---------\n"));
391386
392387
/* After the webpage has been sent, do any useful background
393388
** processing.
394389
--- src/cgi.c
+++ src/cgi.c
@@ -289,14 +289,10 @@
289 fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
290 }else{
291 assert( rangeEnd==0 );
292 fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
293 }
294 if( iReplyStatus==304 ){
295 fprintf(g.httpOut, "\r\n");
296 goto finish_cgi_reply;
297 }
298 if( g.isConst ){
299 /* isConst means that the reply is guaranteed to be invariant, even
300 ** after configuration changes and/or Fossil binary recompiles. */
301 fprintf(g.httpOut, "Cache-Control: max-age=31536000\r\n");
302 }else if( etag_tag()!=0 ){
@@ -333,17 +329,17 @@
333 */
334
335 /* Content intended for logged in users should only be cached in
336 ** the browser, not some shared location.
337 */
338 fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
339 if( fossil_strcmp(zContentType,"application/x-fossil")==0 ){
340 cgi_combine_header_and_body();
341 blob_compress(&cgiContent[0], &cgiContent[0]);
342 }
343
344 if( iReplyStatus!=304 ) {
 
 
 
 
 
 
345 if( is_gzippable() && iReplyStatus!=206 ){
346 int i;
347 gzip_begin(0);
348 for( i=0; i<2; i++ ){
349 int size = blob_size(&cgiContent[i]);
@@ -383,11 +379,10 @@
383 rangeStart = 0;
384 total_size -= n;
385 }
386 }
387 }
388 finish_cgi_reply:
389 fflush(g.httpOut);
390 CGIDEBUG(("-------- END cgi ---------\n"));
391
392 /* After the webpage has been sent, do any useful background
393 ** processing.
394
--- src/cgi.c
+++ src/cgi.c
@@ -289,14 +289,10 @@
289 fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n");
290 }else{
291 assert( rangeEnd==0 );
292 fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
293 }
 
 
 
 
294 if( g.isConst ){
295 /* isConst means that the reply is guaranteed to be invariant, even
296 ** after configuration changes and/or Fossil binary recompiles. */
297 fprintf(g.httpOut, "Cache-Control: max-age=31536000\r\n");
298 }else if( etag_tag()!=0 ){
@@ -333,17 +329,17 @@
329 */
330
331 /* Content intended for logged in users should only be cached in
332 ** the browser, not some shared location.
333 */
 
 
 
 
 
 
334 if( iReplyStatus!=304 ) {
335 fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
336 if( fossil_strcmp(zContentType,"application/x-fossil")==0 ){
337 cgi_combine_header_and_body();
338 blob_compress(&cgiContent[0], &cgiContent[0]);
339 }
340
341 if( is_gzippable() && iReplyStatus!=206 ){
342 int i;
343 gzip_begin(0);
344 for( i=0; i<2; i++ ){
345 int size = blob_size(&cgiContent[i]);
@@ -383,11 +379,10 @@
379 rangeStart = 0;
380 total_size -= n;
381 }
382 }
383 }
 
384 fflush(g.httpOut);
385 CGIDEBUG(("-------- END cgi ---------\n"));
386
387 /* After the webpage has been sent, do any useful background
388 ** processing.
389

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button