Fossil SCM
Another 304 change: Omit only the Content-Type header. Retain the cache-control header lines.
Commit
fff9b6799cf3faa606ce86855ebe50c9c8d11acfe47d14eeb2985eb514f8d814
Parent
9f99257451fb917…
1 file changed
+6
-11
+6
-11
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -289,14 +289,10 @@ | ||
| 289 | 289 | fprintf(g.httpOut, "X-UA-Compatible: IE=edge\r\n"); |
| 290 | 290 | }else{ |
| 291 | 291 | assert( rangeEnd==0 ); |
| 292 | 292 | fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus); |
| 293 | 293 | } |
| 294 | - if( iReplyStatus==304 ){ | |
| 295 | - fprintf(g.httpOut, "\r\n"); | |
| 296 | - goto finish_cgi_reply; | |
| 297 | - } | |
| 298 | 294 | if( g.isConst ){ |
| 299 | 295 | /* isConst means that the reply is guaranteed to be invariant, even |
| 300 | 296 | ** after configuration changes and/or Fossil binary recompiles. */ |
| 301 | 297 | fprintf(g.httpOut, "Cache-Control: max-age=31536000\r\n"); |
| 302 | 298 | }else if( etag_tag()!=0 ){ |
| @@ -333,17 +329,17 @@ | ||
| 333 | 329 | */ |
| 334 | 330 | |
| 335 | 331 | /* Content intended for logged in users should only be cached in |
| 336 | 332 | ** the browser, not some shared location. |
| 337 | 333 | */ |
| 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 | 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 | + | |
| 345 | 341 | if( is_gzippable() && iReplyStatus!=206 ){ |
| 346 | 342 | int i; |
| 347 | 343 | gzip_begin(0); |
| 348 | 344 | for( i=0; i<2; i++ ){ |
| 349 | 345 | int size = blob_size(&cgiContent[i]); |
| @@ -383,11 +379,10 @@ | ||
| 383 | 379 | rangeStart = 0; |
| 384 | 380 | total_size -= n; |
| 385 | 381 | } |
| 386 | 382 | } |
| 387 | 383 | } |
| 388 | -finish_cgi_reply: | |
| 389 | 384 | fflush(g.httpOut); |
| 390 | 385 | CGIDEBUG(("-------- END cgi ---------\n")); |
| 391 | 386 | |
| 392 | 387 | /* After the webpage has been sent, do any useful background |
| 393 | 388 | ** processing. |
| 394 | 389 |
| --- 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 |