mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
some fix
This commit is contained in:
parent
2d52d6d538
commit
832fe2c988
|
@ -67,6 +67,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define U_DEBUG(fmt,args...) u__printf(STDERR_FILENO, "%W%N%W: %WDEBUG: %9D (pid %P) " fmt "%W", BRIGHTCYAN, RESET, YELLOW, ##args, RESET)
|
||||
|
||||
// Manage class test for memory corruption
|
||||
|
||||
# define U_MEMORY_TEST UMemoryError memory;
|
||||
|
@ -149,6 +152,8 @@ if (envp) \
|
|||
|
||||
#else /* DEBUG */
|
||||
|
||||
#define U_DEBUG(fmt,args...)
|
||||
|
||||
# define U_MEMORY_TEST
|
||||
# define U_CHECK_MEMORY
|
||||
# define U_MEMORY_TEST_COPY(o)
|
||||
|
|
|
@ -2883,26 +2883,31 @@ static void setAccessPointLocalization()
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
char* ptr;
|
||||
uint32_t len;
|
||||
char buffer[4096];
|
||||
UHTTP::UFileCacheData* ptr_file_data;
|
||||
*/
|
||||
|
||||
setAccessPointReference(U_STRING_TO_PARAM(*ap_address));
|
||||
|
||||
if (url_banner_ap_default)
|
||||
// if (url_banner_ap_default)
|
||||
{
|
||||
U_ASSERT(url_banner_ap_default->dir())
|
||||
// U_ASSERT(url_banner_ap_default->dir())
|
||||
|
||||
// "wifi-aaa.comune.fi.it/banner/luoghi/X0054R13/full/banner.html"
|
||||
// "wifi-aaa.comune.fi.it/banner/luoghi/X0054R13/mobile/banner.html"
|
||||
|
||||
/*
|
||||
ptr = buffer + (len = u__snprintf(buffer, sizeof(buffer), "%v%v/%v/", virtual_name->rep, url_banner_ap->rep, ap_ref->rep));
|
||||
|
||||
ptr_file_data = UHTTP::getFileInCache(buffer, len + u__snprintf(ptr, sizeof(buffer)-len, "%.*s", U_CONSTANT_TO_TRACE(" full/banner.html")));
|
||||
if (ptr_file_data == 0) ptr_file_data = UHTTP::getFileInCache(buffer, len + u__snprintf(ptr, sizeof(buffer)-len, "%.*s", U_CONSTANT_TO_TRACE("mobile/banner.html")));
|
||||
|
||||
if (ptr_file_data) ap_ref_ap->snprintf("/%v", ap_ref->rep);
|
||||
if (ptr_file_data)
|
||||
*/
|
||||
ap_ref_ap->snprintf("/%v", ap_ref->rep);
|
||||
|
||||
/*
|
||||
banner.snprintf("%v/%v", url_banner_ap_path->rep, ap_ref->rep);
|
||||
|
@ -2921,19 +2926,22 @@ static void setAccessPointLocalization()
|
|||
*/
|
||||
}
|
||||
|
||||
if (url_banner_comune_default)
|
||||
// if (url_banner_comune_default)
|
||||
{
|
||||
U_ASSERT(url_banner_comune_default->dir())
|
||||
// U_ASSERT(url_banner_comune_default->dir())
|
||||
|
||||
// "wifi-aaa.comune.fi.it/banner/eventi/X0054R13/full/banner.html"
|
||||
// "wifi-aaa.comune.fi.it/banner/eventi/X0054R13/mobile/banner.html"
|
||||
|
||||
/*
|
||||
ptr = buffer + (len = u__snprintf(buffer, sizeof(buffer), "%v%v/%v/", virtual_name->rep, url_banner_comune->rep, ap_ref->rep));
|
||||
|
||||
ptr_file_data = UHTTP::getFileInCache(buffer, len + u__snprintf(ptr, sizeof(buffer)-len, "%.*s", U_CONSTANT_TO_TRACE(" full/banner.html")));
|
||||
if (ptr_file_data == 0) ptr_file_data = UHTTP::getFileInCache(buffer, len + u__snprintf(ptr, sizeof(buffer)-len, "%.*s", U_CONSTANT_TO_TRACE("mobile/banner.html")));
|
||||
|
||||
if (ptr_file_data) ap_ref_comune->snprintf("/%v", ap_ref->rep);
|
||||
if (ptr_file_data)
|
||||
*/
|
||||
ap_ref_comune->snprintf("/%v", ap_ref->rep);
|
||||
|
||||
/*
|
||||
banner.snprintf("%v/%v", url_banner_comune_path->rep, ap_ref->rep);
|
||||
|
@ -4357,12 +4365,6 @@ static void GET_login() // MAIN PAGE
|
|||
|
||||
sz += request1.size();
|
||||
|
||||
if (url_banner_ap_default ||
|
||||
url_banner_comune_default)
|
||||
{
|
||||
setAccessPointLocalization();
|
||||
}
|
||||
|
||||
U_INTERNAL_DUMP("request1 = %V", request1.rep)
|
||||
|
||||
if (UStringExt::startsWith(*title_default, U_CONSTANT_TO_PARAM("Firenze ")))
|
||||
|
@ -4375,6 +4377,8 @@ static void GET_login() // MAIN PAGE
|
|||
|
||||
U_INTERNAL_DUMP("request2 = %S", request2.rep)
|
||||
|
||||
setAccessPointLocalization();
|
||||
|
||||
USSIPlugIn::setAlternativeInclude(cache->getContent(U_CONSTANT_TO_PARAM("login.tmpl")), sz, false,
|
||||
title_default->data(), 0, 0,
|
||||
url_banner_ap->rep,
|
||||
|
|
|
@ -455,6 +455,15 @@ protected:
|
|||
static void endRequest();
|
||||
static bool startRequest();
|
||||
|
||||
static void do_nothing() {}
|
||||
|
||||
// NB: we have default to true to manage pipeline for protocol as RPC...
|
||||
|
||||
static bool handlerCache() { return true; }
|
||||
static bool isValidMethod( const char* ptr) { return true; }
|
||||
static bool isValidRequest( const char* ptr, uint32_t sz) { return true; }
|
||||
static bool isValidRequestExt(const char* ptr, uint32_t sz) { return true; }
|
||||
|
||||
#ifndef U_CACHE_REQUEST_DISABLE
|
||||
static bool isRequestCacheable() __pure;
|
||||
#endif
|
||||
|
@ -469,10 +478,6 @@ protected:
|
|||
#endif
|
||||
|
||||
private:
|
||||
static bool isValidMethod( const char* ptr) U_NO_EXPORT;
|
||||
static bool isValidRequest( const char* ptr, uint32_t sz) U_NO_EXPORT;
|
||||
static bool isValidRequestExt(const char* ptr, uint32_t sz) U_NO_EXPORT;
|
||||
|
||||
UClientImage_Base(const UClientImage_Base&) : UEventFd() {}
|
||||
UClientImage_Base& operator=(const UClientImage_Base&) { return *this; }
|
||||
|
||||
|
|
|
@ -128,27 +128,27 @@ public:
|
|||
{
|
||||
U_TRACE(0, "UStringExt::startsWith(%V,%V)", s1.rep, s2.rep)
|
||||
|
||||
bool result = u_startsWith(U_STRING_TO_PARAM(s1), U_STRING_TO_PARAM(s2));
|
||||
if (u_startsWith(U_STRING_TO_PARAM(s1), U_STRING_TO_PARAM(s2))) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
static bool startsWith(const UString& s1, const char* s2, uint32_t n2)
|
||||
{
|
||||
U_TRACE(0, "UStringExt::startsWith(%V,%.*S,%u)", s1.rep, n2, s2, n2)
|
||||
|
||||
bool result = u_startsWith(U_STRING_TO_PARAM(s1), s2, n2);
|
||||
if (u_startsWith(U_STRING_TO_PARAM(s1), s2, n2)) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
static bool startsWith(const char* s1, uint32_t n1, const char* s2, uint32_t n2)
|
||||
{
|
||||
U_TRACE(0, "UStringExt::startsWith(%.*S,%u,%.*S,%u)", n1, s1, n1, n2, s2, n2)
|
||||
|
||||
bool result = u_startsWith(s1, n1, s2, n2);
|
||||
if (u_startsWith(s1, n1, s2, n2)) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
// check if string s1 terminate with string s2
|
||||
|
@ -157,27 +157,27 @@ public:
|
|||
{
|
||||
U_TRACE(0, "UStringExt::endsWith(%V,%V)", s1.rep, s2.rep)
|
||||
|
||||
bool result = u_endsWith(U_STRING_TO_PARAM(s1), U_STRING_TO_PARAM(s2));
|
||||
if (u_endsWith(U_STRING_TO_PARAM(s1), U_STRING_TO_PARAM(s2))) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
static bool endsWith(const UString& s1, const char* s2, uint32_t n2)
|
||||
{
|
||||
U_TRACE(0, "UStringExt::endsWith(%V,%.*S,%u)", s1.rep, n2, s2, n2)
|
||||
|
||||
bool result = u_endsWith(U_STRING_TO_PARAM(s1), s2, n2);
|
||||
if (u_endsWith(U_STRING_TO_PARAM(s1), s2, n2)) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
static bool endsWith(const char* s1, uint32_t n1, const char* s2, uint32_t n2)
|
||||
{
|
||||
U_TRACE(0, "UStringExt::endsWith(%.*S,%u,%.*S,%u)", n1, s1, n1, n2, s2, n2)
|
||||
|
||||
bool result = u_endsWith(s1, n1, s2, n2);
|
||||
if (u_endsWith(s1, n1, s2, n2)) U_RETURN(true);
|
||||
|
||||
U_RETURN(result);
|
||||
U_RETURN(false);
|
||||
}
|
||||
|
||||
// SUBSTITUTE: replace all occurrences of 'a' with 'b'
|
||||
|
|
|
@ -28,17 +28,17 @@ int UClientImage_Base::idx;
|
|||
int UClientImage_Base::csfd;
|
||||
int UClientImage_Base::iovcnt;
|
||||
iPF UClientImage_Base::callerHandlerRead;
|
||||
iPF UClientImage_Base::callerHandlerRequest;
|
||||
bPF UClientImage_Base::callerHandlerCache;
|
||||
vPF UClientImage_Base::callerHandlerEndRequest;
|
||||
bPF UClientImage_Base::callerHandlerCache = handlerCache;
|
||||
iPF UClientImage_Base::callerHandlerRequest = UServer_Base::pluginsHandlerRequest;
|
||||
vPF UClientImage_Base::callerHandlerEndRequest = do_nothing;
|
||||
bool UClientImage_Base::bIPv6;
|
||||
bool UClientImage_Base::log_request_partial;
|
||||
char UClientImage_Base::cbuffer[128];
|
||||
long UClientImage_Base::time_run;
|
||||
long UClientImage_Base::time_between_request = 10;
|
||||
bPFpc UClientImage_Base::callerIsValidMethod;
|
||||
bPFpcu UClientImage_Base::callerIsValidRequest;
|
||||
bPFpcu UClientImage_Base::callerIsValidRequestExt;
|
||||
bPFpc UClientImage_Base::callerIsValidMethod = isValidMethod;
|
||||
bPFpcu UClientImage_Base::callerIsValidRequest = isValidRequest;
|
||||
bPFpcu UClientImage_Base::callerIsValidRequestExt = isValidRequestExt;
|
||||
uint32_t UClientImage_Base::resto;
|
||||
uint32_t UClientImage_Base::rstart;
|
||||
uint32_t UClientImage_Base::ncount;
|
||||
|
@ -250,12 +250,6 @@ void UClientImage_Base::saveRequestResponse()
|
|||
}
|
||||
#endif
|
||||
|
||||
// NB: we have default to true to manage pipeline for protocol as RPC...
|
||||
|
||||
U_NO_EXPORT bool UClientImage_Base::isValidMethod( const char* ptr) { return true; }
|
||||
U_NO_EXPORT bool UClientImage_Base::isValidRequest( const char* ptr, uint32_t sz) { return true; }
|
||||
U_NO_EXPORT bool UClientImage_Base::isValidRequestExt(const char* ptr, uint32_t sz) { return true; }
|
||||
|
||||
void UClientImage_Base::init()
|
||||
{
|
||||
U_TRACE_NO_PARAM(0, "UClientImage_Base::init()")
|
||||
|
@ -285,10 +279,6 @@ void UClientImage_Base::init()
|
|||
_buffer = U_NEW(UString(U_CAPACITY));
|
||||
_encoded = U_NEW(UString(U_CAPACITY));
|
||||
|
||||
callerIsValidMethod = isValidMethod;
|
||||
callerIsValidRequest = isValidRequest;
|
||||
callerIsValidRequestExt = isValidRequestExt;
|
||||
|
||||
#ifdef DEBUG
|
||||
UError::callerDataDump = saveRequestResponse;
|
||||
#endif
|
||||
|
@ -624,10 +614,8 @@ bool UClientImage_Base::startRequest()
|
|||
|
||||
if ((time_run - time_between_request) > 10L)
|
||||
{
|
||||
# ifdef DEBUG
|
||||
U_MESSAGE("%9D (pid %P) UClientImage_Base::startRequest(): time_between_request(%ld) < time_run(%ld) - isParallelizationGoingToStart(%u) = %b request = %V",
|
||||
U_DEBUG("UClientImage_Base::startRequest(): time_between_request(%ld) < time_run(%ld) - isParallelizationGoingToStart(%u) = %b request = %V",
|
||||
time_between_request, time_run, U_NUM_CLIENT_THRESHOLD, UServer_Base::isParallelizationGoingToStart(U_NUM_CLIENT_THRESHOLD), request->rep);
|
||||
# endif
|
||||
|
||||
if (U_http_info.startHeader > 2 &&
|
||||
UServer_Base::isParallelizationGoingToStart(U_NUM_CLIENT_THRESHOLD))
|
||||
|
@ -670,7 +658,7 @@ void UClientImage_Base::endRequest()
|
|||
# endif
|
||||
#endif
|
||||
|
||||
if (callerHandlerEndRequest) callerHandlerEndRequest();
|
||||
callerHandlerEndRequest();
|
||||
|
||||
U_http_method_type = 0; // NB: this mark the end of http request processing...
|
||||
|
||||
|
|
|
@ -495,6 +495,8 @@ int UHttpPlugIn::handlerRun() // NB: we use this method instead of handlerInit()
|
|||
UClientImage_Base::callerIsValidRequest = UHTTP::isValidRequest;
|
||||
UClientImage_Base::callerIsValidRequestExt = UHTTP::isValidRequestExt;
|
||||
UClientImage_Base::callerHandlerEndRequest = UHTTP::setEndRequestProcessing;
|
||||
|
||||
if (UServer_Base::vplugin_size == 1) UClientImage_Base::callerHandlerRequest = UHTTP::processRequest;
|
||||
}
|
||||
|
||||
U_ASSERT(UHTTP::cache_file_check_memory())
|
||||
|
|
|
@ -983,14 +983,28 @@ int USSIPlugIn::handlerRequest()
|
|||
|
||||
// read the SSI file
|
||||
|
||||
if (bcache == false) *body = UHTTP::file->getContent();
|
||||
if (bcache == false)
|
||||
{
|
||||
*body = UHTTP::file->getContent();
|
||||
|
||||
if (body->empty())
|
||||
{
|
||||
U_DEBUG("USSIPlugIn::handlerRequest() SSI file empty: %.*S", U_FILE_TO_TRACE(*UHTTP::file));
|
||||
|
||||
UClientImage_Base::environment->setEmpty();
|
||||
|
||||
UHTTP::setInternalError();
|
||||
|
||||
U_RETURN(U_PLUGIN_HANDLER_GO_ON);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
U_INTERNAL_DUMP("UClientImage_Base::body(%u) = %V", UClientImage_Base::body->size(), UClientImage_Base::body->rep)
|
||||
|
||||
U_ASSERT(UHTTP::isDataFromCache())
|
||||
U_INTERNAL_ASSERT_POINTER(UHTTP::file_data->array)
|
||||
U_INTERNAL_ASSERT_EQUALS( UHTTP::file_data->array->size(),2)
|
||||
U_INTERNAL_ASSERT_EQUALS( UHTTP::file_data->array->size(), 2)
|
||||
|
||||
(void) header->append(UHTTP::getHeaderFromCache()); // NB: after now 'file_data' can change...
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
if (UServer_Base::stats_bytes)
|
||||
{
|
||||
U_MESSAGE("%9D (pid %P): %v", UServer_Base::getStats().rep);
|
||||
U_DEBUG("%v", UServer_Base::getStats().rep);
|
||||
|
||||
UServer_Base::stats_bytes = 0;
|
||||
}
|
||||
|
@ -1686,18 +1686,13 @@ int UServer_Base::loadPlugins(UString& plugin_dir, const UString& plugin_list)
|
|||
UServerPlugIn* _plugin;
|
||||
int result = U_PLUGIN_HANDLER_ERROR;
|
||||
|
||||
if (plugin_list.empty())
|
||||
if (plugin_list) vplugin_size = vplugin_name->split(U_STRING_TO_PARAM(plugin_list)); // NB: we don't use split with substr() cause of dependency from config var PLUGIN...
|
||||
else
|
||||
{
|
||||
vplugin_size = 1;
|
||||
|
||||
vplugin_name->push_back(*UString::str_http);
|
||||
}
|
||||
else
|
||||
{
|
||||
UClientImage_Base::callerHandlerRequest = pluginsHandlerRequest;
|
||||
|
||||
vplugin_size = vplugin_name->split(U_STRING_TO_PARAM(plugin_list)); // NB: we don't use split with substr() cause of dependency from config var PLUGIN...
|
||||
}
|
||||
|
||||
/**
|
||||
* I do know that to include code in the middle of a function is hacky and dirty,
|
||||
|
|
|
@ -163,9 +163,7 @@ read:
|
|||
|
||||
if (value == (ssize_t)ncount)
|
||||
{
|
||||
# ifdef DEBUG
|
||||
U_MESSAGE("UServices::read(%u) ran out of buffer space(%u)", count, ncount);
|
||||
# endif
|
||||
U_DEBUG("UServices::read(%u) ran out of buffer space(%u)", count, ncount);
|
||||
|
||||
buffer.size_adjust_force(start + byte_read); // NB: we force because string can be referenced...
|
||||
|
||||
|
|
|
@ -396,17 +396,14 @@ U_NO_EXPORT bool UHTTP::checkForInotifyDirectory(UStringRep* key, void* value)
|
|||
|
||||
UHTTP::UFileCacheData* cptr = (UHTTP::UFileCacheData*)value;
|
||||
|
||||
if (cptr->ptr == 0 &&
|
||||
cptr->link == false &&
|
||||
S_ISDIR(cptr->mode))
|
||||
if (S_ISDIR(cptr->mode) &&
|
||||
cptr->link == false)
|
||||
{
|
||||
U_INTERNAL_ASSERT_EQUALS(cptr->ptr, 0)
|
||||
U_INTERNAL_ASSERT_EQUALS(cptr->array, 0)
|
||||
U_INTERNAL_ASSERT(key->isNullTerminated())
|
||||
|
||||
cptr->wd = U_SYSCALL(inotify_add_watch, "%d,%s,%u",
|
||||
UServer_Base::handler_inotify->fd,
|
||||
key->data(),
|
||||
IN_ONLYDIR | IN_CREATE | IN_DELETE | IN_MODIFY);
|
||||
cptr->wd = U_SYSCALL(inotify_add_watch, "%d,%s,%u", UServer_Base::handler_inotify->fd, key->data(), IN_ONLYDIR | IN_CREATE | IN_DELETE | IN_MODIFY);
|
||||
}
|
||||
|
||||
U_RETURN(true);
|
||||
|
@ -496,20 +493,20 @@ void UHTTP::in_READ()
|
|||
len = event.ip->len;
|
||||
name = event.ip->name;
|
||||
|
||||
U_INTERNAL_DUMP("The %s %s(%u) was %s", (mask & IN_ISDIR ? "directory" : "file"), name, len,
|
||||
(mask & IN_CREATE ? "created" :
|
||||
mask & IN_DELETE ? "deleted" :
|
||||
mask & IN_MODIFY ? "modified" : "???"))
|
||||
|
||||
// NB: The length contains any potential padding that is, the result of strlen() on the name field may be smaller than len...
|
||||
|
||||
while (name[len-1] == '\0') --len;
|
||||
|
||||
U_DEBUG("INOTIFY: %s %.*S was %s", (mask & IN_ISDIR ? "DIRECTORY" : "FILE"), len, name,
|
||||
(mask & IN_CREATE ? "created" :
|
||||
mask & IN_DELETE ? "deleted" :
|
||||
mask & IN_MODIFY ? "modified" : "???"));
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(len, u__strlen(name, __PRETTY_FUNCTION__))
|
||||
|
||||
file_data = 0;
|
||||
|
||||
if (wd == inotify_wd)
|
||||
if (wd == inotify_wd)
|
||||
{
|
||||
if (inotify_file_data &&
|
||||
len == inotify_len &&
|
||||
|
@ -550,33 +547,32 @@ next:
|
|||
{
|
||||
if (inotify_file_data)
|
||||
{
|
||||
if (file_data == 0)
|
||||
if (file_data == 0) file_data = cache_file->at(*inotify_pathname);
|
||||
|
||||
if (file_data)
|
||||
{
|
||||
file_data = cache_file->at(*inotify_pathname);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(file_data, inotify_file_data)
|
||||
}
|
||||
|
||||
cache_file->eraseAfterFind();
|
||||
cache_file->eraseAfterFind();
|
||||
}
|
||||
|
||||
inotify_file_data = 0;
|
||||
}
|
||||
}
|
||||
else if ((mask & IN_MODIFY) != 0)
|
||||
{
|
||||
if (inotify_file_data)
|
||||
U_INTERNAL_ASSERT_POINTER(inotify_file_data)
|
||||
|
||||
// NB: check if we have the content of file in cache...
|
||||
|
||||
if (inotify_file_data->array) inotify_file_data->expire = 0; // NB: we delay the renew...
|
||||
else
|
||||
{
|
||||
// NB: check if we have the content of file in cache...
|
||||
if (file_data == 0) file_data = cache_file->at(*inotify_pathname);
|
||||
|
||||
if (inotify_file_data->array) inotify_file_data->expire = 0; // NB: we delay the renew...
|
||||
else
|
||||
if (file_data)
|
||||
{
|
||||
if (file_data == 0)
|
||||
{
|
||||
file_data = cache_file->at(*inotify_pathname);
|
||||
|
||||
U_INTERNAL_ASSERT_EQUALS(file_data, inotify_file_data)
|
||||
}
|
||||
U_INTERNAL_ASSERT_EQUALS(file_data, inotify_file_data)
|
||||
|
||||
renewFileDataInCache();
|
||||
}
|
||||
|
@ -3148,7 +3144,7 @@ U_NO_EXPORT bool UHTTP::callService()
|
|||
|
||||
if (file_data == 0) U_RETURN(false);
|
||||
|
||||
U_SRV_LOG("WARNING: called service not in cache: %.*S - inotify %s enabled", U_FILE_TO_TRACE(*file), UServer_Base::handler_inotify ? "is" : "NOT");
|
||||
U_DEBUG("called service not in cache: %.*S - inotify %s enabled", U_FILE_TO_TRACE(*file), UServer_Base::handler_inotify ? "is" : "NOT");
|
||||
|
||||
U_RETURN(true);
|
||||
}
|
||||
|
@ -3780,8 +3776,7 @@ file_in_cache:
|
|||
|
||||
if (u__isdigit(mime_index))
|
||||
{
|
||||
if (u_is_ssi(mime_index)) checkForPathName();
|
||||
else
|
||||
if (u_is_ssi(mime_index) == false)
|
||||
{
|
||||
UClientImage_Base::setRequestNoCache();
|
||||
|
||||
|
@ -3831,6 +3826,8 @@ from_cache:
|
|||
{
|
||||
file_exist_and_need_to_be_processed: // NB: if we can't service the content of file directly from cache, set status to 'file exist and need to be processed'...
|
||||
|
||||
checkForPathName();
|
||||
|
||||
UClientImage_Base::setRequestNeedProcessing();
|
||||
}
|
||||
|
||||
|
@ -3906,15 +3903,20 @@ need_to_be_processed:
|
|||
#endif
|
||||
|
||||
#if !defined(U_HTTP_STRICT_TRANSPORT_SECURITY) && !defined(USE_LIBSSL)
|
||||
end: // NB: we check if we can shortcut the http request processing...
|
||||
end:
|
||||
#endif
|
||||
if (UClientImage_Base::isRequestNeedProcessing() &&
|
||||
UClientImage_Base::callerHandlerRequest == 0)
|
||||
#ifdef DEBUG
|
||||
if (file_data &&
|
||||
UClientImage_Base::isRequestInFileCache() &&
|
||||
UClientImage_Base::isRequestNeedProcessing())
|
||||
{
|
||||
U_ASSERT_EQUALS(UServer_Base::vplugin_name->last(), *UString::str_http)
|
||||
U_INTERNAL_DUMP("pathname = %V file->getPath() = %V", pathname->rep, file->getPath().rep)
|
||||
|
||||
return processRequest();
|
||||
U_INTERNAL_ASSERT(*pathname)
|
||||
U_ASSERT(UStringExt::endsWith(file->getPath(), *pathname))
|
||||
U_ASSERT_EQUALS(UClientImage_Base::isRequestNotFound(), false)
|
||||
}
|
||||
#endif
|
||||
|
||||
U_RETURN(U_PLUGIN_HANDLER_FINISHED);
|
||||
}
|
||||
|
@ -3984,8 +3986,6 @@ int UHTTP::processRequest()
|
|||
|
||||
bool result;
|
||||
|
||||
checkForPathName();
|
||||
|
||||
if (file->dir())
|
||||
{
|
||||
// NB: may be we want a directory list...
|
||||
|
@ -4101,6 +4101,8 @@ check_file: // now we check the file...
|
|||
|
||||
U_INTERNAL_DUMP("file_data = %p", file_data)
|
||||
|
||||
errno = 0;
|
||||
|
||||
if (file_data)
|
||||
{
|
||||
if (file_data->fd == -1)
|
||||
|
@ -4131,7 +4133,11 @@ check_file: // now we check the file...
|
|||
|
||||
if (result == false)
|
||||
{
|
||||
setForbidden(); // set forbidden error response...
|
||||
U_INTERNAL_DUMP("errno = %d", errno)
|
||||
|
||||
if (errno == ENOENT) setNotFound();
|
||||
else if (errno == EPERM) setForbidden();
|
||||
else setServiceUnavailable();
|
||||
|
||||
U_RETURN(U_PLUGIN_HANDLER_FINISHED);
|
||||
}
|
||||
|
@ -7542,8 +7548,7 @@ void UHTTP::renewFileDataInCache()
|
|||
|
||||
pathname->snprintf("%v", key);
|
||||
|
||||
U_SRV_LOG("WARNING: renewFileDataInCache() called for file: %V - inotify %s enabled, expired=%b",
|
||||
pathname->rep, UServer_Base::handler_inotify ? "is" : "NOT", (u_now->tv_sec > file_data->expire));
|
||||
U_DEBUG("renewFileDataInCache() called for file: %V - inotify %s enabled, expired=%b", pathname->rep, UServer_Base::handler_inotify ? "is" : "NOT", (u_now->tv_sec > file_data->expire));
|
||||
|
||||
cache_file->eraseAfterFind();
|
||||
|
||||
|
@ -7863,7 +7868,7 @@ nocontent:
|
|||
|
||||
(void) pathname->replace(U_FILE_TO_PARAM(*file));
|
||||
|
||||
U_SRV_LOG("WARNING: found file not in cache: %V - inotify %s enabled", pathname->rep, UServer_Base::handler_inotify ? "is" : "NOT");
|
||||
U_DEBUG("found file not in cache: %V - inotify %s enabled", pathname->rep, UServer_Base::handler_inotify ? "is" : "NOT");
|
||||
|
||||
manageDataForCache();
|
||||
|
||||
|
@ -7882,7 +7887,7 @@ nocontent:
|
|||
|
||||
if (U_SYSCALL(stat, "%S,%p", buffer, &st) == 0)
|
||||
{
|
||||
U_SRV_LOG("WARNING: request usp service not in cache: %V - try to compile", pathname->rep);
|
||||
U_DEBUG("request usp service not in cache: %V - try to compile", pathname->rep);
|
||||
|
||||
(void) pathname->replace(buffer, sz);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user