mirror of https://github.com/vitalif/grive2
fix MD5 and remote XML dump
parent
8ff04683a8
commit
b6aafd7ccd
|
@ -94,8 +94,8 @@ Drive::Drive( OAuth2& auth, const Json& options ) :
|
|||
if ( prev_stamp != -1 )
|
||||
{
|
||||
boost::format changes_uri( "https://docs.google.com/feeds/default/private/changes?start-index=%1%" ) ;
|
||||
http::ResponseLog log2( "changes-", ".xml", &xrsp ) ;
|
||||
http.Get( (changes_uri%(prev_stamp+1)).str(), &log2, m_http_hdr ) ;
|
||||
// http::ResponseLog log2( "changes-", ".xml", &xrsp ) ;
|
||||
http.Get( (changes_uri%(prev_stamp+1)).str(), &xrsp, m_http_hdr ) ;
|
||||
|
||||
Feed changes( xrsp.Response() ) ;
|
||||
std::for_each( changes.begin(), changes.end(), boost::bind( &Drive::FromChange, this, _1 ) ) ;
|
||||
|
|
|
@ -51,7 +51,7 @@ std::string MD5( StdioFile& file )
|
|||
char buf[read_size] ;
|
||||
|
||||
gcry_md_hd_t hd ;
|
||||
gcry_error_t err = gcry_md_open( &hd, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC ) ;
|
||||
gcry_error_t err = gcry_md_open( &hd, GCRY_MD_MD5, 0 ) ;
|
||||
if ( err != GPG_ERR_NO_ERROR )
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( Exception() << expt::ErrMsg( gcry_strerror(err) ) ) ;
|
||||
|
@ -60,13 +60,13 @@ std::string MD5( StdioFile& file )
|
|||
std::size_t count = 0 ;
|
||||
while ( (count = file.Read( buf, sizeof(buf) )) > 0 )
|
||||
gcry_md_write( hd, buf, count ) ;
|
||||
gcry_md_final(hd) ;
|
||||
|
||||
unsigned char *md5 = gcry_md_read( hd, GCRY_MD_MD5 ) ;
|
||||
unsigned int len = gcry_md_get_algo_dlen(GCRY_MD_MD5) ;
|
||||
|
||||
// format the MD5 string
|
||||
std::ostringstream ss ;
|
||||
for ( unsigned int i = 0 ; i < gcry_md_get_algo_dlen(GCRY_MD_MD5) ; i++ )
|
||||
for ( unsigned int i = 0 ; i < len ; i++ )
|
||||
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(md5[i]) ;
|
||||
|
||||
gcry_md_close( hd ) ;
|
||||
|
|
Loading…
Reference in New Issue