C currency mall>library classification>Technical books> Nginx Module Development Guide: using C++11 and Boost Library

Commodity number:S20151116172688680

Nginx Module Development Guide: the use of C++11 and Boost Library

The nginx Module Development Guide: use C + + 11 and boost library "rigorous structure, context clear, detailed slightly proper, worthy of our software development engineer, system operation and maintenance engineers and programming enthusiasts have.

Product details

Nginx by Russian engineer Igor sysoev developed a high performance web server and run efficiency far more than traditional Apache, Tomcat, is the world's second largest web server, has been adopted by many domestic and foreign Internet companies.
Nginx is a prominent feature is the flexible modular architecture can add arbitrary functions under the premise does not modify the core, since 2004 released so far, already has hundreds of official and non official function modules such as fastcgi, memcached mysql, allowing nginx to grow to a near universal server software.
Nginx pure C language, development expansion function module also most of the use of C language, but due to the process type characteristics inherent in the C language writing and debugging code are more troublesome, especially for beginners nginx. The nginx Module Development Guide: using C + + 11 and boost library "deep source code, a detailed analysis of the nginx module system, configuration directives, HTTP framework of the core operating mechanism, and on this basis, explain how to use C + + and boost library to develop nginx module, take full advantage of modern C + + in a large number of new features and library components, let nginx module development becomes more convenient, easy and pleasant.

 Luo Jianfeng, 1996 and enrolled in Dongbei University of Finance and economics, 1997 came into contact with C / C + +, 1998 in computer software professional and technical qualifications and, proficiency test, won the senior programmer aptitude, graduated in 2003 in Beijing Science and Technology University, computer, professional master's degree, main research direction for C / C + +, design pattern, the development of high performance network server, hobbies is reading, music and travel.

