1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
This commit is contained in:
stefanocasazza 2018-09-27 16:52:45 +02:00
parent ff51914763
commit e4cad79820
14 changed files with 68 additions and 30 deletions

20
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for ULib 1.4.2. # Generated by GNU Autoconf 2.69 for ULib 2.4.2.
# #
# Report bugs to <stefano.casazza@gmail.com>. # Report bugs to <stefano.casazza@gmail.com>.
# #
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='ULib' PACKAGE_NAME='ULib'
PACKAGE_TARNAME='ULib' PACKAGE_TARNAME='ULib'
PACKAGE_VERSION='1.4.2' PACKAGE_VERSION='2.4.2'
PACKAGE_STRING='ULib 1.4.2' PACKAGE_STRING='ULib 2.4.2'
PACKAGE_BUGREPORT='stefano.casazza@gmail.com' PACKAGE_BUGREPORT='stefano.casazza@gmail.com'
PACKAGE_URL='http://stefanocasazza.github.io/ULib/' PACKAGE_URL='http://stefanocasazza.github.io/ULib/'
@ -1691,7 +1691,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures ULib 1.4.2 to adapt to many kinds of systems. \`configure' configures ULib 2.4.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1762,7 +1762,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of ULib 1.4.2:";; short | recursive ) echo "Configuration of ULib 2.4.2:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1985,7 +1985,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
ULib configure 1.4.2 ULib configure 2.4.2
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -3130,7 +3130,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by ULib $as_me 1.4.2, which was It was created by ULib $as_me 2.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -4133,7 +4133,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='ULib' PACKAGE='ULib'
VERSION='1.4.2' VERSION='2.4.2'
# Some tools Automake needs. # Some tools Automake needs.
@ -36728,7 +36728,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by ULib $as_me 1.4.2, which was This file was extended by ULib $as_me 2.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -36795,7 +36795,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
ULib config.status 1.4.2 ULib config.status 2.4.2
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -25,7 +25,7 @@
# This macro must be the very first invoked # This macro must be the very first invoked
AC_PREREQ([2.69]) AC_PREREQ([2.69])
AC_INIT([ULib],[1.4.2],[stefano.casazza@gmail.com],[ULib],[http://stefanocasazza.github.io/ULib/]) AC_INIT([ULib],[2.4.2],[stefano.casazza@gmail.com],[ULib],[http://stefanocasazza.github.io/ULib/])
AC_CONFIG_SRCDIR([src/ulib/string.cpp]) AC_CONFIG_SRCDIR([src/ulib/string.cpp])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])

View File

@ -185,6 +185,8 @@ userver {
# NOCACHE_FILE_MASK mask (DOS regexp) of pathfile that content NOT be cached in memory # NOCACHE_FILE_MASK mask (DOS regexp) of pathfile that content NOT be cached in memory
# CACHE_FILE_STORE pathfile of memory cache filesystem stored on a single file (may be compressed) # CACHE_FILE_STORE pathfile of memory cache filesystem stored on a single file (may be compressed)
# #
# CACHE_FILE_AS_DYNAMIC_MASK mask (DOS regexp) of pathfile that content be cached as dynamic in memory (to avoid 'Last-Modified: ...' in header response)
#
# CGI_TIMEOUT timeout for cgi execution # CGI_TIMEOUT timeout for cgi execution
# VIRTUAL_HOST flag to activate practice of maintaining more than one server on one machine, as differentiated by their apparent hostname # VIRTUAL_HOST flag to activate practice of maintaining more than one server on one machine, as differentiated by their apparent hostname
# DIGEST_AUTHENTICATION flag authentication method (yes = digest, no = basic) # DIGEST_AUTHENTICATION flag authentication method (yes = digest, no = basic)

View File

@ -915,6 +915,16 @@ private:
}; };
#if defined(U_STDCPP_ENABLE) && defined(HAVE_CXX11) #if defined(U_STDCPP_ENABLE) && defined(HAVE_CXX11)
/**
* for (decl : rng) { ... } is equivalent to: {
* auto && __range = rng;
* auto __begin = begin(__range);
* auto __end = end(__range) ;
* for ( ; __begin != __end; ++__begin ) {
* decl = *__begin;
* ...
* } }
*/
class UVectorStringIter { // this class is to make work Range-based for loop: for ( UString x : UVector<UString> ) loop_statement class UVectorStringIter { // this class is to make work Range-based for loop: for ( UString x : UVector<UString> ) loop_statement
public: public:
explicit UVectorStringIter(const UVector<UString>* p_vec, uint32_t pos) : _pos(pos), _p_vec(p_vec) {} explicit UVectorStringIter(const UVector<UString>* p_vec, uint32_t pos) : _pos(pos), _p_vec(p_vec) {}
@ -929,11 +939,7 @@ public:
{ {
++_pos; ++_pos;
// although not strictly necessary for a range-based for loop return *this; // although not strictly necessary for a range-based for loop following the normal convention of returning a value from operator++ is a good idea
// following the normal convention of returning a value from
// operator++ is a good idea
return *this;
} }
private: private:

View File

@ -16,7 +16,7 @@
#include <ulib/event/event_fd.h> #include <ulib/event/event_fd.h>
#define U_QUERY_INFO_SZ 168 #define U_QUERY_INFO_SZ 1024
class UServer_Base; class UServer_Base;
class UClientImage_Base; class UClientImage_Base;
@ -27,10 +27,6 @@ public:
// Check for memory error // Check for memory error
U_MEMORY_TEST U_MEMORY_TEST
// Allocator e Deallocator
U_MEMORY_ALLOCATOR
U_MEMORY_DEALLOCATOR
UEventDB(); UEventDB();
~UEventDB(); ~UEventDB();

View File

@ -21,6 +21,9 @@
#endif #endif
/** /**
* Serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or
* memory buffer) or transmitted (for example, across a network connection link) and reconstructed later (possibly in a different computer environment)
*
* @see http://google.github.io/flatbuffers/index.html * @see http://google.github.io/flatbuffers/index.html
* *
* All data is accessed over offsets, all scalars are aligned to their own size, and all data is always stored in little endian format. * All data is accessed over offsets, all scalars are aligned to their own size, and all data is always stored in little endian format.

View File

@ -1207,9 +1207,10 @@ private:
static UString* cache_file_mask; static UString* cache_file_mask;
static UString* cache_avoid_mask; static UString* cache_avoid_mask;
static UString* cache_file_store; static UString* cache_file_store;
static UString* nocache_file_mask;
static UFileCacheData* file_data; static UFileCacheData* file_data;
static UString* nocache_file_mask;
static UFileCacheData* file_gzip_bomb; static UFileCacheData* file_gzip_bomb;
static UString* cache_file_as_dynamic_mask;
static UHashMap<UFileCacheData*>* cache_file; static UHashMap<UFileCacheData*>* cache_file;
static UFileCacheData* file_not_in_cache_data; static UFileCacheData* file_not_in_cache_data;

2
rpm.sh
View File

@ -3,7 +3,7 @@
PACKAGE=$HOME/rpmbuild # fedora PACKAGE=$HOME/rpmbuild # fedora
#PACKAGE=/usr/src/packages # SUSE #PACKAGE=/usr/src/packages # SUSE
VERSION=1.4.2 VERSION=2.4.2
run_build() { run_build() {

View File

@ -78,6 +78,8 @@ int UHttpPlugIn::handlerConfig(UFileConfig& cfg)
// NOCACHE_FILE_MASK mask (DOS regexp) of pathfile that content NOT be cached in memory // NOCACHE_FILE_MASK mask (DOS regexp) of pathfile that content NOT be cached in memory
// CACHE_FILE_STORE pathfile of memory cache stored on filesystem // CACHE_FILE_STORE pathfile of memory cache stored on filesystem
// //
// CACHE_FILE_AS_DYNAMIC_MASK mask (DOS regexp) of pathfile that content be cached as dynamic in memory (to avoid 'Last-Modified: ...' in header response)
//
// CGI_TIMEOUT timeout for cgi execution // CGI_TIMEOUT timeout for cgi execution
// VIRTUAL_HOST flag to activate practice of maintaining more than one server on one machine, as differentiated by their apparent hostname // VIRTUAL_HOST flag to activate practice of maintaining more than one server on one machine, as differentiated by their apparent hostname
// DIGEST_AUTHENTICATION flag authentication method (yes = digest, no = basic) // DIGEST_AUTHENTICATION flag authentication method (yes = digest, no = basic)
@ -225,6 +227,17 @@ int UHttpPlugIn::handlerConfig(UFileConfig& cfg)
U_NEW_STRING(UHTTP::nocache_file_mask, UString(x)); U_NEW_STRING(UHTTP::nocache_file_mask, UString(x));
} }
x = cfg.at(U_CONSTANT_TO_PARAM("CACHE_FILE_AS_DYNAMIC_MASK"));
if (x)
{
U_INTERNAL_ASSERT_EQUALS(UHTTP::cache_file_as_dynamic_mask, U_NULLPTR)
if (x.findWhiteSpace() != U_NOT_FOUND) x = UStringExt::removeWhiteSpace(x);
U_NEW_STRING(UHTTP::cache_file_as_dynamic_mask, UString(x));
}
# ifdef U_STDCPP_ENABLE # ifdef U_STDCPP_ENABLE
x = cfg.at(U_CONSTANT_TO_PARAM("CACHE_FILE_STORE")); x = cfg.at(U_CONSTANT_TO_PARAM("CACHE_FILE_STORE"));

View File

@ -448,10 +448,7 @@ bool USocket::enable_bpf()
{ BPF_RET | BPF_A, 0, 0, 0 } { BPF_RET | BPF_A, 0, 0, 0 }
}; };
struct sock_fprog p = { struct sock_fprog p = { 2, code };
.len = 2,
.filter = code,
};
/** /**
* the kernel will call the specified filter to distribute the packets among the SO_REUSEPORT sockets group. * the kernel will call the specified filter to distribute the packets among the SO_REUSEPORT sockets group.

View File

@ -108,6 +108,7 @@ UString* UHTTP::cgi_cookie_option;
UString* UHTTP::set_cookie_option; UString* UHTTP::set_cookie_option;
UString* UHTTP::user_authentication; UString* UHTTP::user_authentication;
UString* UHTTP::string_HTTP_Variables; UString* UHTTP::string_HTTP_Variables;
UString* UHTTP::cache_file_as_dynamic_mask;
uint32_t UHTTP::old_path_len; uint32_t UHTTP::old_path_len;
uint32_t UHTTP::sid_counter_gen; uint32_t UHTTP::sid_counter_gen;
uint32_t UHTTP::sid_counter_cur; uint32_t UHTTP::sid_counter_cur;
@ -9243,7 +9244,7 @@ manage:
} }
else if (file->open()) else if (file->open())
{ {
UString content; UString content, header;
const char* ptr = U_NULLPTR; const char* ptr = U_NULLPTR;
mime_index = file_data->mime_index; mime_index = file_data->mime_index;
@ -9262,7 +9263,17 @@ manage:
ptr = content.data(); ptr = content.data();
} }
putDataInCache(lpathname, getHeaderMimeType(ptr, 0, ctype, U_TIME_FOR_EXPIRE), content); if (cache_file_as_dynamic_mask &&
UServices::dosMatchWithOR(basename_ptr, basename_len, U_STRING_TO_PARAM(*cache_file_as_dynamic_mask), 0))
{
mime_index = '9'; // NB: '9' => we declare a dynamic page to avoid 'Last-Modified: ...' in header response...
}
header = getHeaderMimeType(ptr, 0, ctype, U_TIME_FOR_EXPIRE);
mime_index = file_data->mime_index;
putDataInCache(lpathname, header, content);
} }
} }

View File

@ -1 +1 @@
0400 040E

View File

@ -0,0 +1,8 @@
from math import sqrt
print('Entrer du triangle isocele du sommet A le 2 cotes a = BC et b = AC = AB:')
str = input('a = ')
a = float(str)
str = input('b = ')
b = float(str)
h = sqrt(a*a - (b*b /4))
print("l'aire du triangle isocele, ayant base {0} et hauteur {1} il est: {2}".format(a, h, (a*h)/2))

View File

@ -36,6 +36,7 @@ userver {
http { http {
CACHE_AVOID_MASK ap|immagini CACHE_AVOID_MASK ap|immagini
NOCACHE_FILE_MASK banner.html NOCACHE_FILE_MASK banner.html
CACHE_FILE_AS_DYNAMIC_MASK *.html
URI_PROTECTED_MASK /get_config URI_PROTECTED_MASK /get_config
USP_AUTOMATIC_ALIASING servlet/wi_auth2 USP_AUTOMATIC_ALIASING servlet/wi_auth2