C:/fscan/HTTPCore/Modules/LogFile.cpp

Go to the documentation of this file.
00001 
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 #include <string.h>
00009 #include "../CallBack.h"
00010 //#include "../HTTPCore/Build.h"
00011 #include "LogFile.h"
00012 
00013 #ifndef _CRT_SECURE_NO_DEPRECATE
00014 #define _CRT_SECURE_NO_DEPRECATE
00015 #define _CRT_SECURE_NO_WARNINGS
00016 #endif
00017 
00018 FILE *Session = NULL;
00019 const char LogFileName[]="HTTP_Session.log";
00020 
00021 /******************************************************************************/
00023 
00031 /******************************************************************************/
00032 int CBLogFile(int cbType,HTTPHANDLE HTTPHandle,PHTTP_DATA  *prequest,PHTTP_DATA *presponse)
00033 {
00034         PHTTP_DATA request = *prequest;
00035         PHTTP_DATA response = *presponse;
00036 
00037         const char RequestHeader[]="Request Information:\n";
00038         const char ResponseHeader[]="Response Information:\n";
00039         const char Delim[]="---------------------------------\n";
00040 
00041         if (Session == NULL) {
00042                 Session=fopen(LogFileName,"a+");
00043         }
00044 
00045         if ( (cbType == CBTYPE_PROXY_RESPONSE) )
00046         {
00047                 fwrite(RequestHeader,1,strlen(RequestHeader),Session);
00048                 if (request)
00049                 {
00050                         if (request->HeaderSize)
00051                                 fwrite(request->Header,1,request->HeaderSize,Session);
00052                         if (request->DataSize)
00053                                 fwrite(request->Data,1,request->DataSize,Session);
00054                 }
00055                 fwrite(ResponseHeader,1,strlen(ResponseHeader),Session);
00056                 if (response)
00057                 {
00058                         if (response->HeaderSize)
00059                                 fwrite(response->Header,1,response->HeaderSize,Session);
00060                         if (response->DataSize)
00061                                 fwrite(response->Data,1,response->DataSize,Session);
00062                 }
00063                 fwrite(Delim,1,strlen(Delim),Session);
00064                 fflush(Session);
00065         }
00066         return(CBRET_STATUS_NEXT_CB_CONTINUE);
00067 
00068 }
00069 

Generated on Sun Jan 18 00:32:04 2009 for Fast HTTP Vulnerability Scanner by  doxygen 1.5.4