Althttpd

Check-in [1fb1a1c2a5]
Login

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

Overview
Comment:Add support for -DLOG_PID to append the althttpd pid to the log to assist in debugging hanging althttpd processes, per discussion in /forumpost/4dc31619341ce947.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | signal-safety
Files: files | file ages | folders
SHA3-256: 1fb1a1c2a54bc65d9306bf892d54c5c1505025e985327d9c5ecb1d586ac4e3d5
User & Date: stephan 2023-12-16 11:19:14
Context
2023-12-20
14:47
Replace use of Escape() in MakeLogEntry() with a non-allocating variant. Testing reminder: it seems that curl is the only http client which does not auto-escape double-quotes in the request string to %22. ... (check-in: db964137c0 user: stephan tags: signal-safety)
2023-12-16
11:19
Add support for -DLOG_PID to append the althttpd pid to the log to assist in debugging hanging althttpd processes, per discussion in /forumpost/4dc31619341ce947. ... (check-in: 1fb1a1c2a5 user: stephan tags: signal-safety)
00:32
Add explicit mode 0640 to the log file open() to avoid system-dependent defaults doing weird things. ... (check-in: 081b3ed27c user: stephan tags: signal-safety)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.
34
35
36
37
38
39
40
41
42
	@flags="`cat version`"; set -x; \
	$(CC) $(CFLAGS) "-D$$flags" -static -o althttpd althttpd.c

static-althttpsd:	althttpd.c version
	@flags="`cat version`"; set -x; \
	$(CC) $(CFLAGS) "-D$$flags" -static -fPIC -o althttpsd -DENABLE_TLS althttpd.c -lssl -lcrypto -lpthread -ldl

clean:	
	rm -f althttpd althttpsd version







|

34
35
36
37
38
39
40
41
42
	@flags="`cat version`"; set -x; \
	$(CC) $(CFLAGS) "-D$$flags" -static -o althttpd althttpd.c

static-althttpsd:	althttpd.c version
	@flags="`cat version`"; set -x; \
	$(CC) $(CFLAGS) "-D$$flags" -static -fPIC -o althttpsd -DENABLE_TLS althttpd.c -lssl -lcrypto -lpthread -ldl

clean:
	rm -f althttpd althttpsd version
Changes to althttpd.c.
975
976
977
978
979
980
981







982
983
984
985
986
987
988
      /* (11) */ aint( tvms(&children.ru_stime) - tvms(&priorChild.ru_stime) );
      /* (12) */ aint( tvms(&tvNow) - tvms(&beginTime) );
      /* (13) */ aint( nRequest );
      /* (14) */ astr( "\"" ); astr( Escape(zAgent) ); astr2("\"");
      /* (15) */ astr( "\"" ); astr( Escape(zRM) ); astr2("\"");
      /* (16) */ aint( strlen(zHttpScheme)+strlen(zHttpHost)+strlen(zRealScript)+3 );
      /* (17) */ altfmt_int( zPos, zEnd, lineNum, 1, &zPos );







      astr( "\n" );
      priorSelf = self;
      priorChild = children;
#endif
      if( zPos ){
        assert( zPos<zEnd );
        assert( zPos>&msgbuf[0] );







>
>
>
>
>
>
>







975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
      /* (11) */ aint( tvms(&children.ru_stime) - tvms(&priorChild.ru_stime) );
      /* (12) */ aint( tvms(&tvNow) - tvms(&beginTime) );
      /* (13) */ aint( nRequest );
      /* (14) */ astr( "\"" ); astr( Escape(zAgent) ); astr2("\"");
      /* (15) */ astr( "\"" ); astr( Escape(zRM) ); astr2("\"");
      /* (16) */ aint( strlen(zHttpScheme)+strlen(zHttpHost)+strlen(zRealScript)+3 );
      /* (17) */ altfmt_int( zPos, zEnd, lineNum, 1, &zPos );
#ifdef LOG_PID
      /* Appending of PID to the log is used only to assist in
      ** debugging of hanging althttpd processes:
      ** https://sqlite.org/althttpd/forumpost/4dc31619341ce947 */
      acomma;
      /* (18) */ altfmt_int( zPos, zEnd, getpid(), 1, &zPos );
#endif
      astr( "\n" );
      priorSelf = self;
      priorChild = children;
#endif
      if( zPos ){
        assert( zPos<zEnd );
        assert( zPos>&msgbuf[0] );