diff --git a/configure b/configure index 2523332a2..4eb80b35c 100755 --- a/configure +++ b/configure @@ -36621,4 +36621,5 @@ fi echo echo "You are now ready to build ULib" echo "Enter the following command: ${T_MD}make && make install${T_ME}" +echo "After on some environment you must run also the following command: ${T_MD}sudo ldconfig${T_ME}" echo "***" diff --git a/configure.ac b/configure.ac index a02e910a2..9c60148ca 100644 --- a/configure.ac +++ b/configure.ac @@ -2762,4 +2762,5 @@ fi echo echo "You are now ready to build ULib" echo "Enter the following command: ${T_MD}make && make install${T_ME}" +echo "After on some environment you must run also the following command: ${T_MD}sudo ldconfig${T_ME}" echo "***" diff --git a/include/ulib/container/hash_map.h b/include/ulib/container/hash_map.h index 5e5c1e04e..f01095727 100644 --- a/include/ulib/container/hash_map.h +++ b/include/ulib/container/hash_map.h @@ -849,7 +849,7 @@ template <> class U_EXPORT UHashMap : public UHashMap { UHashMap::insertAfterFind(_key, str.rep); } - uint32_t getSpaceToDump() const; + uint32_t getSpaceToDump() const __pure; // OPERATOR diff --git a/include/ulib/container/vector.h b/include/ulib/container/vector.h index fe7b348ed..ce9cb306e 100644 --- a/include/ulib/container/vector.h +++ b/include/ulib/container/vector.h @@ -1244,7 +1244,7 @@ template <> class U_EXPORT UVector : public UVector { uint32_t getSpaceToDump() const { - U_TRACE_NO_PARAM(0, "UVector::getSpaceToDump()") + U_TRACE_NO_PARAM(0+256, "UVector::getSpaceToDump()") U_CHECK_MEMORY diff --git a/include/ulib/examples/wi_auth_declaration.h b/include/ulib/examples/wi_auth_declaration.h index 6191c4817..62281a0ad 100644 --- a/include/ulib/examples/wi_auth_declaration.h +++ b/include/ulib/examples/wi_auth_declaration.h @@ -3761,23 +3761,38 @@ static void usp_init_wi_auth() U_NEW(UHashMap, table, UHashMap); U_NEW(UHashMap, table1, UHashMap); + U_NEW(UString, telefono, UString); + U_NEW(UString, fmt_auth_cmd, UString); + U_NEW(UString, redirect_default, UString); + + U_NEW(UString, url_banner_ap, UString); + U_NEW(UString, url_banner_comune, UString); + + U_NEW(UString, help_url, UString); + U_NEW(UString, login_url, UString); + U_NEW(UString, wallet_url, UString); + U_NEW(UString, password_url, UString); + U_NEW(UString, registrazione_url, UString); + + U_NEW(UString, des3_key, UString); + if (UFileConfig::loadProperties(*table, content)) { - U_NEW(UString, telefono, UString((*table)["TELEFONO"])); - U_NEW(UString, fmt_auth_cmd, UString((*table)["FMT_AUTH_CMD"])); - U_NEW(UString, redirect_default, UString((*table)["REDIRECT_DEFAULT"])); + *telefono = (*table)["TELEFONO"]; + *fmt_auth_cmd = (*table)["FMT_AUTH_CMD"]; + *redirect_default = (*table)["REDIRECT_DEFAULT"]; - U_NEW(UString, url_banner_ap, UString(UStringExt::expandPath((*table)["URL_BANNER_AP"], environment))); - U_NEW(UString, url_banner_comune, UString(UStringExt::expandPath((*table)["URL_BANNER_COMUNE"], environment))); + *url_banner_ap = UStringExt::expandPath((*table)["URL_BANNER_AP"], environment); + *url_banner_comune = UStringExt::expandPath((*table)["URL_BANNER_COMUNE"], environment); - U_NEW(UString, help_url, UString(UStringExt::expandEnvironmentVar((*table)["HELP_URL"], environment))); - U_NEW(UString, login_url, UString(UStringExt::expandEnvironmentVar((*table)["LOGIN_URL"], environment))); - U_NEW(UString, wallet_url, UString(UStringExt::expandEnvironmentVar((*table)["WALLET_URL"], environment))); - U_NEW(UString, password_url, UString(UStringExt::expandEnvironmentVar((*table)["PASSWORD_URL"], environment))); - U_NEW(UString, registrazione_url, UString(UStringExt::expandEnvironmentVar((*table)["REGISTRAZIONE_URL"], environment))); + *help_url = UStringExt::expandEnvironmentVar((*table)["HELP_URL"], environment); + *login_url = UStringExt::expandEnvironmentVar((*table)["LOGIN_URL"], environment); + *wallet_url = UStringExt::expandEnvironmentVar((*table)["WALLET_URL"], environment); + *password_url = UStringExt::expandEnvironmentVar((*table)["PASSWORD_URL"], environment); + *registrazione_url = UStringExt::expandEnvironmentVar((*table)["REGISTRAZIONE_URL"], environment); # ifdef USE_LIBSSL - U_NEW(UString, des3_key, UString((*table)["DES3_KEY"])); + *des3_key = (*table)["DES3_KEY"]; UDES3::setPassword(des3_key->c_str()); # endif @@ -5719,49 +5734,53 @@ static void GET_login() // MAIN PAGE (se il portatile non mostra la login page c // GET /login?mac=00%3A14%3AA5%3A6E%3A9C%3ACB&ip=192.168.226.2&redirect=http%3A%2F%2Fgoogle&gateway=192.168.226.1%3A5280&timeout=0&token=x&ap=lab2 // ----------------------------------------------------------------------------------------------------------------------------------------------- + if (checkLoginRequest(0, 14, 2, true, false) == false) + { + checkForRedirect(); + + return; + } + + if (checkTimeRequest() == false) return; + + auth_domain->clear(); + bool login_validate = false; - if (checkLoginRequest(0, 14, 2, true, false)) + if (WiAuthNodog::checkMAC() || + getCookie1()) { - if (checkTimeRequest() == false) return; + *uid = *mac; - auth_domain->clear(); + login_validate = true; - if (WiAuthNodog::checkMAC() || - getCookie1()) - { - *uid = *mac; - - login_validate = true; + if (auth_domain->empty()) *auth_domain = *mac_auth; + } +#ifdef USE_LIBSSL + else if (UServer_Base::bssl) + { + X509* x509 = ((USSLSocket*)UServer_Base::csocket)->getPeerCertificate(); - if (auth_domain->empty()) *auth_domain = *mac_auth; - } -# ifdef USE_LIBSSL - else if (UServer_Base::bssl) + if (x509) { - X509* x509 = ((USSLSocket*)UServer_Base::csocket)->getPeerCertificate(); + long serial = UCertificate::getSerialNumber(x509); + UString issuer = UCertificate::getIssuer(x509); - if (x509) + if (askToLDAP(0,0,0,"ldapsearch -LLL -b %v %v (&(objectClass=waUser)(&(waIssuer=%v)(waSerial=%ld)(waActive=TRUE)))", + wiauth_user_basedn->rep, ldap_user_param->rep, issuer.rep, serial) == 1) { - long serial = UCertificate::getSerialNumber(x509); - UString issuer = UCertificate::getIssuer(x509); - - if (askToLDAP(0,0,0,"ldapsearch -LLL -b %v %v (&(objectClass=waUser)(&(waIssuer=%v)(waSerial=%ld)(waActive=TRUE)))", - wiauth_user_basedn->rep, ldap_user_param->rep, issuer.rep, serial) == 1) - { - *uid = (*table)["waUid"]; + *uid = (*table)["waUid"]; - table->clear(); + table->clear(); - *policy = *policy_flat; - *auth_domain = *cert_auth; + *policy = *policy_flat; + *auth_domain = *cert_auth; - login_validate = true; - } + login_validate = true; } } -# endif } +#endif if (*redirect) { diff --git a/include/ulib/internal/chttp.h b/include/ulib/internal/chttp.h index 648f288ed..ad3ab131b 100644 --- a/include/ulib/internal/chttp.h +++ b/include/ulib/internal/chttp.h @@ -203,7 +203,6 @@ extern U_EXPORT uclientimage_info u_clientimage_info; #define U_PARALLELIZATION_PARENT 2 #define U_http_info u_clientimage_info.http_info -#define U_clientimage_flag u_clientimage_info.flag #define U_http_method_list u_clientimage_info.http_method_list #define U_http_method_type u_clientimage_info.http_info.method_type diff --git a/include/ulib/json/value.h b/include/ulib/json/value.h index debfc01c4..a7b5ad998 100644 --- a/include/ulib/json/value.h +++ b/include/ulib/json/value.h @@ -1551,21 +1551,21 @@ template class U_EXPORT UJsonTypeHandler > : public UJsonT U_ASSERT(((uvector*)pval)->empty()) - UValue* element = json.toNode(); + UValue* pelement = json.toNode(); - while (element) + while (pelement) { T* pitem; U_NEW(T, pitem, T); - U_DUMP("element = %p element->next = %p element->type = (%d,%S)", element, element->next, element->getTag(), UValue::getDataTypeDescription(element->getTag())) + U_DUMP("pelement = %p pelement->next = %p pelement->type = (%d,%S)", pelement, pelement->next, pelement->getTag(), UValue::getDataTypeDescription(pelement->getTag())) - element->fromJSON(UJsonTypeHandler(*pitem)); + UJsonTypeHandler(*pitem).fromJSON(*pelement); - ((uvector*)pval)->push_back(pitem); + ((UVector*)pval)->push_back(pitem); - element = element->next; + pelement = pelement->next; } } }; diff --git a/include/ulib/net/server/client_image.h b/include/ulib/net/server/client_image.h index 29f80231a..9947716b4 100644 --- a/include/ulib/net/server/client_image.h +++ b/include/ulib/net/server/client_image.h @@ -288,7 +288,7 @@ class U_EXPORT UClientImage_Base : public UEventFd { { U_TRACE_NO_PARAM(0, "UClientImage_Base::setRequestToCache()") -# if !defined(U_CACHE_REQUEST_DISABLE) || defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) +# if !defined(U_CACHE_REQUEST_DISABLE) || (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) U_INTERNAL_ASSERT_MAJOR(U_http_info.startHeader, 2) U_INTERNAL_ASSERT_MAJOR(UClientImage_Base::size_request, 0) U_INTERNAL_ASSERT_RANGE(1,UClientImage_Base::uri_offset,64) @@ -310,7 +310,7 @@ class U_EXPORT UClientImage_Base : public UEventFd { U_INTERNAL_DUMP("U_ClientImage_request_is_cached = %b", U_ClientImage_request_is_cached) -# if !defined(U_CACHE_REQUEST_DISABLE) || defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) +# if !defined(U_CACHE_REQUEST_DISABLE) || (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) U_INTERNAL_ASSERT(U_ClientImage_request_is_cached) uint32_t sz = request->size(); @@ -468,7 +468,7 @@ class U_EXPORT UClientImage_Base : public UEventFd { static uint32_t ncount, nrequest, resto, uri_offset; static void endRequest(); - static bool startRequest(); + static void startRequest(); static void resetReadBuffer(); static void resetWriteBuffer(); diff --git a/include/ulib/net/server/plugin/mod_nocat.h b/include/ulib/net/server/plugin/mod_nocat.h index 06b97afe3..6ec77b2bb 100644 --- a/include/ulib/net/server/plugin/mod_nocat.h +++ b/include/ulib/net/server/plugin/mod_nocat.h @@ -233,7 +233,7 @@ class U_EXPORT UNoCatPlugIn : public UServerPlugIn, UEventTime { static bool checkPeerStatus(UStringRep* key, void* value); static bool getPeerListInfo(UStringRep* key, void* value); static void setHTTPResponse(const UString& content, int mime_index); - static void permit(const UString& UserDownloadRate, const UString& UserUploadRate); + static void permit(UString& UserDownloadRate, UString& UserUploadRate); static void sendMsgToPortal(uint32_t index_AUTH, const UString& msg, UString* poutput); static void sendData(uint32_t index_AUTH, const UString& data, const char* service, uint32_t service_len); diff --git a/include/ulib/net/server/server.h b/include/ulib/net/server/server.h index 5a71d4c10..48219a2f0 100644 --- a/include/ulib/net/server/server.h +++ b/include/ulib/net/server/server.h @@ -477,7 +477,34 @@ class U_EXPORT UServer_Base : public UEventFd { static pid_t startNewChild(); static bool startParallelization( uint32_t nclient = 1); // it can creates a copy of itself, return true if parent... - static bool isParallelizationGoingToStart(uint32_t nclient = 1) __pure; + static bool isParallelizationGoingToStart(uint32_t nclient = 1) + { + U_TRACE(0, "UServer_Base::isParallelizationGoingToStart(%u)", nclient) + + U_INTERNAL_ASSERT_POINTER(ptr_shared_data) + + U_INTERNAL_DUMP("U_ClientImage_pipeline = %b U_ClientImage_parallelization = %d UNotifier::num_connection - UNotifier::min_connection = %d", + U_ClientImage_pipeline, U_ClientImage_parallelization, UNotifier::num_connection - UNotifier::min_connection) + +# ifndef U_SERVER_CAPTIVE_PORTAL +# ifndef U_HTTP2_DISABLE + U_INTERNAL_DUMP("U_http_version = %C", U_http_version) + + if (U_http_version != '2') +# endif + { + if (U_ClientImage_parallelization != U_PARALLELIZATION_CHILD && + (UNotifier::num_connection - UNotifier::min_connection) > nclient) + { + U_INTERNAL_DUMP("U_ClientImage_close = %b", U_ClientImage_close) + + U_RETURN(true); + } + } +# endif + + U_RETURN(false); + } // manage log server... diff --git a/include/ulib/utility/http2.h b/include/ulib/utility/http2.h index 6b9afbc4f..11f5625d1 100644 --- a/include/ulib/utility/http2.h +++ b/include/ulib/utility/http2.h @@ -104,6 +104,7 @@ class U_EXPORT UHTTP2 { // streams uint32_t max_processed_stream_id; Stream streams[HTTP2_MAX_CONCURRENT_STREAMS]; + bool bnghttp2; #ifdef DEBUG UHashMap dtable; HpackDynamicTable ddyntbl; @@ -244,7 +245,7 @@ class U_EXPORT UHTTP2 { static Connection* pConnection; static const Settings settings; static uint32_t wait_for_continuation; - static bool bcontinue100, bsetting_ack, bsetting_send, bnghttp2; + static bool bcontinue100, bsetting_ack, bsetting_send; static uint8_t priority_weight; // 0 if not set static bool priority_exclusive; @@ -280,6 +281,7 @@ class U_EXPORT UHTTP2 { static void sendResetStream(); static void sendWindowUpdate(); + static bool eraseHeaders(UStringRep* key, void* elem); static void handlerDelete(UClientImage_Base* pclient); static void updateSetting(unsigned char* ptr, uint32_t len); static void writeData(struct iovec* iov, bool bdata, bool flag); diff --git a/include/ulib/utility/uhttp.h b/include/ulib/utility/uhttp.h index 273ceef27..c697a26ce 100644 --- a/include/ulib/utility/uhttp.h +++ b/include/ulib/utility/uhttp.h @@ -269,6 +269,25 @@ class U_EXPORT UHTTP { U_RETURN(true); } + static void startRequest() + { + U_TRACE_NO_PARAM(0, "UHTTP::startRequest()") + +# if (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) || (defined(DEBUG) && !defined(U_LOG_DISABLE)) + UClientImage_Base::startRequest(); +# endif + + // ------------------------------ + // U_http_info.uri + // .... + // U_http_info.nResponseCode + // .... + // ------------------------------ + U_HTTP_INFO_RESET(0); + + u_clientimage_info.flag.u = 0; + } + // UPLOAD static vPFi on_upload; @@ -639,7 +658,7 @@ class U_EXPORT UHTTP { #ifndef U_LOG_DISABLE static char iov_buffer[20]; static struct iovec iov_vec[10]; -# if !defined(U_CACHE_REQUEST_DISABLE) || defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) +# if !defined(U_CACHE_REQUEST_DISABLE) || (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) static uint32_t request_offset, referer_offset, agent_offset; # endif diff --git a/src/ulib/container/hash_map.cpp b/src/ulib/container/hash_map.cpp index 604578d2f..2acd90c7c 100644 --- a/src/ulib/container/hash_map.cpp +++ b/src/ulib/container/hash_map.cpp @@ -800,9 +800,9 @@ uint32_t UHashMap::loadFromData(const char* ptr, uint32_t sz) U_RETURN(sz); } -uint32_t UHashMap::getSpaceToDump() const +__pure uint32_t UHashMap::getSpaceToDump() const { - U_TRACE_NO_PARAM(0, "UHashMap::getSpaceToDump()") + U_TRACE_NO_PARAM(0+256, "UHashMap::getSpaceToDump()") U_CHECK_MEMORY diff --git a/src/ulib/debug/debug_common.cpp b/src/ulib/debug/debug_common.cpp index 1cb428a0f..90b332b72 100644 --- a/src/ulib/debug/debug_common.cpp +++ b/src/ulib/debug/debug_common.cpp @@ -94,7 +94,7 @@ static void print_info(void) char* memusage = getenv("UMEMUSAGE"); - U_MESSAGE("UMEMUSAGE%W<%W%s%W>%W", YELLOW, (memusage ? GREEN : RED), (memusage ? "on" : "off"), YELLOW, RESET); + U_MESSAGE("MEMUSAGE%W<%W%s%W>%W", YELLOW, (memusage ? GREEN : RED), (memusage ? "on" : "off"), YELLOW, RESET); } extern "C" void U_EXPORT u_debug_init(void) @@ -269,13 +269,13 @@ __noreturn void U_EXPORT u_debug_exec(const char* pathname, char* const argv[], (void) write(STDERR_FILENO, buffer, iov[1].iov_len); (void) write(STDERR_FILENO, iov[2].iov_base, iov[2].iov_len); - for (i = 0; argv[i]; ++i) (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("argv[%2u] = %p %S"), i, argv[i], argv[i])); - (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("argv[%2u] = %p %S"), i, argv[i], argv[i])); + for (i = 0; argv[i]; ++i) (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("argv[%2u] = %p %S\n"), i, argv[i], argv[i])); + (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("argv[%2u] = %p %S\n"), i, argv[i], argv[i])); if (envp) { - for (i = 0; envp[i]; ++i) (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("envp[%2u] = %p %S"), i, envp[i], envp[i])); - (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("envp[%2u] = %p %S"), i, envp[i], envp[i])); + for (i = 0; envp[i]; ++i) (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("envp[%2u] = %p %S\n"), i, envp[i], envp[i])); + (void) write(STDERR_FILENO, buffer, u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("envp[%2u] = %p %S\n"), i, envp[i], envp[i])); } } else diff --git a/src/ulib/net/server/client_image.cpp b/src/ulib/net/server/client_image.cpp index abba48309..87bb71d86 100644 --- a/src/ulib/net/server/client_image.cpp +++ b/src/ulib/net/server/client_image.cpp @@ -22,7 +22,7 @@ # include #endif -#ifdef U_SERVER_CHECK_TIME_BETWEEN_REQUEST +#if defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE) # define U_NUM_CLIENT_THRESHOLD 128 #endif @@ -616,11 +616,11 @@ const char* UClientImage_Base::getRequestUri(uint32_t& sz) # define U_IOV_TO_SAVE (sizeof(struct iovec) * 4) #endif -bool UClientImage_Base::startRequest() +void UClientImage_Base::startRequest() { U_TRACE_NO_PARAM(0, "UClientImage_Base::startRequest()") -#ifdef U_SERVER_CHECK_TIME_BETWEEN_REQUEST +#if defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE) long time_elapsed = chronometer->restart(); U_INTERNAL_DUMP("U_ClientImage_pipeline = %b time_elapsed = %ld time_run = %ld U_ClientImage_request_is_cached = %b csfd = %d", @@ -648,27 +648,40 @@ bool UClientImage_Base::startRequest() { U_INTERNAL_DUMP("U_ClientImage_request_is_cached = %b", U_ClientImage_request_is_cached) + U_ClientImage_advise_for_parallelization = 1; + if (U_ClientImage_request_is_cached == false) { - U_ClientImage_advise_for_parallelization = true; + U_ClientImage_advise_for_parallelization = 2; UClientImage_Base::setRequestToCache(); } - U_RETURN(true); + return; } } } #endif - U_RETURN(false); +#if defined(DEBUG) && !defined(U_LOG_DISABLE) + if (UServer_Base::isLog()) + { +#if !defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) || !defined(U_HTTP2_DISABLE) + (void) chronometer->restart(); +# endif + } +#endif } void UClientImage_Base::endRequest() { U_TRACE_NO_PARAM(0, "UClientImage_Base::endRequest()") -#ifdef U_SERVER_CHECK_TIME_BETWEEN_REQUEST + callerHandlerEndRequest(); + + U_http_method_type = 0; // NB: this mark the end of http request processing... + +#if defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE) time_run = chronometer->stop(); # ifdef DEBUG @@ -682,15 +695,13 @@ void UClientImage_Base::endRequest() # endif #endif - callerHandlerEndRequest(); - - U_http_method_type = 0; // NB: this mark the end of http request processing... - #ifndef U_HTTP2_DISABLE - U_INTERNAL_DUMP("U_http_info.uri_len = %u", U_http_info.uri_len) + U_INTERNAL_DUMP("U_http_version = %C U_http_info.uri_len = %u", U_http_version, U_http_info.uri_len) - if (U_http_info.uri_len == 0) return; + if (U_http_info.uri_len) #endif + { + U_MEMCPY(iov_vec, iov_sav, U_IOV_TO_SAVE); #if defined(DEBUG) && !defined(U_LOG_DISABLE) if (UServer_Base::isLog()) @@ -738,6 +749,10 @@ void UClientImage_Base::endRequest() U_MEMCPY(ptr1, "\" run in ", U_CONSTANT_SIZE("\" run in ")); ptr1 += U_CONSTANT_SIZE("\" run in "); +#if !defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) || !defined(U_HTTP2_DISABLE) + time_run = chronometer->stop(); +# endif + if (time_run > 0L) ptr1 += u__snprintf(ptr1, sizeof(buffer1)-(ptr1-buffer1), U_CONSTANT_TO_PARAM("%ld ms"), time_run); else ptr1 += u__snprintf(ptr1, sizeof(buffer1)-(ptr1-buffer1), U_CONSTANT_TO_PARAM( "%g ms"), chronometer->getTimeElapsed()); @@ -769,12 +784,13 @@ void UClientImage_Base::endRequest() ULog::write(buffer1, ptr1-buffer1); } #endif + } #ifdef U_ALIAS + U_INTERNAL_DUMP("request_uri(%u) = %V", request_uri->size(), request_uri->rep) + request_uri->clear(); #endif - - U_MEMCPY(iov_vec, iov_sav, U_IOV_TO_SAVE); } void UClientImage_Base::manageReadBufferResize(uint32_t n) @@ -900,7 +916,7 @@ void UClientImage_Base::prepareForRead() { U_TRACE_NO_PARAM(0, "UClientImage_Base::prepareForRead()") - U_clientimage_flag.u = 0; // NB: U_ClientImage_parallelization is reset by this... + u_clientimage_info.flag.u = 0; // NB: U_ClientImage_parallelization is reset by this... #ifdef U_CLASSIC_SUPPORT if (UServer_Base::isClassic()) @@ -969,8 +985,8 @@ bool UClientImage_Base::genericRead() U_INTERNAL_ASSERT_EQUALS(socket->iSockDesc, UEventFd::fd) -#ifdef U_SERVER_CHECK_TIME_BETWEEN_REQUEST - bool advise_for_parallelization = startRequest(); +#if (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) || (defined(DEBUG) && !defined(U_LOG_DISABLE)) + startRequest(); #endif request->clear(); // reset buffer before read @@ -1016,8 +1032,8 @@ bool UClientImage_Base::genericRead() data_pending = 0; } -#ifdef U_SERVER_CHECK_TIME_BETWEEN_REQUEST - if (advise_for_parallelization) +#if defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE) + if (U_ClientImage_advise_for_parallelization) { if (checkRequestToCache() == 2 && UServer_Base::startParallelization(U_NUM_CLIENT_THRESHOLD)) @@ -1029,7 +1045,7 @@ bool UClientImage_Base::genericRead() U_RETURN(false); } - if (U_ClientImage_advise_for_parallelization) U_ClientImage_request_is_cached = false; + if (U_ClientImage_advise_for_parallelization == 2) U_ClientImage_request_is_cached = false; } #endif @@ -1385,8 +1401,10 @@ int UClientImage_Base::handlerRead() // Connection-wide hooks { if (U_ClientImage_pipeline) { - endRequest(); - (void) startRequest(); + endRequest(); +# if (defined(U_SERVER_CHECK_TIME_BETWEEN_REQUEST) && defined(U_HTTP2_DISABLE)) || (defined(DEBUG) && !defined(U_LOG_DISABLE)) + startRequest(); +# endif goto pipeline; } diff --git a/src/ulib/net/server/plugin/mod_nocat.cpp b/src/ulib/net/server/plugin/mod_nocat.cpp index f33803fda..820e2f9a7 100644 --- a/src/ulib/net/server/plugin/mod_nocat.cpp +++ b/src/ulib/net/server/plugin/mod_nocat.cpp @@ -972,18 +972,30 @@ void UNoCatPlugIn::deny(int disconnected, bool bcheck_expire) if (bcheck_expire) UTimer::erase(peer); } -void UNoCatPlugIn::permit(const UString& UserDownloadRate, const UString& UserUploadRate) +void UNoCatPlugIn::permit(UString& UserDownloadRate, UString& UserUploadRate) { - U_TRACE(0, "UNoCatPlugIn::permit(%S,%S)", &UserDownloadRate, &UserUploadRate) + U_TRACE(0, "UNoCatPlugIn::permit(%V,%V)", UserDownloadRate.rep, UserUploadRate.rep) U_INTERNAL_ASSERT_POINTER(peer) U_INTERNAL_ASSERT_EQUALS(U_peer_status, UModNoCatPeer::PEER_DENY) - if (UserDownloadRate) peer->fw.setArgument(7, UserDownloadRate.c_str()); - if (UserUploadRate) peer->fw.setArgument(8, UserUploadRate.c_str()); + if (UserDownloadRate) + { + if (UserDownloadRate.strtol() == 0) UserDownloadRate.clear(); + else peer->fw.setArgument(7, UserDownloadRate.c_str()); + } + + if (UserUploadRate) + { + if (UserUploadRate.strtol() == 0) UserUploadRate.clear(); + else peer->fw.setArgument(8, UserUploadRate.c_str()); + } executeCommand(UModNoCatPeer::PEER_PERMIT); + if (UserDownloadRate) peer->fw.setArgument(7, "0"); + if (UserUploadRate) peer->fw.setArgument(8, "0"); + ++total_connections; U_SRV_LOG("Peer permitted: IP %v MAC %v - UserDownloadRate %v UserUploadRate %v remain: %ld secs %llu bytes - total_connections %u", diff --git a/src/ulib/net/server/plugin/usp/mdb.usp b/src/ulib/net/server/plugin/usp/mdb.usp index 659a2285b..e08c4b5c7 100644 --- a/src/ulib/net/server/plugin/usp/mdb.usp +++ b/src/ulib/net/server/plugin/usp/mdb.usp @@ -24,7 +24,7 @@ static void usp_fork_mdb() return; } - if (mc->selectCollection("hello_world", "World") == false) + if (mc->selectCollection("hello_world", "world") == false) { U_WARNING("usp_fork_mdb(): selectCollection() failed"); diff --git a/src/ulib/net/server/plugin/usp/mfortune.usp b/src/ulib/net/server/plugin/usp/mfortune.usp index d1351e4f2..ad352a3db 100644 --- a/src/ulib/net/server/plugin/usp/mfortune.usp +++ b/src/ulib/net/server/plugin/usp/mfortune.usp @@ -23,7 +23,7 @@ static void usp_fork_mfortune() return; } - if (mc->selectCollection("hello_world", "Fortune") == false) + if (mc->selectCollection("hello_world", "fortune") == false) { U_WARNING("usp_fork_mfortune(): selectCollection() failed"); diff --git a/src/ulib/net/server/plugin/usp/mquery.usp b/src/ulib/net/server/plugin/usp/mquery.usp index 1086abf9f..c6a53988f 100644 --- a/src/ulib/net/server/plugin/usp/mquery.usp +++ b/src/ulib/net/server/plugin/usp/mquery.usp @@ -25,7 +25,7 @@ static void usp_fork_mquery() return; } - if (mc->selectCollection("hello_world", "World") == false) + if (mc->selectCollection("hello_world", "world") == false) { U_WARNING("usp_fork_mquery(): selectCollection() failed"); diff --git a/src/ulib/net/server/plugin/usp/mupdate.usp b/src/ulib/net/server/plugin/usp/mupdate.usp index e1c12173e..190774132 100644 --- a/src/ulib/net/server/plugin/usp/mupdate.usp +++ b/src/ulib/net/server/plugin/usp/mupdate.usp @@ -25,7 +25,7 @@ static void usp_fork_mupdate() return; } - if (mc->selectCollection("hello_world", "World") == false) + if (mc->selectCollection("hello_world", "world") == false) { U_WARNING("usp_fork_mupdate(): selectCollection() failed"); @@ -60,7 +60,7 @@ Content-Type: application/json -->