Skip to content

Commit

Permalink
nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
y123456yz committed Jul 30, 2015
1 parent bdf1e0c commit e0160e4
Show file tree
Hide file tree
Showing 178 changed files with 4,943 additions and 636 deletions.
1 change: 1 addition & 0 deletions git
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git pull commit -m nginx
1,616 changes: 1,616 additions & 0 deletions nginx-1.9.2/html/gmime-gmime-cipher-context.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nginx-1.9.2/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<h1>Welcome to nginx!yang test /var/yyz/nginx/html</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

Expand Down
76 changes: 76 additions & 0 deletions nginx-1.9.2/http_响应码大全.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
http响应状态码大全
http状态返回代码 1xx(临时响应)
表示临时响应并需要请求者继续执行操作的状态代码。
http状态返回代码 代码 说明
100 (继续) 请求者应当继续提出请求。服务器返回此代码表示已收到请求的第一部分,正在等待其余部分。
101 (切换协议)请求者已要求服务器切换协议,服务器已确认并准备切换。
http状态返回代码 2xx (成功)
表示成功处理了请求的状态代码。
http状态返回代码 代码 说明
200 (成功) 服务器已成功处理了请求。 通常,这表示服务器提供了请求的网页。
201 (已创建) 请求成功并且服务器创建了新的资源。
202 (已接受) 服务器已接受请求,但尚未处理。
203 (非授权信息) 服务器已成功处理了请求,但返回的信息可能来自另一来源。
204 (无内容) 服务器成功处理了请求,但没有返回任何内容。
205 (重置内容)服务器成功处理了请求,但没有返回任何内容。
206 (部分内容) 服务器成功处理了部分 GET 请求。
http状态返回代码 3xx (重定向)
表示要完成请求,需要进一步操作。 通常,这些状态代码用来重定向。
http状态返回代码 代码 说明
300 (多种选择) 针对请求,服务器可执行多种操作。 服务器可根据请求者 (user agent) 选择一项操作,或提供操作列表供请求者选择。
301 (永久移动) 请求的网页已永久移动到新位置。 服务器返回此响应(对 GET 或 HEAD 请求的响应)时,会自动将请求者转到新位置。
302 (临时移动) 服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。
303 (查看其他位置) 请求者应当对不同的位置使用单独的 GET 请求来检索响应时,服务器返回此代码。
304 (未修改)自从上次请求后,请求的网页未修改过。 服务器返回此响应时,不会返回网页内容。
305 (使用代理) 请求者只能使用代理访问请求的网页。如果服务器返回此响应,还表示请求者应使用代理。
307 (临时重定向) 服务器目前从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。
http状态返回代码 4xx(请求错误)
这些状态代码表示请求可能出错,妨碍了服务器的处理。
http状态返回代码 代码 说明
400 (错误请求) 服务器不理解请求的语法。
401 (未授权) 请求要求身份验证。对于需要登录的网页,服务器可能返回此响应。
403 (禁止) 服务器拒绝请求。
404 (未找到) 服务器找不到请求的网页。
405 (方法禁用) 禁用请求中指定的方法。
406 (不接受)无法使用请求的内容特性响应请求的网页。
407 (需要代理授权) 此状态代码与 401(未授权)类似,但指定请求者应当授权使用代理。
408 (请求超时) 服务器等候请求时发生超时。
409 (冲突) 服务器在完成请求时发生冲突。 服务器必须在响应中包含有关冲突的信息。
410 (已删除) 如果请求的资源已永久删除,服务器就会返回此响应。
411 (需要有效长度)服务器不接受不含有效内容长度标头字段的请求。
412 (未满足前提条件)服务器未满足请求者在请求中设置的其中一个前提条件。
413 (请求实体过大)服务器无法处理请求,因为请求实体过大,超出服务器的处理能力。
414 (请求的 URI 过长) 请求的 URI(通常为网址)过长,服务器无法处理。
415 (不支持的媒体类型)请求的格式不受请求页面的支持。
416 (请求范围不符合要求)如果页面无法提供请求的范围,则服务器会返回此状态代码。
417 (未满足期望值)服务器未满足"期望"请求标头字段的要求。
http状态返回代码 5xx(服务器错误)
这些状态代码表示服务器在尝试处理请求时发生内部错误。 这些错误可能是服务器本身的错误,而不是请求出错。
http状态返回代码 代码 说明
500 (服务器内部错误) 服务器遇到错误,无法完成请求。
501 (尚未实施) 服务器不具备完成请求的功能。例如,服务器无法识别请求方法时可能会返回此代码。
502 (错误网关)服务器作为网关或代理,从上游服务器收到无效响应。
503 (服务不可用)服务器目前无法使用(由于超载或停机维护)。 通常,这只是暂时状态。
504 (网关超时) 服务器作为网关或代理,但是没有及时从上游服务器收到请求。
505 (HTTP 版本不受支持) 服务器不支持请求中所用的 HTTP 协议版本。
一些常见的http状态返回代码为:
200 - 服务器成功返回网页
404 - 请求的网页不存在
503 - 服务不可用
*/
39 changes: 38 additions & 1 deletion nginx-1.9.2/objs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ CORE_DEPS = src/core/nginx.h \
src/os/unix/ngx_process_cycle.h \
src/os/unix/ngx_linux_config.h \
src/os/unix/ngx_linux.h \
src/core/ngx_thread_pool.h \
src/core/ngx_regex.h \
objs/ngx_auto_config.h

