mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
nginx-0.0.1-2003-11-20-20:36:43 import
This commit is contained in:
parent
bb6ec8c9fd
commit
1ef225254e
14
auto/configure
vendored
14
auto/configure
vendored
@ -4,6 +4,20 @@ CPP='cc -E'
|
|||||||
|
|
||||||
echo > ngx_auto_config.h
|
echo > ngx_auto_config.h
|
||||||
|
|
||||||
|
NGX_TYPE="long"; . auto/types/sizeof; NGX_MAX_LONG=$NGX_MAX_SIZE
|
||||||
|
NGX_FORMATS="l"; . auto/fmt/fmt
|
||||||
|
|
||||||
|
|
||||||
|
NGX_TYPE="long long"; . auto/types/sizeof; NGX_MAX_LONG_LONG=$NGX_MAX_SIZE
|
||||||
|
NGX_FORMATS="ll q"; . auto/fmt/fmt
|
||||||
|
|
||||||
|
#NGX_TYPE="__int64_t"; . auto/types/typedef; NGX_TIME_T_FMT=$NGX_FMT
|
||||||
|
|
||||||
|
#NGX_TYPE="time_t"; . auto/types/typedef; NGX_TIME_T_FMT=$NGX_FMT
|
||||||
|
|
||||||
|
|
||||||
|
#exit
|
||||||
|
|
||||||
. auto/types/time_t
|
. auto/types/time_t
|
||||||
|
|
||||||
. auto/types/uint64_t
|
. auto/types/uint64_t
|
||||||
|
32
auto/fmt/fmt
Normal file
32
auto/fmt/fmt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
echo "Checking for printf() $NGX_TYPE format"
|
||||||
|
|
||||||
|
NGX_FMT=NO
|
||||||
|
|
||||||
|
for FMT in $NGX_FORMATS
|
||||||
|
do
|
||||||
|
echo "int main() {" > autotest.c
|
||||||
|
echo "printf(\"%${FMT}u\", (unsigned $NGX_TYPE) -1);" >> autotest.c
|
||||||
|
echo "return 0; }" >> autotest.c
|
||||||
|
|
||||||
|
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
|
||||||
|
|
||||||
|
if [ -x ./autotest -a "`./autotest`" = $NGX_MAX_SIZE ]; then
|
||||||
|
echo " + \"%${FMT}\" used"
|
||||||
|
NGX_FMT=$FMT
|
||||||
|
else
|
||||||
|
echo " + \"%${FMT}\" is not appropriate"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
|
|
||||||
|
if [ $NGX_FMT != NO ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ $NGX_FMT = NO ]; then
|
||||||
|
echo "printf() $NGX_TYPE format not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
45
auto/fmt/longlong
Normal file
45
auto/fmt/longlong
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
echo "Checking for printf() long long format"
|
||||||
|
|
||||||
|
NGX_LONG_LONG_FMT=NO
|
||||||
|
|
||||||
|
echo "int main() {" > autotest.c
|
||||||
|
echo "printf(\"%llu\", (unsigned long long) -1);" >> autotest.c
|
||||||
|
echo "return 0; }" >> autotest.c
|
||||||
|
|
||||||
|
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
|
||||||
|
|
||||||
|
if [ -x ./autotest -a "`./autotest`" = $NGX_MAX_LONG_LONG ]; then
|
||||||
|
echo " + \"%ll\" used"
|
||||||
|
NGX_LONG_LONG_FMT="ll"
|
||||||
|
else
|
||||||
|
echo " + \"%ll\" is not appropriate"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
|
|
||||||
|
|
||||||
|
if [ $NGX_LONG_LONG_FMT = NO ]; then
|
||||||
|
|
||||||
|
echo "int main() {" > autotest.c
|
||||||
|
echo "printf(\"%qu\", (unsigned long long) -1);" >> autotest.c
|
||||||
|
echo "return 0; }" >> autotest.c
|
||||||
|
|
||||||
|
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
|
||||||
|
|
||||||
|
if [ -x ./autotest -a "`./autotest`" = $NGX_MAX_LONG_LONG ]; then
|
||||||
|
echo " + \"%q\" used"
|
||||||
|
NGX_LONG_LONG_FMT="q"
|
||||||
|
else
|
||||||
|
echo " + \"%q\" is not appropriate"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ $NGX_LONG_LONG_FMT = NO ]; then
|
||||||
|
echo "printf() long long format not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
31
auto/types/longlong
Normal file
31
auto/types/longlong
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
echo "Checking for long long size"
|
||||||
|
|
||||||
|
BYTES=
|
||||||
|
|
||||||
|
echo "int main() {" > autotest.c
|
||||||
|
echo "printf(\"%d\", sizeof(long long));" >> autotest.c
|
||||||
|
echo "return 0; }" >> autotest.c
|
||||||
|
|
||||||
|
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
|
||||||
|
|
||||||
|
if [ -x ./autotest ]; then
|
||||||
|
BYTES=`./autotest`
|
||||||
|
echo " + long long is $BYTES bytes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
|
|
||||||
|
case $BYTES in
|
||||||
|
4)
|
||||||
|
NGX_MAX_LONG_LONG=4294967295
|
||||||
|
;;
|
||||||
|
|
||||||
|
8)
|
||||||
|
NGX_MAX_LONG_LONG=18446744073709551615
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$0: error: can not detect long long size"
|
||||||
|
exit 1
|
||||||
|
esac
|
31
auto/types/sizeof
Normal file
31
auto/types/sizeof
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
echo "Checking for $NGX_TYPE size"
|
||||||
|
|
||||||
|
BYTES=
|
||||||
|
|
||||||
|
echo "int main() {" > autotest.c
|
||||||
|
echo "printf(\"%d\", sizeof($NGX_TYPE));" >> autotest.c
|
||||||
|
echo "return 0; }" >> autotest.c
|
||||||
|
|
||||||
|
eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
|
||||||
|
|
||||||
|
if [ -x ./autotest ]; then
|
||||||
|
BYTES=`./autotest`
|
||||||
|
echo " + $NGX_TYPE is $BYTES bytes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
|
|
||||||
|
case $BYTES in
|
||||||
|
4)
|
||||||
|
NGX_MAX_SIZE=4294967295
|
||||||
|
;;
|
||||||
|
|
||||||
|
8)
|
||||||
|
NGX_MAX_SIZE=18446744073709551615
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$0: error: can not detect $NGX_TYPE size"
|
||||||
|
exit 1
|
||||||
|
esac
|
32
auto/types/typedef
Normal file
32
auto/types/typedef
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
echo "Checking for $NGX_TYPE definition"
|
||||||
|
|
||||||
|
echo "#include <sys/types.h>" > autotest.c
|
||||||
|
TYPE=`${CPP} autotest.c | \
|
||||||
|
awk "/^typedef.*$NGX_TYPE/ { for (i = 1; i< NF; i++) print $i}"`
|
||||||
|
#rm autotest.c
|
||||||
|
|
||||||
|
echo $TYPE
|
||||||
|
|
||||||
|
case $TYPE in
|
||||||
|
"long long")
|
||||||
|
echo ' + defined as long long'
|
||||||
|
NGX_FMT=$NGX_LONG_LONG_FMT
|
||||||
|
;;
|
||||||
|
|
||||||
|
long)
|
||||||
|
echo ' + defined as long'
|
||||||
|
NGX_FMT=$NGX_LONG_FMT
|
||||||
|
;;
|
||||||
|
|
||||||
|
int)
|
||||||
|
echo ' + defined as int'
|
||||||
|
NGX_FMT=$NGX_INT_FMT
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "$0: error: unknown $NGX_TYPE definition: \"$TYPE\""
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
@ -29,6 +29,8 @@ if [ $found = 0 ]; then
|
|||||||
type="typedef $type uintptr_t;"
|
type="typedef $type uintptr_t;"
|
||||||
found=2
|
found=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm autotest*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,6 +252,8 @@ void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p)
|
|||||||
rc = ngx_http_busy_lock_cachable(p->lcf->busy_lock, &p->busy_lock,
|
rc = ngx_http_busy_lock_cachable(p->lcf->busy_lock, &p->busy_lock,
|
||||||
p->try_busy_lock);
|
p->try_busy_lock);
|
||||||
|
|
||||||
|
ngx_log_debug(p->request->connection->log, "LOCK CACHABLE: %d" _ rc);
|
||||||
|
|
||||||
if (rc == NGX_OK) {
|
if (rc == NGX_OK) {
|
||||||
if (p->try_busy_lock) {
|
if (p->try_busy_lock) {
|
||||||
p->busy_locked = 1;
|
p->busy_locked = 1;
|
||||||
@ -344,7 +346,7 @@ static void ngx_http_proxy_cache_look_complete_request(ngx_http_proxy_ctx_t *p)
|
|||||||
|
|
||||||
rc = ngx_http_cache_open_file(ctx, ngx_file_uniq(&p->cache->ctx.file.info));
|
rc = ngx_http_cache_open_file(ctx, ngx_file_uniq(&p->cache->ctx.file.info));
|
||||||
|
|
||||||
if (rc == NGX_HTTP_CACHE_THE_SAME) {
|
if (rc == NGX_DECLINED || rc == NGX_HTTP_CACHE_THE_SAME) {
|
||||||
p->try_busy_lock = 1;
|
p->try_busy_lock = 1;
|
||||||
p->busy_lock.time = 0;
|
p->busy_lock.time = 0;
|
||||||
ngx_http_proxy_cache_busy_lock(p);
|
ngx_http_proxy_cache_busy_lock(p);
|
||||||
|
@ -448,8 +448,11 @@ void ngx_http_proxy_busy_lock_handler(ngx_event_t *rev)
|
|||||||
|
|
||||||
void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc)
|
void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc)
|
||||||
{
|
{
|
||||||
ngx_log_debug(p->request->connection->log,
|
ngx_http_request_t *r;
|
||||||
"finalize http proxy request");
|
|
||||||
|
r = p->request;
|
||||||
|
|
||||||
|
ngx_log_debug(r->connection->log, "finalize http proxy request");
|
||||||
|
|
||||||
if (p->upstream && p->upstream->peer.connection) {
|
if (p->upstream && p->upstream->peer.connection) {
|
||||||
ngx_http_proxy_close_connection(p);
|
ngx_http_proxy_close_connection(p);
|
||||||
@ -462,11 +465,27 @@ void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p->saved_ctx) {
|
if (p->saved_ctx) {
|
||||||
p->request->connection->log->data = p->saved_ctx;
|
r->connection->log->data = p->saved_ctx;
|
||||||
p->request->connection->log->handler = p->saved_handler;
|
r->connection->log->handler = p->saved_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_http_finalize_request(p->request, rc);
|
if (p->upstream && p->upstream->event_pipe) {
|
||||||
|
ngx_log_debug(r->connection->log, "TEMP FD: %d" _
|
||||||
|
p->upstream->event_pipe->temp_file->file.fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p->cache) {
|
||||||
|
ngx_log_debug(r->connection->log, "CACHE FD: %d" _ p->cache->ctx.file.fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p->upstream && p->upstream->event_pipe) {
|
||||||
|
r->file.fd = p->upstream->event_pipe->temp_file->file.fd;
|
||||||
|
|
||||||
|
} else if (p->cache) {
|
||||||
|
r->file.fd = p->cache->ctx.file.fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_http_finalize_request(r, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ int ngx_http_busy_lock_cachable(ngx_http_busy_lock_t *bl,
|
|||||||
|
|
||||||
rc = ngx_http_busy_lock_look_cachable(bl, bc, lock);
|
rc = ngx_http_busy_lock_look_cachable(bl, bc, lock);
|
||||||
|
|
||||||
ngx_log_debug(bc->event->log, "BUSYLOCK: %d" _ rc);
|
ngx_log_debug(bc->event->log, "BUSYLOCK: %d %d:%d" _
|
||||||
|
rc _ bl->waiting _ bl->max_waiting);
|
||||||
|
|
||||||
if (rc == NGX_OK) { /* no the same request, there's free slot */
|
if (rc == NGX_OK) { /* no the same request, there's free slot */
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user