The zeroth Chapter 1
0.1 about this book 1
0.2 Reader 2
0.3 reader requirements 3
0.4 operating environment 3
0.5 the structure of the book 4
0.6 how to read this book 6
0.7 source code of the book 6
The first chapter Nginx entry 7
1.1 about Nginx 7
1.1.1 history 8
1.1.2 features 8
1.1.3 process model 9
1.1.4 version 10
1.2 install Nginx 11
1.2.1 ready to work 11
1.2.2 quick install 11
1.2.3 run command 12
1.2.4 verify installation 13
1.2.5 custom install 14
1.3 configuration Nginx 15
1.3.1 configuration file format 16
1.3.2 process configuration 17
1.3.3 run log configuration 18
HTTP 1.3.4 configuration 18
Server 1.3.5 configuration 19
Location 1.3.6 configuration 20
1.3.7 file access configuration 21
Upstream 1.3.8 configuration 22
1.3.9 variable 22
1.4 summary 24
The second chapter Nginx development preparation 25
2.1 development environment 25
C++ 2.1.1 standard 25
Boost 2.1.2 library 26
2.2 Nginx directory structure 26
2.3 Nginx source characteristics 27
2.3.1 code style 28
2.3.2 code optimization 28
2.3.3 object oriented idea 28
2.4 using C++ 29 in Nginx
2.4.1 realization principle 29
2.4.2 code style 29
2.4.3 compiler 30
2.5 basic C++ wrapper class 32
2.5.1 class definition 32
2.5.2 structure and structure 33
2.5.3 member function 33
2.6 summary 34
The third chapter Nginx infrastructure 35
3.1 header files 35
3.2 integer type 36
3.2.1 standard integer type 36
3.2.2 custom integer type 36
3.2.3 invalid value 37
C++ 3.2.4 package 38
3.3 error handling 41
3.3.1 error code definition 41
C++ 3.3.2 exception 41
3.4 memory pool 44
3.4.1 structure definition 44
3.4.2 operating function 45
C++ 3.4.3 package 45
3.4.4 cleaning mechanism 48
C++ 3.4.5 memory dispenser 50
3.5 string 52
3.5.1 structure definition 52
3.5.2 operating function 53
C++ 3.5.3 package 55
3.6 time and date 58
3.6.1 time structure definition 58
3.6.2 time operating function 58
3.6.3 date structure definition 59
3.6.4 date operating function 60
C++ 3.6.5 package time 61
C++ 3.6.6 package date: 62
3.7 run log 64
3.7.1 structure definition 65
3.7.2 operating function 65
C++ 3.7.3 package 66
3.8 summary 68
The fourth chapter Nginx advanced data structure 71
4.1 dynamic array 71
4.1.1 structure definition 71
4.1.2 operating function 73
C++ 4.1.3 package 73
4.2 one-way linked list 76
4.2.1 structure definition 77
4.2.2 operating function 78
C++ 4.2.3 iterator 79
C++ 4.2.4 package list 81
4.3 double ended queue 84
4.3.1 structure definition 84
4.3.2 operating function 85
C++ 4.3.3 node 87
C++ 4.3.4 iterator 89
C++ 4.3.5 package queue 90
4.4 buffer 95
4.4.1 structure definition 95
4.4.2 operating function 97
C++ 4.4.3 package 98
4.5 data block chain 100
4.5.1 structure definition 100
4.5.2 operating function 101
C++ 4.5.3 node 101
C++ 4.5.4 iterator 103
C++ 4.5.5 package data block chain 105
4.6 pairs of 107
4.6.1 simple key value of 107
4.6.2 hash table key 107
4.7 summary 108
The fifth chapter is the summary of Nginx development 111
5.1 the simplest Nginx module 111
5.1.1 module design 112
5.1.2 configuration analysis 112
5.1.3 processing function 114
5.1.4 module integration 116
5.1.5 compile scripts and commands 117
5.1.6 test verification 118
5.2 basic process of Nginx development 119
5.2.1 design 119
5.2.2 development 119
5.2.3 compiler 120
5.2.4 test verification 120
121 5.2.5 tuning
5.3 Nginx module 121
5.3.1 module data structure 121
5.3.2 module type 123
Http 5.3.3 module 124
Class diagram of 5.3.4 module 124
The organization form of 5.3.5 module 125
5.4 Nginx configuration 127
5.4.1 structure definition 128
5.4.2 configuration analysis of the basic process 131
5.4.3 configuration data storage model 133
5.4.4 access configuration data 138
5.4.5 determine the location of the configuration data 138
5.4.6 configuration analytic function 140
5.4.7 configuration data merge 141
Type 142 of the 5.4.8 configuration directive
5.5 Nginx module source code analysis 143
Ngx_core_module 5.5.1 143
Ngx_errlog_module 5.5.2 146
5.6 Nginx compiler 147
5.6.1 operating mechanism 147
Variables used in 5.6.2 148
5.7 C++ package module information 149
NgxModuleConfig 5.7.1 149
NgxModule 5.7.2 153
5.8 C++ package configuration 155
NgxCommand 5.8.1 155
NgxTake 5.8.2 155
NGX_MODULE_NULL 5.8.3 157
5.9 C++ development Nginx module 158
The basic composition of C++ 5.9.1 module 158
5.9.2 configuration information class 159
5.9.3 business logic class 160
5.9.4 module integrated class 162
5.9.5 to achieve the source file 164
5.9.6 add more features 164
5.10 summary 165
The sixth chapter is the summary of HTTP Nginx framework 169
6.1 HTTP framework introduction 169
6.1.1 module classification 169
6.1.2 processing flow 170
6.1.3 request structure 172
6.1.4 request processing stage 173
Environmental data requested by 6.1.5 175
6.2 HTTP processing engine 176
6.2.1 processing function prototype 176
Storage mode of 6.2.2 processing function 176
6.2.3 content processing function 177
6.2.4 engine data structure 178
6.2.5 engine initialization 179
The running mechanism of 6.2.6 engine 181
6.2.7 log phase processing 182
6.3 HTTP filter engine 183
6.3.1 filter function prototype 183
6.3.2 filter function list 184
The order of 6.3.3 filter function 185
The running mechanism of 6.3.4 filter list 187
6.3.5 request body filter 188
6.4 Nginx module source code analysis 188
Ngx_http_static_module 6.4.1 188
Ngx_http_not_modified_filter_ module 6.4.2 189
6.5 C++ package 190
NgxModuleCtx 6.5.1 191
NgxHttpCoreModule 6.5.2 193
NgxFilter 6.5.3 195
6.6 summary 197
The seventh chapter HTTP Nginx request processing 199
7.1 HTTP status code 199
7.2 request structure 200
7.3 request line 201
7.3.1 request method 201
7.3.2 protocol version number 202
7.3.3 resource identifier 202
7.4 request header 203
7.5 request body 204
7.5.1 structure definition 205
7.5.2 operating function 205
7.6 response header 206
7.6.1 structure definition 206
7.6.2 operating function 207
7.7 response body 207
7.8 C++ package 208
NgxHeaders 7.8.1 208
NgxRequestBody 7.8.2 211
NgxRequest 7.8.3 212
NgxResponse 7.8.4 213
7.9 development of HTTP processing module 216
7.9.1 module design 216
7.9.2 configuration information class 217
7.9.3 business logic class 217
7.9.4 module integrated class 219
7.9.5 to achieve the source file 221
7.9.6 compiler 221
7.9.7 test verification 221
7.10 develop HTTP filter module 222
7.10.1 module design 222
7.10.2 configuration information class 222
7.10.3 environmental data class 223
7.10.4 business logic class 223
7.10.5 module integrated class 227
7.10.6 to achieve the source file 228
7.10.7 compiler 228
7.10.8 test verification 228
7.11 summary 229
The eighth chapter HTTP Nginx request forwarding 231
8.1 upstream framework introduction 231
8.1.1 working principle 232
8.1.2 request structure 233
8.1.3 upstream structure 234
8.1.4 upstream configuration parameter 236
8.2 upstream operating mechanism 237
8.2.1 callback function 237
8.2.2 initialization upstream 239
8.2.3 set upstream 239
8.2.4 start upstream 241
8.2.5 processing upstream data 241
8.3 load-balance operating mechanism 242
8.3.1 structure definition 243
8.3.2 initialization module portal 247
8.3.3 to initialize the IP address list 248
8.3.4 initialization algorithm 250
8.3.5 implementation algorithm 251
8.4 Nginx module source code analysis 251
Ngx_http_memcached_module 8.4.1 251
Ngx_http_upstream_ip_hash_ module 8.4.2 254
8.5 C++ package 257
NgxUpstream 8.5.1 257
NgxUpstreamHelper 8.5.2 259
NgxHttpUpstreamModule 8.5.3 261
NgxLoadBalance 8.5.4 263
8.6 development of upstream module 264
8.6.1 module design 264
8.6.2 configuration information class 264
8.6.3 business logic class 265
8.6.4 module integrated class 268
8.6.5 to achieve the source file 269
8.6.6 compiler 269
8.6.7 test verification 269
8.7 development of load-balance module 270
8.7.1 module design 271
8.7.2 configuration information class 271
8.7.3 business logic class 271
8.7.4 module integrated class 273
8.7.5 to achieve the source file 275
8.7.6 compiler 275
8.7.7 test verification 275
8.8 summary 276
The ninth chapter HTTP Nginx sub request 277
9.1 request introduction 277
9.1.1 working principle 278
9.1.2 request structure 279
9.1.3 callback function 280
9.1.4 to deal with the request list 282
9.1.5 sub request storage structure 282
9.2 sub request operation mechanism 283
9.2.1 create child request 283
9.2.2 processing engine 287
9.2.3 data finishing 288
9.3 C++ package 290
NgxSubRequestHandler 9.3.1 290
NgxSubRequest 9.3.2 292
9.4 data transmission module 293
9.4.1 module design 293
9.4.2 environmental data class 293
9.4.3 business logic class 295
9.4.4 module integrated class 297
9.4.5 compiler 298
9.5 using the sub request in the module 299
9.5.1 module design 299
9.5.2 configuration information class 299
9.5.3 business logic class 300
9.5.4 test verification 303
9.6 summary 304
The tenth chapter Nginx variables 305
10.1 structure definition 305
10.1.1 variable value 305
10.1.2 variable access object 306
10.1.3 variable storage 307
10.1.4 request structure 307
10.2 operating mechanism 308
10.2.1 registration variable 308
10.2.2 acquisition variable 309
10.3 C++ package 310
NgxVariableValue 10.3.1 310
NgxVariable 10.3.2 311
NgxVariables 10.3.3 312
NgxVarManager 10.3.4 313
NgxVariableValueProxy 10.3.5 314
10.4 use variable 315 in the module.
10.4.1 add variable 316
10.4.2 read and write variables 317
10.5 summary 317
The eleventh chapter Nginx auxiliary facilities 319
11.1 abstract algorithm 319
MD5 11.1.1 319
SHA-1 11.1.2 320
MurmurHash 11.1.3 321
C++ 11.1.4 package 321
11.2 encoding and decoder 324
CRC 11.2.1 check 324
Base64 11.2.2 encoding decoder 325
URI 11.2.3 encoding decoder 326
HTML 11.2.4 and JSON encoding 327
11.3 regular expression 327
11.4 shared memory 328
11.4.1 structure definition 328
11.4.2 operating function 329
C++ 11.4.3 shared memory 329
11.5 timer 331
11.5.1 structure definition 331
11.5.2 operating function 332
C++ 11.5.3 timer event 332
C++ 11.5.4 timer factory 333
11.6 summary 335
The twelfth chapter Nginx and design pattern 337
12.1 introduction to design patterns 337
12.2 framework level 337
12.3 level of business model 339
12.4 code level mode 340
12.5 summary 342
The thirteenth chapter is the conclusion of the 343 chapter.
13.1 books of regret 343
13.2 next 344
13.3 345 valediction
Appendix A recommended bibliography 347
Appendix GDB B commissioning introduction 349
Appendix Nginx C string format 351
Appendix void* variables in Nginx D 353
Appendix Nginx C++ E module introduction 355
Appendix Nginx Lua F module introduction 357