Expand Down Expand Up @@ -165,6 +166,10 @@ objs/nginx: objs/src/core/nginx.o \
objs/src/event/modules/ngx_epoll_module.o \
objs/src/os/unix/ngx_linux_sendfile_chain.o \
objs/src/os/unix/ngx_linux_aio_read.o \
objs/src/core/ngx_thread_pool.o \
objs/src/os/unix/ngx_thread_cond.o \
objs/src/os/unix/ngx_thread_mutex.o \
objs/src/os/unix/ngx_thread_id.o \
objs/src/core/ngx_regex.o \
objs/src/http/ngx_http.o \
objs/src/http/ngx_http_core_module.o \
Expand Down Expand Up @@ -285,6 +290,10 @@ objs/nginx: objs/src/core/nginx.o \
objs/src/event/modules/ngx_epoll_module.o \
objs/src/os/unix/ngx_linux_sendfile_chain.o \
objs/src/os/unix/ngx_linux_aio_read.o \
objs/src/core/ngx_thread_pool.o \
objs/src/os/unix/ngx_thread_cond.o \
objs/src/os/unix/ngx_thread_mutex.o \
objs/src/os/unix/ngx_thread_id.o \
objs/src/core/ngx_regex.o \
objs/src/http/ngx_http.o \
objs/src/http/ngx_http_core_module.o \
Expand Down Expand Up @@ -341,7 +350,7 @@ objs/nginx: objs/src/core/nginx.o \
objs/addon/ngx_http_myfilter_module/ngx_http_myfilter_module.o \
objs/addon/sendfile_test/sendfile_test.o \
objs/ngx_modules.o \
-lpthread -lcrypt -lpcre -lcrypto -lcrypto -lz
-lpthread -lpthread -lcrypt -lpcre -lcrypto -lcrypto -lz



Expand Down Expand Up @@ -786,6 +795,34 @@ objs/src/os/unix/ngx_linux_aio_read.o: $(CORE_DEPS) \
src/os/unix/ngx_linux_aio_read.c


objs/src/core/ngx_thread_pool.o: $(CORE_DEPS) \
src/core/ngx_thread_pool.c
$(CC) -c $(CFLAGS) $(CORE_INCS) \
-o objs/src/core/ngx_thread_pool.o \
src/core/ngx_thread_pool.c


objs/src/os/unix/ngx_thread_cond.o: $(CORE_DEPS) \
src/os/unix/ngx_thread_cond.c
$(CC) -c $(CFLAGS) $(CORE_INCS) \
-o objs/src/os/unix/ngx_thread_cond.o \
src/os/unix/ngx_thread_cond.c


objs/src/os/unix/ngx_thread_mutex.o: $(CORE_DEPS) \
src/os/unix/ngx_thread_mutex.c
$(CC) -c $(CFLAGS) $(CORE_INCS) \
-o objs/src/os/unix/ngx_thread_mutex.o \
src/os/unix/ngx_thread_mutex.c


objs/src/os/unix/ngx_thread_id.o: $(CORE_DEPS) \
src/os/unix/ngx_thread_id.c
$(CC) -c $(CFLAGS) $(CORE_INCS) \
-o objs/src/os/unix/ngx_thread_id.o \
src/os/unix/ngx_thread_id.c


objs/src/core/ngx_regex.o: $(CORE_DEPS) \
src/core/ngx_regex.c
$(CC) -c $(CFLAGS) $(CORE_INCS) \
Expand Down
Binary file modified nginx-1.9.2/objs/addon/my_test_module/ngx_http_mytest_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/addon/mytest_config/mytest_config.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/addon/mytest_upstream/mytest_upstream.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/addon/sendfile_test/sendfile_test.o
Binary file not shown.
10 changes: 5 additions & 5 deletions nginx-1.9.2/objs/autoconf.err
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c
----------------------------------------
checking for crypt()

