Fossil

Check-in [22cb1e1be2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Here is a better fix for ticket [c62fac40af] suggested by Kees Nuyt.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 22cb1e1be2d1636a8e4dc106d081a5100610fe79
User & Date: drh 2008-11-20 00:35:23.000
Context
2008-11-20
01:07
When creating a new repository or cloning a repository, print the initial administrator password on standard output. This is intended to help new users figure out how to log in. Ticket [ca08d51f19] ... (check-in: 0c6ea0d93f user: drh tags: trunk)
00:35
Here is a better fix for ticket [c62fac40af] suggested by Kees Nuyt. ... (check-in: 22cb1e1be2 user: drh tags: trunk)
2008-11-19
23:33
Make sure the socket of the "ui" and "server" commands is bound to the specified port when the -P or --port option is used. Ticket [7ef970e4a2] ... (check-in: 53db94cd41 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cgi.c.
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
  if( strcmp(zContentType,"application/x-fossil")==0 ){
    cgi_combine_header_and_body();
    blob_compress(&cgiContent[0], &cgiContent[0]);
  }

  if( iReplyStatus != 304 ) {
    total_size = blob_size(&cgiContent[0]) + blob_size(&cgiContent[1]);
#ifdef __MINGW32__
    /* In windows versions of Apache, extra \r characters get added to the
    ** response, which mess up the Content-Length.  So let apache figure
    ** out the content length for itself if we are using CGI.  If this
    ** is a complete stand-alone webserver, on the other hand, we still
    ** need the Content-Length.
    */
    if( g.fullHttpReply ){
      fprintf(g.httpOut, "Content-Length: %d\r\n", total_size);
    }
#else
    /* On unix, \n to \r\n translation is never a problem.  We know the
    ** content length, so we might as well go ahead and tell the webserver
    ** what it is in all cases.
    */
    fprintf(g.httpOut, "Content-Length: %d\r\n", total_size);
#endif
  }
  fprintf(g.httpOut, "\r\n");
  if( total_size>0 && iReplyStatus != 304 ){
    int i, size;
    for(i=0; i<2; i++){
      size = blob_size(&cgiContent[i]);
      if( size>0 ){







<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<







334
335
336
337
338
339
340








341








342
343
344
345
346
347
348
  if( strcmp(zContentType,"application/x-fossil")==0 ){
    cgi_combine_header_and_body();
    blob_compress(&cgiContent[0], &cgiContent[0]);
  }

  if( iReplyStatus != 304 ) {
    total_size = blob_size(&cgiContent[0]) + blob_size(&cgiContent[1]);








    fprintf(g.httpOut, "Content-Length: %d\r\n", total_size);








  }
  fprintf(g.httpOut, "\r\n");
  if( total_size>0 && iReplyStatus != 304 ){
    int i, size;
    for(i=0; i<2; i++){
      size = blob_size(&cgiContent[i]);
      if( size>0 ){
Changes to src/main.c.
24
25
26
27
28
29
30

31
32
33
34
35
36
37
** This module codes the main() procedure that runs first when the
** program is invoked.
*/
#include "config.h"
#include "main.h"
#include <string.h>
#include <time.h>


#if INTERFACE

/*
** Number of elements in an array
*/
#define count(X)  (sizeof(X)/sizeof(X[0]))







>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
** This module codes the main() procedure that runs first when the
** program is invoked.
*/
#include "config.h"
#include "main.h"
#include <string.h>
#include <time.h>
#include <fcntl.h>

#if INTERFACE

/*
** Number of elements in an array
*/
#define count(X)  (sizeof(X)/sizeof(X[0]))
606
607
608
609
610
611
612






613
614
615
616
617
618
619
  if( g.argc==3 && strcmp(g.argv[1],"cgi")==0 ){
    zFile = g.argv[2];
  }else{
    zFile = g.argv[1];
  }
  g.httpOut = stdout;
  g.httpIn = stdin;






  g.cgiPanic = 1;
  blob_read_from_file(&config, zFile);
  while( blob_line(&config, &line) ){
    if( !blob_token(&line, &key) ) continue;
    if( blob_buffer(&key)[0]=='#' ) continue;
    if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
      g.fDebug = fopen(blob_str(&value), "a");







>
>
>
>
>
>







607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
  if( g.argc==3 && strcmp(g.argv[1],"cgi")==0 ){
    zFile = g.argv[2];
  }else{
    zFile = g.argv[1];
  }
  g.httpOut = stdout;
  g.httpIn = stdin;
#ifdef __MINGW32__
  /* Set binary mode on windows to avoid undesired translations
  ** between \n and \r\n. */
  setmode(_fileno(g.httpOut), _O_BINARY);
  setmode(_fileno(g.httpIn), _O_BINARY);
#endif
  g.cgiPanic = 1;
  blob_read_from_file(&config, zFile);
  while( blob_line(&config, &line) ){
    if( !blob_token(&line, &key) ) continue;
    if( blob_buffer(&key)[0]=='#' ) continue;
    if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
      g.fDebug = fopen(blob_str(&value), "a");