mirror of https://gitee.com/bigwinds/arangodb
added binary client
This commit is contained in:
parent
56ab94678a
commit
29778d0b4d
66
Makefile.in
66
Makefile.in
|
@ -512,6 +512,8 @@ am_lib_libarango_client_a_OBJECTS = \
|
|||
lib/SimpleHttpClient/GeneralClientConnection.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/ClientConnection.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/SslClientConnection.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/SimpleClient.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/SimpleBinaryClient.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/SimpleHttpClient.$(OBJEXT) \
|
||||
lib/SimpleHttpClient/SimpleHttpResult.$(OBJEXT)
|
||||
lib_libarango_client_a_OBJECTS = $(am_lib_libarango_client_a_OBJECTS)
|
||||
|
@ -1381,6 +1383,8 @@ lib_libarango_client_a_SOURCES = \
|
|||
lib/SimpleHttpClient/GeneralClientConnection.cpp \
|
||||
lib/SimpleHttpClient/ClientConnection.cpp \
|
||||
lib/SimpleHttpClient/SslClientConnection.cpp \
|
||||
lib/SimpleHttpClient/SimpleClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleBinaryClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleHttpClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleHttpResult.cpp
|
||||
|
||||
|
@ -2130,6 +2134,12 @@ lib/SimpleHttpClient/ClientConnection.$(OBJEXT): \
|
|||
lib/SimpleHttpClient/SslClientConnection.$(OBJEXT): \
|
||||
lib/SimpleHttpClient/$(am__dirstamp) \
|
||||
lib/SimpleHttpClient/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/SimpleHttpClient/SimpleClient.$(OBJEXT): \
|
||||
lib/SimpleHttpClient/$(am__dirstamp) \
|
||||
lib/SimpleHttpClient/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/SimpleHttpClient/SimpleBinaryClient.$(OBJEXT): \
|
||||
lib/SimpleHttpClient/$(am__dirstamp) \
|
||||
lib/SimpleHttpClient/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/SimpleHttpClient/SimpleHttpClient.$(OBJEXT): \
|
||||
lib/SimpleHttpClient/$(am__dirstamp) \
|
||||
lib/SimpleHttpClient/$(DEPDIR)/$(am__dirstamp)
|
||||
|
@ -2507,7 +2517,7 @@ arangosh/V8Client/bin_arangob-V8ClientConnection.$(OBJEXT): \
|
|||
arangosh/V8Client/bin_arangob-arangob.$(OBJEXT): \
|
||||
arangosh/V8Client/$(am__dirstamp) \
|
||||
arangosh/V8Client/$(DEPDIR)/$(am__dirstamp)
|
||||
bin/arangob$(EXEEXT): $(bin_arangob_OBJECTS) $(bin_arangob_DEPENDENCIES) bin/$(am__dirstamp)
|
||||
bin/arangob$(EXEEXT): $(bin_arangob_OBJECTS) $(bin_arangob_DEPENDENCIES) $(EXTRA_bin_arangob_DEPENDENCIES) bin/$(am__dirstamp)
|
||||
@rm -f bin/arangob$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(bin_arangob_OBJECTS) $(bin_arangob_LDADD) $(LIBS)
|
||||
arangod/Actions/$(am__dirstamp):
|
||||
|
@ -3070,6 +3080,8 @@ mostlyclean-compile:
|
|||
-rm -f lib/ShapedJson/shaped-json.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/ClientConnection.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/GeneralClientConnection.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/SimpleBinaryClient.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/SimpleClient.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/SimpleHttpClient.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/SimpleHttpResult.$(OBJEXT)
|
||||
-rm -f lib/SimpleHttpClient/SslClientConnection.$(OBJEXT)
|
||||
|
@ -3330,6 +3342,8 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@lib/ShapedJson/$(DEPDIR)/shaped-json.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/ClientConnection.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/GeneralClientConnection.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/SimpleBinaryClient.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/SimpleClient.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/SimpleHttpClient.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/SimpleHttpResult.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/SimpleHttpClient/$(DEPDIR)/SslClientConnection.Po@am__quote@
|
||||
|
@ -4146,66 +4160,58 @@ UnitTests/Cambridge/UnitTests_geo_suite-georeg.obj: UnitTests/Cambridge/georeg.c
|
|||
arangosh/ArangoShell/bin_arangob-ArangoClient.o: arangosh/ArangoShell/ArangoClient.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/ArangoShell/bin_arangob-ArangoClient.o -MD -MP -MF arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Tpo -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.o `test -f 'arangosh/ArangoShell/ArangoClient.cpp' || echo '$(srcdir)/'`arangosh/ArangoShell/ArangoClient.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Tpo arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/ArangoShell/ArangoClient.cpp' object='arangosh/ArangoShell/bin_arangob-ArangoClient.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/ArangoShell/ArangoClient.cpp' object='arangosh/ArangoShell/bin_arangob-ArangoClient.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.o `test -f 'arangosh/ArangoShell/ArangoClient.cpp' || echo '$(srcdir)/'`arangosh/ArangoShell/ArangoClient.cpp
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.o `test -f 'arangosh/ArangoShell/ArangoClient.cpp' || echo '$(srcdir)/'`arangosh/ArangoShell/ArangoClient.cpp
|
||||
|
||||
arangosh/ArangoShell/bin_arangob-ArangoClient.obj: arangosh/ArangoShell/ArangoClient.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/ArangoShell/bin_arangob-ArangoClient.obj -MD -MP -MF arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Tpo -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.obj `if test -f 'arangosh/ArangoShell/ArangoClient.cpp'; then $(CYGPATH_W) 'arangosh/ArangoShell/ArangoClient.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/ArangoShell/ArangoClient.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Tpo arangosh/ArangoShell/$(DEPDIR)/bin_arangob-ArangoClient.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/ArangoShell/ArangoClient.cpp' object='arangosh/ArangoShell/bin_arangob-ArangoClient.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/ArangoShell/ArangoClient.cpp' object='arangosh/ArangoShell/bin_arangob-ArangoClient.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.obj `if test -f 'arangosh/ArangoShell/ArangoClient.cpp'; then $(CYGPATH_W) 'arangosh/ArangoShell/ArangoClient.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/ArangoShell/ArangoClient.cpp'; fi`
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/ArangoShell/bin_arangob-ArangoClient.obj `if test -f 'arangosh/ArangoShell/ArangoClient.cpp'; then $(CYGPATH_W) 'arangosh/ArangoShell/ArangoClient.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/ArangoShell/ArangoClient.cpp'; fi`
|
||||
|
||||
arangosh/V8Client/bin_arangob-ImportHelper.o: arangosh/V8Client/ImportHelper.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-ImportHelper.o -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Tpo -c -o arangosh/V8Client/bin_arangob-ImportHelper.o `test -f 'arangosh/V8Client/ImportHelper.cpp' || echo '$(srcdir)/'`arangosh/V8Client/ImportHelper.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/ImportHelper.cpp' object='arangosh/V8Client/bin_arangob-ImportHelper.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/ImportHelper.cpp' object='arangosh/V8Client/bin_arangob-ImportHelper.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-ImportHelper.o `test -f 'arangosh/V8Client/ImportHelper.cpp' || echo '$(srcdir)/'`arangosh/V8Client/ImportHelper.cpp
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-ImportHelper.o `test -f 'arangosh/V8Client/ImportHelper.cpp' || echo '$(srcdir)/'`arangosh/V8Client/ImportHelper.cpp
|
||||
|
||||
arangosh/V8Client/bin_arangob-ImportHelper.obj: arangosh/V8Client/ImportHelper.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-ImportHelper.obj -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Tpo -c -o arangosh/V8Client/bin_arangob-ImportHelper.obj `if test -f 'arangosh/V8Client/ImportHelper.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/ImportHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/ImportHelper.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-ImportHelper.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/ImportHelper.cpp' object='arangosh/V8Client/bin_arangob-ImportHelper.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/ImportHelper.cpp' object='arangosh/V8Client/bin_arangob-ImportHelper.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-ImportHelper.obj `if test -f 'arangosh/V8Client/ImportHelper.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/ImportHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/ImportHelper.cpp'; fi`
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-ImportHelper.obj `if test -f 'arangosh/V8Client/ImportHelper.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/ImportHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/ImportHelper.cpp'; fi`
|
||||
|
||||
arangosh/V8Client/bin_arangob-V8ClientConnection.o: arangosh/V8Client/V8ClientConnection.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-V8ClientConnection.o -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Tpo -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.o `test -f 'arangosh/V8Client/V8ClientConnection.cpp' || echo '$(srcdir)/'`arangosh/V8Client/V8ClientConnection.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/V8ClientConnection.cpp' object='arangosh/V8Client/bin_arangob-V8ClientConnection.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/V8ClientConnection.cpp' object='arangosh/V8Client/bin_arangob-V8ClientConnection.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.o `test -f 'arangosh/V8Client/V8ClientConnection.cpp' || echo '$(srcdir)/'`arangosh/V8Client/V8ClientConnection.cpp
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.o `test -f 'arangosh/V8Client/V8ClientConnection.cpp' || echo '$(srcdir)/'`arangosh/V8Client/V8ClientConnection.cpp
|
||||
|
||||
arangosh/V8Client/bin_arangob-V8ClientConnection.obj: arangosh/V8Client/V8ClientConnection.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-V8ClientConnection.obj -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Tpo -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.obj `if test -f 'arangosh/V8Client/V8ClientConnection.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/V8ClientConnection.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/V8ClientConnection.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-V8ClientConnection.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/V8ClientConnection.cpp' object='arangosh/V8Client/bin_arangob-V8ClientConnection.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/V8ClientConnection.cpp' object='arangosh/V8Client/bin_arangob-V8ClientConnection.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.obj `if test -f 'arangosh/V8Client/V8ClientConnection.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/V8ClientConnection.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/V8ClientConnection.cpp'; fi`
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-V8ClientConnection.obj `if test -f 'arangosh/V8Client/V8ClientConnection.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/V8ClientConnection.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/V8ClientConnection.cpp'; fi`
|
||||
|
||||
arangosh/V8Client/bin_arangob-arangob.o: arangosh/V8Client/arangob.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-arangob.o -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Tpo -c -o arangosh/V8Client/bin_arangob-arangob.o `test -f 'arangosh/V8Client/arangob.cpp' || echo '$(srcdir)/'`arangosh/V8Client/arangob.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/arangob.cpp' object='arangosh/V8Client/bin_arangob-arangob.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/arangob.cpp' object='arangosh/V8Client/bin_arangob-arangob.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-arangob.o `test -f 'arangosh/V8Client/arangob.cpp' || echo '$(srcdir)/'`arangosh/V8Client/arangob.cpp
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-arangob.o `test -f 'arangosh/V8Client/arangob.cpp' || echo '$(srcdir)/'`arangosh/V8Client/arangob.cpp
|
||||
|
||||
arangosh/V8Client/bin_arangob-arangob.obj: arangosh/V8Client/arangob.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangosh/V8Client/bin_arangob-arangob.obj -MD -MP -MF arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Tpo -c -o arangosh/V8Client/bin_arangob-arangob.obj `if test -f 'arangosh/V8Client/arangob.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/arangob.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/arangob.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Tpo arangosh/V8Client/$(DEPDIR)/bin_arangob-arangob.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='arangosh/V8Client/arangob.cpp' object='arangosh/V8Client/bin_arangob-arangob.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='arangosh/V8Client/arangob.cpp' object='arangosh/V8Client/bin_arangob-arangob.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-arangob.obj `if test -f 'arangosh/V8Client/arangob.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/arangob.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/arangob.cpp'; fi`
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangob_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o arangosh/V8Client/bin_arangob-arangob.obj `if test -f 'arangosh/V8Client/arangob.cpp'; then $(CYGPATH_W) 'arangosh/V8Client/arangob.cpp'; else $(CYGPATH_W) '$(srcdir)/arangosh/V8Client/arangob.cpp'; fi`
|
||||
|
||||
arangod/Actions/bin_arangod-actions.o: arangod/Actions/actions.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bin_arangod_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT arangod/Actions/bin_arangod-actions.o -MD -MP -MF arangod/Actions/$(DEPDIR)/bin_arangod-actions.Tpo -c -o arangod/Actions/bin_arangod-actions.o `test -f 'arangod/Actions/actions.cpp' || echo '$(srcdir)/'`arangod/Actions/actions.cpp
|
||||
|
@ -5900,11 +5906,13 @@ js/server/js-%.h: @srcdir@/js/server/%.js .setup-js-directories
|
|||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ && ./configure \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --enable-static \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-shared \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-tests \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-samples \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-extras \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-tests \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-samples \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --disable-extras \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --prefix=$(ICUDIR) \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --libdir=$(ICUDIR)/libs
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ --libdir=$(ICUDIR)/libs \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ CC=${CC} \
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ CXX=${CXX}
|
||||
|
||||
@ENABLE_ALL_IN_ONE_ICU_TRUE@ cd @top_srcdir@/3rdParty/icu/source && $(MAKE) install
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include "Basics/ConditionVariable.h"
|
||||
#include "Basics/Thread.h"
|
||||
#include "V8Client/SharedCounter.h"
|
||||
#include "SimpleHttpClient/SimpleClient.h"
|
||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||
#include "SimpleHttpClient/SimpleBinaryClient.h"
|
||||
#include "SimpleHttpClient/GeneralClientConnection.h"
|
||||
#include "BinaryServer/BinaryMessage.h"
|
||||
#include "ProtocolBuffers/arangodb.pb.h"
|
||||
|
||||
|
@ -95,9 +99,14 @@ namespace triagens {
|
|||
if (_connection != 0 && _connection->isConnected()) {
|
||||
_connection->disconnect();
|
||||
}
|
||||
|
||||
if (_connection != 0) {
|
||||
delete _connection;
|
||||
}
|
||||
|
||||
if (_client != 0) {
|
||||
delete _client;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -127,25 +136,29 @@ namespace triagens {
|
|||
cerr << "out of memory" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
_client = new SimpleHttpClient(_connection, 10.0, true);
|
||||
_client->setUserNamePassword("/", _username, _password);
|
||||
|
||||
map<string, string> headerFields;
|
||||
SimpleHttpResult* result = _client->request(SimpleHttpClient::GET, "/_api/version", 0, 0, headerFields);
|
||||
|
||||
if (! result || ! result->isComplete()) {
|
||||
if (result) {
|
||||
delete result;
|
||||
}
|
||||
delete _client;
|
||||
|
||||
cerr << "could not connect to server" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
bool isBinary = _endpoint->isBinary();
|
||||
|
||||
if (isBinary) {
|
||||
_client = new SimpleBinaryClient(_connection, 10.0, true);
|
||||
}
|
||||
else {
|
||||
_client = new SimpleHttpClient(_connection, 10.0, true);
|
||||
_client->setUserNamePassword("/", _username, _password);
|
||||
map<string, string> headerFields;
|
||||
SimpleHttpResult* result = _client->request(SimpleHttpClient::GET, "/_api/version", 0, 0, headerFields);
|
||||
|
||||
if (! result || ! result->isComplete()) {
|
||||
if (result) {
|
||||
delete result;
|
||||
}
|
||||
cerr << "could not connect to server" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
delete result;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
{
|
||||
ConditionLocker guard(_startCondition);
|
||||
guard.wait();
|
||||
|
@ -158,7 +171,7 @@ namespace triagens {
|
|||
break;
|
||||
}
|
||||
|
||||
if (_batchSize == 1) {
|
||||
if (_batchSize == 1 && ! isBinary) {
|
||||
executeRequest();
|
||||
}
|
||||
else {
|
||||
|
@ -214,6 +227,11 @@ namespace triagens {
|
|||
size_t messageSize = messages.ByteSize();
|
||||
char* message = new char[messageSize];
|
||||
|
||||
if (message == 0) {
|
||||
cerr << "out of memory" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (! messages.SerializeToArray(message, messageSize)) {
|
||||
cerr << "out of memory" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -221,6 +239,7 @@ namespace triagens {
|
|||
|
||||
map<string, string> headerFields;
|
||||
headerFields["Content-Type"] = BinaryMessage::getContentType();
|
||||
|
||||
SimpleHttpResult* result = _client->request(SimpleHttpClient::POST, "/_api/batch", message, (size_t) messageSize, headerFields);
|
||||
delete message;
|
||||
|
||||
|
@ -325,7 +344,7 @@ namespace triagens {
|
|||
/// @brief underlying client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
triagens::httpclient::SimpleHttpClient* _client;
|
||||
triagens::httpclient::SimpleClient* _client;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief connection to the server
|
||||
|
|
|
@ -210,6 +210,9 @@ namespace triagens {
|
|||
this->_request = 0;
|
||||
bool ok = this->_server->handleRequest(this, handler);
|
||||
|
||||
delete this->_binaryMessage;
|
||||
this->_binaryMessage = 0;
|
||||
|
||||
if (! ok) {
|
||||
HttpResponse response(HttpResponse::SERVER_ERROR);
|
||||
this->handleResponse(&response);
|
||||
|
|
|
@ -115,19 +115,15 @@ namespace triagens {
|
|||
}
|
||||
|
||||
// validate signature
|
||||
if ((data[0] & 0xff) != 0xaa) {
|
||||
return 0;
|
||||
const char* signature = getSignature();
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (data[i] != signature[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((data[1] & 0xff) != 0xdb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// validate body length
|
||||
size_t bodyLength = (size_t) data[7] +
|
||||
(size_t) (data[6] << 8) +
|
||||
(size_t) (data[5] << 16) +
|
||||
(size_t) (data[4] << 24);
|
||||
size_t bodyLength = decodeLength(data + 4);
|
||||
|
||||
if (bodyLength > getMaxLength()) {
|
||||
LOGGER_WARNING << "maximum binary message size is " << getMaxLength() << ", actual size is " << bodyLength;
|
||||
|
@ -152,6 +148,38 @@ namespace triagens {
|
|||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the protocol signature
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const char* getSignature () {
|
||||
return "\xaa\xdb\x00\x00";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the encoded length as a size_t
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static size_t decodeLength (const char* data) {
|
||||
size_t length = (size_t) (((size_t) data[3]) << 0) +
|
||||
(size_t) (((size_t) data[2]) << 8) +
|
||||
(size_t) (((size_t) data[1]) << 16) +
|
||||
(size_t) (((size_t) data[0]) << 24);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief encode the size_t length in a char[4]
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void encodeLength (const size_t length, char* out) {
|
||||
out[0] = (char) ((length >> 24) & 0xff);
|
||||
out[1] = (char) ((length >> 16) & 0xff);
|
||||
out[2] = (char) ((length >> 8) & 0xff);
|
||||
out[3] = (char) ((length >> 0) & 0xff);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the required content-type string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -124,6 +124,8 @@ lib_libarango_client_a_SOURCES = \
|
|||
lib/SimpleHttpClient/GeneralClientConnection.cpp \
|
||||
lib/SimpleHttpClient/ClientConnection.cpp \
|
||||
lib/SimpleHttpClient/SslClientConnection.cpp \
|
||||
lib/SimpleHttpClient/SimpleClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleBinaryClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleHttpClient.cpp \
|
||||
lib/SimpleHttpClient/SimpleHttpResult.cpp
|
||||
|
||||
|
|
|
@ -248,6 +248,14 @@ namespace triagens {
|
|||
return _protocol;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return whether the protocol is binary
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool isBinary () const {
|
||||
return _protocol == PROTOCOL_BINARY;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the encryption used
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple binary client
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Jan Steemann
|
||||
/// @author Copyright 2012, triagens GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SimpleBinaryClient.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <errno.h>
|
||||
|
||||
#include "Basics/StringUtils.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
#include "GeneralClientConnection.h"
|
||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
#include "BinaryServer/BinaryMessage.h"
|
||||
|
||||
using namespace triagens::basics;
|
||||
using namespace triagens::rest;
|
||||
using namespace std;
|
||||
|
||||
namespace triagens {
|
||||
namespace httpclient {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SimpleBinaryClient::SimpleBinaryClient (GeneralClientConnection* connection, double requestTimeout, bool warn) :
|
||||
SimpleClient(connection, requestTimeout, warn), _result(0) {
|
||||
}
|
||||
|
||||
SimpleBinaryClient::~SimpleBinaryClient () {
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// public methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SimpleHttpResult* SimpleBinaryClient::request (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields) {
|
||||
|
||||
assert(_result == 0);
|
||||
|
||||
_result = new SimpleHttpResult;
|
||||
_errorMessage = "";
|
||||
|
||||
// set body to all connections
|
||||
setRequest(method, location, body, bodyLength, headerFields);
|
||||
|
||||
double endTime = now() + _requestTimeout;
|
||||
double remainingTime = _requestTimeout;
|
||||
|
||||
while (isWorking() && remainingTime > 0.0) {
|
||||
switch (_state) {
|
||||
case (IN_CONNECT): {
|
||||
handleConnect();
|
||||
break;
|
||||
}
|
||||
|
||||
case (IN_WRITE): {
|
||||
size_t bytesWritten = 0;
|
||||
|
||||
if (! _connection->handleWrite(remainingTime, (void*) (_writeBuffer.c_str() + _written), _writeBuffer.length() - _written, &bytesWritten)) {
|
||||
setErrorMessage("::send() failed", errno);
|
||||
close();
|
||||
}
|
||||
else {
|
||||
_written += bytesWritten;
|
||||
if (_written == _writeBuffer.length()) {
|
||||
_state = IN_READ_HEADER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case (IN_READ_HEADER): {
|
||||
if (_connection->handleRead(remainingTime, _readBuffer)) {
|
||||
switch (_state) {
|
||||
case (IN_READ_HEADER):
|
||||
// _result->setData(_readBuffer.c_str(), _readBuffer.length());
|
||||
// _result->getBody().write(_readBuffer.c_str(), _result->getContentLength());
|
||||
_result->setResultType(SimpleHttpResult::COMPLETE);
|
||||
_state = FINISHED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
setErrorMessage("gesockopt() failed", errno);
|
||||
close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
remainingTime = endTime - now();
|
||||
}
|
||||
|
||||
if (isWorking() && _errorMessage == "" ) {
|
||||
setErrorMessage("Request timeout reached");
|
||||
}
|
||||
|
||||
// set result type in getResult()
|
||||
SimpleHttpResult* result = getResult();
|
||||
|
||||
_result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// private methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SimpleBinaryClient::reset () {
|
||||
SimpleClient::reset();
|
||||
if (_result) {
|
||||
_result->clear();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleHttpResult* SimpleBinaryClient::getResult () {
|
||||
switch (_state) {
|
||||
case (IN_CONNECT):
|
||||
_result->setResultType(SimpleHttpResult::COULD_NOT_CONNECT);
|
||||
break;
|
||||
|
||||
case (IN_WRITE):
|
||||
_result->setResultType(SimpleHttpResult::WRITE_ERROR);
|
||||
break;
|
||||
|
||||
case (IN_READ_HEADER):
|
||||
case (IN_READ_BODY):
|
||||
case (IN_READ_CHUNKED_HEADER):
|
||||
case (IN_READ_CHUNKED_BODY):
|
||||
_result->setResultType(SimpleHttpResult::READ_ERROR);
|
||||
break;
|
||||
|
||||
case (FINISHED):
|
||||
_result->setResultType(SimpleHttpResult::COMPLETE);
|
||||
break;
|
||||
|
||||
default :
|
||||
_result->setResultType(SimpleHttpResult::COULD_NOT_CONNECT);
|
||||
}
|
||||
|
||||
return _result;
|
||||
}
|
||||
|
||||
void SimpleBinaryClient::setRequest (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields) {
|
||||
|
||||
if (_state == DEAD) {
|
||||
_connection->resetNumConnectRetries();
|
||||
}
|
||||
|
||||
///////////////////// fill the write buffer //////////////////////////////
|
||||
_writeBuffer.clear();
|
||||
|
||||
// write signature
|
||||
const char* signature = BinaryMessage::getSignature();
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
_writeBuffer.appendChar(signature[i]);
|
||||
}
|
||||
|
||||
// write length
|
||||
char length[4];
|
||||
BinaryMessage::encodeLength(bodyLength, &length[0]);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
_writeBuffer.appendChar(length[i]);
|
||||
}
|
||||
|
||||
_writeBuffer.appendText(body, bodyLength);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (_state != FINISHED) {
|
||||
// close connection to reset all read and write buffers
|
||||
close();
|
||||
}
|
||||
|
||||
if (_connection->isConnected()) {
|
||||
// we are connected, start with writing
|
||||
_state = IN_WRITE;
|
||||
_written = 0;
|
||||
}
|
||||
else {
|
||||
// connect to server
|
||||
_state = IN_CONNECT;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple binary client
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Jan Steemann
|
||||
/// @author Copyright 2012, triagens GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef TRIAGENS_SIMPLE_HTTP_CLIENT_SIMPLE_BINARY_CLIENT_H
|
||||
#define TRIAGENS_SIMPLE_HTTP_CLIENT_SIMPLE_BINARY_CLIENT_H 1
|
||||
|
||||
#include <Basics/Common.h>
|
||||
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "SimpleHttpClient/SimpleClient.h"
|
||||
#include "ProtocolBuffers/arangodb.pb.h"
|
||||
|
||||
namespace triagens {
|
||||
namespace httpclient {
|
||||
|
||||
class SimpleHttpResult;
|
||||
class GeneralClientConnection;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple binary client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class SimpleBinaryClient : public SimpleClient {
|
||||
|
||||
private:
|
||||
SimpleBinaryClient (SimpleBinaryClient const&);
|
||||
SimpleBinaryClient& operator= (SimpleBinaryClient const&);
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructs a new binary client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleBinaryClient (GeneralClientConnection*,
|
||||
double,
|
||||
bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destructs a binary client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~SimpleBinaryClient ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief make a http request
|
||||
/// the caller has to delete the result object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual SimpleHttpResult* request (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set user name and password
|
||||
/// not needed for binary client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void setUserNamePassword (const string& prefix,
|
||||
const string& username,
|
||||
const string& password) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reset state
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void reset ();
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the result
|
||||
/// the caller has to delete the result object
|
||||
///
|
||||
/// @return SimpleHttpResult the request result
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleHttpResult* getResult ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set the request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setRequest (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields);
|
||||
|
||||
private:
|
||||
|
||||
SimpleHttpResult* _result;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple client
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
/// @author Achim Brandt
|
||||
/// @author Copyright 2009, triagens GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SimpleClient.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <errno.h>
|
||||
|
||||
#include "Basics/StringUtils.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
#include "GeneralClientConnection.h"
|
||||
#include "SimpleHttpResult.h"
|
||||
|
||||
using namespace triagens::basics;
|
||||
using namespace triagens::rest;
|
||||
using namespace std;
|
||||
|
||||
namespace triagens {
|
||||
namespace httpclient {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SimpleClient::SimpleClient (GeneralClientConnection* connection, double requestTimeout, bool warn) :
|
||||
_connection(connection),
|
||||
_writeBuffer(TRI_UNKNOWN_MEM_ZONE),
|
||||
_readBuffer(TRI_UNKNOWN_MEM_ZONE),
|
||||
_requestTimeout(requestTimeout),
|
||||
_warn(warn) {
|
||||
|
||||
_errorMessage = "";
|
||||
_written = 0;
|
||||
_state = IN_CONNECT;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
SimpleClient::~SimpleClient () {
|
||||
_connection->disconnect();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// protected methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SimpleClient::handleConnect () {
|
||||
if (! _connection->connect()) {
|
||||
setErrorMessage("Could not connect to '" + _connection->getEndpoint()->getSpecification() + "'", errno);
|
||||
_state = DEAD;
|
||||
}
|
||||
else {
|
||||
// can write now
|
||||
_state = IN_WRITE;
|
||||
_written = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool SimpleClient::close () {
|
||||
_connection->disconnect();
|
||||
_state = IN_CONNECT;
|
||||
|
||||
reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleClient::reset () {
|
||||
_readBuffer.clear();
|
||||
}
|
||||
|
||||
double SimpleClient::now () {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
||||
double sec = tv.tv_sec; // seconds
|
||||
double usc = tv.tv_usec; // microseconds
|
||||
|
||||
return sec + usc / 1000000.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple client
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Dr. Frank Celler
|
||||
/// @author Achim Brandt
|
||||
/// @author Copyright 2009, triagens GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef TRIAGENS_SIMPLE_HTTP_CLIENT_SIMPLE_CLIENT_H
|
||||
#define TRIAGENS_SIMPLE_HTTP_CLIENT_SIMPLE_CLIENT_H 1
|
||||
|
||||
#include <Basics/Common.h>
|
||||
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
namespace triagens {
|
||||
namespace httpclient {
|
||||
|
||||
class GeneralClientConnection;
|
||||
class SimpleHttpResult;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class SimpleClient {
|
||||
|
||||
private:
|
||||
SimpleClient (SimpleClient const&);
|
||||
SimpleClient& operator= (SimpleClient const&);
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief state of the connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum request_state {
|
||||
IN_CONNECT,
|
||||
IN_WRITE,
|
||||
IN_READ_HEADER,
|
||||
IN_READ_BODY,
|
||||
IN_READ_CHUNKED_HEADER,
|
||||
IN_READ_CHUNKED_BODY,
|
||||
FINISHED,
|
||||
DEAD
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructs a new client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleClient (GeneralClientConnection*,
|
||||
double,
|
||||
bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destructs a client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~SimpleClient ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the port of the remote server
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const string& getErrorMessage () {
|
||||
return _errorMessage;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set user name and password
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void setUserNamePassword (const string& prefix,
|
||||
const string& username,
|
||||
const string& password) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief make a http request
|
||||
/// the caller has to delete the result object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual SimpleHttpResult* request (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register and dump an error message
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setErrorMessage (const string& message) {
|
||||
_errorMessage = message;
|
||||
|
||||
if (_warn) {
|
||||
LOGGER_WARNING << _errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register an error message
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setErrorMessage (const string& message, int error) {
|
||||
if (error != 0) {
|
||||
_errorMessage = message + ": " + strerror(error);
|
||||
}
|
||||
else {
|
||||
setErrorMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns true if the request is in progress
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool isWorking () const {
|
||||
return _state < FINISHED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialise the connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void handleConnect ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief close connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool close ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reset state
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void reset ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get timestamp
|
||||
///
|
||||
/// @return double time in seconds
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static double now ();
|
||||
|
||||
protected:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief connection used (TCP or SSL connection)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GeneralClientConnection* _connection;
|
||||
|
||||
// read and write buffer
|
||||
triagens::basics::StringBuffer _writeBuffer;
|
||||
triagens::basics::StringBuffer _readBuffer;
|
||||
|
||||
double _requestTimeout;
|
||||
|
||||
bool _warn;
|
||||
|
||||
request_state _state;
|
||||
|
||||
size_t _written;
|
||||
|
||||
string _errorMessage;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -50,22 +50,10 @@ namespace triagens {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
SimpleHttpClient::SimpleHttpClient (GeneralClientConnection* connection, double requestTimeout, bool warn) :
|
||||
_connection(connection),
|
||||
_writeBuffer(TRI_UNKNOWN_MEM_ZONE),
|
||||
_readBuffer(TRI_UNKNOWN_MEM_ZONE),
|
||||
_requestTimeout(requestTimeout),
|
||||
_warn(warn) {
|
||||
|
||||
_result = 0;
|
||||
_errorMessage = "";
|
||||
_written = 0;
|
||||
_state = IN_CONNECT;
|
||||
|
||||
reset();
|
||||
SimpleClient(connection, requestTimeout, warn), _result(0) {
|
||||
}
|
||||
|
||||
SimpleHttpClient::~SimpleHttpClient () {
|
||||
_connection->disconnect();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -162,19 +150,14 @@ namespace triagens {
|
|||
// -----------------------------------------------------------------------------
|
||||
// private methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SimpleHttpClient::handleConnect () {
|
||||
if (! _connection->connect()) {
|
||||
setErrorMessage("Could not connect to '" + _connection->getEndpoint()->getSpecification() + "'", errno);
|
||||
_state = DEAD;
|
||||
}
|
||||
else {
|
||||
// can write now
|
||||
_state = IN_WRITE;
|
||||
_written = 0;
|
||||
|
||||
void SimpleHttpClient::reset () {
|
||||
SimpleClient::reset();
|
||||
if (_result) {
|
||||
_result->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets username and password
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -329,15 +312,6 @@ namespace triagens {
|
|||
// private methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SimpleHttpClient::close () {
|
||||
_connection->disconnect();
|
||||
_state = IN_CONNECT;
|
||||
|
||||
reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleHttpClient::readHeader () {
|
||||
char* pos = (char*) memchr(_readBuffer.c_str(), '\n', _readBuffer.length());
|
||||
|
||||
|
@ -457,25 +431,6 @@ namespace triagens {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SimpleHttpClient::reset () {
|
||||
if (_result) {
|
||||
_result->clear();
|
||||
}
|
||||
|
||||
_readBuffer.clear();
|
||||
}
|
||||
|
||||
double SimpleHttpClient::now () {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
||||
double sec = tv.tv_sec; // seconds
|
||||
double usc = tv.tv_usec; // microseconds
|
||||
|
||||
return sec + usc / 1000000.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,18 +33,19 @@
|
|||
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "SimpleHttpClient/GeneralClientConnection.h"
|
||||
#include "SimpleHttpClient/SimpleClient.h"
|
||||
|
||||
namespace triagens {
|
||||
namespace httpclient {
|
||||
|
||||
class SimpleHttpResult;
|
||||
class GeneralClientConnection;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple http client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class SimpleHttpClient {
|
||||
class SimpleHttpClient : public SimpleClient {
|
||||
|
||||
private:
|
||||
SimpleHttpClient (SimpleHttpClient const&);
|
||||
|
@ -60,21 +61,6 @@ namespace triagens {
|
|||
GET, POST, PUT, DELETE, HEAD, PATCH
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief state of the connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum request_state {
|
||||
IN_CONNECT,
|
||||
IN_WRITE,
|
||||
IN_READ_HEADER,
|
||||
IN_READ_BODY,
|
||||
IN_READ_CHUNKED_HEADER,
|
||||
IN_READ_CHUNKED_BODY,
|
||||
FINISHED,
|
||||
DEAD
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructs a new http client
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -91,24 +77,14 @@ namespace triagens {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief make a http request
|
||||
///
|
||||
/// The caller has to delete the result object
|
||||
/// the caller has to delete the result object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleHttpResult* request (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the port of the remote server
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const string& getErrorMessage () {
|
||||
return _errorMessage;
|
||||
}
|
||||
virtual SimpleHttpResult* request (int method,
|
||||
const string& location,
|
||||
const char* body,
|
||||
size_t bodyLength,
|
||||
const map<string, string>& headerFields);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets username and password
|
||||
|
@ -116,46 +92,23 @@ namespace triagens {
|
|||
/// @param prefix prefix for sending username and password
|
||||
/// @param username username
|
||||
/// @param password password
|
||||
///
|
||||
/// @return void
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setUserNamePassword (const string& prefix,
|
||||
const string& username,
|
||||
const string& password);
|
||||
virtual void setUserNamePassword (const string& prefix,
|
||||
const string& username,
|
||||
const string& password);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reset state
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void reset ();
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register and dump an error message
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setErrorMessage (const string& message) {
|
||||
_errorMessage = message;
|
||||
|
||||
if (_warn) {
|
||||
LOGGER_WARNING << _errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief register an error message
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setErrorMessage (const string& message, int error) {
|
||||
if (error != 0) {
|
||||
_errorMessage = message + ": " + strerror(error);
|
||||
}
|
||||
else {
|
||||
setErrorMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the Result
|
||||
/// The caller has to delete the result object
|
||||
///
|
||||
/// @return SimpleHttpResult the request result
|
||||
/// @brief get the result
|
||||
/// the caller has to delete the result object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SimpleHttpResult* getResult ();
|
||||
|
@ -176,26 +129,6 @@ namespace triagens {
|
|||
size_t bodyLength,
|
||||
const map<string, string>& headerFields);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns true if the request is in progress
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool isWorking () {
|
||||
return _state < FINISHED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialise the connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void handleConnect ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief close connection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool close ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read the http header
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -220,46 +153,13 @@ namespace triagens {
|
|||
|
||||
bool readChunkedBody ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reset state
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void reset ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get timestamp
|
||||
///
|
||||
/// @return double time in seconds
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static double now ();
|
||||
|
||||
private:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief connection used (TCP or SSL connection)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GeneralClientConnection* _connection;
|
||||
|
||||
// read and write buffer
|
||||
triagens::basics::StringBuffer _writeBuffer;
|
||||
triagens::basics::StringBuffer _readBuffer;
|
||||
|
||||
double _requestTimeout;
|
||||
|
||||
bool _warn;
|
||||
|
||||
request_state _state;
|
||||
|
||||
size_t _written;
|
||||
|
||||
uint32_t _nextChunkedSize;
|
||||
|
||||
SimpleHttpResult* _result;
|
||||
|
||||
string _errorMessage;
|
||||
|
||||
std::vector< std::pair<std::string, std::string> >_pathToBasicAuth;
|
||||
std::vector<std::pair<std::string, std::string> >_pathToBasicAuth;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ namespace triagens {
|
|||
return "Error while writing to server.";
|
||||
case (READ_ERROR):
|
||||
return "Error while reading from server.";
|
||||
default:
|
||||
return "Unknown error.";
|
||||
default:
|
||||
return "Unknown error.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace triagens {
|
|||
SimpleHttpResult& operator= (SimpleHttpResult const&);
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief result types
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -69,6 +70,10 @@ namespace triagens {
|
|||
READ_ERROR,
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief http response codes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum http_status_codes {
|
||||
HTTP_STATUS_OK = 200,
|
||||
|
@ -122,7 +127,7 @@ namespace triagens {
|
|||
/// @brief returns the http return code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int getHttpReturnCode () {
|
||||
int getHttpReturnCode () const {
|
||||
return _returnCode;
|
||||
}
|
||||
|
||||
|
@ -138,7 +143,7 @@ namespace triagens {
|
|||
/// @brief returns the http return message
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string getHttpReturnMessage () {
|
||||
string getHttpReturnMessage () const {
|
||||
return _returnMessage;
|
||||
}
|
||||
|
||||
|
@ -154,7 +159,7 @@ namespace triagens {
|
|||
/// @brief returns the content length
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
size_t getContentLength () {
|
||||
size_t getContentLength () const {
|
||||
return _contentLength;
|
||||
}
|
||||
|
||||
|
@ -188,7 +193,6 @@ namespace triagens {
|
|||
return _requestResultType == COMPLETE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns true if "transfer-encoding: chunked"
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -197,7 +201,6 @@ namespace triagens {
|
|||
return _chunked;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets the request result type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue