mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
Setting for FrameworkBenchmarks participations
This commit is contained in:
parent
3c3c591bb9
commit
c03d8716bb
|
@ -217,7 +217,9 @@ private:
|
|||
UString cfg_str, upload, user, password;
|
||||
bool follow_redirects;
|
||||
|
||||
#ifndef U_COVERITY_FALSE_POSITIVE
|
||||
U_APPLICATION_PRIVATE
|
||||
#endif
|
||||
};
|
||||
|
||||
U_MAIN
|
||||
|
|
|
@ -123,7 +123,9 @@ private:
|
|||
Server* server;
|
||||
UFileConfig cfg; // NB: we put this here to avoid unnecessary destructor at runtime...
|
||||
|
||||
#ifndef U_COVERITY_FALSE_POSITIVE
|
||||
U_APPLICATION_PRIVATE
|
||||
#endif
|
||||
};
|
||||
|
||||
U_MAIN
|
||||
|
|
|
@ -112,14 +112,20 @@
|
|||
|
||||
/* Manage message info */
|
||||
|
||||
# define U_ERROR(fmt,args...) {u_flag_exit=-1;u__printf(STDERR_FILENO,"%W%N%W: %WERROR: (pid %P) " fmt " - Exiting...%W",BRIGHTCYAN,RESET,RED, ##args,RESET);}
|
||||
# define U_ABORT(fmt,args...) {u_flag_exit=-2;u__printf(STDERR_FILENO,"%W%N%W: %WABORT: (pid %P) " fmt "%W",BRIGHTCYAN,RESET,RED, ##args,RESET);}
|
||||
# define U_WARNING(fmt,args...) {u_flag_exit=2;u__printf(STDERR_FILENO,"%W%N%W: %WWARNING: (pid %P) " fmt "%W",BRIGHTCYAN,RESET,YELLOW, ##args,RESET);}
|
||||
# define U_MESSAGE(fmt,args...) u__printf(STDERR_FILENO, "%W%N%W: " fmt,BRIGHTCYAN,RESET, ##args)
|
||||
# define U_ERROR(fmt,args...) \
|
||||
{ u_flag_exit = -1; u__printf(STDERR_FILENO, "%W%N%W: %WERROR: %9D (pid %P) " fmt " - Exiting...%W", BRIGHTCYAN, RESET, RED, ##args, RESET); }
|
||||
|
||||
# define U_ERROR_SYSCALL(msg) U_ERROR("%R",msg)
|
||||
# define U_ABORT_SYSCALL(msg) U_ABORT("%R",msg)
|
||||
# define U_WARNING_SYSCALL(msg) U_WARNING("%R",msg)
|
||||
#define U_ABORT(fmt,args...) \
|
||||
{ u_flag_exit = -2; u__printf(STDERR_FILENO, "%W%N%W: %WABORT: %9D (pid %P) " fmt "%W", BRIGHTCYAN, RESET, RED, ##args, RESET); }
|
||||
|
||||
#define U_WARNING(fmt,args...) \
|
||||
{ u_flag_exit = 2; u__printf(STDERR_FILENO, "%W%N%W: %WWARNING: %9D (pid %P) " fmt "%W", BRIGHTCYAN, RESET, YELLOW, ##args, RESET); }
|
||||
|
||||
#define U_MESSAGE(fmt,args...) u__printf(STDERR_FILENO, "%W%N%W: " fmt, BRIGHTCYAN, RESET, ##args)
|
||||
|
||||
#define U_ERROR_SYSCALL(msg) U_ERROR("%R",msg)
|
||||
#define U_ABORT_SYSCALL(msg) U_ABORT("%R",msg)
|
||||
#define U_WARNING_SYSCALL(msg) U_WARNING("%R",msg)
|
||||
|
||||
/* Get string costant size from compiler */
|
||||
|
||||
|
|
|
@ -147,7 +147,8 @@ public:
|
|||
protected:
|
||||
UMimeHeader* requestHeader;
|
||||
UMimeHeader* responseHeader;
|
||||
UString method, body, user, password, setcookie, last_request;
|
||||
UString body, user, password, setcookie, last_request;
|
||||
uint32_t method_num;
|
||||
bool bFollowRedirects, bproxy;
|
||||
|
||||
static struct uhttpinfo u_http_info_save;
|
||||
|
@ -158,10 +159,8 @@ protected:
|
|||
|
||||
// Add the MIME-type headers to the request for HTTP server
|
||||
|
||||
static UString wrapRequest(UString* req, const UString& host_port,
|
||||
const char* method, uint32_t method_len,
|
||||
const char* uri, uint32_t uri_len,
|
||||
const char* extension, const char* content_type = 0);
|
||||
static UString wrapRequest(UString* req, const UString& host_port, uint32_t method_num,
|
||||
const char* uri, uint32_t uri_len, const char* extension, const char* content_type = 0);
|
||||
|
||||
// In response to a HTTP_UNAUTHORISED response from the HTTP server, this function will attempt
|
||||
// to generate an Authentication header to satisfy the server.
|
||||
|
@ -178,8 +177,9 @@ protected:
|
|||
requestHeader = U_NEW(UMimeHeader);
|
||||
responseHeader = U_NEW(UMimeHeader);
|
||||
|
||||
bproxy = false;
|
||||
method_num = 0;
|
||||
bFollowRedirects = true;
|
||||
bproxy = false;
|
||||
}
|
||||
|
||||
~UHttpClient_Base()
|
||||
|
|
|
@ -646,8 +646,6 @@ public:
|
|||
static const UString* str_name;
|
||||
static const UString* str_localhost;
|
||||
static const UString* str_http;
|
||||
static const UString* str_GET;
|
||||
static const UString* str_POST;
|
||||
static const UString* str_filename;
|
||||
static const UString* str_msg_rfc;
|
||||
static const UString* str_txt_plain;
|
||||
|
|
|
@ -182,10 +182,13 @@ public:
|
|||
const char* a, uint32_t n1,
|
||||
const char* b, uint32_t n2);
|
||||
|
||||
static UString substitute(const UString& s, char a, char b)
|
||||
static UString substitute(const UString& s, char a, char b)
|
||||
{ return substitute(U_STRING_TO_PARAM(s), &a, 1, &b, 1); }
|
||||
|
||||
static UString substitute(const UString& s, char a, const char* b, uint32_t n2)
|
||||
static UString substitute(const char* s, uint32_t n, char a, const char* b, uint32_t n2)
|
||||
{ return substitute(s, n, &a, 1, b, n2); }
|
||||
|
||||
static UString substitute(const UString& s, char a, const char* b, uint32_t n2)
|
||||
{ return substitute(U_STRING_TO_PARAM(s), &a, 1, b, n2); }
|
||||
|
||||
static UString substitute(const UString& s, const char* a, uint32_t n1, char b)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef ULIB_SOAP_CLIENT_H
|
||||
#define ULIB_SOAP_CLIENT_H 1
|
||||
|
||||
#include <ulib/utility/uhttp.h>
|
||||
#include <ulib/net/client/http.h>
|
||||
#include <ulib/net/server/server.h>
|
||||
#include <ulib/net/rpc/rpc_client.h>
|
||||
|
@ -60,10 +59,8 @@ public:
|
|||
|
||||
request = URPCMethod::encoder->encodeMethodCall(method, *UString::str_ns);
|
||||
|
||||
request = UHttpClient_Base::wrapRequest(&request, UClient_Base::host_port,
|
||||
U_CONSTANT_TO_PARAM("POST"),
|
||||
U_CONSTANT_TO_PARAM("/soap"), "",
|
||||
"application/soap+xml; charset=\"utf-8\"");
|
||||
request = UHttpClient_Base::wrapRequest(&request, UClient_Base::host_port, 2,
|
||||
U_CONSTANT_TO_PARAM("/soap"), "", "application/soap+xml; charset=\"utf-8\"");
|
||||
|
||||
if (sendRequest() &&
|
||||
readResponse() &&
|
||||
|
@ -72,7 +69,9 @@ public:
|
|||
if (parser.getMethodName() == *UString::str_fault) UClient_Base::response = parser.getFaultResponse();
|
||||
else
|
||||
{
|
||||
# ifndef U_COVERITY_FALSE_POSITIVE // Explicit null dereferenced (FORWARD_NULL)
|
||||
UClient_Base::response = parser.getResponse();
|
||||
# endif
|
||||
|
||||
U_RETURN(true);
|
||||
}
|
||||
|
|
|
@ -457,12 +457,14 @@ static int yy_pop_parser_stack(yyParser *pParser){
|
|||
yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
|
||||
|
||||
if( pParser->yyidx<0 ) return 0;
|
||||
#ifndef U_COVERITY_FALSE_POSITIVE
|
||||
#ifndef NDEBUG
|
||||
if( yyTraceFILE && pParser->yyidx>=0 ){
|
||||
fprintf(yyTraceFILE,"%sPopping %s\n",
|
||||
yyTracePrompt,
|
||||
yyTokenName[yytos->major]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
yymajor = yytos->major;
|
||||
yy_destructor( yymajor, &yytos->minor);
|
||||
|
|
|
@ -253,6 +253,7 @@ multiplicativeExpression(A) ::= multiplicativeExpression(B) multiplicativeCond(C
|
|||
|
||||
U_INTERNAL_DUMP("B = %.*S C = %d D = %.*S", U_STRING_TO_TRACE(*B), C, U_STRING_TO_TRACE(*D))
|
||||
|
||||
#ifndef U_COVERITY_FALSE_POSITIVE
|
||||
long Blo = B->strtol(),
|
||||
Dlo = D->strtol(),
|
||||
lo = (C == U_TK_MULT ? Blo * Dlo :
|
||||
|
@ -265,6 +266,7 @@ multiplicativeExpression(A) ::= multiplicativeExpression(B) multiplicativeCond(C
|
|||
delete D;
|
||||
|
||||
U_INTERNAL_DUMP("A = %.*S", U_STRING_TO_TRACE(*A))
|
||||
#endif
|
||||
}
|
||||
|
||||
multiplicativeExpression(A) ::= unaryExpression(B). {
|
||||
|
|
|
@ -67,7 +67,9 @@ ULog::ULog(const UString& path, uint32_t _size, const char* dir_log_gz) : UFile(
|
|||
|
||||
if (UFile::creat(O_RDWR | O_APPEND, 0664) == false)
|
||||
{
|
||||
# ifndef U_COVERITY_FALSE_POSITIVE
|
||||
U_ERROR("cannot creat log file %.*S", U_FILE_TO_TRACE(*this));
|
||||
# endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -213,8 +213,7 @@ void UHttpClient_Base::reset()
|
|||
{
|
||||
U_TRACE(0, "UHttpClient_Base::reset()")
|
||||
|
||||
body.clear();
|
||||
method.clear();
|
||||
body.clear();
|
||||
|
||||
requestHeader->clear();
|
||||
responseHeader->clear();
|
||||
|
@ -395,7 +394,7 @@ bool UHttpClient_Base::createAuthorizationHeader()
|
|||
|
||||
// MD5(method : uri)
|
||||
|
||||
a2.snprintf("%.*s:%.*s", U_STRING_TO_TRACE(method), U_STRING_TO_TRACE(UClient_Base::uri));
|
||||
a2.snprintf("%.*s:%.*s", u_http_method_list[method_num].len, u_http_method_list[method_num].name, U_STRING_TO_TRACE(UClient_Base::uri));
|
||||
|
||||
UServices::generateDigest(U_HASH_MD5, 0, a2, ha2, false);
|
||||
|
||||
|
@ -585,7 +584,7 @@ bool UHttpClient_Base::putRequestOnQueue() // In general, if sendRequest() faile
|
|||
{
|
||||
// we need to compose the request to the HTTP server...
|
||||
|
||||
method = *UString::str_GET;
|
||||
method_num = 0; // GET
|
||||
|
||||
composeRequest();
|
||||
}
|
||||
|
@ -620,7 +619,7 @@ int UHttpClient_Base::sendRequestAsync(const UString& _url, bool bqueue, const c
|
|||
{
|
||||
// we need to compose the request to the HTTP server...
|
||||
|
||||
method = *UString::str_GET;
|
||||
method_num = 0; // GET
|
||||
|
||||
composeRequest();
|
||||
|
||||
|
@ -714,17 +713,14 @@ void UHttpClient_Base::parseRequest()
|
|||
UClient_Base::iov[2].iov_len = last_request.size() - startHeader;
|
||||
}
|
||||
|
||||
UString UHttpClient_Base::wrapRequest(UString* req, const UString& host_port,
|
||||
const char* method, uint32_t method_len,
|
||||
const char* _uri, uint32_t uri_len,
|
||||
const char* extension, const char* content_type)
|
||||
UString UHttpClient_Base::wrapRequest(UString* req, const UString& host_port, uint32_t method_num,
|
||||
const char* _uri, uint32_t uri_len, const char* extension, const char* content_type)
|
||||
{
|
||||
U_TRACE(0, "UHttpClient_Base::wrapRequest(%p,%.*S,%.*S,%u,%.*S,%u,%S,%S)", req, U_STRING_TO_TRACE(host_port),
|
||||
method_len, method, method_len,
|
||||
uri_len, _uri, uri_len, extension, content_type)
|
||||
U_TRACE(0, "UHttpClient_Base::wrapRequest(%p,%.*S,%u,%.*S,%u,%S,%S)", req, U_STRING_TO_TRACE(host_port), method_num,
|
||||
uri_len, _uri, uri_len, extension, content_type)
|
||||
|
||||
U_INTERNAL_ASSERT_MAJOR(uri_len, 0)
|
||||
U_INTERNAL_ASSERT_MAJOR(method_len, 0)
|
||||
U_INTERNAL_ASSERT_MINOR(method_num, U_NUM_ELEMENTS(u_http_method_list))
|
||||
|
||||
// Add the MIME-type headers to the request for HTTP server
|
||||
|
||||
|
@ -734,7 +730,7 @@ UString UHttpClient_Base::wrapRequest(UString* req, const UString& host_port,
|
|||
"Host: %.*s\r\n"
|
||||
"User-Agent: " PACKAGE_NAME "/" PACKAGE_VERSION "\r\n"
|
||||
"%s",
|
||||
method_len, method,
|
||||
u_http_method_list[method_num].len, u_http_method_list[method_num].name,
|
||||
uri_len, _uri,
|
||||
U_STRING_TO_TRACE(host_port),
|
||||
extension);
|
||||
|
@ -760,10 +756,9 @@ void UHttpClient_Base::composeRequest()
|
|||
{
|
||||
U_TRACE(0, "UHttpClient_Base::composeRequest()")
|
||||
|
||||
U_INTERNAL_ASSERT(method)
|
||||
U_INTERNAL_ASSERT(UClient_Base::uri)
|
||||
|
||||
last_request = wrapRequest(0, UClient_Base::host_port, U_STRING_TO_PARAM(method), U_STRING_TO_PARAM(UClient_Base::uri), "\r\n");
|
||||
last_request = wrapRequest(0, UClient_Base::host_port, method_num, U_STRING_TO_PARAM(UClient_Base::uri), "\r\n");
|
||||
|
||||
parseRequest();
|
||||
}
|
||||
|
@ -856,7 +851,7 @@ bool UHttpClient_Base::sendRequest()
|
|||
{
|
||||
// we need to compose the request to the HTTP server...
|
||||
|
||||
method = *UString::str_GET;
|
||||
method_num = 0; // GET
|
||||
|
||||
composeRequest();
|
||||
}
|
||||
|
@ -886,11 +881,11 @@ bool UHttpClient_Base::sendRequest(const UString& req)
|
|||
|
||||
if (UHTTP::scanfHeader((const char*)UClient_Base::iov[0].iov_base, UClient_Base::iov[0].iov_len))
|
||||
{
|
||||
U_INTERNAL_DUMP("method_type = %B", U_http_method_type)
|
||||
U_INTERNAL_DUMP("U_http_method_type = %B", U_http_method_type)
|
||||
|
||||
U_INTERNAL_ASSERT(UHTTP::isGETorPOST())
|
||||
|
||||
method = (U_http_method_type == HTTP_GET ? *UString::str_GET : *UString::str_POST);
|
||||
method_num = (U_http_method_type == HTTP_GET ? 0 : 2); // GET|POST
|
||||
|
||||
(void) UClient_Base::uri.assign(U_HTTP_URI_QUERY_TO_PARAM);
|
||||
|
||||
|
@ -937,7 +932,7 @@ bool UHttpClient_Base::sendPost(const UString& _url, const UString& _body, const
|
|||
|
||||
// send post request to server and get response
|
||||
|
||||
method = *UString::str_POST;
|
||||
method_num = 2; // POST
|
||||
|
||||
if (sendRequest()) U_RETURN(true);
|
||||
|
||||
|
@ -1009,7 +1004,7 @@ bool UHttpClient_Base::upload(const UString& _url, UFile& file, const char* file
|
|||
|
||||
// send upload request to server and get response
|
||||
|
||||
method = *UString::str_POST;
|
||||
method_num = 2; // POST
|
||||
|
||||
if (sendRequest()) U_RETURN(true);
|
||||
|
||||
|
@ -1025,10 +1020,10 @@ const char* UHttpClient_Base::dump(bool _reset) const
|
|||
|
||||
*UObjectIO::os << '\n'
|
||||
<< "bproxy " << bproxy << '\n'
|
||||
<< "method_num " << method_num << ")\n"
|
||||
<< "bFollowRedirects " << bFollowRedirects << '\n'
|
||||
<< "body (UString " << (void*)&body << ")\n"
|
||||
<< "user (UString " << (void*)&user << ")\n"
|
||||
<< "method (UString " << (void*)&method << ")\n"
|
||||
<< "password (UString " << (void*)&password << ")\n"
|
||||
<< "setcookie (UString " << (void*)&setcookie << ")\n"
|
||||
<< "last_request (UString " << (void*)&last_request << ")\n"
|
||||
|
|
|
@ -405,9 +405,9 @@ void UClientImage_Base::handlerDelete()
|
|||
|
||||
U_DUMP("UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
#if !defined(USE_LIBEVENT) && defined(HAVE_EPOLL_WAIT) && defined(DEBUG)
|
||||
if (UNLIKELY(UNotifier::num_connection <= UNotifier::min_connection))
|
||||
|
@ -415,9 +415,9 @@ void UClientImage_Base::handlerDelete()
|
|||
U_WARNING("handlerDelete(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -448,9 +448,9 @@ void UClientImage_Base::handlerDelete()
|
|||
U_WARNING("handlerDelete(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b logbuf->strtol() = %d",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B logbuf->strtol() = %d",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild(), fd_logbuf);
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask, fd_logbuf);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
@ -517,9 +517,9 @@ void UClientImage_Base::handlerError()
|
|||
|
||||
U_DUMP("UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
#if !defined(USE_LIBEVENT) && defined(HAVE_EPOLL_WAIT) && defined(DEBUG)
|
||||
if (UNLIKELY(socket->iSockDesc == -1))
|
||||
|
@ -527,9 +527,9 @@ void UClientImage_Base::handlerError()
|
|||
U_WARNING("handlerError(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -552,9 +552,9 @@ int UClientImage_Base::handlerTimeout()
|
|||
|
||||
U_DUMP("UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
#if !defined(USE_LIBEVENT) && defined(HAVE_EPOLL_WAIT) && defined(DEBUG)
|
||||
if (UNLIKELY(socket->iSockDesc == -1))
|
||||
|
@ -562,9 +562,9 @@ int UClientImage_Base::handlerTimeout()
|
|||
U_WARNING("handlerTimeout(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
last_event = u_now->tv_sec;
|
||||
|
||||
|
@ -843,9 +843,9 @@ bool UClientImage_Base::genericRead()
|
|||
|
||||
U_DUMP("UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (UNLIKELY(socket->iSockDesc == -1))
|
||||
|
@ -853,9 +853,9 @@ bool UClientImage_Base::genericRead()
|
|||
U_WARNING("genericRead(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild());
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
U_ClientImage_state = U_PLUGIN_HANDLER_ERROR;
|
||||
|
||||
|
@ -910,21 +910,14 @@ bool UClientImage_Base::genericRead()
|
|||
# ifndef U_SERVER_CHECK_TIME_BETWEEN_REQUEST
|
||||
U_MESSAGE("UClientImage_Base::genericRead(): time_between_request(%ld) < time_run(%ld)", time_between_request, time_run);
|
||||
# else
|
||||
if (U_ClientImage_parallelization != 1) // 1 => child of parallelization
|
||||
if (U_ClientImage_parallelization != 1 && // 1 => child of parallelization
|
||||
UServer_Base::startParallelization())
|
||||
{
|
||||
if (UServer_Base::startParallelization())
|
||||
{
|
||||
// parent
|
||||
// parent
|
||||
|
||||
U_ClientImage_state = U_PLUGIN_HANDLER_ERROR;
|
||||
U_ClientImage_state = U_PLUGIN_HANDLER_ERROR;
|
||||
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
// NB: better because it is unexpected by the server...
|
||||
|
||||
U_ClientImage_close = true;
|
||||
UServer_Base::flag_loop = false;
|
||||
U_RETURN(false);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
@ -1466,7 +1459,11 @@ int UClientImage_Base::handlerWrite()
|
|||
{
|
||||
U_TRACE(0, "UClientImage_Base::handlerWrite()")
|
||||
|
||||
U_INTERNAL_DUMP("sfd = %d count = %u UEventFd::op_mask = %B", sfd, count, UEventFd::op_mask)
|
||||
U_DUMP("UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
#if !defined(USE_LIBEVENT) && defined(HAVE_EPOLL_WAIT) && defined(DEBUG)
|
||||
if (UNLIKELY(count == 0))
|
||||
|
@ -1474,9 +1471,11 @@ int UClientImage_Base::handlerWrite()
|
|||
U_WARNING("handlerWrite(): "
|
||||
"UEventFd::fd = %d socket->iSockDesc = %d "
|
||||
"UNotifier::num_connection = %d UNotifier::min_connection = %d "
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d",
|
||||
"UServer_Base::isParallelizationChild() = %b sfd = %d UEventFd::op_mask = %B",
|
||||
UEventFd::fd, socket->iSockDesc, UNotifier::num_connection, UNotifier::min_connection,
|
||||
UServer_Base::isParallelizationChild(), sfd);
|
||||
UServer_Base::isParallelizationChild(), sfd, UEventFd::op_mask);
|
||||
|
||||
if (UNotifier::num_connection > UNotifier::min_connection) U_RETURN(U_NOTIFIER_DELETE);
|
||||
|
||||
U_RETURN(U_NOTIFIER_OK);
|
||||
}
|
||||
|
|
|
@ -580,10 +580,15 @@ void UNoCatPlugIn::sendMsgToPortal(uint32_t index_AUTH, const UString& msg, UStr
|
|||
if (UServer_Base::isLog())
|
||||
{
|
||||
char log_msg[4096];
|
||||
uint32_t sz = msg.size();
|
||||
|
||||
UString str = UStringExt::substitute(msg, '%', U_CONSTANT_TO_PARAM("%%")); // NB: we need this because we have many url encoded char...
|
||||
// NB: we need this because we have a message with many url encoded char...
|
||||
|
||||
(void) u__snprintf(log_msg, sizeof(log_msg), "[nocat] Sent info %%s after %%d attempts to AUTH(%u): %.*S", index_AUTH, U_STRING_TO_TRACE(str));
|
||||
UString str = UStringExt::substitute(msg.data(), U_min(sz,200), '%', U_CONSTANT_TO_PARAM("%%"));
|
||||
|
||||
(void) u__snprintf(log_msg, sizeof(log_msg),
|
||||
"[nocat] Sent info %%s (%u bytes) after %%d attempts to AUTH(%u): %.*S",
|
||||
sz, index_AUTH, U_STRING_TO_TRACE(str));
|
||||
|
||||
(void) client->sendRequestAsync(url, false, log_msg);
|
||||
}
|
||||
|
|
|
@ -1944,8 +1944,8 @@ try_accept:
|
|||
# endif
|
||||
# ifdef U_LOG_ENABLE
|
||||
if (isLog() &&
|
||||
flag_loop && // NB: check to avoid SIGTERM event...
|
||||
csocket->iState != -EINTR && // NB: to avoid log spurious EINTR on accept() by timer...
|
||||
flag_loop && // NB: we check to avoid SIGTERM event...
|
||||
csocket->iState != -EINTR && // NB: we check to avoid log spurious EINTR on accept() by timer...
|
||||
csocket->iState != -EAGAIN)
|
||||
{
|
||||
csocket->setMsgError();
|
||||
|
@ -2041,26 +2041,31 @@ try_accept:
|
|||
#if defined(HAVE_EPOLL_WAIT) || defined(USE_LIBEVENT)
|
||||
if (UNLIKELY(UNotifier::num_connection >= UNotifier::max_connection))
|
||||
{
|
||||
csocket->close();
|
||||
if (startParallelization()) U_RETURN(U_NOTIFIER_OK); // parent of parallelization
|
||||
|
||||
--UNotifier::num_connection;
|
||||
|
||||
U_SRV_LOG("WARNING: new client connected from %.*S, connection denied by MAX_KEEP_ALIVE (%d)",
|
||||
U_CLIENT_ADDRESS_TO_TRACE, UNotifier::max_connection - UNotifier::min_connection);
|
||||
|
||||
if (timeoutMS != -1 &&
|
||||
isPreForked() == false)
|
||||
if (U_ClientImage_parallelization != 1) // 1 => child of parallelization
|
||||
{
|
||||
// NB: we check for idle connection in the middle of a burst of new connections (DOS attack)
|
||||
csocket->close();
|
||||
|
||||
U_SYSCALL(gettimeofday, "%p,%p", u_now, 0);
|
||||
--UNotifier::num_connection;
|
||||
|
||||
last_event = u_now->tv_sec;
|
||||
U_SRV_LOG("WARNING: new client connected from %.*S, connection denied by MAX_KEEP_ALIVE (%d)",
|
||||
U_CLIENT_ADDRESS_TO_TRACE, UNotifier::max_connection - UNotifier::min_connection);
|
||||
|
||||
UNotifier::callForAllEntryDynamic(handlerTimeoutConnection);
|
||||
if (timeoutMS != -1 &&
|
||||
isPreForked() == false)
|
||||
{
|
||||
// NB: we check for idle connection in the middle of a burst of new connections (DOS attack)
|
||||
|
||||
U_SYSCALL(gettimeofday, "%p,%p", u_now, 0);
|
||||
|
||||
last_event = u_now->tv_sec;
|
||||
|
||||
UNotifier::callForAllEntryDynamic(handlerTimeoutConnection);
|
||||
}
|
||||
|
||||
U_RETURN(U_NOTIFIER_OK);
|
||||
}
|
||||
|
||||
U_RETURN(U_NOTIFIER_OK);
|
||||
}
|
||||
#else
|
||||
if (UNLIKELY(csocket->iSockDesc >= FD_SETSIZE))
|
||||
|
@ -2185,6 +2190,8 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
U_INTERNAL_ASSERT_MINOR(UNotifier::num_connection, UNotifier::max_connection)
|
||||
|
||||
#ifdef DEBUG
|
||||
if (UServer_Base::max_depth < UNotifier::num_connection) UServer_Base::max_depth = UNotifier::num_connection;
|
||||
#endif
|
||||
|
|
|
@ -64,8 +64,6 @@ const UString* UString::str_user;
|
|||
const UString* UString::str_name;
|
||||
const UString* UString::str_localhost;
|
||||
const UString* UString::str_http;
|
||||
const UString* UString::str_GET;
|
||||
const UString* UString::str_POST;
|
||||
const UString* UString::str_filename;
|
||||
const UString* UString::str_msg_rfc;
|
||||
const UString* UString::str_txt_plain;
|
||||
|
@ -129,8 +127,6 @@ void UString::str_allocate()
|
|||
U_INTERNAL_ASSERT_EQUALS(str_name, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_localhost, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_http, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_GET, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_POST, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_filename, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_msg_rfc, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(str_txt_plain, 0)
|
||||
|
@ -293,11 +289,6 @@ void UString::str_allocate()
|
|||
U_INTERNAL_ASSERT_EQUALS(*str_without_mac, "00:00:00:00:00:00")
|
||||
U_INTERNAL_ASSERT_EQUALS(*str_CLIENT_QUEUE_DIR, "/tmp/uclient")
|
||||
U_INTERNAL_ASSERT_EQUALS(U_NUM_ELEMENTS(stringrep_storage), 58)
|
||||
|
||||
U_NEW_ULIB_OBJECT(str_GET, UString(u_http_method_list[0].name, u_http_method_list[0].len));
|
||||
U_NEW_ULIB_OBJECT(str_POST, UString(u_http_method_list[2].name, u_http_method_list[2].len));
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(*str_POST, "POST")
|
||||
}
|
||||
|
||||
U_NO_EXPORT void UStringRep::set(uint32_t __length, uint32_t __capacity, const char* ptr)
|
||||
|
|
|
@ -43,8 +43,8 @@ bool USOAPParser::parse(const UString& msg)
|
|||
|
||||
# ifndef U_COVERITY_FALSE_POSITIVE // Explicit null dereferenced (FORWARD_NULL)
|
||||
method = body->childAt(0);
|
||||
# endif
|
||||
envelope.methodName = method->elem()->getAccessorName();
|
||||
# endif
|
||||
|
||||
// load the parameters for the method to execute
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +1 @@
|
|||
AFDA
|
||||
AFF6
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user