Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.7 KiB

  1. #include "convlog.h"
  2. BOOL
  3. ProcessWebLine(
  4. IN LPINLOGLINE lpLogLine,
  5. IN LPCSTR pszInFileName,
  6. IN LPOUTFILESTATUS lpOutFile
  7. )
  8. {
  9. BOOL bLineOK = FALSE; //function return code
  10. BOOL bDateChanged = FALSE;
  11. BOOL bTimeChanged = FALSE;
  12. char szMonth[4];
  13. char szDate[MAX_PATH];
  14. char szTime[MAX_PATH];
  15. static WORD wSecond; // Bug # 110921
  16. PCHAR szBytes;
  17. //
  18. // NCSA Only
  19. //
  20. {
  21. bDateChanged = FALSE;
  22. bTimeChanged = FALSE;
  23. bLineOK = TRUE;
  24. if ( 0 != strcmp(lpOutFile->szLastDate, lpLogLine->szDate) ) {
  25. if (0 == strcmp(lpOutFile->szLastDate, NEW_DATETIME)) {
  26. lpOutFile->fpOutFile = StartNewOutputLog (
  27. lpOutFile,
  28. pszInFileName,
  29. lpLogLine->szDate
  30. );
  31. }
  32. strcpy(lpOutFile->szLastDate, lpLogLine->szDate);
  33. lpOutFile->DosDate.wDOSDate = DateStringToDOSDate(lpLogLine->szDate);
  34. bDateChanged = TRUE;
  35. }
  36. if (0 != strcmp(lpOutFile->szLastTime, lpLogLine->szTime))
  37. {
  38. strcpy(lpOutFile->szLastTime, lpLogLine->szTime);
  39. lpOutFile->DosDate.wDOSTime = TimeStringToDOSTime(lpLogLine->szTime, &wSecond);
  40. bTimeChanged = TRUE;
  41. }
  42. if (bDateChanged || bTimeChanged)
  43. {
  44. DosDateTimeToFileTime(lpOutFile->DosDate.wDOSDate, lpOutFile->DosDate.wDOSTime, &(lpOutFile->FileTime));
  45. FileTimeToSystemTime(&(lpOutFile->FileTime), &(lpOutFile->SystemTime));
  46. lpOutFile->SystemTime.wSecond = wSecond;
  47. }
  48. AscMonth (lpOutFile->SystemTime.wMonth, szMonth);
  49. //
  50. // Get bytes
  51. //
  52. if ( (_stricmp(lpLogLine->szOperation,"PUT") == 0) ||
  53. (_stricmp(lpLogLine->szOperation,"POST") == 0) ) {
  54. szBytes = lpLogLine->szBytesRec;
  55. } else {
  56. szBytes = lpLogLine->szBytesSent;
  57. }
  58. if ((0 != strcmp(lpLogLine->szParameters, " - ")) &&
  59. (0 != strcmp(lpLogLine->szParameters, "-,")) &&
  60. (0 != strcmp(lpLogLine->szParameters, "-")) &&
  61. (0 != strcmp(lpLogLine->szParameters, "")))
  62. {
  63. fprintf(lpOutFile->fpOutFile,"%s - %s [%02d/%s/%d:%02d:%02d:%02d %s] \"%s %s?%s %s\" %s %s\n",
  64. lpLogLine->szClientIP, lpLogLine->szUserName, lpOutFile->SystemTime.wDay,
  65. szMonth, lpOutFile->SystemTime.wYear, lpOutFile->SystemTime.wHour,
  66. lpOutFile->SystemTime.wMinute, lpOutFile->SystemTime.wSecond,
  67. NCSAGMTOffset, lpLogLine->szOperation,
  68. lpLogLine->szTargetURL, lpLogLine->szParameters, lpLogLine->szVersion,
  69. lpLogLine->szServiceStatus, szBytes);
  70. } else {
  71. fprintf(lpOutFile->fpOutFile, "%s - %s [%02d/%s/%d:%02d:%02d:%02d %s] \"%s %s %s\" %s %s\n",
  72. lpLogLine->szClientIP, lpLogLine->szUserName, lpOutFile->SystemTime.wDay,
  73. szMonth, lpOutFile->SystemTime.wYear, lpOutFile->SystemTime.wHour,
  74. lpOutFile->SystemTime.wMinute, lpOutFile->SystemTime.wSecond,
  75. NCSAGMTOffset, lpLogLine->szOperation,
  76. lpLogLine->szTargetURL, lpLogLine->szVersion, lpLogLine->szServiceStatus, szBytes);
  77. }
  78. //} //only process 200s
  79. }
  80. return (bLineOK);
  81. } //end ProcessWebLine