/tmp/ccQVrtHb.o: In function `main':
/tmp/cc8RR4Ad.o: In function `main':
autotest.c:(.text+0x1f): undefined reference to `crypt'
collect2: ld returned 1 exit status
----------
Expand Down Expand Up @@ -292,7 +292,7 @@ checking for statvfs()
----------------------------------------
checking for dlopen()

/tmp/ccypwqjC.o: In function `main':
/tmp/ccWXydIZ.o: In function `main':
autotest.c:(.text+0x19): undefined reference to `dlopen'
collect2: ld returned 1 exit status
----------
Expand Down Expand Up @@ -515,7 +515,7 @@ checking for time_t size
----------------------------------------
checking for setproctitle()

/tmp/ccmMexZN.o: In function `main':
/tmp/ccikjvkj.o: In function `main':
autotest.c:(.text+0x1a): undefined reference to `setproctitle'
collect2: ld returned 1 exit status
----------
Expand Down Expand Up @@ -544,7 +544,7 @@ checking for pwrite()
----------------------------------------
checking for sys_nerr

/tmp/cceSHcxn.o: In function `main':
/tmp/ccekipwM.o: In function `main':
autotest.c:(.text+0x13): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
132
----------------------------------------
Expand Down Expand Up @@ -574,7 +574,7 @@ checking for System V shared memory
----------------------------------------
checking for POSIX semaphores

/tmp/ccin4Q5B.o: In function `main':
/tmp/ccElbycP.o: In function `main':
autotest.c:(.text+0x1d): undefined reference to `sem_init'
autotest.c:(.text+0x38): undefined reference to `sem_destroy'
collect2: ld returned 1 exit status
Expand Down
Binary file modified nginx-1.9.2/objs/nginx
Binary file not shown.
7 changes: 6 additions & 1 deletion nginx-1.9.2/objs/ngx_auto_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define NGX_CONFIGURE " --add-module=./src/mytest_config --add-module=./src/my_test_module --add-module=./src/mytest_subrequest --add-module=./src/mytest_upstream --add-module=./src/ngx_http_myfilter_module --with-debug --with-file-aio --add-module=./src/sendfile_test"
#define NGX_CONFIGURE " --add-module=./src/mytest_config --add-module=./src/my_test_module --add-module=./src/mytest_subrequest --add-module=./src/mytest_upstream --add-module=./src/ngx_http_myfilter_module --with-debug --with-file-aio --add-module=./src/sendfile_test --with-threads"

#ifndef NGX_DEBUG
#define NGX_DEBUG 1
Expand Down Expand Up @@ -283,6 +283,11 @@
#endif


#ifndef NGX_THREADS
#define NGX_THREADS 1
#endif


#ifndef NGX_HTTP_CACHE
#define NGX_HTTP_CACHE 1
#endif
Expand Down
2 changes: 2 additions & 0 deletions nginx-1.9.2/objs/ngx_modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern ngx_module_t ngx_conf_module;
extern ngx_module_t ngx_events_module;
extern ngx_module_t ngx_event_core_module;
extern ngx_module_t ngx_epoll_module;
extern ngx_module_t ngx_thread_pool_module;
extern ngx_module_t ngx_regex_module;
extern ngx_module_t ngx_http_module;
extern ngx_module_t ngx_http_core_module;
Expand Down Expand Up @@ -66,6 +67,7 @@ ngx_module_t *ngx_modules[] = {
&ngx_events_module,
&ngx_event_core_module,
&ngx_epoll_module,
&ngx_thread_pool_module,
&ngx_regex_module,
&ngx_http_module,
&ngx_http_core_module,
Expand Down
Binary file modified nginx-1.9.2/objs/ngx_modules.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/nginx.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_array.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_buf.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_conf_file.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_connection.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_crc32.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_crypt.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_cycle.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_file.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_hash.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_inet.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_list.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_log.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_open_file_cache.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_output_chain.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_palloc.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_parse.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_proxy_protocol.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_radix_tree.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_regex.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_resolver.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_shmtx.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_slab.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_string.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/core/ngx_syslog.o
Binary file not shown.
Binary file added nginx-1.9.2/objs/src/core/ngx_thread_pool.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/modules/ngx_epoll_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event_accept.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event_connect.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event_pipe.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event_posted.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/event/ngx_event_timer.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_access_module.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_autoindex_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_browser_module.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_chunked_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_empty_gif_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_fastcgi_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_geo_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_gzip_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_headers_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_index_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_limit_conn_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_limit_req_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_log_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_map_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_memcached_module.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_proxy_module.o
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_referer_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_rewrite_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_scgi_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_split_clients_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_ssi_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_static_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_upstream_hash_module.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_upstream_zone_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_userid_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/modules/ngx_http_uwsgi_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_copy_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_core_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_file_cache.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_header_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_parse.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_postpone_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_request.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_request_body.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_script.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_special_response.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_upstream.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_upstream_round_robin.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_variables.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/http/ngx_http_write_filter_module.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_alloc.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_channel.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_daemon.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_files.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_linux_aio_read.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_linux_init.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_linux_sendfile_chain.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_posix_init.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_process.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_process_cycle.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_readv_chain.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_recv.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_send.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_setaffinity.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_setproctitle.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_shmem.o
Binary file not shown.
Binary file added nginx-1.9.2/objs/src/os/unix/ngx_thread_cond.o
Binary file not shown.
Binary file added nginx-1.9.2/objs/src/os/unix/ngx_thread_id.o
Binary file not shown.
Binary file added nginx-1.9.2/objs/src/os/unix/ngx_thread_mutex.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_udp_recv.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_user.o
Binary file not shown.
Binary file modified nginx-1.9.2/objs/src/os/unix/ngx_writev_chain.o
Binary file not shown.
6 changes: 4 additions & 2 deletions nginx-1.9.2/src/core/ngx_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ngx_array_destroy(ngx_array_t *a)
}

//检查array数组的elts元素释放已经用完,如果已经用完,则再重新开辟array空间来存储
//ngx_array_push从数组中获取一个数组成员,ngx_array_push_n为一次性获取n个
void *
ngx_array_push(ngx_array_t *a)
{
Expand Down Expand Up @@ -96,7 +97,7 @@ ngx_array_push(ngx_array_t *a)
return elt;
}


//ngx_array_push从数组中获取一个数组成员,ngx_array_push_n为一次性获取n个
void *
ngx_array_push_n(ngx_array_t *a, ngx_uint_t n)
{
Expand Down Expand Up @@ -147,7 +148,8 @@ ngx_array_push_n(ngx_array_t *a, ngx_uint_t n)
}

elt = (u_char *) a->elts + a->size * a->nelts;
a->nelts += n;
a->nelts += n;

return elt;
}

2 changes: 1 addition & 1 deletion nginx-1.9.2/src/core/ngx_conf_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return rv;
}


//获取配置文件全面,包括路径,存放到cycle->conf_prefix或者cycle->prefix中
ngx_int_t
ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
{
Expand Down
2 changes: 1 addition & 1 deletion nginx-1.9.2/src/core/ngx_conf_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ struct ngx_conf_s {

ngx_cycle_t *cycle; //指向对应的cycle,见ngx_init_cycle中的两行conf.ctx = cycle->conf_ctx; conf.cycle = cycle;
ngx_pool_t *pool;
ngx_pool_t *temp_pool;
ngx_pool_t *temp_pool; //用该poll的空间都是临时空间,最终在ngx_init_cycle->ngx_destroy_pool(conf.temp_pool);中释放
ngx_conf_file_t *conf_file; //nginx.conf
ngx_log_t *log;

Expand Down
4 changes: 2 additions & 2 deletions nginx-1.9.2/src/core/ngx_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,11 +1083,11 @@ ngx_close_connection(ngx_connection_t *c)
用ngx_del_timer方法把事件从定时器中移除。
*/
if (c->read->timer_set) {
ngx_del_timer(c->read);
ngx_del_timer(c->read, NGX_FUNC_LINE);
}

if (c->write->timer_set) {
ngx_del_timer(c->write);
ngx_del_timer(c->write, NGX_FUNC_LINE);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions nginx-1.9.2/src/core/ngx_cycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
*old = old_cycle;

if (!ngx_cleaner_event.timer_set) {
ngx_add_timer(&ngx_cleaner_event, 30000);
ngx_add_timer(&ngx_cleaner_event, 30000, NGX_FUNC_LINE);
ngx_cleaner_event.timer_set = 1;
}

Expand Down Expand Up @@ -1446,7 +1446,7 @@ ngx_clean_old_cycles(ngx_event_t *ev)
ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %d", live);

if (live) {
ngx_add_timer(ev, 30000);
ngx_add_timer(ev, 30000, NGX_FUNC_LINE);

} else {
ngx_destroy_pool(ngx_temp_pool);
Expand Down
3 changes: 3 additions & 0 deletions nginx-1.9.2/src/core/ngx_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,9 @@ ngx_int_t
{
return NGX_ERROR;
}

//下面这几个实际上是hash通的各个桶的头部指针,每个hash有ha->hsize个桶头部指针,在ngx_hash_add_key的时候头部指针指向每个桶
//中具体的成员列表

/*
初始化二位数组,这个数组存放的第一个维度代表的是bucket的编号,那么keys_hash[i]中存放的是所有的key算出来的hash值对hsize取
Expand Down
5 changes: 3 additions & 2 deletions nginx-1.9.2/src/core/ngx_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct {
} ngx_hash_elt_t; //hash元素结构 //ngx_hash_init中names数组存入hash桶前,其结构是ngx_hash_key_t形式,在往hash桶里面存数据的时候,会把ngx_hash_key_t里面的成员拷贝到ngx_hash_elt_t中相应成员

//在创建hash桶的时候赋值,见ngx_hash_init
typedef struct {
typedef struct { //hash桶遍历可以参考ngx_hash_find
ngx_hash_elt_t **buckets; //hash桶(有size个桶)
ngx_uint_t size;//hash桶个数
} ngx_hash_t;
Expand Down Expand Up @@ -83,7 +83,7 @@ typedef ngx_uint_t (*ngx_hash_key_pt) (u_char *data, size_t len);
再次,选择通配符在后面的server name,如www.testweb.*。
ngx_hash_combined_t是由3个哈希表组成,一个普通hash表hash,一个包含前向通配符的hash表wc_head和一个包含后向通配符的hash表 wc_tail。
*/
*/ //ngx_http_virtual_names_t中包含该结构
typedef struct { //这里面的hash信息是ngx_http_server_names中存储到hash表中的server_name及其所在server{}上下文ctx,server_name为key,上下文ctx为value
ngx_hash_t hash; //普通hash,完全匹配
ngx_hash_wildcard_t *wc_head; //前置通配符hash
Expand Down Expand Up @@ -165,6 +165,7 @@ typedef struct {
ngx_pool_t *pool;//内存池,用于分配永久性的内存
ngx_pool_t *temp_pool; //临时内存池,下面的临时动态数组都是由临时内存池分配

//下面这几个实际上是hash通的各个桶的头部指针,每个hash有ha->hsize个桶头部指针,在ngx_hash_add_key的时候头部指针指向每个桶中具体的成员列表
//下面的这些可以参考ngx_hash_add_key
/*
keys_hash这是个二维数组,第一个维度代表的是bucket的编号,那么keys_hash[i]中存放的是所有的key算出来的hash值对hsize取模以后的值为i的key。
Expand Down
12 changes: 8 additions & 4 deletions nginx-1.9.2/src/core/ngx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,22 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, const char* filename, int l
ssize_t n;
ngx_uint_t wrote_stderr, debug_connection;
u_char errstr[NGX_MAX_ERROR_STR];
char filebuf[52];

last = errstr + NGX_MAX_ERROR_STR;

p = ngx_cpymem(errstr, ngx_cached_err_log_time.data,
ngx_cached_err_log_time.len);

snprintf(filebuf, sizeof(filebuf), "[%35s, %5d]", filename, lineno);
p = ngx_slprintf(p, last, "%s ", filebuf);

p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]);

/* pid#tid */
p = ngx_slprintf(p, last, "%P#" NGX_TID_T_FMT ": ",
ngx_log_pid, ngx_log_tid);

if (log->connection) {
p = ngx_slprintf(p, last, "*%uA ", log->connection);
}
Expand Down Expand Up @@ -309,7 +313,7 @@ ngx_log_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,

if (log->log_level >= level) {
va_start(args, fmt);
ngx_log_error_core(level, log,__FILE__, __LINE__, err, fmt, args);
ngx_log_error_core(level, log,__FUNCTION__, __LINE__, err, fmt, args);
va_end(args);
}
}
Expand All @@ -321,7 +325,7 @@ ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, const char *fmt, ...)
va_list args;

va_start(args, fmt);
ngx_log_error_core(NGX_LOG_DEBUG, log,__FILE__, __LINE__, err, fmt, args);
ngx_log_error_core(NGX_LOG_DEBUG, log,__FUNCTION__, __LINE__, err, fmt, args);
va_end(args);
}

Expand Down
Loading

0 comments on commit e0160e4

Please sign in to comment.