[med-svn] [Git][med-team/ncbi-vdb][upstream] New upstream version 2.10.4+dfsg
Steffen Möller
gitlab at salsa.debian.org
Mon Mar 2 11:55:35 GMT 2020
Steffen Möller pushed to branch upstream at Debian Med / ncbi-vdb
Commits:
84ec5d9e by Steffen Moeller at 2020-03-02T02:04:33+01:00
New upstream version 2.10.4+dfsg
- - - - -
9 changed files:
- CHANGES.md
- build/Makefile.vers
- libs/blast/blast-mgr.c
- libs/kdb/libkdb.vers.h
- libs/klib/release-vers.h
- libs/kns/http-request.c
- libs/ncbi-vdb/libncbi-vdb.vers
- libs/vdb/libvdb.vers.h
- test/kns/test-http-request.cpp
Changes:
=====================================
CHANGES.md
=====================================
@@ -1,6 +1,12 @@
# NCBI External Developer Release:
+## NCBI VDB 2.10.4
+**February 26, 2020**
+
+ **kns**: fixed errors when using ngc file
+
+
## NCBI VDB 2.10.3
**February 18, 2020**
=====================================
build/Makefile.vers
=====================================
@@ -23,4 +23,4 @@
# ===========================================================================
# NCBI-VDB and library version
-VERSION = 2.10.3
+VERSION = 2.10.4
=====================================
libs/blast/blast-mgr.c
=====================================
@@ -50,7 +50,7 @@
#include <stdio.h> /* fprintf */
#include <string.h> /* memset */
-#define TOOLKIT "sratoolkit2_10_3"
+#define TOOLKIT "sratoolkit2_10_4"
/******************************************************************************/
=====================================
libs/kdb/libkdb.vers.h
=====================================
@@ -24,4 +24,4 @@
*
*/
-#define LIBKDB_VERS 0x02070023
+#define LIBKDB_VERS 0x02070024
=====================================
libs/klib/release-vers.h
=====================================
@@ -28,7 +28,7 @@
/* Version of current SRA Toolkit Release */
-#define RELEASE_VERS 0x020A0003
+#define RELEASE_VERS 0x020A0004
/* Type of Version of current SRA Toolkit Release is one of:
=====================================
libs/kns/http-request.c
=====================================
@@ -145,7 +145,8 @@ rc_t KClientHttpMakeRequestInt ( const KClientHttp *self,
rc_t rc;
/* create the object with empty buffer */
- KClientHttpRequest * req = calloc ( 1, sizeof * req );
+ KClientHttpRequest * req
+ = (KClientHttpRequest *) calloc ( 1, sizeof * req );
if ( req == NULL )
rc = RC ( rcNS, rcNoTarg, rcAllocating, rcMemory, rcNull );
else
@@ -160,7 +161,8 @@ rc_t KClientHttpMakeRequestInt ( const KClientHttp *self,
rc = KDataBufferMakeBytes ( & req -> body, 0 );
if ( rc == 0 )
{
- KRefcountInit ( & req -> refcount, 1, "KClientHttpRequest", "make", buf -> base );
+ KRefcountInit ( & req -> refcount, 1, "KClientHttpRequest",
+ "make", (char*) buf -> base );
/* fill out url_buffer with URL */
rc = KClientHttpRequestInit ( req, block, buf );
@@ -226,7 +228,8 @@ LIB_EXPORT rc_t CC KClientHttpVMakeRequest ( const KClientHttp *self,
{
/* parse the URL */
URLBlock block;
- rc = ParseUrl ( & block, buf . base, buf . elem_count - 1 );
+ rc = ParseUrl ( & block, (char*) buf . base,
+ buf . elem_count - 1 );
if ( rc == 0 )
rc = KClientHttpMakeRequestInt ( self, _req, & block, & buf );
}
@@ -303,7 +306,8 @@ rc_t CC KNSManagerMakeClientRequestInt ( const KNSManager *self,
{
/* parse the URL */
URLBlock block;
- rc = ParseUrl ( & block, buf . base, buf . elem_count - 1 );
+ rc = ParseUrl ( & block, (char*) buf . base,
+ buf . elem_count - 1 );
if ( rc == 0 )
{
KClientHttp * http;
@@ -731,7 +735,7 @@ rc_t
UrlEncode( const char * source, size_t size, char ** res )
{ /* source: https://www.tutorialspoint.com/html/html_url_encoding.htm */
char * cur;
- int i;
+ size_t i = 0;
assert ( source != NULL );
assert ( res != NULL );
@@ -837,7 +841,9 @@ LIB_EXPORT rc_t CC KClientHttpRequestVAddQueryParam ( KClientHttpRequest *self,
KDataBufferWhack( & self -> url_buffer );
self -> url_buffer = newBuf;
/* re-parse the new URL */
- rc = ParseUrl ( & self -> url_block, self -> url_buffer . base, self -> url_buffer . elem_count - 1 );
+ rc = ParseUrl ( & self -> url_block,
+ (char*) self -> url_buffer . base,
+ self -> url_buffer . elem_count - 1 );
}
}
free ( encValue );
@@ -862,6 +868,58 @@ LIB_EXPORT rc_t CC KClientHttpRequestAddQueryParam ( KClientHttpRequest *self, c
return rc;
}
+static rc_t urlEncodeBase64(const String ** encoding) {
+ int n = 0;
+ size_t i = 0;
+
+ if (encoding == NULL || *encoding == NULL || (*encoding)->addr == NULL)
+ return 0;
+
+ for (i = 0; i < (*encoding)->size; ++i) {
+ if (((*encoding)->addr)[i] == '+' ||
+ ((*encoding)->addr)[i] == '/')
+ {
+ ++n;
+ }
+ }
+
+ if (n > 0) {
+ size_t iFrom = 0, iTo = 0;
+ const char *from = (*encoding)->addr;
+ char *to = NULL;
+ uint32_t len = (*encoding)->size + n + n;
+
+ String * encoded = (String *) calloc(1, sizeof * encoded + len + 1);
+ if (encoded == NULL)
+ return RC(rcNS, rcString, rcAllocating, rcMemory, rcExhausted);
+
+ to = (char*)(encoded + 1);
+ StringInit(encoded, to, len, len);
+
+ for (iFrom = 0; iFrom < (*encoding)->size; ++iFrom) {
+ if (from[iFrom] == '+') {
+ to[iTo++] = '%';
+ to[iTo++] = '2';
+ to[iTo++] = 'b';
+ }
+ else if (from[iFrom] == '/') {
+ to[iTo++] = '%';
+ to[iTo++] = '2';
+ to[iTo++] = 'f';
+ }
+ else
+ to[iTo++] = from[iFrom];
+ }
+ to[iTo] = '\0';
+ assert(iTo == len);
+
+ StringWhack(*encoding);
+ *encoding = encoded;
+ }
+
+ return 0;
+}
+
LIB_EXPORT rc_t CC KClientHttpRequestAddPostFileParam ( KClientHttpRequest * self, const char * name, const char * path )
{
rc_t rc = 0;
@@ -902,8 +960,10 @@ LIB_EXPORT rc_t CC KClientHttpRequestAddPostFileParam ( KClientHttpRequest * sel
rc = KMMapAddrRead( mm, & fileStart );
if ( rc == 0 )
{
- const String * encoded;
+ const String * encoded = NULL;
rc = encodeBase64( & encoded, fileStart, fileSize );
+ if ( rc == 0 )
+ rc = urlEncodeBase64( & encoded );
if ( rc == 0 )
{
rc = KClientHttpRequestAddPostParam( self, "%s=%S", name, encoded );
@@ -1315,7 +1375,7 @@ rc_t KClientHttpRequestHandleRedirection ( KClientHttpRequest *self, const char
if ( rc == 0 )
{
/* parse the URI into local url_block */
- rc = ParseUrl ( &b, uri . base, uri . elem_count - 1 );
+ rc = ParseUrl ( &b, (char *) uri . base, uri . elem_count - 1 );
if ( rc == 0 )
{
KClientHttp *http = self -> http;
@@ -1379,13 +1439,15 @@ rc_t KClientHttpRequestSendReceiveNoBodyInt ( KClientHttpRequest *self, KClientH
break;
/* send the message and create a response */
- rc = KClientHttpSendReceiveMsg ( self -> http, _rslt, buffer.base,
- buffer.elem_count - 1, NULL, self -> url_buffer . base );
+ rc = KClientHttpSendReceiveMsg ( self -> http, _rslt,
+ (char *) buffer.base,
+ buffer.elem_count - 1, NULL, (char *) self -> url_buffer . base );
if ( rc != 0 )
{
KClientHttpClose ( self -> http );
- rc = KClientHttpSendReceiveMsg ( self -> http, _rslt, buffer.base,
- buffer.elem_count - 1, NULL, self -> url_buffer . base );
+ rc = KClientHttpSendReceiveMsg ( self -> http, _rslt,
+ (char *) buffer.base, buffer.elem_count - 1, NULL,
+ (char *) self -> url_buffer . base );
if ( rc != 0 )
break;
}
@@ -1464,7 +1526,8 @@ static
rc_t KClientHttpRequestSendReceiveNoBody ( KClientHttpRequest *self, KClientHttpResult **_rslt, const char *method )
{
KHttpRetrier retrier;
- rc_t rc = KHttpRetrierInit ( & retrier, self -> url_buffer . base, self -> http -> mgr );
+ rc_t rc = KHttpRetrierInit ( & retrier,
+ (char *) self -> url_buffer . base, self -> http -> mgr );
if ( rc == 0 )
{
@@ -1632,11 +1695,15 @@ rc_t CC KClientHttpRequestPOST_Int ( KClientHttpRequest *self, KClientHttpResult
}
/* send the message and create a response */
- rc = KClientHttpSendReceiveMsg ( self -> http, _rslt, buffer.base, buffer.elem_count, body, self -> url_buffer . base );
+ rc = KClientHttpSendReceiveMsg ( self -> http, _rslt,
+ (char *) buffer.base, buffer.elem_count, body,
+ (char *) self -> url_buffer . base );
if ( rc != 0 )
{
KClientHttpClose ( self -> http );
- rc = KClientHttpSendReceiveMsg ( self -> http, _rslt, buffer.base, buffer.elem_count, NULL, self -> url_buffer . base );
+ rc = KClientHttpSendReceiveMsg ( self -> http, _rslt,
+ (char *) buffer.base, buffer.elem_count, NULL,
+ (char *) self -> url_buffer . base );
}
KDataBufferWhack( & buffer );
if ( rc != 0 )
@@ -1803,7 +1870,8 @@ LIB_EXPORT rc_t CC KClientHttpRequestPOST ( KClientHttpRequest *self, KClientHtt
return RC ( rcNS, rcNoTarg, rcUpdating, rcParam, rcNull );
}
- rc = KHttpRetrierInit ( & retrier, self -> url_buffer . base, self -> http -> mgr );
+ rc = KHttpRetrierInit ( & retrier, (char *) self -> url_buffer . base,
+ self -> http -> mgr );
if ( rc == 0 )
{
@@ -1818,7 +1886,7 @@ LIB_EXPORT rc_t CC KClientHttpRequestPOST ( KClientHttpRequest *self, KClientHtt
assert ( * _rslt );
if ( ( * _rslt ) -> status == 403 &&
- GovSiteByHttp ( self -> url_buffer . base ) )
+ GovSiteByHttp ((char *) self -> url_buffer . base ) )
{
break;
}
=====================================
libs/ncbi-vdb/libncbi-vdb.vers
=====================================
@@ -1 +1 @@
-2.10.3
+2.10.4
=====================================
libs/vdb/libvdb.vers.h
=====================================
@@ -24,4 +24,4 @@
*
*/
-#define LIBVDB_VERS 0x02070023
+#define LIBVDB_VERS 0x02070024
=====================================
test/kns/test-http-request.cpp
=====================================
@@ -34,13 +34,17 @@
#include <kns/manager.h>
#include <kns/kns-mgr-priv.h>
-#include <../libs/kns/http-priv.h>
-#include <../libs/vfs/resolver-cgi.h> /* SDL_CGI */
+#include "../libs/kns/http-priv.h"
+#include "../libs/vfs/resolver-cgi.h" /* SDL_CGI */
#include <kapp/args.h> // Args
#include <ktst/unit_test.hpp>
+#include "../libs/kns/http-request.c" /* urlEncodeBase64 */
+
+#define ALL
+
static rc_t argsHandler ( int argc, char * argv [] );
TEST_SUITE_WITH_ARGS_HANDLER ( HttpRequestVerifyURLSuite, argsHandler );
@@ -77,6 +81,7 @@ public:
string m_url;
};
+#ifdef ALL
FIXTURE_TEST_CASE(HttpRequest_POST_NoParams, HttpRequestFixture)
{ // Bug: KClientHttpRequestPOST crashed if request had no parameters
MakeRequest( GetName() );
@@ -86,6 +91,7 @@ FIXTURE_TEST_CASE(HttpRequest_POST_NoParams, HttpRequestFixture)
REQUIRE_RC ( KClientHttpRequestPOST ( m_req, & rslt ) );
REQUIRE_RC ( KClientHttpResultRelease ( rslt ) );
}
+#endif
// KClientHttpRequestAddQueryParam
@@ -104,6 +110,7 @@ public:
}
};
+#ifdef ALL
FIXTURE_TEST_CASE(HttpRequestAddQueryParam_SelfNull, HttpRequestFixture)
{
MakeRequest( GetName() );
@@ -324,6 +331,39 @@ FIXTURE_TEST_CASE(HttpReliableRequest_BadCgi, HttpFixture)
REQUIRE_EQ ( code, 404u );
REQUIRE_RC ( KHttpResultRelease( rslt ) );
}
+#endif
+
+TEST_CASE(Test_urlEncodePluses) {
+ REQUIRE_RC(urlEncodeBase64(NULL));
+
+ const String * encoding = NULL;
+ REQUIRE_RC(urlEncodeBase64(&encoding));
+
+ encoding = (String*) calloc(1, sizeof *encoding);
+ REQUIRE_RC(urlEncodeBase64(&encoding));
+ free((void*)encoding);
+
+ String s, d;
+
+ CONST_STRING(&s, "");
+ StringCopy(&encoding, &s);
+ REQUIRE_RC(urlEncodeBase64(&encoding));
+ REQUIRE_EQ(StringCompare(encoding, &s), 0);
+ StringWhack(encoding);
+
+ CONST_STRING(&s, "a");
+ StringCopy(&encoding, &s);
+ REQUIRE_RC(urlEncodeBase64(&encoding));
+ REQUIRE_EQ(StringCompare(encoding, &s), 0);
+ StringWhack(encoding);
+
+ CONST_STRING(&s, "+/");
+ StringCopy(&encoding, &s);
+ REQUIRE_RC(urlEncodeBase64(&encoding));
+ CONST_STRING(&d, "%2b%2f");
+ REQUIRE_EQ(StringCompare(encoding, &d), 0);
+ StringWhack(encoding);
+}
//////////////////////////////////////////// Main
View it on GitLab: https://salsa.debian.org/med-team/ncbi-vdb/-/commit/84ec5d9e03207987c92d1c259b02ec2558aecf96
--
View it on GitLab: https://salsa.debian.org/med-team/ncbi-vdb/-/commit/84ec5d9e03207987c92d1c259b02ec2558aecf96
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200302/8f831fcf/attachment-0001.html>
More information about the debian-med-commit
mailing list