summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2014-10-14 15:51:31 +0200
committerAndreas Baumann <abaumann@yahoo.com>2014-10-14 15:51:31 +0200
commit0a2d48f6d86c48c1f643a28f6f4f9420a3cf58ad (patch)
tree4ad93fcdaf167edf5d8307328abbca0f97e03696
parent564d6bf2f241f0eb12bf681d1e5991d82a8d7389 (diff)
downloadcrawler-0a2d48f6d86c48c1f643a28f6f4f9420a3cf58ad.tar.gz
crawler-0a2d48f6d86c48c1f643a28f6f4f9420a3cf58ad.tar.bz2
temporary for winhttp fetcher (and tests/fetcher) on Windows, needs also
c c:\temp directory for now
-rw-r--r--src/libcrawler/SpoolRewindInputStream.cpp13
-rwxr-xr-xtests/fetcher/Makefile.W323
-rw-r--r--tests/fetcher/run.cmd2
3 files changed, 14 insertions, 4 deletions
diff --git a/src/libcrawler/SpoolRewindInputStream.cpp b/src/libcrawler/SpoolRewindInputStream.cpp
index 7108cc9..6d04e4d 100644
--- a/src/libcrawler/SpoolRewindInputStream.cpp
+++ b/src/libcrawler/SpoolRewindInputStream.cpp
@@ -5,6 +5,13 @@
#include <cstring>
#include <cassert>
+// TODO: thread-safe and platform-conformant name of spool file
+#ifndef _WIN32
+#define SPOOL_FILE_NAME "/tmp/spool.tmp"
+#else
+#define SPOOL_FILE_NAME "C:\\TEMP\\SPOOL.TMP"
+#endif
+
using namespace std;
spool_streambuf::spool_streambuf( size_t bufSize, size_t putBack, size_t spoolBufSize )
@@ -29,7 +36,7 @@ spool_streambuf::~spool_streambuf( )
case TO_SPOOL_FILE:
case FROM_SPOOL_FILE:
m_spoolFile.close( );
- (void)remove( "/tmp/spool.tmp" );
+ (void)remove( SPOOL_FILE_NAME );
break;
}
}
@@ -70,7 +77,7 @@ void spool_streambuf::spoolData( char *data, size_t n )
// ..otherwise start spooling to disk, write
// current memory spool buffer first..
LOG( logWARNING ) << "Spooling spool buffer exceeded (>" << m_spoolBufSize << ")";
- m_spoolFile.open( "/tmp/spool.tmp", ios::binary | ios::out | ios::trunc );
+ m_spoolFile.open( SPOOL_FILE_NAME, ios::binary | ios::out | ios::trunc );
assert( m_spoolFile.good( ) );
m_spoolFile.write( &m_spoolBuf.front( ), m_spoolBufSize );
assert( m_spoolFile.good( ) );
@@ -176,7 +183,7 @@ void spool_streambuf::rewind( )
case TO_SPOOL_FILE:
m_spoolFile.close( );
- m_spoolFile.open( "/tmp/spool.tmp", ios::binary | ios::in );
+ m_spoolFile.open( SPOOL_FILE_NAME, ios::binary | ios::in );
m_spoolFile.seekg( 0, ios::end );
m_spoolBufSize = m_spoolFile.tellg( );
m_spoolFile.seekg( 0, ios::beg );
diff --git a/tests/fetcher/Makefile.W32 b/tests/fetcher/Makefile.W32
index b4e5128..0ebfb09 100755
--- a/tests/fetcher/Makefile.W32
+++ b/tests/fetcher/Makefile.W32
@@ -11,6 +11,7 @@ INCLUDE_CXXFLAGS = \
INCLUDE_DIRS = \
/I. \
/I$(TOPDIR)\src \
+ /I$(TOPDIR)\include \
/I$(TOPDIR)\include\module \
/I$(TOPDIR)\include\util \
/I$(TOPDIR)\include\crawler \
@@ -22,7 +23,7 @@ INCLUDE_LDFLAGS = \
INCLUDE_LIBS = \
$(TOPDIR)\src\modules\fetcher\winhttp\winhttpfetcher.lib \
WinHttp.lib \
- $(TOPDIR)\src\modules\urlnormalizer\simpleurl\simpleurlnormalizerstatic.lib \
+ $(TOPDIR)\src\modules\urlnormalizer\simpleurl\simpleurlnormalizer.lib \
$(TOPDIR)\src\libcrawler\crawlerstatic.lib \
$(TOPDIR)\src\libutil\util.lib
diff --git a/tests/fetcher/run.cmd b/tests/fetcher/run.cmd
index 5b6b4b5..041633f 100644
--- a/tests/fetcher/run.cmd
+++ b/tests/fetcher/run.cmd
@@ -3,5 +3,7 @@
copy ..\..\src\libcrawler\crawler.dll . >NUL
copy ..\..\src\liblogger\logger.dll . >NUL
copy ..\..\src\libutil\util.dll . >NUL
+copy ..\..\src\libluaglue\luaglue.dll . >NUL
+copy ..\..\lua\src\lua52.dll . >NUL
test1 %1 %2