diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7665f8e..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -objs/* -!objs/ndk_* -.pc/ -.vscode/ -modules/media-framework/ -modules/nginx-srt-module/ -modules/nginx-vod-module/ -Makefile -*.orig -*.txt \ No newline at end of file diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 0dc64a5..0000000 --- a/.hgtags +++ /dev/null @@ -1,483 +0,0 @@ -551102312e19b704cd22bd7254a9444b9ea14e96 release-0.1.0 -23fb87bddda14ce9faec90f774085634106aded4 release-0.1.1 -295d97d70c698585705345f1a8f92b02e63d6d0d release-0.1.2 -ded1284520cc939ad5ae6ddab39925375e64237d release-0.1.3 -0491b909ef7612d8411f1f59054186c1f3471b52 release-0.1.4 -a88a3e4e158fade0aaa6f3eb25597d5ced2c1075 release-0.1.5 -1f31dc6d33a3a4e65240b08066bf186df9e33b79 release-0.1.6 -5aecc125bc33d81d6214c91d73eb44230a903dde release-0.1.7 -bbd6b0b4a2b15ef8c8f1aaf7b027b6da47303524 release-0.1.8 -2ff194b74f1e60cd04670986973e3b1a6aa3bece release-0.1.9 -31ee1b50354fb829564b81a6f34e8d6ceb2d3f48 release-0.1.10 -8e8f3af115b5b903b2b8f3335de971f18891246f release-0.1.11 -c3c2848fc081e19aec5ffa97e468ad20ddb81df0 release-0.1.12 -ad1e9ebf93bb5ae4c748d471fad2de8a0afc4d2a release-0.1.13 -c5240858380136a67bec261c59b1532560b57885 release-0.1.14 -fd661d14a7fad212e326a7dad6234ea0de992fbf release-0.1.15 -621229427cba1b0af417ff2a101fc4f17a7d93c8 release-0.1.16 -4ebe09b07e3021f1a63b459903ec58f162183b26 release-0.1.17 -31ff3e943e1675a2caf745ba7a981244445d4c98 release-0.1.18 -45a460f82aec80b0f61136aa09f412436d42203a release-0.1.19 -0f836f0288eee4980f57736d50a7a60fa082d8e9 release-0.1.20 -975f62e77f0244f1b631f740be77c72c8f2da1de release-0.1.21 -fc9909c369b2b4716304ac8e38da57b8fb781211 release-0.1.22 -d7c90bb5ce83dab08715e98f9c7b81c7df4b37be release-0.1.23 -64d9afb209da0cd4a917202b7b77e51cc23e2229 release-0.1.24 -d4ea69372b946dc4ec37fc3f5ddd93ff7c3da675 release-0.1.25 -b1648294f6935e993e436fd8a68bca75c74c826d release-0.1.26 -ee66921ecd47a7fa459f70f4a9d660f91f6a1b94 release-0.1.27 -cd3117ad9aab9c58c6f7e677e551e1adbdeaba54 release-0.1.28 -9b8c906f6e63ec2c71cecebfff35819a7d32227d release-0.1.29 -c12967aadd8726daf2d85e3f3e622d89c42db176 release-0.1.30 -fbbf16224844e7d560c00043e8ade8a560415bba release-0.1.31 -417a087c9c4d9abb9b0b9b3f787aff515c43c035 release-0.1.32 -dadfa78d227027348d7f9d1e7b7093d06ba545a0 release-0.1.33 -12234c998d83bfbbaa305273b3dd1b855ca325dc release-0.1.34 -6f00349b98e5f706b82115c6e4dc84456fc0d770 release-0.1.35 -2019117e6b38cc3e89fe4f56a23b271479c627a6 release-0.1.36 -09b42134ac0c42625340f16628e29690a04f8db5 release-0.1.37 -7fa11e5c6e9612ecff5eb58274cc846ae742d1d2 release-0.1.38 -e5d7d0334fdb946133c17523c198800142ac9fe9 release-0.1.39 -c3bd8cdabb8f73e5600a91f198eb7df6fac65e92 release-0.1.40 -d6e48c08d718bf5a9e58c20a37e8ae172bff1139 release-0.1.41 -563ad09abf5042eb41e8ecaf5b4e6c9deaa42731 release-0.1.42 -c9ad0d9c7d59b2fa2a5fe669f1e88debd03e6c04 release-0.1.43 -371c1cee100d7a1b0e6cad4d188e05c98a641ee7 release-0.1.44 -b09ee85d0ac823e36861491eedfc4dfafe282997 release-0.1.45 -511a89da35ada16ae806667d699f9610b4f8499a release-0.2.0 -0148586012ab3dde69b394ec5a389d44bb11c869 release-0.2.1 -818fbd4750b99d14d2736212c939855a11b1f1ef release-0.2.2 -e16a8d574da511622b97d6237d005f40f2cddb30 release-0.2.3 -483cca23060331f2078b1c2984870d80f288ad41 release-0.2.4 -45033d85b30e3f12c407b7cfc518d76e0eda0263 release-0.2.5 -7bd37aef1e7e87858c12b124e253e98558889b50 release-0.2.6 -ecd9c160f25b7a7075dd93383d98a0fc8d8c0a41 release-0.3.0 -c1f965ef97188fd7ef81342dcf8719da18c554d2 release-0.3.1 -e48ebafc69393fc94fecfdf9997c4179fd1ce473 release-0.3.2 -9c2f3ed7a24711d3b42b124d5f831155c8beff95 release-0.3.3 -7c1369d37c7eb0017c28ebcaa0778046f5aafdcc release-0.3.4 -1af2fcb3be8a63796b6b23a488049c92a6bc12f4 release-0.3.5 -174f1e853e1e831b01000aeccfd06a9c8d4d95a2 release-0.3.6 -458b6c3fea65a894c99dd429334a77bb164c7e83 release-0.3.7 -58475592100cb792c125101b6d2d898f5adada30 release-0.3.8 -fcd6fc7ff7f9b132c35193d834e6e7d05026c716 release-0.3.9 -4d9ea73a627a914d364e83e20c58eb1283f4031d release-0.3.10 -4c5c2c55975c1152b5ca5d5d55b32d4dd7945f7a release-0.3.11 -326634fb9d47912ad94221dc2f8fa4bec424d40c release-0.3.12 -4e296b7d25bf62390ca2afb599e395426b94f785 release-0.3.13 -401de5a43ba5a8acdb9c52465193c0ea7354afe7 release-0.3.14 -284cc140593bb16ac71094acd509ab415ff4837d release-0.3.15 -d4e858a5751a7fd08e64586795ed7d336011fbc0 release-0.3.16 -8c0cdd81580eb76d774cfc5724de68e7e5cbbdc2 release-0.3.17 -425af804d968f30eeff01e33b808bc2e8c467f2c release-0.3.18 -ebc68d8ca4962fe3531b7e13444f7ac4395d9c6e release-0.3.19 -9262f520ce214d3d5fd7c842891519336ef85ca6 release-0.3.20 -869b6444d2341a587183859d4df736c7f3381169 release-0.3.21 -77f77f53214a0e3a68fef8226c15532b54f2c365 release-0.3.22 -858700ae46b453ea111b966b6d03f2c21ddcb94e release-0.3.23 -5dac8c7fb71b86aafed8ea352305e7f85759f72e release-0.3.24 -77cdfe394a94a625955e7585e09983b3af9b889b release-0.3.25 -608cf78b24ef7baaf9705e4715a361f26bb16ba9 release-0.3.26 -3f8a2132b93d66ac19bec006205a304a68524a0b release-0.3.27 -c73c5c58c619c22dd3a5a26c91bb0567a62c6930 release-0.3.28 -5ef026a2ac7481f04154f29ab49377bf99aaf96f release-0.3.29 -51b27717f140b71a2e9158807d79da17c888ce4c release-0.3.30 -7a16e281c01f1c7ab3b79c64b43ddb754ea7935e release-0.3.31 -93e85a79757c49d502e42a1cb8264a0f133b0b00 release-0.3.32 -0216fd1471f386168545f772836156761eddec08 release-0.3.33 -fbed40ce7cb4fd7203fecc22a617b9ce5b950fb3 release-0.3.34 -387450de0b4d21652f0b6242a5e26a31e3be8d8c release-0.3.35 -65bf042c0b4f39f18a235464c52f980e9fa24f6b release-0.3.36 -5d2b8078c1c2593b95ec50acfeeafbefa65be344 release-0.3.37 -f971949ffb585d400e0f15508a56232a0f897c80 release-0.3.38 -18268abd340cb351e0c01b9c44e9f8cc05492364 release-0.3.39 -e60fe4cf1d4ea3c34be8c49047c712c6d46c1727 release-0.3.40 -715d243270806d38be776fc3ed826d97514a73d6 release-0.3.41 -5e8fb59c18c19347a5607fb5af075fe1e2925b9a release-0.3.42 -947c6fd27699e0199249ad592151f844c8a900b0 release-0.3.43 -4946078f0a79e6cc952d3e410813aac9b8bda650 release-0.3.44 -95d7da23ea5315a6e9255ce036ed2c51f091f180 release-0.3.45 -1e720b0be7ecd92358da8a60944669fa493e78cd release-0.3.46 -39b7d7b33c918d8f4abc86c4075052d8c19da3c7 release-0.3.47 -7cbef16c71a1f43a07f8141f02e0135c775f0f5b release-0.3.48 -4c8cd5ae5cc100add5c08c252d991b82b1838c6b release-0.3.49 -400711951595aef7cd2ef865b84b31df52b15782 release-0.3.50 -649c9063d0fda23620eaeaf0f6393be0a672ebe7 release-0.3.51 -9079ee4735aefa98165bb2cb26dee4f58d58c1d7 release-0.3.52 -6d5c1535bb9dcd891c5963971f767421a334a728 release-0.3.53 -5fd7a5e990477189c40718c8c3e01002a2c20b81 release-0.3.54 -63a820b0bc6ca629c8e45a069b52d622ddc27a2d release-0.3.55 -562806624c4afb1687cba83bc1852f5d0fecbac3 release-0.3.56 -cec32b3753acf610ac1a6227d14032c1a89d6319 release-0.3.57 -b80f94fa2197b99db5e033fec92e0426d1fe5026 release-0.3.58 -e924670896abe2769ea0fcfd2058b405bed8e8ec release-0.3.59 -921a7ce4baf42fd1091b7e40f89c858c6b23053e release-0.3.60 -df95dcff753a6dc5e94257302aea02c18c7a7c87 release-0.3.61 -7e24168b0853ee7e46c9c7b943ef077dc64f17f5 release-0.4.0 -8183d4ba50f8500465efb27e66dd23f98775dd21 release-0.4.1 -610267a772c7bf911b499d37f66c21ce8f2ebaf7 release-0.4.2 -39dd0b045441e21512e0a6061a03d0df63414d8b release-0.4.3 -5e42c1615f4de0079bd4d8913886d588ce6a295d release-0.4.4 -40266f92b829a870808b3d4ee54c8fccdecbd2d6 release-0.4.5 -56e33c6efee7ff63cdc52bd1cf172bde195079df release-0.4.6 -119bad43bfd493400c57a05848eada2c35a46810 release-0.4.7 -0f404f82a1343cb4e4b277a44e3417385798e5e5 release-0.4.8 -d24a717314365c857b9f283d6072c2a427d5e342 release-0.4.9 -d6f0a00015fdef861fd67fb583b9690638650656 release-0.4.10 -e372368dadd7b2ecd0182b2f1b11db86fc27b2c3 release-0.4.11 -fd57967d850d2361072c72562d1ed03598473478 release-0.4.12 -979045fdcbd20cf7188545c1c589ff240251f890 release-0.4.13 -93c94cfa9f78f0a5740595dde4466ec4fba664f8 release-0.4.14 -589ee12e8d7c2ae5e4f4676bcc7a1279a76f9e8e release-0.5.0 -13416db8a807e5acb4021bc3c581203de57e2f50 release-0.5.1 -06c58edc88831fb31c492a8eddcf2c6056567f18 release-0.5.2 -e2ac5fa41bcba14adbbb722d45c083c30c07bb5c release-0.5.3 -393dbc659df15ccd411680b5c1ce87ed86d4c144 release-0.5.4 -38cc7bd8e04f2c519fd4526c12841a876be353cb release-0.5.5 -6d1fcec2ea79101c756316c015f72e75f601a5ab release-0.5.6 -aed8a9de62456c4b360358bc112ccca32ce02e8d release-0.5.7 -7642f45af67d805452df2667486201c36efaff85 release-0.5.8 -779216610662c3a459935d506f66a9b16b9c9576 release-0.5.9 -9eeb585454f3daa30cf768e95c088a092fe229b9 release-0.5.10 -bb491c8197e38ca10ae63b1f1ecb36bf6fdaf950 release-0.5.11 -613369e08810f36bbcc9734ef1059a03ccbf5e16 release-0.5.12 -bd796ef5c9c9dd34bfac20261b98685e0410122a release-0.5.13 -8a730c49f906d783b47e4b44d735efd083936c64 release-0.5.14 -cb447039152d85e9145139ff2575a6199b9af9d4 release-0.5.15 -64854c7c95d04f838585ca08492823000503fa61 release-0.5.16 -d1ffcf84ea1244f659145c36ff28de6fcdf528b2 release-0.5.17 -796a6e30ca9d29504195c10210dbc8deced0ae83 release-0.5.18 -1f81c711d2a039e1f93b9b515065a2235372d455 release-0.5.19 -8e8f6082654aedb4438c8fca408cfc316c7c5a2a release-0.5.20 -e9551132f7dd40da5719dd5bcf924c86f1436f85 release-0.5.21 -533a252896c4d1cff1586ae42129d610f7497811 release-0.5.22 -f461a49b6c747e0b67f721f2be172902afea5528 release-0.5.23 -2d5ef73671f690b65bf6d9e22e7155f68f484d5a release-0.5.24 -77bf42576050862c268e267ef3e508b145845a25 release-0.5.25 -2aefee4d4ed69eb7567680bf27a2efd212232488 release-0.6.0 -7ac0fe9bec9a2b5f8e191f6fdd6922bfd916a6cb release-0.6.1 -4882735ebc71eeec0fbfe645bdfdb31306872d82 release-0.6.2 -b94731c73d0922f472ff938b9d252ba29020f20c release-0.6.3 -13e649b813d6ccba5db33a61e08ebe09d683cd5b release-0.6.4 -80de622646b0059fd4c553eff47c391bf7503b89 release-0.6.5 -3b05edb2619d5935023b979ee7a9611b61b6c9e5 release-0.6.6 -1dcfd375100c4479611f71efb99271d0a3059215 release-0.6.7 -0228185d4c5772947b842e856ad74cf7f7fd52f3 release-0.6.8 -d1879c52326ecac45c713203670f54220879911e release-0.6.9 -5a80c6ccbe2ad24fa3d4ff6f9fe4a2b07408d19d release-0.6.10 -f88a8b0b39601b19cd740e4db614ab0b5b874686 release-0.6.11 -5557460a7247a1602ae96efd1d0ccf781344cb58 release-0.6.12 -451b02cc770a794cd41363461b446948ae1d8bc8 release-0.6.13 -537b6ef014c4a133e0ab0b7dc817508e0647e315 release-0.6.14 -5e68764f0d6e91a983170fa806e7450a9e9b33fe release-0.6.15 -158aa4e8cc46fcf9504a61469d22daf3476b17bf release-0.6.16 -d8fcca555542619228d9fab89e1665b993f8c3ee release-0.6.17 -60707ebc037086cf004736a0d4979e2a608da033 release-0.6.18 -3c2a99d3a71af846855be35e62edb9a12f363f44 release-0.6.19 -3e0a27f9358ffc1b5249e0ea2311ce7da5c8967e release-0.6.20 -143f4d65b1c875d6563ccb7f653d9157afc72194 release-0.6.21 -95e6160d2b7d0af8ffd1b95a23cadadf8f0b3f6d release-0.6.22 -69a03d5e3b6e6660079ef1ef172db7ac08d8370e release-0.6.23 -3e2a58fb48f1e1a99ebf851e0d47a7034c52ae22 release-0.6.24 -3b8607c05a8bebcfa59235c2126a70d737f0ccf5 release-0.6.25 -07ad5b2606614c4be4ee720c46cf4af126059d31 release-0.6.26 -be531addfabe5214f409d457140c1038af10d199 release-0.6.27 -58f05255d3a345d04baef5cff0ca1ae0ac7ecebb release-0.6.28 -eb2bd21dc8d03f6c94016f04ffb9adaf83a2b606 release-0.6.29 -55408deb3cd171efa9b81d23d7a1dd1ccde0b839 release-0.6.30 -d4288915bba73c4c3c9cf5d39d34e86879eb2b45 release-0.6.31 -0a189588830b8629c4dfea68feb49af36b59e4a9 release-0.7.0 -6ab27a06f3346cf9ec8737f5dbcc82dd4031e30f release-0.7.1 -a07e258cef3b0a0b6e76a6ff4ba4651c5facc85a release-0.7.2 -9992c4583513d2804fc2e7fec860fbc7ab043009 release-0.7.3 -4dc24d50230fbadfc037a414a86390db2de69dd2 release-0.7.4 -9527137b4354a648a229c7169850c7c65272c00d release-0.7.5 -c2f0f7cf306f302254beae512bda18713922375c release-0.7.6 -bbcf6d75556fdcee8bd4aba8f6c27014be9920ee release-0.7.7 -43bde71f0bbe5a33b161760d7f9f980d50386597 release-0.7.8 -769f0dd7081e9011394f264aa22aa66fd79730d8 release-0.7.9 -511edfa732da637f5f0c9476335df7dca994706d release-0.7.10 -0e7023bf6b2461309c29885935443449a41be807 release-0.7.11 -9ad1bd2b21d93902863807528e426862aedee737 release-0.7.12 -d90ea21e24ea35379aef50c5d70564158e110a15 release-0.7.13 -c07d2d20d95c83d804079bbdcecbce4a0c8282f0 release-0.7.14 -0cd7bb051f67eac2b179fb9f9cc988b9ba18ed76 release-0.7.15 -eab2e87deba73ae6abd9cc740e8d4365bed96322 release-0.7.16 -91d7a9eb8ade90e9421d7b1e3c2e47a6bc427876 release-0.7.17 -fc10f7b5cb1305fb930f8ac40b46882d0828d61e release-0.7.18 -9dba9779e37e5969a2d408c792084fd7acfec062 release-0.7.19 -61838d1bcbddc7bc4dd9f30d535573a6fddca8f9 release-0.7.20 -5f665d0fa6a5f6e748157f2ccbc445b2db8125d0 release-0.7.21 -24763afa5efe91e54f00b2ae5b87666eb6c08c3b release-0.7.22 -0562fb355a25266150cbe8c8d4e00f55e3654df3 release-0.7.23 -19c452ecd083550816873a8a31eb3ed9879085e6 release-0.7.24 -46b68faf271d6fdcaaf3ad2c69f6167ea9e9fa28 release-0.7.25 -d04bfca0c7e3ae2e4422bc1d383553139d6f0a19 release-0.7.26 -9425d9c7f8ead95b00a3929a9a5e487e0e3c8499 release-0.7.27 -fbc3e7e8b3ee756568a875f87d8a954a2f9d3bf6 release-0.7.28 -5176dfdf153fc785b18604197d58806f919829ad release-0.7.29 -87e07ccdf0a4ec53458d9d7a4ea66e1239910968 release-0.7.30 -9fddd7e1a7a27f8463867f41a461aad57df461b2 release-0.7.31 -780b2ba1ec6daf6e3773774e26b05b9ff0d5483e release-0.7.32 -83027471a25385b1c671968be761e9aa7a8591a7 release-0.7.33 -1e9a362c3dcee221ca6e34308c483ed93867aca2 release-0.7.34 -c7ee9e15717b54ead5f4a554686e74abe66c6b07 release-0.7.35 -b84548abe9b9d4f4e203f848696e52c8c82c308f release-0.7.36 -3286f0bab8e77dbc7ebb370b1dc379592ccff123 release-0.7.37 -11a4e2ed5b166b9c9f119171aa399a9e3aa4684a release-0.7.38 -f822655d4120629977794c32d3b969343b6c30db release-0.7.39 -8a350e49d2b6751296db6d8e27277ccf63ed412a release-0.7.40 -c4a56c197eeafd71fc1caef7a9d890a330e3c23d release-0.7.41 -a9575a57a5443df39611774cf3840e9088132b0e release-0.7.42 -7503d95d6eadad14c28b2db183ba09848265274b release-0.7.43 -9be652e9114435fc6f1fdec84c0458d56702db91 release-0.7.44 -797e070d480a34b31ddac0d364784773f1bbbcf9 release-0.7.45 -9b5037e7ec7db25875c40f9d1cf20a853388b124 release-0.7.46 -d1d0e6d7ff0ca3c0dd1be1ef1cfff2e3fd0b4e1c release-0.7.47 -9816fb28eda599bfd53940e6d3b6617d1ecb6323 release-0.7.48 -452b9d09df8e3f2fb04b2a33d04d2f3a6436eb34 release-0.7.49 -e4350efa7cf7a0e868c2236a1137de8a33bd8ec6 release-0.7.50 -f51f2bec766c8b6d7e1799d904f18f8ea631bd44 release-0.7.51 -18e39e566781c9c187e2eb62bebd9d669d68f08c release-0.7.52 -b073eaa1dcea296a3488b83d455fab6621a73932 release-0.7.53 -01c6fe6c2a55998434cd3b05dd10ca487ac3fb6c release-0.7.54 -3ed9377e686f2521e6ec15873084381033fb490d release-0.7.55 -a1e44954549c35023b409f728c678be8bf898148 release-0.7.56 -fbb1918a85e38a7becdb1a001dbaf5933f23a919 release-0.7.57 -87f4a49a9cc34a5b11c8784cc5ea89e97b4b2bd8 release-0.7.58 -0c22cb4862c8beb4ee1b9e4627125162a29a5304 release-0.7.59 -82d56c2425ef857cd430b8530a3f9e1127145a67 release-0.8.0 -f4acb784b53cd952559567971b97dde1e818a2b6 release-0.8.1 -b3503597c1a0f0f378afdc5e5e5b85e2c095a4be release-0.8.2 -c98da980514a02ba81c421b25bf91803ffffddf3 release-0.8.3 -db34ec0c53c4b9dec12ffdf70caf89a325ab9577 release-0.8.4 -0914802433b8678ba2cdf91280766f00f4b9b76e release-0.8.5 -ff52ee9e6422f3759f43a442b7ba615595b3a3d4 release-0.8.6 -7607237b4829fff1f60999f4663c50ed9d5182f7 release-0.8.7 -1cef1807bc12cb05ac52fb0e7a0f111d3760b569 release-0.8.8 -a40f8475511d74a468ade29c1505e8986600d7a3 release-0.8.9 -2d9faf2260df6c3e5d4aa1781493c31f27a557d0 release-0.8.10 -d0d61c32331a6505381b5218318f7b69db167ca8 release-0.8.11 -ca7a1c6c798a7eb5b294d4ac3179ec87ecf297d3 release-0.8.12 -81c8277cd8ed55febcb2dd9d9213076f6c0ccb09 release-0.8.13 -3089486a8dc5844b5b6e9f78d536b4b26f7ffa16 release-0.8.14 -d364c2c12dd9723a2dfac3f096f5e55d4cfe6838 release-0.8.15 -52163a1027c3efd6b4c461b60a2ca6266c23e193 release-0.8.16 -06564e9a2d9ec5852132c212e85eda0bf1300307 release-0.8.17 -7aaa959da85e09e29bcac3b1cadec35b0a25b64d release-0.8.18 -4bc73c644329a510da4e96b7241b80ead7772f83 release-0.8.19 -ea3d168fb99c32a5c3545717ecc61e85a375e5dd release-0.8.20 -27951ca037e63dae45ff5b6279124c224ae1255a release-0.8.21 -d56c8b5df517c2bf6e7bc2827b8bf3e08cda90e1 release-0.8.22 -3c6ac062b379b126212cbb27e98a3c8275ef381a release-0.8.23 -89b9173476de14688b1418fbf7df10f91d1719ef release-0.8.24 -aa550cb4159ae0d566006e091fb1c7a888771050 release-0.8.25 -06ce92293f6a65651b08c466f90f55bd69984b98 release-0.8.26 -ea50b0d79ef1d7d901cd0e4dcd7373447849d719 release-0.8.27 -e68b1c35cad86105ff1c5b240f53442f4c36356e release-0.8.28 -78d3582a30afe63fc0adb17c3ac8891a64e47146 release-0.8.29 -9852c5965a3292a1b6127dbb4da9fce4912d898a release-0.8.30 -4f84115914490e572bcbee5069157b7334df2744 release-0.8.31 -59dee6f7f3afeb1fad6ed5983756e48c81ad2a5c release-0.8.32 -a4456378d234c07038456cf32bfe3c651f1d5e82 release-0.8.33 -21cb50799a20575a42f9733342d37a426f79db4d release-0.8.34 -7cb3cb8d78ef7ae63561733ed91fd07933896bc8 release-0.8.35 -aed68639d4eb6afe944b7fb50499c16f7f3f503c release-0.8.36 -265b7fd2ae21c75bbffa5115b83a0123d6c4acb4 release-0.8.37 -fa5f1ca353c0c5aa5415f51d72fd7bbcc02d1ed7 release-0.8.38 -af10bf9d4c6532850aa1f70cdf7504bd109b284c release-0.8.39 -4846ec9f83cb5bc4c8519d5641b35fb9b190430c release-0.8.40 -718b4cb3faf7efe4e0648140f064bf7a92c3f7e8 release-0.8.41 -b5a3065749093282ddd19845e0b77ffc2e54333e release-0.8.42 -34df9fb22fed415cdad52def04095dc6d4b48222 release-0.8.43 -00ec8cd76fb89af27363b76c40d9f88bf4679c3b release-0.8.44 -e16dd52a0d226c23dcae9a11252564a04753bbed release-0.8.45 -f034d9173df0a433e0bbcf5974f12ea9eb9076c0 release-0.8.46 -4434dc967087315efcd0658206a67fe6c85528f3 release-0.8.47 -0b65c962e0cd6783a854877b52c903cb058eec8c release-0.8.48 -a2b7e94b9807e981866bf07e37b715847d1b7120 release-0.8.49 -e7bdb8edc1bab2bc352a9fb6ce765c46575c35bf release-0.8.50 -21dacebd12f65cb57ceb8d2688db5b07fad6e06d release-0.8.51 -67dd7533b99c8945b5b8b5b393504d4e003a1c50 release-0.8.52 -010468d890dbac33a4cae6dfb2017db70721b2fe release-0.8.53 -62b599022a2fa625b526c2ad1711dc6db7d66786 release-0.9.0 -71281dd73b17a0ead5535d531afaee098da723cb release-0.9.1 -16cff36b0e49fc9fdeee13b2e92690286bcc1b3d release-0.9.2 -b7b306325972661117694879d3e22faf4cf0df32 release-0.9.3 -fe671505a8ea86a76f0358b3ec4de84a9037ac2b release-0.9.4 -70542931bc5436d1bbd38f152245d93ac063968d release-0.9.5 -27e2f3b7a3db1819c5d0ba28327ceaba84a13c4e release-0.9.6 -657d05d63915ce2f6c4d763091059f5f85bb10e5 release-0.9.7 -e0fd9f36005923b8f98d1ba1ea583cb7625f318f release-1.0.0 -f8f89eb4e0c27e857ec517d893d4f9a454985084 release-1.0.1 -c50df367648e53d55e80b60a447c9c66caa0d326 release-1.0.2 -80d586db316512b5a9d39f00fe185f7f91523f52 release-1.0.3 -c9c2805ac9245cc48ce6efeba2b4a444f859d6aa release-1.0.4 -fa2c37b1122c2c983b6e91d1188e387d72dde4d6 release-1.0.5 -f31aea5b06654c9163be5acd6d9b7aaf0fdf6b33 release-1.1.0 -44bf95f670656fae01ccb266b3863843ea13d324 release-1.1.1 -da1289482a143dfa016769649bdff636c26f53c8 release-1.1.2 -bac8ba08a6570bac2ecd3bf2ad64b0ac3030c903 release-1.1.3 -911060bc8221d4113a693ae97952a1fa88663ca8 release-1.1.4 -e47531dfabbf8e5f8b8aff9ff353642ea4aa7abb release-1.1.5 -f9ddecfe331462f870a95e4c1c3ba1bb8f19f2d3 release-1.1.6 -378c297bb7459fb99aa9c77decac0d35391a3932 release-1.1.7 -71600ce67510af093d4bc0117a78b3b4678c6b3a release-1.1.8 -482d7d907f1ab92b78084d8b8631ed0eb7dd08f7 release-1.1.9 -c7e65deabf0db5109e8d8f6cf64cd3fb7633a3d1 release-1.1.10 -9590f0cf5aab8e6e0b0c8ae59c70187b2b97d886 release-1.1.11 -ade8fc136430cfc04a8d0885c757968b0987d56c release-1.1.12 -6a6836e65827fd3cb10a406e7bbbe36e0dad8736 release-1.1.13 -6845f4ac909233f5a08ed8a51de137713a888328 release-1.1.14 -2397e9c72f1bc5eac67006e12ad3e33e0ea9ba74 release-1.1.15 -7b7c49639a7bceecabf4963c60b26b65a77d6ce0 release-1.1.16 -f7e1113a9a1648cad122543e7080e895cf2d88f4 release-1.1.17 -2b22743c3079b41233ded0fc35af8aa89bcfab91 release-1.1.18 -0f0b425659e0b26f5bc8ea14a42dbf34de2eaba6 release-1.1.19 -f582d662cc408eb7a132c21f4b298b71d0701abb release-1.2.0 -9ee68d629722f583d43d92271f2eb84281afc630 release-1.3.0 -61b6a3438afef630774e568eefd89c53e3b93287 release-1.3.1 -7ccd50a0a455f2f2d3b241f376e1193ad956196d release-1.2.1 -0000000000000000000000000000000000000000 release-1.2.1 -50107e2d96bbfc2c59e46f889b1a5f68dd10cf19 release-1.3.2 -2c5e1e88c8cf710caf551c5c67eba00443601efe release-1.3.3 -a43447fb82aa03eabcd85352758ae14606a84d35 release-1.3.4 -90f3b4ea7992a7bf9385851a3e77173363091eea release-1.3.5 -3aeb14f88daeb973e4708310daa3dc68ac1200f7 release-1.3.6 -dafd375f1c882b15fa4a9b7aa7c801c55082395e release-1.3.7 -ab7ce0eb4cf78a656750ab1d8e55ef61f7e535ec release-1.3.8 -1b1a9337a7399ad3cdc5e3a2f9fbaaec990271d5 release-1.3.9 -2c053b2572694eb9cd4aed26a498b6cb1f51bbcc release-1.3.10 -36409ac209872ce53019f084e4e07467c5d9d25e release-1.3.11 -560dc55e90c13860a79d8f3e0d67a81c7b0257bb release-1.3.12 -dc195ffe0965b2b9072f8e213fe74ecce38f6773 release-1.3.13 -e04428778567dd4de329bbbe97ad653e22801612 release-1.3.14 -cd84e467c72967b9f5fb4d96bfc708c93edeb634 release-1.3.15 -23159600bdea695db8f9d2890aaf73424303e49c release-1.3.16 -7809529022b83157067e7d1e2fb65d57db5f4d99 release-1.4.0 -48a84bc3ff074a65a63e353b9796ff2b14239699 release-1.5.0 -99eed1a88fc33f32d66e2ec913874dfef3e12fcc release-1.5.1 -5bdca4812974011731e5719a6c398b54f14a6d61 release-1.5.2 -644a079526295aca11c52c46cb81e3754e6ad4ad release-1.5.3 -376a5e7694004048a9d073e4feb81bb54ee3ba91 release-1.5.4 -60e0409b9ec7ee194c6d8102f0656598cc4a6cfe release-1.5.5 -70c5cd3a61cb476c2afb3a61826e59c7cda0b7a7 release-1.5.6 -9ba2542d75bf62a3972278c63561fc2ef5ec573a release-1.5.7 -eaa76f24975948b0ce8be01838d949122d44ed67 release-1.5.8 -5a1759f33b7fa6270e1617c08d7e655b7b127f26 release-1.5.9 -b798fc020e3a84ef68e6c9f47865a319c826d33c release-1.5.10 -f995a10d4c7e9a817157a6ce7b753297ad32897e release-1.5.11 -97b47d95e4449cbde976657cf8cbbc118351ffe0 release-1.5.12 -fd722b890eabc600394349730a093f50dac31639 release-1.5.13 -d161d68df8be32e5cbf72b07db1a707714827803 release-1.7.0 -0351a6d89c3dbcc7a76295024ba6b70e27b9a497 release-1.7.1 -0bd223a546192fdf2e862f33938f4ec2a3b5b283 release-1.7.2 -fe7cd01828d5ca7491059f0690bb4453645eb28b release-1.7.3 -cbb146b120296852e781079d5138b04495bab6df release-1.7.4 -fe129aa02db9001d220f1db7c3c056f79482c111 release-1.7.5 -a8d111bb68847f61d682a3c8792fecb2e52efa2c release-1.7.6 -6d2fbc30f8a7f70136cf08f32d5ff3179d524873 release-1.7.7 -d5ea659b8bab2d6402a2266efa691f705e84001e release-1.7.8 -34b201c1abd1e2d4faeae4650a21574771a03c0e release-1.7.9 -860cfbcc4606ee36d898a9cd0c5ae8858db984d6 release-1.7.10 -2b3b737b5456c05cd63d3d834f4fb4d3776953d0 release-1.7.11 -3ef00a71f56420a9c3e9cec311c9a2109a015d67 release-1.7.12 -53d850fe292f157d2fb999c52788ec1dc53c91ed release-1.9.0 -884a967c369f73ab16ea859670d690fb094d3850 release-1.9.1 -3a32d6e7404a79a0973bcd8d0b83181c5bf66074 release-1.9.2 -e27a215601292872f545a733859e06d01af1017d release-1.9.3 -5cb7e2eed2031e32d2e5422caf9402758c38a6ad release-1.9.4 -942475e10cb47654205ede7ccbe7d568698e665b release-1.9.5 -b78018cfaa2f0ec20494fccb16252daa87c48a31 release-1.9.6 -54117529e40b988590ea2d38aae909b0b191663f release-1.9.7 -1bdc497c81607d854e3edf8b9a3be324c3d136b6 release-1.9.8 -ef107f3ddc237a3007e2769ec04adde0dcf627fa release-1.9.9 -be00ca08e41a69e585b6aff70a725ed6c9e1a876 release-1.9.10 -fe66cff450a95beed36a2515210eb2d7ef62c9d3 release-1.9.11 -ead3907d74f90a14d1646f1b2b56ba01d3d11702 release-1.9.12 -5936b7ed929237f1a73b467f662611cdc0309e51 release-1.9.13 -4106db71cbcb9c8274700199ac17e520902c6c0f release-1.9.14 -13070ecfda67397985f0e986eb9c42ecb46d05b5 release-1.9.15 -271ee30c6791847980cd139d31807541f5e569bf release-1.11.0 -cb783d9cc19761e14e1285d91c38f4b84d0b8756 release-1.11.1 -4d3b3a13a8cf5fc3351a7f167d1c13325e00f21c release-1.11.2 -b83a067949a3384a49fd3d943eb8d0997b31f87b release-1.11.3 -953512ca02c6f63b4fcbbc3e10d0d9835896bf99 release-1.11.4 -5253015a339aaca0a3111473d3e931b6d4752393 release-1.11.5 -5e371426b3bcba4312ce08606194b89b758927d1 release-1.11.6 -5c8f60faf33ca8926473d2da27b4c3c417bd4630 release-1.11.7 -4591da489a30f790def29bc5987f43409b503cae release-1.11.8 -20a45c768e5ed26b740679d0e22045c98727c3cc release-1.11.9 -1ad0999a7ded3d4fb01c7acf8ff57c80b643da7e release-1.11.10 -d8b321a876d6254e9e98795e3b194ef053290354 release-1.11.11 -7f394e433f0003222aa6531931ecc0b24740d5e4 release-1.11.12 -3d0e8655f897959e48cc74e87670bb5492a58871 release-1.11.13 -3671096a45bce570a2afa20b9faf42c7fb0f7e66 release-1.13.0 -539f7893ecb96bee60965528c8958d7eb2f1ce6b release-1.13.1 -5be2b25bdc65775a85f18f68a4be4f58c7384415 release-1.13.2 -8457ce87640f9bfe6221c4ac4466ced20e03bebe release-1.13.3 -bbc642c813c829963ce8197c0ca237ab7601f3d4 release-1.13.4 -0d45b4cf7c2e4e626a5a16e1fe604402ace1cea5 release-1.13.5 -f87da7d9ca02b8ced4caa6c5eb9013ccd47b0117 release-1.13.6 -47cca243d0ed39bf5dcb9859184affc958b79b6f release-1.13.7 -20ca4bcff108d3e66977f4d97508637093492287 release-1.13.8 -fb1212c7eca4c5328fe17d6cd95b010c67336aac release-1.13.9 -31c929e16910c38492581ef474e72fa67c28f124 release-1.13.10 -64179f242cb55fc206bca59de9bfdc4cf5ebcec7 release-1.13.11 -051e5fa03b92b8a564f6b12debd483d267391e82 release-1.13.12 -990b3e885636d763b97ed02d0d2cfc161a4e0c09 release-1.15.0 -4189160cb946bb38d0bc0a452b5eb4cdd8979fb5 release-1.15.1 -b234199c7ed8a156a6bb98f7ff58302c857c954f release-1.15.2 -28b3e17ca7eba1e6a0891afde0e4bc5bcc99c861 release-1.15.3 -49d49835653857daa418e68d6cbfed4958c78fca release-1.15.4 -f062e43d74fc2578bb100a9e82a953efa1eb9e4e release-1.15.5 -2351853ce6867b6166823bdf94333c0a76633c0a release-1.15.6 -051a039ce1c7e09144de4a4846669ec7116cecea release-1.15.7 -ee551e3f6dba336c0d875e266d7d55385f379b42 release-1.15.8 -d2fd76709909767fc727a5b4affcf1dc9ca488a7 release-1.15.9 -75f5c7f628411c79c7044102049f7ab4f7a246e7 release-1.15.10 -5155d0296a5ef9841f035920527ffdb771076b44 release-1.15.11 -0130ca3d58437b3c7c707cdddd813d530c68da9a release-1.15.12 -054c1c46395caff79bb4caf16f40b331f71bb6dd release-1.17.0 -7816bd7dabf6ee86c53c073b90a7143161546e06 release-1.17.1 -2fc9f853a6b7cd29dc84e0af2ed3cf78e0da6ca8 release-1.17.2 -ed4303aa1b31a9aad5440640c0840d9d0af45fed release-1.17.3 -ce2ced3856909f36f8130c99eaa4dbdbae636ddc release-1.17.4 -9af0dddbddb2c368bfedd2801bc100ffad01e19b release-1.17.5 -de68d0d94320cbf033599c6f3ca37e5335c67fd7 release-1.17.6 -e56295fe0ea76bf53b06bffa77a2d3a9a335cb8c release-1.17.7 -fdacd273711ddf20f778c1fb91529ab53979a454 release-1.17.8 -5e8d52bca714d4b85284ddb649d1ba4a3ca978a8 release-1.17.9 -c44970de01474f6f3e01b0adea85ec1d03e3a5f2 release-1.17.10 -cbe6ba650211541310618849168631ce0b788f35 release-1.19.0 -062920e2f3bf871ef7a3d8496edec1b3065faf80 release-1.19.1 -a7b46539f507e6c64efa0efda69ad60b6f4ffbce release-1.19.2 -3cbc2602325f0ac08917a4397d76f5155c34b7b1 release-1.19.3 -dc0cc425fa63a80315f6efb68697cadb6626cdf2 release-1.19.4 -8e5b068f761cd512d10c9671fbde0b568c1fd08b release-1.19.5 -f618488eb769e0ed74ef0d93cd118d2ad79ef94d release-1.19.6 -3fa6e2095a7a51acc630517e1c27a7b7ac41f7b3 release-1.19.7 -8c65d21464aaa5923775f80c32474adc7a320068 release-1.19.8 -da571b8eaf8f30f36c43b3c9b25e01e31f47149c release-1.19.9 -ffcbb9980ee2bad27b4d7b1cd680b14ff47b29aa release-1.19.10 -df34dcc9ac072ffd0945e5a1f3eb7987e8275375 release-1.21.0 -a68ac0677f8553b1f84d357bc9da114731ab5f47 release-1.21.1 -bfbc52374adcbf2f9060afd62de940f6fab3bba5 release-1.21.2 -2217a9c1d0b86026f22700b3c089545db1964f55 release-1.21.3 -39be8a682c58308d9399cddd57e37f9fdb7bdf3e release-1.21.4 -d986378168fd4d70e0121cabac274c560cca9bdf release-1.21.5 -714eb4b2c09e712fb2572a2164ce2bf67638ccac release-1.21.6 -5da2c0902e8e2aa4534008a582a60c61c135960e release-1.23.0 -a63d0a70afea96813ba6667997bc7d68b5863f0d release-1.23.1 -aa901551a7ebad1e8b0f8c11cb44e3424ba29707 release-1.23.2 -ff3afd1ce6a6b65057741df442adfaa71a0e2588 release-1.23.3 -ac779115ed6ee4f3039e9aea414a54e560450ee2 release-1.23.4 -12dcf92b0c2c68552398f19644ce3104459807d7 release-1.25.0 -f8134640e8615448205785cf00b0bc810489b495 release-1.25.1 -1d839f05409d1a50d0f15a2bf36547001f99ae40 release-1.25.2 -294a3d07234f8f65d7b0e0b0e2c5b05c12c5da0a release-1.25.3 -173a0a7dbce569adbb70257c6ec4f0f6bc585009 release-1.25.4 -8618e4d900cc71082fbe7dc72af087937d64faf5 release-1.25.5 -a58202a8c41bf0bd97eef1b946e13105a105520d release-1.26.0 -a63c124e34bcf2d1d1feb8d40ff075103b967c4c release-1.26.1 -e4c5da06073ca24e2ffc5c8f8b8d7833a926356f release-1.26.2 diff --git a/CHANGES b/CHANGES index 9c2fb00..5b1242a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,2561 +1,36 @@ -Changes with nginx 1.26.3 05 Feb 2025 - - *) Security: insufficient check in virtual servers handling with TLSv1.3 - SNI allowed to reuse SSL sessions in a different virtual server, to - bypass client SSL certificates verification (CVE-2025-23419). - - *) Bugfix: in the ngx_http_mp4_module. - Thanks to Nils Bars. - - *) Workaround: "gzip filter failed to use preallocated memory" alerts - appeared in logs when using zlib-ng. - - *) Bugfix: nginx could not build libatomic library using the library - sources if the --with-libatomic=DIR option was used. - - *) Bugfix: nginx now ignores QUIC version negotiation packets from - clients. - - *) Bugfix: nginx could not be built on Solaris 10 and earlier with the - ngx_http_v3_module. - - *) Bugfixes in HTTP/3. - - -Changes with nginx 1.26.2 14 Aug 2024 - - *) Security: processing of a specially crafted mp4 file by the - ngx_http_mp4_module might cause a worker process crash - (CVE-2024-7347). - Thanks to Nils Bars. - - -Changes with nginx 1.26.1 29 May 2024 - - *) Security: when using HTTP/3, processing of a specially crafted QUIC - session might cause a worker process crash, worker process memory - disclosure on systems with MTU larger than 4096 bytes, or might have - potential other impact (CVE-2024-32760, CVE-2024-31079, - CVE-2024-35200, CVE-2024-34161). - Thanks to Nils Bars of CISPA. - - *) Bugfix: reduced memory consumption for long-lived requests if "gzip", - "gunzip", "ssi", "sub_filter", or "grpc_pass" directives are used. - - *) Bugfix: nginx could not be built by gcc 14 if the --with-libatomic - option was used. - Thanks to Edgar Bonet. - - *) Bugfix: in HTTP/3. - - -Changes with nginx 1.26.0 23 Apr 2024 - - *) 1.26.x stable branch. - - -Changes with nginx 1.25.5 16 Apr 2024 - - *) Feature: virtual servers in the stream module. - - *) Feature: the ngx_stream_pass_module. - - *) Feature: the "deferred", "accept_filter", and "setfib" parameters of - the "listen" directive in the stream module. - - *) Feature: cache line size detection for some architectures. - Thanks to Piotr Sikora. - - *) Feature: support for Homebrew on Apple Silicon. - Thanks to Piotr Sikora. - - *) Bugfix: Windows cross-compilation bugfixes and improvements. - Thanks to Piotr Sikora. - - *) Bugfix: unexpected connection closure while using 0-RTT in QUIC. - Thanks to Vladimir Khomutov. - - -Changes with nginx 1.25.4 14 Feb 2024 - - *) Security: when using HTTP/3 a segmentation fault might occur in a - worker process while processing a specially crafted QUIC session - (CVE-2024-24989, CVE-2024-24990). - - *) Bugfix: connections with pending AIO operations might be closed - prematurely during graceful shutdown of old worker processes. - - *) Bugfix: socket leak alerts no longer logged when fast shutdown was - requested after graceful shutdown of old worker processes. - - *) Bugfix: a socket descriptor error, a socket leak, or a segmentation - fault in a worker process (for SSL proxying) might occur if AIO was - used in a subrequest. - - *) Bugfix: a segmentation fault might occur in a worker process if SSL - proxying was used along with the "image_filter" directive and errors - with code 415 were redirected with the "error_page" directive. - - *) Bugfixes and improvements in HTTP/3. - - -Changes with nginx 1.25.3 24 Oct 2023 - - *) Change: improved detection of misbehaving clients when using HTTP/2. - - *) Feature: startup speedup when using a large number of locations. - Thanks to Yusuke Nojima. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2 without SSL; the bug had appeared in 1.25.1. - - *) Bugfix: the "Status" backend response header line with an empty - reason phrase was handled incorrectly. - - *) Bugfix: memory leak during reconfiguration when using the PCRE2 - library. - Thanks to ZhenZhong Wu. - - *) Bugfixes and improvements in HTTP/3. - - -Changes with nginx 1.25.2 15 Aug 2023 - - *) Feature: path MTU discovery when using HTTP/3. - - *) Feature: TLS_AES_128_CCM_SHA256 cipher suite support when using - HTTP/3. - - *) Change: now nginx uses appname "nginx" when loading OpenSSL - configuration. - - *) Change: now nginx does not try to load OpenSSL configuration if the - --with-openssl option was used to built OpenSSL and the OPENSSL_CONF - environment variable is not set. - - *) Bugfix: in the $body_bytes_sent variable when using HTTP/3. - - *) Bugfix: in HTTP/3. - - -Changes with nginx 1.25.1 13 Jun 2023 - - *) Feature: the "http2" directive, which enables HTTP/2 on a per-server - basis; the "http2" parameter of the "listen" directive is now - deprecated. - - *) Change: HTTP/2 server push support has been removed. - - *) Change: the deprecated "ssl" directive is not supported anymore. - - *) Bugfix: in HTTP/3 when using OpenSSL. - - -Changes with nginx 1.25.0 23 May 2023 - - *) Feature: experimental HTTP/3 support. - - -Changes with nginx 1.23.4 28 Mar 2023 - - *) Change: now TLSv1.3 protocol is enabled by default. - - *) Change: now nginx issues a warning if protocol parameters of a - listening socket are redefined. - - *) Change: now nginx closes connections with lingering if pipelining was - used by the client. - - *) Feature: byte ranges support in the ngx_http_gzip_static_module. - - *) Bugfix: port ranges in the "listen" directive did not work; the bug - had appeared in 1.23.3. - Thanks to Valentin Bartenev. - - *) Bugfix: incorrect location might be chosen to process a request if a - prefix location longer than 255 characters was used in the - configuration. - - *) Bugfix: non-ASCII characters in file names on Windows were not - supported by the ngx_http_autoindex_module, the ngx_http_dav_module, - and the "include" directive. - - *) Change: the logging level of the "data length too long", "length too - short", "bad legacy version", "no shared signature algorithms", "bad - digest length", "missing sigalgs extension", "encrypted length too - long", "bad length", "bad key update", "mixed handshake and non - handshake data", "ccs received early", "data between ccs and - finished", "packet length too long", "too many warn alerts", "record - too small", and "got a fin before a ccs" SSL errors has been lowered - from "crit" to "info". - - *) Bugfix: a socket leak might occur when using HTTP/2 and the - "error_page" directive to redirect errors with code 400. - - *) Bugfix: messages about logging to syslog errors did not contain - information that the errors happened while logging to syslog. - Thanks to Safar Safarly. - - *) Workaround: "gzip filter failed to use preallocated memory" alerts - appeared in logs when using zlib-ng. - - *) Bugfix: in the mail proxy server. - - -Changes with nginx 1.23.3 13 Dec 2022 - - *) Bugfix: an error might occur when reading PROXY protocol version 2 - header with large number of TLVs. - - *) Bugfix: a segmentation fault might occur in a worker process if SSI - was used to process subrequests created by other modules. - Thanks to Ciel Zhao. - - *) Workaround: when a hostname used in the "listen" directive resolves - to multiple addresses, nginx now ignores duplicates within these - addresses. - - *) Bugfix: nginx might hog CPU during unbuffered proxying if SSL - connections to backends were used. - - -Changes with nginx 1.23.2 19 Oct 2022 - - *) Security: processing of a specially crafted mp4 file by the - ngx_http_mp4_module might cause a worker process crash, worker - process memory disclosure, or might have potential other impact - (CVE-2022-41741, CVE-2022-41742). - - *) Feature: the "$proxy_protocol_tlv_..." variables. - - *) Feature: TLS session tickets encryption keys are now automatically - rotated when using shared memory in the "ssl_session_cache" - directive. - - *) Change: the logging level of the "bad record type" SSL errors has - been lowered from "crit" to "info". - Thanks to Murilo Andrade. - - *) Change: now when using shared memory in the "ssl_session_cache" - directive the "could not allocate new session" errors are logged at - the "warn" level instead of "alert" and not more often than once per - second. - - *) Bugfix: nginx/Windows could not be built with OpenSSL 3.0.x. - - *) Bugfix: in logging of the PROXY protocol errors. - Thanks to Sergey Brester. - - *) Workaround: shared memory from the "ssl_session_cache" directive was - spent on sessions using TLS session tickets when using TLSv1.3 with - OpenSSL. - - *) Workaround: timeout specified with the "ssl_session_timeout" - directive did not work when using TLSv1.3 with OpenSSL or BoringSSL. - - -Changes with nginx 1.23.1 19 Jul 2022 - - *) Feature: memory usage optimization in configurations with SSL - proxying. - - *) Feature: looking up of IPv4 addresses while resolving now can be - disabled with the "ipv4=off" parameter of the "resolver" directive. - - *) Change: the logging level of the "bad key share", "bad extension", - "bad cipher", and "bad ecpoint" SSL errors has been lowered from - "crit" to "info". - - *) Bugfix: while returning byte ranges nginx did not remove the - "Content-Range" header line if it was present in the original backend - response. - - *) Bugfix: a proxied response might be truncated during reconfiguration - on Linux; the bug had appeared in 1.17.5. - - -Changes with nginx 1.23.0 21 Jun 2022 - - *) Change in internal API: now header lines are represented as linked - lists. - - *) Change: now nginx combines arbitrary header lines with identical - names when sending to FastCGI, SCGI, and uwsgi backends, in the - $r->header_in() method of the ngx_http_perl_module, and during lookup - of the "$http_...", "$sent_http_...", "$sent_trailer_...", - "$upstream_http_...", and "$upstream_trailer_..." variables. - - *) Bugfix: if there were multiple "Vary" header lines in the backend - response, nginx only used the last of them when caching. - - *) Bugfix: if there were multiple "WWW-Authenticate" header lines in the - backend response and errors with code 401 were intercepted or the - "auth_request" directive was used, nginx only sent the first of the - header lines to the client. - - *) Change: the logging level of the "application data after close - notify" SSL errors has been lowered from "crit" to "info". - - *) Bugfix: connections might hang if nginx was built on Linux 2.6.17 or - newer, but was used on systems without EPOLLRDHUP support, notably - with epoll emulation layers; the bug had appeared in 1.17.5. - Thanks to Marcus Ball. - - *) Bugfix: nginx did not cache the response if the "Expires" response - header line disabled caching, but following "Cache-Control" header - line enabled caching. - - -Changes with nginx 1.21.6 25 Jan 2022 - - *) Bugfix: when using EPOLLEXCLUSIVE on Linux client connections were - unevenly distributed among worker processes. - - *) Bugfix: nginx returned the "Connection: keep-alive" header line in - responses during graceful shutdown of old worker processes. - - *) Bugfix: in the "ssl_session_ticket_key" when using TLSv1.3. - - -Changes with nginx 1.21.5 28 Dec 2021 - - *) Change: now nginx is built with the PCRE2 library by default. - - *) Change: now nginx always uses sendfile(SF_NODISKIO) on FreeBSD. - - *) Feature: support for sendfile(SF_NOCACHE) on FreeBSD. - - *) Feature: the $ssl_curve variable. - - *) Bugfix: connections might hang when using HTTP/2 without SSL with the - "sendfile" and "aio" directives. - - -Changes with nginx 1.21.4 02 Nov 2021 - - *) Change: support for NPN instead of ALPN to establish HTTP/2 - connections has been removed. - - *) Change: now nginx rejects SSL connections if ALPN is used by the - client, but no supported protocols can be negotiated. - - *) Change: the default value of the "sendfile_max_chunk" directive was - changed to 2 megabytes. - - *) Feature: the "proxy_half_close" directive in the stream module. - - *) Feature: the "ssl_alpn" directive in the stream module. - - *) Feature: the $ssl_alpn_protocol variable. - - *) Feature: support for SSL_sendfile() when using OpenSSL 3.0. - - *) Feature: the "mp4_start_key_frame" directive in the - ngx_http_mp4_module. - Thanks to Tracey Jaquith. - - *) Bugfix: in the $content_length variable when using chunked transfer - encoding. - - *) Bugfix: after receiving a response with incorrect length from a - proxied backend nginx might nevertheless cache the connection. - Thanks to Awdhesh Mathpal. - - *) Bugfix: invalid headers from backends were logged at the "info" level - instead of "error"; the bug had appeared in 1.21.1. - - *) Bugfix: requests might hang when using HTTP/2 and the "aio_write" - directive. - - -Changes with nginx 1.21.3 07 Sep 2021 - - *) Change: optimization of client request body reading when using - HTTP/2. - - *) Bugfix: in request body filters internal API when using HTTP/2 and - buffering of the data being processed. - - -Changes with nginx 1.21.2 31 Aug 2021 - - *) Change: now nginx rejects HTTP/1.0 requests with the - "Transfer-Encoding" header line. - - *) Change: export ciphers are no longer supported. - - *) Feature: OpenSSL 3.0 compatibility. - - *) Feature: the "Auth-SSL-Protocol" and "Auth-SSL-Cipher" header lines - are now passed to the mail proxy authentication server. - Thanks to Rob Mueller. - - *) Feature: request body filters API now permits buffering of the data - being processed. - - *) Bugfix: backend SSL connections in the stream module might hang after - an SSL handshake. - - *) Bugfix: the security level, which is available in OpenSSL 1.1.0 or - newer, did not affect loading of the server certificates when set - with "@SECLEVEL=N" in the "ssl_ciphers" directive. - - *) Bugfix: SSL connections with gRPC backends might hang if select, - poll, or /dev/poll methods were used. - - *) Bugfix: when using HTTP/2 client request body was always written to - disk if the "Content-Length" header line was not present in the - request. - - -Changes with nginx 1.21.1 06 Jul 2021 - - *) Change: now nginx always returns an error for the CONNECT method. - - *) Change: now nginx always returns an error if both "Content-Length" - and "Transfer-Encoding" header lines are present in the request. - - *) Change: now nginx always returns an error if spaces or control - characters are used in the request line. - - *) Change: now nginx always returns an error if spaces or control - characters are used in a header name. - - *) Change: now nginx always returns an error if spaces or control - characters are used in the "Host" request header line. - - *) Change: optimization of configuration testing when using many - listening sockets. - - *) Bugfix: nginx did not escape """, "<", ">", "\", "^", "`", "{", "|", - and "}" characters when proxying with changed URI. - - *) Bugfix: SSL variables might be empty when used in logs; the bug had - appeared in 1.19.5. - - *) Bugfix: keepalive connections with gRPC backends might not be closed - after receiving a GOAWAY frame. - - *) Bugfix: reduced memory consumption for long-lived requests when - proxying with more than 64 buffers. - - -Changes with nginx 1.21.0 25 May 2021 - - *) Security: 1-byte memory overwrite might occur during DNS server - response processing if the "resolver" directive was used, allowing an - attacker who is able to forge UDP packets from the DNS server to - cause worker process crash or, potentially, arbitrary code execution - (CVE-2021-23017). - - *) Feature: variables support in the "proxy_ssl_certificate", - "proxy_ssl_certificate_key" "grpc_ssl_certificate", - "grpc_ssl_certificate_key", "uwsgi_ssl_certificate", and - "uwsgi_ssl_certificate_key" directives. - - *) Feature: the "max_errors" directive in the mail proxy module. - - *) Feature: the mail proxy module supports POP3 and IMAP pipelining. - - *) Feature: the "fastopen" parameter of the "listen" directive in the - stream module. - Thanks to Anbang Wen. - - *) Bugfix: special characters were not escaped during automatic redirect - with appended trailing slash. - - *) Bugfix: connections with clients in the mail proxy module might be - closed unexpectedly when using SMTP pipelining. - - -Changes with nginx 1.19.10 13 Apr 2021 - - *) Change: the default value of the "keepalive_requests" directive was - changed to 1000. - - *) Feature: the "keepalive_time" directive. - - *) Feature: the $connection_time variable. - - *) Workaround: "gzip filter failed to use preallocated memory" alerts - appeared in logs when using zlib-ng. - - -Changes with nginx 1.19.9 30 Mar 2021 - - *) Bugfix: nginx could not be built with the mail proxy module, but - without the ngx_mail_ssl_module; the bug had appeared in 1.19.8. - - *) Bugfix: "upstream sent response body larger than indicated content - length" errors might occur when working with gRPC backends; the bug - had appeared in 1.19.1. - - *) Bugfix: nginx might not close a connection till keepalive timeout - expiration if the connection was closed by the client while - discarding the request body. - - *) Bugfix: nginx might not detect that a connection was already closed - by the client when waiting for auth_delay or limit_req delay, or when - working with backends. - - *) Bugfix: in the eventport method. - - -Changes with nginx 1.19.8 09 Mar 2021 - - *) Feature: flags in the "proxy_cookie_flags" directive can now contain - variables. - - *) Feature: the "proxy_protocol" parameter of the "listen" directive, - the "proxy_protocol" and "set_real_ip_from" directives in mail proxy. - - *) Bugfix: HTTP/2 connections were immediately closed when using - "keepalive_timeout 0"; the bug had appeared in 1.19.7. - - *) Bugfix: some errors were logged as unknown if nginx was built with - glibc 2.32. - - *) Bugfix: in the eventport method. - - -Changes with nginx 1.19.7 16 Feb 2021 - - *) Change: connections handling in HTTP/2 has been changed to better - match HTTP/1.x; the "http2_recv_timeout", "http2_idle_timeout", and - "http2_max_requests" directives have been removed, the - "keepalive_timeout" and "keepalive_requests" directives should be - used instead. - - *) Change: the "http2_max_field_size" and "http2_max_header_size" - directives have been removed, the "large_client_header_buffers" - directive should be used instead. - - *) Feature: now, if free worker connections are exhausted, nginx starts - closing not only keepalive connections, but also connections in - lingering close. - - *) Bugfix: "zero size buf in output" alerts might appear in logs if an - upstream server returned an incorrect response during unbuffered - proxying; the bug had appeared in 1.19.1. - - *) Bugfix: HEAD requests were handled incorrectly if the "return" - directive was used with the "image_filter" or "xslt_stylesheet" - directives. - - *) Bugfix: in the "add_trailer" directive. - - -Changes with nginx 1.19.6 15 Dec 2020 - - *) Bugfix: "no live upstreams" errors if a "server" inside "upstream" - block was marked as "down". - - *) Bugfix: a segmentation fault might occur in a worker process if HTTPS - was used; the bug had appeared in 1.19.5. - - *) Bugfix: nginx returned the 400 response on requests like - "GET http://example.com?args HTTP/1.0". - - *) Bugfix: in the ngx_http_flv_module and ngx_http_mp4_module. - Thanks to Chris Newton. - - -Changes with nginx 1.19.5 24 Nov 2020 - - *) Feature: the -e switch. - - *) Feature: the same source files can now be specified in different - modules while building addon modules. - - *) Bugfix: SSL shutdown did not work when lingering close was used. - - *) Bugfix: "upstream sent frame for closed stream" errors might occur - when working with gRPC backends. - - *) Bugfix: in request body filters internal API. - - -Changes with nginx 1.19.4 27 Oct 2020 - - *) Feature: the "ssl_conf_command", "proxy_ssl_conf_command", - "grpc_ssl_conf_command", and "uwsgi_ssl_conf_command" directives. - - *) Feature: the "ssl_reject_handshake" directive. - - *) Feature: the "proxy_smtp_auth" directive in mail proxy. - - -Changes with nginx 1.19.3 29 Sep 2020 - - *) Feature: the ngx_stream_set_module. - - *) Feature: the "proxy_cookie_flags" directive. - - *) Feature: the "userid_flags" directive. - - *) Bugfix: the "stale-if-error" cache control extension was erroneously - applied if backend returned a response with status code 500, 502, - 503, 504, 403, 404, or 429. - - *) Bugfix: "[crit] cache file ... has too long header" messages might - appear in logs if caching was used and the backend returned responses - with the "Vary" header line. - - *) Workaround: "[crit] SSL_write() failed" messages might appear in logs - when using OpenSSL 1.1.1. - - *) Bugfix: "SSL_shutdown() failed (SSL: ... bad write retry)" messages - might appear in logs; the bug had appeared in 1.19.2. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2 if errors with code 400 were redirected to a proxied - location using the "error_page" directive. - - *) Bugfix: socket leak when using HTTP/2 and subrequests in the njs - module. - - -Changes with nginx 1.19.2 11 Aug 2020 - - *) Change: now nginx starts closing keepalive connections before all - free worker connections are exhausted, and logs a warning about this - to the error log. - - *) Change: optimization of client request body reading when using - chunked transfer encoding. - - *) Bugfix: memory leak if the "ssl_ocsp" directive was used. - - *) Bugfix: "zero size buf in output" alerts might appear in logs if a - FastCGI server returned an incorrect response; the bug had appeared - in 1.19.1. - - *) Bugfix: a segmentation fault might occur in a worker process if - different large_client_header_buffers sizes were used in different - virtual servers. - - *) Bugfix: SSL shutdown might not work. - - *) Bugfix: "SSL_shutdown() failed (SSL: ... bad write retry)" messages - might appear in logs. - - *) Bugfix: in the ngx_http_slice_module. - - *) Bugfix: in the ngx_http_xslt_filter_module. - - -Changes with nginx 1.19.1 07 Jul 2020 - - *) Change: the "lingering_close", "lingering_time", and - "lingering_timeout" directives now work when using HTTP/2. - - *) Change: now extra data sent by a backend are always discarded. - - *) Change: now after receiving a too short response from a FastCGI - server nginx tries to send the available part of the response to the - client, and then closes the client connection. - - *) Change: now after receiving a response with incorrect length from a - gRPC backend nginx stops response processing with an error. - - *) Feature: the "min_free" parameter of the "proxy_cache_path", - "fastcgi_cache_path", "scgi_cache_path", and "uwsgi_cache_path" - directives. - Thanks to Adam Bambuch. - - *) Bugfix: nginx did not delete unix domain listen sockets during - graceful shutdown on the SIGQUIT signal. - - *) Bugfix: zero length UDP datagrams were not proxied. - - *) Bugfix: proxying to uwsgi backends using SSL might not work. - Thanks to Guanzhong Chen. - - *) Bugfix: in error handling when using the "ssl_ocsp" directive. - - *) Bugfix: on XFS and NFS file systems disk cache size might be - calculated incorrectly. - - *) Bugfix: "negative size buf in writer" alerts might appear in logs if - a memcached server returned a malformed response. - - -Changes with nginx 1.19.0 26 May 2020 - - *) Feature: client certificate validation with OCSP. - - *) Bugfix: "upstream sent frame for closed stream" errors might occur - when working with gRPC backends. - - *) Bugfix: OCSP stapling might not work if the "resolver" directive was - not specified. - - *) Bugfix: connections with incorrect HTTP/2 preface were not logged. - - -Changes with nginx 1.17.10 14 Apr 2020 - - *) Feature: the "auth_delay" directive. - - -Changes with nginx 1.17.9 03 Mar 2020 - - *) Change: now nginx does not allow several "Host" request header lines. - - *) Bugfix: nginx ignored additional "Transfer-Encoding" request header - lines. - - *) Bugfix: socket leak when using HTTP/2. - - *) Bugfix: a segmentation fault might occur in a worker process if OCSP - stapling was used. - - *) Bugfix: in the ngx_http_mp4_module. - - *) Bugfix: nginx used status code 494 instead of 400 if errors with code - 494 were redirected with the "error_page" directive. - - *) Bugfix: socket leak when using subrequests in the njs module and the - "aio" directive. - - -Changes with nginx 1.17.8 21 Jan 2020 - - *) Feature: variables support in the "grpc_pass" directive. - - *) Bugfix: a timeout might occur while handling pipelined requests in an - SSL connection; the bug had appeared in 1.17.5. - - *) Bugfix: in the "debug_points" directive when using HTTP/2. - Thanks to Daniil Bondarev. - - -Changes with nginx 1.17.7 24 Dec 2019 - - *) Bugfix: a segmentation fault might occur on start or during - reconfiguration if the "rewrite" directive with an empty replacement - string was used in the configuration. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "break" directive was used with the "alias" directive or with the - "proxy_pass" directive with a URI. - - *) Bugfix: the "Location" response header line might contain garbage if - the request URI was rewritten to the one containing a null character. - - *) Bugfix: requests with bodies were handled incorrectly when returning - redirections with the "error_page" directive; the bug had appeared in - 0.7.12. - - *) Bugfix: socket leak when using HTTP/2. - - *) Bugfix: a timeout might occur while handling pipelined requests in an - SSL connection; the bug had appeared in 1.17.5. - - *) Bugfix: in the ngx_http_dav_module. - - -Changes with nginx 1.17.6 19 Nov 2019 - - *) Feature: the $proxy_protocol_server_addr and - $proxy_protocol_server_port variables. - - *) Feature: the "limit_conn_dry_run" directive. - - *) Feature: the $limit_req_status and $limit_conn_status variables. - - -Changes with nginx 1.17.5 22 Oct 2019 - - *) Feature: now nginx uses ioctl(FIONREAD), if available, to avoid - reading from a fast connection for a long time. - - *) Bugfix: incomplete escaped characters at the end of the request URI - were ignored. - - *) Bugfix: "/." and "/.." at the end of the request URI were not - normalized. - - *) Bugfix: in the "merge_slashes" directive. - - *) Bugfix: in the "ignore_invalid_headers" directive. - Thanks to Alan Kemp. - - *) Bugfix: nginx could not be built with MinGW-w64 gcc 8.1 or newer. - - -Changes with nginx 1.17.4 24 Sep 2019 - - *) Change: better detection of incorrect client behavior in HTTP/2. - - *) Change: in handling of not fully read client request body when - returning errors in HTTP/2. - - *) Bugfix: the "worker_shutdown_timeout" directive might not work when - using HTTP/2. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2 and the "proxy_request_buffering" directive. - - *) Bugfix: the ECONNABORTED error log level was "crit" instead of - "error" on Windows when using SSL. - - *) Bugfix: nginx ignored extra data when using chunked transfer - encoding. - - *) Bugfix: nginx always returned the 500 error if the "return" directive - was used and an error occurred during reading client request body. - - *) Bugfix: in memory allocation error handling. - - -Changes with nginx 1.17.3 13 Aug 2019 - - *) Security: when using HTTP/2 a client might cause excessive memory - consumption and CPU usage (CVE-2019-9511, CVE-2019-9513, - CVE-2019-9516). - - *) Bugfix: "zero size buf" alerts might appear in logs when using - gzipping; the bug had appeared in 1.17.2. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "resolver" directive was used in SMTP proxy. - - -Changes with nginx 1.17.2 23 Jul 2019 - - *) Change: minimum supported zlib version is 1.2.0.4. - Thanks to Ilya Leoshkevich. - - *) Change: the $r->internal_redirect() embedded perl method now expects - escaped URIs. - - *) Feature: it is now possible to switch to a named location using the - $r->internal_redirect() embedded perl method. - - *) Bugfix: in error handling in embedded perl. - - *) Bugfix: a segmentation fault might occur on start or during - reconfiguration if hash bucket size larger than 64 kilobytes was used - in the configuration. - - *) Bugfix: nginx might hog CPU during unbuffered proxying and when - proxying WebSocket connections if the select, poll, or /dev/poll - methods were used. - - *) Bugfix: in the ngx_http_xslt_filter_module. - - *) Bugfix: in the ngx_http_ssi_filter_module. - - -Changes with nginx 1.17.1 25 Jun 2019 - - *) Feature: the "limit_req_dry_run" directive. - - *) Feature: when using the "hash" directive inside the "upstream" block - an empty hash key now triggers round-robin balancing. - Thanks to Niklas Keller. - - *) Bugfix: a segmentation fault might occur in a worker process if - caching was used along with the "image_filter" directive, and errors - with code 415 were redirected with the "error_page" directive; the - bug had appeared in 1.11.10. - - *) Bugfix: a segmentation fault might occur in a worker process if - embedded perl was used; the bug had appeared in 1.7.3. - - -Changes with nginx 1.17.0 21 May 2019 - - *) Feature: variables support in the "limit_rate" and "limit_rate_after" - directives. - - *) Feature: variables support in the "proxy_upload_rate" and - "proxy_download_rate" directives in the stream module. - - *) Change: minimum supported OpenSSL version is 0.9.8. - - *) Change: now the postpone filter is always built. - - *) Bugfix: the "include" directive did not work inside the "if" and - "limit_except" blocks. - - *) Bugfix: in byte ranges processing. - - -Changes with nginx 1.15.12 16 Apr 2019 - - *) Bugfix: a segmentation fault might occur in a worker process if - variables were used in the "ssl_certificate" or "ssl_certificate_key" - directives and OCSP stapling was enabled. - - -Changes with nginx 1.15.11 09 Apr 2019 - - *) Bugfix: in the "ssl_stapling_file" directive on Windows. - - -Changes with nginx 1.15.10 26 Mar 2019 - - *) Change: when using a hostname in the "listen" directive nginx now - creates listening sockets for all addresses the hostname resolves to - (previously, only the first address was used). - - *) Feature: port ranges in the "listen" directive. - - *) Feature: loading of SSL certificates and secret keys from variables. - - *) Workaround: the $ssl_server_name variable might be empty when using - OpenSSL 1.1.1. - - *) Bugfix: nginx/Windows could not be built with Visual Studio 2015 or - newer; the bug had appeared in 1.15.9. - - -Changes with nginx 1.15.9 26 Feb 2019 - - *) Feature: variables support in the "ssl_certificate" and - "ssl_certificate_key" directives. - - *) Feature: the "poll" method is now available on Windows when using - Windows Vista or newer. - - *) Bugfix: if the "select" method was used on Windows and an error - occurred while establishing a backend connection, nginx waited for - the connection establishment timeout to expire. - - *) Bugfix: the "proxy_upload_rate" and "proxy_download_rate" directives - in the stream module worked incorrectly when proxying UDP datagrams. - - -Changes with nginx 1.15.8 25 Dec 2018 - - *) Feature: the $upstream_bytes_sent variable. - Thanks to Piotr Sikora. - - *) Feature: new directives in vim syntax highlighting scripts. - Thanks to Gena Makhomed. - - *) Bugfix: in the "proxy_cache_background_update" directive. - - *) Bugfix: in the "geo" directive when using unix domain listen sockets. - - *) Workaround: the "ignoring stale global SSL error ... bad length" - alerts might appear in logs when using the "ssl_early_data" directive - with OpenSSL. - - *) Bugfix: in nginx/Windows. - - *) Bugfix: in the ngx_http_autoindex_module on 32-bit platforms. - - -Changes with nginx 1.15.7 27 Nov 2018 - - *) Feature: the "proxy_requests" directive in the stream module. - - *) Feature: the "delay" parameter of the "limit_req" directive. - Thanks to Vladislav Shabanov and Peter Shchuchkin. - - *) Bugfix: memory leak on errors during reconfiguration. - - *) Bugfix: in the $upstream_response_time, $upstream_connect_time, and - $upstream_header_time variables. - - *) Bugfix: a segmentation fault might occur in a worker process if the - ngx_http_mp4_module was used on 32-bit platforms. - - -Changes with nginx 1.15.6 06 Nov 2018 - - *) Security: when using HTTP/2 a client might cause excessive memory - consumption (CVE-2018-16843) and CPU usage (CVE-2018-16844). - - *) Security: processing of a specially crafted mp4 file with the - ngx_http_mp4_module might result in worker process memory disclosure - (CVE-2018-16845). - - *) Feature: the "proxy_socket_keepalive", "fastcgi_socket_keepalive", - "grpc_socket_keepalive", "memcached_socket_keepalive", - "scgi_socket_keepalive", and "uwsgi_socket_keepalive" directives. - - *) Bugfix: if nginx was built with OpenSSL 1.1.0 and used with OpenSSL - 1.1.1, the TLS 1.3 protocol was always enabled. - - *) Bugfix: working with gRPC backends might result in excessive memory - consumption. - - -Changes with nginx 1.15.5 02 Oct 2018 - - *) Bugfix: a segmentation fault might occur in a worker process when - using OpenSSL 1.1.0h or newer; the bug had appeared in 1.15.4. - - *) Bugfix: of minor potential bugs. - - -Changes with nginx 1.15.4 25 Sep 2018 - - *) Feature: now the "ssl_early_data" directive can be used with OpenSSL. - - *) Bugfix: in the ngx_http_uwsgi_module. - Thanks to Chris Caputo. - - *) Bugfix: connections with some gRPC backends might not be cached when - using the "keepalive" directive. - - *) Bugfix: a socket leak might occur when using the "error_page" - directive to redirect early request processing errors, notably errors - with code 400. - - *) Bugfix: the "return" directive did not change the response code when - returning errors if the request was redirected by the "error_page" - directive. - - *) Bugfix: standard error pages and responses of the - ngx_http_autoindex_module module used the "bgcolor" attribute, and - might be displayed incorrectly when using custom color settings in - browsers. - Thanks to Nova DasSarma. - - *) Change: the logging level of the "no suitable key share" and "no - suitable signature algorithm" SSL errors has been lowered from "crit" - to "info". - - -Changes with nginx 1.15.3 28 Aug 2018 - - *) Feature: now TLSv1.3 can be used with BoringSSL. - - *) Feature: the "ssl_early_data" directive, currently available with - BoringSSL. - - *) Feature: the "keepalive_timeout" and "keepalive_requests" directives - in the "upstream" block. - - *) Bugfix: the ngx_http_dav_module did not truncate destination file - when copying a file over an existing one with the COPY method. - - *) Bugfix: the ngx_http_dav_module used zero access rights on the - destination file and did not preserve file modification time when - moving a file between different file systems with the MOVE method. - - *) Bugfix: the ngx_http_dav_module used default access rights when - copying a file with the COPY method. - - *) Workaround: some clients might not work when using HTTP/2; the bug - had appeared in 1.13.5. - - *) Bugfix: nginx could not be built with LibreSSL 2.8.0. - - -Changes with nginx 1.15.2 24 Jul 2018 - - *) Feature: the $ssl_preread_protocol variable in the - ngx_stream_ssl_preread_module. - - *) Feature: now when using the "reset_timedout_connection" directive - nginx will reset connections being closed with the 444 code. - - *) Change: a logging level of the "http request", "https proxy request", - "unsupported protocol", and "version too low" SSL errors has been - lowered from "crit" to "info". - - *) Bugfix: DNS requests were not resent if initial sending of a request - failed. - - *) Bugfix: the "reuseport" parameter of the "listen" directive was - ignored if the number of worker processes was specified after the - "listen" directive. - - *) Bugfix: when using OpenSSL 1.1.0 or newer it was not possible to - switch off "ssl_prefer_server_ciphers" in a virtual server if it was - switched on in the default server. - - *) Bugfix: SSL session reuse with upstream servers did not work with the - TLS 1.3 protocol. - - -Changes with nginx 1.15.1 03 Jul 2018 - - *) Feature: the "random" directive inside the "upstream" block. - - *) Feature: improved performance when using the "hash" and "ip_hash" - directives with the "zone" directive. - - *) Feature: the "reuseport" parameter of the "listen" directive now uses - SO_REUSEPORT_LB on FreeBSD 12. - - *) Bugfix: HTTP/2 server push did not work if SSL was terminated by a - proxy server in front of nginx. - - *) Bugfix: the "tcp_nopush" directive was always used on backend - connections. - - *) Bugfix: sending a disk-buffered request body to a gRPC backend might - fail. - - -Changes with nginx 1.15.0 05 Jun 2018 - - *) Change: the "ssl" directive is deprecated; the "ssl" parameter of the - "listen" directive should be used instead. - - *) Change: now nginx detects missing SSL certificates during - configuration testing when using the "ssl" parameter of the "listen" - directive. - - *) Feature: now the stream module can handle multiple incoming UDP - datagrams from a client within a single session. - - *) Bugfix: it was possible to specify an incorrect response code in the - "proxy_cache_valid" directive. - - *) Bugfix: nginx could not be built by gcc 8.1. - - *) Bugfix: logging to syslog stopped on local IP address changes. - - *) Bugfix: nginx could not be built by clang with CUDA SDK installed; - the bug had appeared in 1.13.8. - - *) Bugfix: "getsockopt(TCP_FASTOPEN) ... failed" messages might appear - in logs during binary upgrade when using unix domain listen sockets - on FreeBSD. - - *) Bugfix: nginx could not be built on Fedora 28 Linux. - - *) Bugfix: request processing rate might exceed configured rate when - using the "limit_req" directive. - - *) Bugfix: in handling of client addresses when using unix domain listen - sockets to work with datagrams on Linux. - - *) Bugfix: in memory allocation error handling. - - -Changes with nginx 1.13.12 10 Apr 2018 - - *) Bugfix: connections with gRPC backends might be closed unexpectedly - when returning a large response. - - -Changes with nginx 1.13.11 03 Apr 2018 - - *) Feature: the "proxy_protocol" parameter of the "listen" directive now - supports the PROXY protocol version 2. - - *) Bugfix: nginx could not be built with OpenSSL 1.1.1 statically on - Linux. - - *) Bugfix: in the "http_404", "http_500", etc. parameters of the - "proxy_next_upstream" directive. - - -Changes with nginx 1.13.10 20 Mar 2018 - - *) Feature: the "set" parameter of the "include" SSI directive now - allows writing arbitrary responses to a variable; the - "subrequest_output_buffer_size" directive defines maximum response - size. - - *) Feature: now nginx uses clock_gettime(CLOCK_MONOTONIC) if available, - to avoid timeouts being incorrectly triggered on system time changes. - - *) Feature: the "escape=none" parameter of the "log_format" directive. - Thanks to Johannes Baiter and Calin Don. - - *) Feature: the $ssl_preread_alpn_protocols variable in the - ngx_stream_ssl_preread_module. - - *) Feature: the ngx_http_grpc_module. - - *) Bugfix: in memory allocation error handling in the "geo" directive. - - *) Bugfix: when using variables in the "auth_basic_user_file" directive - a null character might appear in logs. - Thanks to Vadim Filimonov. - - -Changes with nginx 1.13.9 20 Feb 2018 - - *) Feature: HTTP/2 server push support; the "http2_push" and - "http2_push_preload" directives. - - *) Bugfix: "header already sent" alerts might appear in logs when using - cache; the bug had appeared in 1.9.13. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "ssl_verify_client" directive was used and no SSL certificate was - specified in a virtual server. - - *) Bugfix: in the ngx_http_v2_module. - - *) Bugfix: in the ngx_http_dav_module. - - -Changes with nginx 1.13.8 26 Dec 2017 - - *) Feature: now nginx automatically preserves the CAP_NET_RAW capability - in worker processes when using the "transparent" parameter of the - "proxy_bind", "fastcgi_bind", "memcached_bind", "scgi_bind", and - "uwsgi_bind" directives. - - *) Feature: improved CPU cache line size detection. - Thanks to Debayan Ghosh. - - *) Feature: new directives in vim syntax highlighting scripts. - Thanks to Gena Makhomed. - - *) Bugfix: binary upgrade refused to work if nginx was re-parented to a - process with PID different from 1 after its parent process has - finished. - - *) Bugfix: the ngx_http_autoindex_module incorrectly handled requests - with bodies. - - *) Bugfix: in the "proxy_limit_rate" directive when used with the - "keepalive" directive. - - *) Bugfix: some parts of a response might be buffered when using - "proxy_buffering off" if the client connection used SSL. - Thanks to Patryk Lesiewicz. - - *) Bugfix: in the "proxy_cache_background_update" directive. - - *) Bugfix: it was not possible to start a parameter with a variable in - the "${name}" form with the name in curly brackets without enclosing - the parameter into single or double quotes. - - -Changes with nginx 1.13.7 21 Nov 2017 - - *) Bugfix: in the $upstream_status variable. - - *) Bugfix: a segmentation fault might occur in a worker process if a - backend returned a "101 Switching Protocols" response to a - subrequest. - - *) Bugfix: a segmentation fault occurred in a master process if a shared - memory zone size was changed during a reconfiguration and the - reconfiguration failed. - - *) Bugfix: in the ngx_http_fastcgi_module. - - *) Bugfix: nginx returned the 500 error if parameters without variables - were specified in the "xslt_stylesheet" directive. - - *) Workaround: "gzip filter failed to use preallocated memory" alerts - appeared in logs when using a zlib library variant from Intel. - - *) Bugfix: the "worker_shutdown_timeout" directive did not work when - using mail proxy and when proxying WebSocket connections. - - -Changes with nginx 1.13.6 10 Oct 2017 - - *) Bugfix: switching to the next upstream server in the stream module - did not work when using the "ssl_preread" directive. - - *) Bugfix: in the ngx_http_v2_module. - Thanks to Piotr Sikora. - - *) Bugfix: nginx did not support dates after the year 2038 on 32-bit - platforms with 64-bit time_t. - - *) Bugfix: in handling of dates prior to the year 1970 and after the - year 10000. - - *) Bugfix: in the stream module timeouts waiting for UDP datagrams from - upstream servers were not logged or logged at the "info" level - instead of "error". - - *) Bugfix: when using HTTP/2 nginx might return the 400 response without - logging the reason. - - *) Bugfix: in processing of corrupted cache files. - - *) Bugfix: cache control headers were ignored when caching errors - intercepted by error_page. - - *) Bugfix: when using HTTP/2 client request body might be corrupted. - - *) Bugfix: in handling of client addresses when using unix domain - sockets. - - *) Bugfix: nginx hogged CPU when using the "hash ... consistent" - directive in the upstream block if large weights were used and all or - most of the servers were unavailable. - - -Changes with nginx 1.13.5 05 Sep 2017 - - *) Feature: the $ssl_client_escaped_cert variable. - - *) Bugfix: the "ssl_session_ticket_key" directive and the "include" - parameter of the "geo" directive did not work on Windows. - - *) Bugfix: incorrect response length was returned on 32-bit platforms - when requesting more than 4 gigabytes with multiple ranges. - - *) Bugfix: the "expires modified" directive and processing of the - "If-Range" request header line did not use the response last - modification time if proxying without caching was used. - - -Changes with nginx 1.13.4 08 Aug 2017 - - *) Feature: the ngx_http_mirror_module. - - *) Bugfix: client connections might be dropped during configuration - testing when using the "reuseport" parameter of the "listen" - directive on Linux. - - *) Bugfix: request body might not be available in subrequests if it was - saved to a file and proxying was used. - - *) Bugfix: cleaning cache based on the "max_size" parameter did not work - on Windows. - - *) Bugfix: any shared memory allocation required 4096 bytes on Windows. - - *) Bugfix: nginx worker might be terminated abnormally when using the - "zone" directive inside the "upstream" block on Windows. - - -Changes with nginx 1.13.3 11 Jul 2017 - - *) Security: a specially crafted request might result in an integer - overflow and incorrect processing of ranges in the range filter, - potentially resulting in sensitive information leak (CVE-2017-7529). - - -Changes with nginx 1.13.2 27 Jun 2017 - - *) Change: nginx now returns 200 instead of 416 when a range starting - with 0 is requested from an empty file. - - *) Feature: the "add_trailer" directive. - Thanks to Piotr Sikora. - - *) Bugfix: nginx could not be built on Cygwin and NetBSD; the bug had - appeared in 1.13.0. - - *) Bugfix: nginx could not be built under MSYS2 / MinGW 64-bit. - Thanks to Orgad Shaneh. - - *) Bugfix: a segmentation fault might occur in a worker process when - using SSI with many includes and proxy_pass with variables. - - *) Bugfix: in the ngx_http_v2_module. - Thanks to Piotr Sikora. - - -Changes with nginx 1.13.1 30 May 2017 - - *) Feature: now a hostname can be used as the "set_real_ip_from" - directive parameter. - - *) Feature: vim syntax highlighting scripts improvements. - - *) Feature: the "worker_cpu_affinity" directive now works on DragonFly - BSD. - Thanks to Sepherosa Ziehau. - - *) Bugfix: SSL renegotiation on backend connections did not work when - using OpenSSL before 1.1.0. - - *) Workaround: nginx could not be built with Oracle Developer Studio - 12.5. - - *) Workaround: now cache manager ignores long locked cache entries when - cleaning cache based on the "max_size" parameter. - - *) Bugfix: client SSL connections were immediately closed if deferred - accept and the "proxy_protocol" parameter of the "listen" directive - were used. - - *) Bugfix: in the "proxy_cache_background_update" directive. - - *) Workaround: now the "tcp_nodelay" directive sets the TCP_NODELAY - option before an SSL handshake. - - -Changes with nginx 1.13.0 25 Apr 2017 - - *) Change: SSL renegotiation is now allowed on backend connections. - - *) Feature: the "rcvbuf" and "sndbuf" parameters of the "listen" - directives of the mail proxy and stream modules. - - *) Feature: the "return" and "error_page" directives can now be used to - return 308 redirections. - Thanks to Simon Leblanc. - - *) Feature: the "TLSv1.3" parameter of the "ssl_protocols" directive. - - *) Feature: when logging signals nginx now logs PID of the process which - sent the signal. - - *) Bugfix: in memory allocation error handling. - - *) Bugfix: if a server in the stream module listened on a wildcard - address, the source address of a response UDP datagram could differ - from the original datagram destination address. - - -Changes with nginx 1.11.13 04 Apr 2017 - - *) Feature: the "http_429" parameter of the "proxy_next_upstream", - "fastcgi_next_upstream", "scgi_next_upstream", and - "uwsgi_next_upstream" directives. - Thanks to Piotr Sikora. - - *) Bugfix: in memory allocation error handling. - - *) Bugfix: requests might hang when using the "sendfile" and - "timer_resolution" directives on Linux. - - *) Bugfix: requests might hang when using the "sendfile" and "aio_write" - directives with subrequests. - - *) Bugfix: in the ngx_http_v2_module. - Thanks to Piotr Sikora. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2. - - *) Bugfix: requests might hang when using the "limit_rate", - "sendfile_max_chunk", "limit_req" directives, or the $r->sleep() - embedded perl method with subrequests. - - *) Bugfix: in the ngx_http_slice_module. - - -Changes with nginx 1.11.12 24 Mar 2017 - - *) Bugfix: nginx might hog CPU; the bug had appeared in 1.11.11. - - -Changes with nginx 1.11.11 21 Mar 2017 - - *) Feature: the "worker_shutdown_timeout" directive. - - *) Feature: vim syntax highlighting scripts improvements. - Thanks to Wei-Ko Kao. - - *) Bugfix: a segmentation fault might occur in a worker process if the - $limit_rate variable was set to an empty string. - - *) Bugfix: the "proxy_cache_background_update", - "fastcgi_cache_background_update", "scgi_cache_background_update", - and "uwsgi_cache_background_update" directives might work incorrectly - if the "if" directive was used. - - *) Bugfix: a segmentation fault might occur in a worker process if - number of large_client_header_buffers in a virtual server was - different from the one in the default server. - - *) Bugfix: in the mail proxy server. - - -Changes with nginx 1.11.10 14 Feb 2017 - - *) Change: cache header format has been changed, previously cached - responses will be invalidated. - - *) Feature: support of "stale-while-revalidate" and "stale-if-error" - extensions in the "Cache-Control" backend response header line. - - *) Feature: the "proxy_cache_background_update", - "fastcgi_cache_background_update", "scgi_cache_background_update", - and "uwsgi_cache_background_update" directives. - - *) Feature: nginx is now able to cache responses with the "Vary" header - line up to 128 characters long (instead of 42 characters in previous - versions). - - *) Feature: the "build" parameter of the "server_tokens" directive. - Thanks to Tom Thorogood. - - *) Bugfix: "[crit] SSL_write() failed" messages might appear in logs - when handling requests with the "Expect: 100-continue" request header - line. - - *) Bugfix: the ngx_http_slice_module did not work in named locations. - - *) Bugfix: a segmentation fault might occur in a worker process when - using AIO after an "X-Accel-Redirect" redirection. - - *) Bugfix: reduced memory consumption for long-lived requests using - gzipping. - - -Changes with nginx 1.11.9 24 Jan 2017 - - *) Bugfix: nginx might hog CPU when using the stream module; the bug had - appeared in 1.11.5. - - *) Bugfix: EXTERNAL authentication mechanism in mail proxy was accepted - even if it was not enabled in the configuration. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "ssl_verify_client" directive of the stream module was used. - - *) Bugfix: the "ssl_verify_client" directive of the stream module might - not work. - - *) Bugfix: closing keepalive connections due to no free worker - connections might be too aggressive. - Thanks to Joel Cunningham. - - *) Bugfix: an incorrect response might be returned when using the - "sendfile" directive on FreeBSD and macOS; the bug had appeared in - 1.7.8. - - *) Bugfix: a truncated response might be stored in cache when using the - "aio_write" directive. - - *) Bugfix: a socket leak might occur when using the "aio_write" - directive. - - -Changes with nginx 1.11.8 27 Dec 2016 - - *) Feature: the "absolute_redirect" directive. - - *) Feature: the "escape" parameter of the "log_format" directive. - - *) Feature: client SSL certificates verification in the stream module. - - *) Feature: the "ssl_session_ticket_key" directive supports AES256 - encryption of TLS session tickets when used with 80-byte keys. - - *) Feature: vim-commentary support in vim scripts. - Thanks to Armin Grodon. - - *) Bugfix: recursion when evaluating variables was not limited. - - *) Bugfix: in the ngx_stream_ssl_preread_module. - - *) Bugfix: if a server in an upstream in the stream module failed, it - was considered alive only when a test connection sent to it after - fail_timeout was closed; now a successfully established connection is - enough. - - *) Bugfix: nginx/Windows could not be built with 64-bit Visual Studio. - - *) Bugfix: nginx/Windows could not be built with OpenSSL 1.1.0. - - -Changes with nginx 1.11.7 13 Dec 2016 - - *) Change: now in case of a client certificate verification error the - $ssl_client_verify variable contains a string with the failure - reason, for example, "FAILED:certificate has expired". - - *) Feature: the $ssl_ciphers, $ssl_curves, $ssl_client_v_start, - $ssl_client_v_end, and $ssl_client_v_remain variables. - - *) Feature: the "volatile" parameter of the "map" directive. - - *) Bugfix: dependencies specified for a module were ignored while - building dynamic modules. - - *) Bugfix: when using HTTP/2 and the "limit_req" or "auth_request" - directives client request body might be corrupted; the bug had - appeared in 1.11.0. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2; the bug had appeared in 1.11.3. - - *) Bugfix: in the ngx_http_mp4_module. - Thanks to Congcong Hu. - - *) Bugfix: in the ngx_http_perl_module. - - -Changes with nginx 1.11.6 15 Nov 2016 - - *) Change: format of the $ssl_client_s_dn and $ssl_client_i_dn variables - has been changed to follow RFC 2253 (RFC 4514); values in the old - format are available in the $ssl_client_s_dn_legacy and - $ssl_client_i_dn_legacy variables. - - *) Change: when storing temporary files in a cache directory they will - be stored in the same subdirectories as corresponding cache files - instead of a separate subdirectory for temporary files. - - *) Feature: EXTERNAL authentication mechanism support in mail proxy. - Thanks to Robert Norris. - - *) Feature: WebP support in the ngx_http_image_filter_module. - - *) Feature: variables support in the "proxy_method" directive. - Thanks to Dmitry Lazurkin. - - *) Feature: the "http2_max_requests" directive in the - ngx_http_v2_module. - - *) Feature: the "proxy_cache_max_range_offset", - "fastcgi_cache_max_range_offset", "scgi_cache_max_range_offset", and - "uwsgi_cache_max_range_offset" directives. - - *) Bugfix: graceful shutdown of old worker processes might require - infinite time when using HTTP/2. - - *) Bugfix: in the ngx_http_mp4_module. - - *) Bugfix: "ignore long locked inactive cache entry" alerts might appear - in logs when proxying WebSocket connections with caching enabled. - - *) Bugfix: nginx did not write anything to log and returned a response - with code 502 instead of 504 when a timeout occurred during an SSL - handshake to a backend. - - -Changes with nginx 1.11.5 11 Oct 2016 - - *) Change: the --with-ipv6 configure option was removed, now IPv6 - support is configured automatically. - - *) Change: now if there are no available servers in an upstream, nginx - will not reset number of failures of all servers as it previously - did, but will wait for fail_timeout to expire. - - *) Feature: the ngx_stream_ssl_preread_module. - - *) Feature: the "server" directive in the "upstream" context supports - the "max_conns" parameter. - - *) Feature: the --with-compat configure option. - - *) Feature: "manager_files", "manager_threshold", and "manager_sleep" - parameters of the "proxy_cache_path", "fastcgi_cache_path", - "scgi_cache_path", and "uwsgi_cache_path" directives. - - *) Bugfix: flags passed by the --with-ld-opt configure option were not - used while building perl module. - - *) Bugfix: in the "add_after_body" directive when used with the - "sub_filter" directive. - - *) Bugfix: in the $realip_remote_addr variable. - - *) Bugfix: the "dav_access", "proxy_store_access", - "fastcgi_store_access", "scgi_store_access", and "uwsgi_store_access" - directives ignored permissions specified for user. - - *) Bugfix: unix domain listen sockets might not be inherited during - binary upgrade on Linux. - - *) Bugfix: nginx returned the 400 response on requests with the "-" - character in the HTTP method. - - -Changes with nginx 1.11.4 13 Sep 2016 - - *) Feature: the $upstream_bytes_received variable. - - *) Feature: the $bytes_received, $session_time, $protocol, $status, - $upstream_addr, $upstream_bytes_sent, $upstream_bytes_received, - $upstream_connect_time, $upstream_first_byte_time, and - $upstream_session_time variables in the stream module. - - *) Feature: the ngx_stream_log_module. - - *) Feature: the "proxy_protocol" parameter of the "listen" directive, - the $proxy_protocol_addr and $proxy_protocol_port variables in the - stream module. - - *) Feature: the ngx_stream_realip_module. - - *) Bugfix: nginx could not be built with the stream module and the - ngx_http_ssl_module, but without ngx_stream_ssl_module; the bug had - appeared in 1.11.3. - - *) Feature: the IP_BIND_ADDRESS_NO_PORT socket option was not used; the - bug had appeared in 1.11.2. - - *) Bugfix: in the "ranges" parameter of the "geo" directive. - - *) Bugfix: an incorrect response might be returned when using the "aio - threads" and "sendfile" directives; the bug had appeared in 1.9.13. - - -Changes with nginx 1.11.3 26 Jul 2016 - - *) Change: now the "accept_mutex" directive is turned off by default. - - *) Feature: now nginx uses EPOLLEXCLUSIVE on Linux. - - *) Feature: the ngx_stream_geo_module. - - *) Feature: the ngx_stream_geoip_module. - - *) Feature: the ngx_stream_split_clients_module. - - *) Feature: variables support in the "proxy_pass" and "proxy_ssl_name" - directives in the stream module. - - *) Bugfix: socket leak when using HTTP/2. - - *) Bugfix: in configure tests. - Thanks to Piotr Sikora. - - -Changes with nginx 1.11.2 05 Jul 2016 - - *) Change: now nginx always uses internal MD5 and SHA1 implementations; - the --with-md5 and --with-sha1 configure options were canceled. - - *) Feature: variables support in the stream module. - - *) Feature: the ngx_stream_map_module. - - *) Feature: the ngx_stream_return_module. - - *) Feature: a port can be specified in the "proxy_bind", "fastcgi_bind", - "memcached_bind", "scgi_bind", and "uwsgi_bind" directives. - - *) Feature: now nginx uses the IP_BIND_ADDRESS_NO_PORT socket option - when available. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2 and the "proxy_request_buffering" directive. - - *) Bugfix: the "Content-Length" request header line was always added to - requests passed to backends, including requests without body, when - using HTTP/2. - - *) Bugfix: "http request count is zero" alerts might appear in logs when - using HTTP/2. - - *) Bugfix: unnecessary buffering might occur when using the "sub_filter" - directive; the issue had appeared in 1.9.4. - - -Changes with nginx 1.11.1 31 May 2016 - - *) Security: a segmentation fault might occur in a worker process while - writing a specially crafted request body to a temporary file - (CVE-2016-4450); the bug had appeared in 1.3.9. - - -Changes with nginx 1.11.0 24 May 2016 - - *) Feature: the "transparent" parameter of the "proxy_bind", - "fastcgi_bind", "memcached_bind", "scgi_bind", and "uwsgi_bind" - directives. - - *) Feature: the $request_id variable. - - *) Feature: the "map" directive supports combinations of multiple - variables as resulting values. - - *) Feature: now nginx checks if EPOLLRDHUP events are supported by - kernel, and optimizes connection handling accordingly if the "epoll" - method is used. - - *) Feature: the "ssl_certificate" and "ssl_certificate_key" directives - can be specified multiple times to load certificates of different - types (for example, RSA and ECDSA). - - *) Feature: the "ssl_ecdh_curve" directive now allows specifying a list - of curves when using OpenSSL 1.0.2 or newer; by default a list built - into OpenSSL is used. - - *) Change: to use DHE ciphers it is now required to specify parameters - using the "ssl_dhparam" directive. - - *) Feature: the $proxy_protocol_port variable. - - *) Feature: the $realip_remote_port variable in the - ngx_http_realip_module. - - *) Feature: the ngx_http_realip_module is now able to set the client - port in addition to the address. - - *) Change: the "421 Misdirected Request" response now used when - rejecting requests to a virtual server different from one negotiated - during an SSL handshake; this improves interoperability with some - HTTP/2 clients when using client certificates. - - *) Change: HTTP/2 clients can now start sending request body - immediately; the "http2_body_preread_size" directive controls size of - the buffer used before nginx will start reading client request body. - - *) Bugfix: cached error responses were not updated when using the - "proxy_cache_bypass" directive. - - -Changes with nginx 1.9.15 19 Apr 2016 - - *) Bugfix: "recv() failed" errors might occur when using HHVM as a - FastCGI server. - - *) Bugfix: when using HTTP/2 and the "limit_req" or "auth_request" - directives a timeout or a "client violated flow control" error might - occur while reading client request body; the bug had appeared in - 1.9.14. - - *) Workaround: a response might not be shown by some browsers if HTTP/2 - was used and client request body was not fully read; the bug had - appeared in 1.9.14. - - *) Bugfix: connections might hang when using the "aio threads" - directive. - Thanks to Mindaugas Rasiukevicius. - - -Changes with nginx 1.9.14 05 Apr 2016 - - *) Feature: OpenSSL 1.1.0 compatibility. - - *) Feature: the "proxy_request_buffering", "fastcgi_request_buffering", - "scgi_request_buffering", and "uwsgi_request_buffering" directives - now work with HTTP/2. - - *) Bugfix: "zero size buf in output" alerts might appear in logs when - using HTTP/2. - - *) Bugfix: the "client_max_body_size" directive might work incorrectly - when using HTTP/2. - - *) Bugfix: of minor bugs in logging. - - -Changes with nginx 1.9.13 29 Mar 2016 - - *) Change: non-idempotent requests (POST, LOCK, PATCH) are no longer - passed to the next server by default if a request has been sent to a - backend; the "non_idempotent" parameter of the "proxy_next_upstream" - directive explicitly allows retrying such requests. - - *) Feature: the ngx_http_perl_module can be built dynamically. - - *) Feature: UDP support in the stream module. - - *) Feature: the "aio_write" directive. - - *) Feature: now cache manager monitors number of elements in caches and - tries to avoid cache keys zone overflows. - - *) Bugfix: "task already active" and "second aio post" alerts might - appear in logs when using the "sendfile" and "aio" directives with - subrequests. - - *) Bugfix: "zero size buf in output" alerts might appear in logs if - caching was used and a client closed a connection prematurely. - - *) Bugfix: connections with clients might be closed needlessly if - caching was used. - Thanks to Justin Li. - - *) Bugfix: nginx might hog CPU if the "sendfile" directive was used on - Linux or Solaris and a file being sent was changed during sending. - - *) Bugfix: connections might hang when using the "sendfile" and "aio - threads" directives. - - *) Bugfix: in the "proxy_pass", "fastcgi_pass", "scgi_pass", and - "uwsgi_pass" directives when using variables. - Thanks to Piotr Sikora. - - *) Bugfix: in the ngx_http_sub_filter_module. - - *) Bugfix: if an error occurred in a cached backend connection, the - request was passed to the next server regardless of the - proxy_next_upstream directive. - - *) Bugfix: "CreateFile() failed" errors when creating temporary files on - Windows. - - -Changes with nginx 1.9.12 24 Feb 2016 - - *) Feature: Huffman encoding of response headers in HTTP/2. - Thanks to Vlad Krasnov. - - *) Feature: the "worker_cpu_affinity" directive now supports more than - 64 CPUs. - - *) Bugfix: compatibility with 3rd party C++ modules; the bug had - appeared in 1.9.11. - Thanks to Piotr Sikora. - - *) Bugfix: nginx could not be built statically with OpenSSL on Linux; - the bug had appeared in 1.9.11. - - *) Bugfix: the "add_header ... always" directive with an empty value did - not delete "Last-Modified" and "ETag" header lines from error - responses. - - *) Workaround: "called a function you should not call" and "shutdown - while in init" messages might appear in logs when using OpenSSL - 1.0.2f. - - *) Bugfix: invalid headers might be logged incorrectly. - - *) Bugfix: socket leak when using HTTP/2. - - *) Bugfix: in the ngx_http_v2_module. - - -Changes with nginx 1.9.11 09 Feb 2016 - - *) Feature: TCP support in resolver. - - *) Feature: dynamic modules. - - *) Bugfix: the $request_length variable did not include size of request - headers when using HTTP/2. - - *) Bugfix: in the ngx_http_v2_module. - - -Changes with nginx 1.9.10 26 Jan 2016 - - *) Security: invalid pointer dereference might occur during DNS server - response processing if the "resolver" directive was used, allowing an - attacker who is able to forge UDP packets from the DNS server to - cause segmentation fault in a worker process (CVE-2016-0742). - - *) Security: use-after-free condition might occur during CNAME response - processing if the "resolver" directive was used, allowing an attacker - who is able to trigger name resolution to cause segmentation fault in - a worker process, or might have potential other impact - (CVE-2016-0746). - - *) Security: CNAME resolution was insufficiently limited if the - "resolver" directive was used, allowing an attacker who is able to - trigger arbitrary name resolution to cause excessive resource - consumption in worker processes (CVE-2016-0747). - - *) Feature: the "auto" parameter of the "worker_cpu_affinity" directive. - - *) Bugfix: the "proxy_protocol" parameter of the "listen" directive did - not work with IPv6 listen sockets. - - *) Bugfix: connections to upstream servers might be cached incorrectly - when using the "keepalive" directive. - - *) Bugfix: proxying used the HTTP method of the original request after - an "X-Accel-Redirect" redirection. - - -Changes with nginx 1.9.9 09 Dec 2015 - - *) Bugfix: proxying to unix domain sockets did not work when using - variables; the bug had appeared in 1.9.8. - - -Changes with nginx 1.9.8 08 Dec 2015 - - *) Feature: pwritev() support. - - *) Feature: the "include" directive inside the "upstream" block. - - *) Feature: the ngx_http_slice_module. - - *) Bugfix: a segmentation fault might occur in a worker process when - using LibreSSL; the bug had appeared in 1.9.6. - - *) Bugfix: nginx could not be built on OS X in some cases. - - -Changes with nginx 1.9.7 17 Nov 2015 - - *) Feature: the "nohostname" parameter of logging to syslog. - - *) Feature: the "proxy_cache_convert_head" directive. - - *) Feature: the $realip_remote_addr variable in the - ngx_http_realip_module. - - *) Bugfix: the "expires" directive might not work when using variables. - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2; the bug had appeared in 1.9.6. - - *) Bugfix: if nginx was built with the ngx_http_v2_module it was - possible to use the HTTP/2 protocol even if the "http2" parameter of - the "listen" directive was not specified. - - *) Bugfix: in the ngx_http_v2_module. - - -Changes with nginx 1.9.6 27 Oct 2015 - - *) Bugfix: a segmentation fault might occur in a worker process when - using HTTP/2. - Thanks to Piotr Sikora and Denis Andzakovic. - - *) Bugfix: the $server_protocol variable was empty when using HTTP/2. - - *) Bugfix: backend SSL connections in the stream module might be timed - out unexpectedly. - - *) Bugfix: a segmentation fault might occur in a worker process if - different ssl_session_cache settings were used in different virtual - servers. - - *) Bugfix: nginx/Windows could not be built with MinGW gcc; the bug had - appeared in 1.9.4. - Thanks to Kouhei Sutou. - - *) Bugfix: time was not updated when the timer_resolution directive was - used on Windows. - - *) Miscellaneous minor fixes and improvements. - Thanks to Markus Linnala, Kurtis Nusbaum and Piotr Sikora. - - -Changes with nginx 1.9.5 22 Sep 2015 - - *) Feature: the ngx_http_v2_module (replaces ngx_http_spdy_module). - Thanks to Dropbox and Automattic for sponsoring this work. - - *) Change: now the "output_buffers" directive uses two buffers by - default. - - *) Change: now nginx limits subrequests recursion, not simultaneous - subrequests. - - *) Change: now nginx checks the whole cache key when returning a - response from cache. - Thanks to Gena Makhomed and Sergey Brester. - - *) Bugfix: "header already sent" alerts might appear in logs when using - cache; the bug had appeared in 1.7.5. - - *) Bugfix: "writev() failed (4: Interrupted system call)" errors might - appear in logs when using CephFS and the "timer_resolution" directive - on Linux. - - *) Bugfix: in invalid configurations handling. - Thanks to Markus Linnala. - - *) Bugfix: a segmentation fault occurred in a worker process if the - "sub_filter" directive was used at http level; the bug had appeared - in 1.9.4. - - -Changes with nginx 1.9.4 18 Aug 2015 - - *) Change: the "proxy_downstream_buffer" and "proxy_upstream_buffer" - directives of the stream module are replaced with the - "proxy_buffer_size" directive. - - *) Feature: the "tcp_nodelay" directive in the stream module. - - *) Feature: multiple "sub_filter" directives can be used simultaneously. - - *) Feature: variables support in the search string of the "sub_filter" - directive. - - *) Workaround: configuration testing might fail under Linux OpenVZ. - Thanks to Gena Makhomed. - - *) Bugfix: old worker processes might hog CPU after reconfiguration with - a large number of worker_connections. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "try_files" and "alias" directives were used inside a location given - by a regular expression; the bug had appeared in 1.7.1. - - *) Bugfix: the "try_files" directive inside a nested location given by a - regular expression worked incorrectly if the "alias" directive was - used in the outer location. - - *) Bugfix: in hash table initialization error handling. - - *) Bugfix: nginx could not be built with Visual Studio 2015. - - -Changes with nginx 1.9.3 14 Jul 2015 - - *) Change: duplicate "http", "mail", and "stream" blocks are now - disallowed. - - *) Feature: connection limiting in the stream module. - - *) Feature: data rate limiting in the stream module. - - *) Bugfix: the "zone" directive inside the "upstream" block did not work - on Windows. - - *) Bugfix: compatibility with LibreSSL in the stream module. - Thanks to Piotr Sikora. - - *) Bugfix: in the "--builddir" configure parameter. - Thanks to Piotr Sikora. - - *) Bugfix: the "ssl_stapling_file" directive did not work; the bug had - appeared in 1.9.2. - Thanks to Faidon Liambotis and Brandon Black. - - *) Bugfix: a segmentation fault might occur in a worker process if the - "ssl_stapling" directive was used; the bug had appeared in 1.9.2. - Thanks to Matthew Baldwin. - - -Changes with nginx 1.9.2 16 Jun 2015 - - *) Feature: the "backlog" parameter of the "listen" directives of the - mail proxy and stream modules. - - *) Feature: the "allow" and "deny" directives in the stream module. - - *) Feature: the "proxy_bind" directive in the stream module. - - *) Feature: the "proxy_protocol" directive in the stream module. - - *) Feature: the -T switch. - - *) Feature: the REQUEST_SCHEME parameter added to the fastcgi.conf, - fastcgi_params, scgi_params, and uwsgi_params standard configuration - files. - - *) Bugfix: the "reuseport" parameter of the "listen" directive of the - stream module did not work. - - *) Bugfix: OCSP stapling might return an expired OCSP response in some - cases. - - -Changes with nginx 1.9.1 26 May 2015 - - *) Change: now SSLv3 protocol is disabled by default. - - *) Change: some long deprecated directives are not supported anymore. - - *) Feature: the "reuseport" parameter of the "listen" directive. - Thanks to Yingqi Lu at Intel and Sepherosa Ziehau. - - *) Feature: the $upstream_connect_time variable. - - *) Bugfix: in the "hash" directive on big-endian platforms. - - *) Bugfix: nginx might fail to start on some old Linux variants; the bug - had appeared in 1.7.11. - - *) Bugfix: in IP address parsing. - Thanks to Sergey Polovko. - - -Changes with nginx 1.9.0 28 Apr 2015 - - *) Change: obsolete aio and rtsig event methods have been removed. - - *) Feature: the "zone" directive inside the "upstream" block. - - *) Feature: the stream module. - - *) Feature: byte ranges support in the ngx_http_memcached_module. - Thanks to Martin Mlynář. - - *) Feature: shared memory can now be used on Windows versions with - address space layout randomization. - Thanks to Sergey Brester. - - *) Feature: the "error_log" directive can now be used on mail and server - levels in mail proxy. - - *) Bugfix: the "proxy_protocol" parameter of the "listen" directive did - not work if not specified in the first "listen" directive for a - listen socket. - - -Changes with nginx 1.7.12 07 Apr 2015 - - *) Feature: now the "tcp_nodelay" directive works with backend SSL - connections. - - *) Feature: now thread pools can be used to read cache file headers. - - *) Bugfix: in the "proxy_request_buffering" directive. - - *) Bugfix: a segmentation fault might occur in a worker process when - using thread pools on Linux. - - *) Bugfix: in error handling when using the "ssl_stapling" directive. - Thanks to Filipe da Silva. - - *) Bugfix: in the ngx_http_spdy_module. - - -Changes with nginx 1.7.11 24 Mar 2015 - - *) Change: the "sendfile" parameter of the "aio" directive is - deprecated; now nginx automatically uses AIO to pre-load data for - sendfile if both "aio" and "sendfile" directives are used. - - *) Feature: experimental thread pools support. - - *) Feature: the "proxy_request_buffering", "fastcgi_request_buffering", - "scgi_request_buffering", and "uwsgi_request_buffering" directives. - - *) Feature: request body filters experimental API. - - *) Feature: client SSL certificates support in mail proxy. - Thanks to Sven Peter, Franck Levionnois, and Filipe Da Silva. - - *) Feature: startup speedup when using the "hash ... consistent" - directive in the upstream block. - Thanks to Wai Keen Woon. - - *) Feature: debug logging into a cyclic memory buffer. - - *) Bugfix: in hash table handling. - Thanks to Chris West. - - *) Bugfix: in the "proxy_cache_revalidate" directive. - - *) Bugfix: SSL connections might hang if deferred accept or the - "proxy_protocol" parameter of the "listen" directive were used. - Thanks to James Hamlin. - - *) Bugfix: the $upstream_response_time variable might contain a wrong - value if the "image_filter" directive was used. - - *) Bugfix: in integer overflow handling. - Thanks to Régis Leroy. - - *) Bugfix: it was not possible to enable SSLv3 with LibreSSL. - - *) Bugfix: the "ignoring stale global SSL error ... called a function - you should not call" alerts appeared in logs when using LibreSSL. - - *) Bugfix: certificates specified by the "ssl_client_certificate" and - "ssl_trusted_certificate" directives were inadvertently used to - automatically construct certificate chains. - - -Changes with nginx 1.7.10 10 Feb 2015 - - *) Feature: the "use_temp_path" parameter of the "proxy_cache_path", - "fastcgi_cache_path", "scgi_cache_path", and "uwsgi_cache_path" - directives. - - *) Feature: the $upstream_header_time variable. - - *) Workaround: now on disk overflow nginx tries to write error logs once - a second only. - - *) Bugfix: the "try_files" directive did not ignore normal files while - testing directories. - Thanks to Damien Tournoud. - - *) Bugfix: alerts "sendfile() failed" if the "sendfile" directive was - used on OS X; the bug had appeared in 1.7.8. - - *) Bugfix: alerts "sem_post() failed" might appear in logs. - - *) Bugfix: nginx could not be built with musl libc. - Thanks to James Taylor. - - *) Bugfix: nginx could not be built on Tru64 UNIX. - Thanks to Goetz T. Fischer. - - -Changes with nginx 1.7.9 23 Dec 2014 - - *) Feature: variables support in the "proxy_cache", "fastcgi_cache", - "scgi_cache", and "uwsgi_cache" directives. - - *) Feature: variables support in the "expires" directive. - - *) Feature: loading of secret keys from hardware tokens with OpenSSL - engines. - Thanks to Dmitrii Pichulin. - - *) Feature: the "autoindex_format" directive. - - *) Bugfix: cache revalidation is now only used for responses with 200 - and 206 status codes. - Thanks to Piotr Sikora. - - *) Bugfix: the "TE" client request header line was passed to backends - while proxying. - - *) Bugfix: the "proxy_pass", "fastcgi_pass", "scgi_pass", and - "uwsgi_pass" directives might not work correctly inside the "if" and - "limit_except" blocks. - - *) Bugfix: the "proxy_store" directive with the "on" parameter was - ignored if the "proxy_store" directive with an explicitly specified - file path was used on a previous level. - - *) Bugfix: nginx could not be built with BoringSSL. - Thanks to Lukas Tribus. - - -Changes with nginx 1.7.8 02 Dec 2014 - - *) Change: now the "If-Modified-Since", "If-Range", etc. client request - header lines are passed to a backend while caching if nginx knows in - advance that the response will not be cached (e.g., when using - proxy_cache_min_uses). - - *) Change: now after proxy_cache_lock_timeout nginx sends a request to a - backend with caching disabled; the new directives - "proxy_cache_lock_age", "fastcgi_cache_lock_age", - "scgi_cache_lock_age", and "uwsgi_cache_lock_age" specify a time - after which the lock will be released and another attempt to cache a - response will be made. - - *) Change: the "log_format" directive can now be used only at http - level. - - *) Feature: the "proxy_ssl_certificate", "proxy_ssl_certificate_key", - "proxy_ssl_password_file", "uwsgi_ssl_certificate", - "uwsgi_ssl_certificate_key", and "uwsgi_ssl_password_file" - directives. - Thanks to Piotr Sikora. - - *) Feature: it is now possible to switch to a named location using - "X-Accel-Redirect". - Thanks to Toshikuni Fukaya. - - *) Feature: now the "tcp_nodelay" directive works with SPDY connections. - - *) Feature: new directives in vim syntax highliting scripts. - Thanks to Peter Wu. - - *) Bugfix: nginx ignored the "s-maxage" value in the "Cache-Control" - backend response header line. - Thanks to Piotr Sikora. - - *) Bugfix: in the ngx_http_spdy_module. - Thanks to Piotr Sikora. - - *) Bugfix: in the "ssl_password_file" directive when using OpenSSL - 0.9.8zc, 1.0.0o, 1.0.1j. - - *) Bugfix: alerts "header already sent" appeared in logs if the - "post_action" directive was used; the bug had appeared in 1.5.4. - - *) Bugfix: alerts "the http output chain is empty" might appear in logs - if the "postpone_output 0" directive was used with SSI includes. - - *) Bugfix: in the "proxy_cache_lock" directive with SSI subrequests. - Thanks to Yichun Zhang. - - -Changes with nginx 1.7.7 28 Oct 2014 - - *) Change: now nginx takes into account the "Vary" header line in a - backend response while caching. - - *) Feature: the "proxy_force_ranges", "fastcgi_force_ranges", - "scgi_force_ranges", and "uwsgi_force_ranges" directives. - - *) Feature: the "proxy_limit_rate", "fastcgi_limit_rate", - "scgi_limit_rate", and "uwsgi_limit_rate" directives. - - *) Feature: the "Vary" parameter of the "proxy_ignore_headers", - "fastcgi_ignore_headers", "scgi_ignore_headers", and - "uwsgi_ignore_headers" directives. - - *) Bugfix: the last part of a response received from a backend with - unbufferred proxy might not be sent to a client if "gzip" or "gunzip" - directives were used. - - *) Bugfix: in the "proxy_cache_revalidate" directive. - Thanks to Piotr Sikora. - - *) Bugfix: in error handling. - Thanks to Yichun Zhang and Daniil Bondarev. - - *) Bugfix: in the "proxy_next_upstream_tries" and - "proxy_next_upstream_timeout" directives. - Thanks to Feng Gu. - - *) Bugfix: nginx/Windows could not be built with MinGW-w64 gcc. - Thanks to Kouhei Sutou. - - -Changes with nginx 1.7.6 30 Sep 2014 - - *) Change: the deprecated "limit_zone" directive is not supported - anymore. - - *) Feature: the "limit_conn_zone" and "limit_req_zone" directives now - can be used with combinations of multiple variables. - - *) Bugfix: request body might be transmitted incorrectly when retrying a - FastCGI request to the next upstream server. - - *) Bugfix: in logging to syslog. - - -Changes with nginx 1.7.5 16 Sep 2014 +Changes with nginx 1.6.2 16 Sep 2014 *) Security: it was possible to reuse SSL sessions in unrelated contexts if a shared SSL session cache or the same TLS session ticket key was used for multiple "server" blocks (CVE-2014-3616). Thanks to Antoine Delignat-Lavaud. - *) Change: now the "stub_status" directive does not require a parameter. - - *) Feature: the "always" parameter of the "add_header" directive. - - *) Feature: the "proxy_next_upstream_tries", - "proxy_next_upstream_timeout", "fastcgi_next_upstream_tries", - "fastcgi_next_upstream_timeout", "memcached_next_upstream_tries", - "memcached_next_upstream_timeout", "scgi_next_upstream_tries", - "scgi_next_upstream_timeout", "uwsgi_next_upstream_tries", and - "uwsgi_next_upstream_timeout" directives. - - *) Bugfix: in the "if" parameter of the "access_log" directive. - - *) Bugfix: in the ngx_http_perl_module. - Thanks to Piotr Sikora. - - *) Bugfix: the "listen" directive of the mail proxy module did not allow - to specify more than two parameters. - - *) Bugfix: the "sub_filter" directive did not work with a string to - replace consisting of a single character. + *) Bugfix: requests might hang if resolver was used and a DNS server + returned a malformed response; the bug had appeared in 1.5.8. *) Bugfix: requests might hang if resolver was used and a timeout occurred during a DNS request. - *) Bugfix: in the ngx_http_spdy_module when using with AIO. - *) Bugfix: a segmentation fault might occur in a worker process if the - "set" directive was used to change the "$http_...", "$sent_http_...", - or "$upstream_http_..." variables. - - *) Bugfix: in memory allocation error handling. - Thanks to Markus Linnala and Feng Gu. - - -Changes with nginx 1.7.4 05 Aug 2014 +Changes with nginx 1.6.1 05 Aug 2014 *) Security: pipelined commands were not discarded after STARTTLS command in SMTP proxy (CVE-2014-3556); the bug had appeared in 1.5.6. Thanks to Chris Boulton. - *) Change: URI escaping now uses uppercase hexadecimal digits. - Thanks to Piotr Sikora. - - *) Feature: now nginx can be build with BoringSSL and LibreSSL. - Thanks to Piotr Sikora. - - *) Bugfix: requests might hang if resolver was used and a DNS server - returned a malformed response; the bug had appeared in 1.5.8. - - *) Bugfix: in the ngx_http_spdy_module. - Thanks to Piotr Sikora. - *) Bugfix: the $uri variable might contain garbage when returning errors with code 400. Thanks to Sergey Bobrov. - *) Bugfix: in error handling in the "proxy_store" directive and the - ngx_http_dav_module. - Thanks to Feng Gu. - - *) Bugfix: a segmentation fault might occur if logging of errors to - syslog was used; the bug had appeared in 1.7.1. - - *) Bugfix: the $geoip_latitude, $geoip_longitude, $geoip_dma_code, and - $geoip_area_code variables might not work. - Thanks to Yichun Zhang. - - *) Bugfix: in memory allocation error handling. - Thanks to Tatsuhiko Kubo and Piotr Sikora. - - -Changes with nginx 1.7.3 08 Jul 2014 - - *) Feature: weak entity tags are now preserved on response - modifications, and strong ones are changed to weak. - - *) Feature: cache revalidation now uses If-None-Match header if - possible. - - *) Feature: the "ssl_password_file" directive. - - *) Bugfix: the If-None-Match request header line was ignored if there - was no Last-Modified header in a response returned from cache. - - *) Bugfix: "peer closed connection in SSL handshake" messages were - logged at "info" level instead of "error" while connecting to - backends. - - *) Bugfix: in the ngx_http_dav_module module in nginx/Windows. - - *) Bugfix: SPDY connections might be closed prematurely if caching was - used. - - -Changes with nginx 1.7.2 17 Jun 2014 - - *) Feature: the "hash" directive inside the "upstream" block. - - *) Feature: defragmentation of free shared memory blocks. - Thanks to Wandenberg Peixoto and Yichun Zhang. - - *) Bugfix: a segmentation fault might occur in a worker process if the - default value of the "access_log" directive was used; the bug had - appeared in 1.7.0. - Thanks to Piotr Sikora. - - *) Bugfix: trailing slash was mistakenly removed from the last parameter - of the "try_files" directive. - - *) Bugfix: nginx could not be built on OS X in some cases. - - *) Bugfix: in the ngx_http_spdy_module. - - -Changes with nginx 1.7.1 27 May 2014 - - *) Feature: the "$upstream_cookie_..." variables. - - *) Feature: the $ssl_client_fingerprint variable. - - *) Feature: the "error_log" and "access_log" directives now support - logging to syslog. - - *) Feature: the mail proxy now logs client port on connect. - - *) Bugfix: memory leak if the "ssl_stapling" directive was used. - Thanks to Filipe da Silva. - - *) Bugfix: the "alias" directive used inside a location given by a - regular expression worked incorrectly if the "if" or "limit_except" - directives were used. - - *) Bugfix: the "charset" directive did not set a charset to encoded - backend responses. - - *) Bugfix: a "proxy_pass" directive without URI part might use original - request after the $args variable was set. - Thanks to Yichun Zhang. - *) Bugfix: in the "none" parameter in the "smtp_auth" directive; the bug had appeared in 1.5.6. Thanks to Svyatoslav Nikolsky. - *) Bugfix: if sub_filter and SSI were used together, then responses - might be transferred incorrectly. - *) Bugfix: nginx could not be built with the --with-file-aio option on - Linux/aarch64. +Changes with nginx 1.6.0 24 Apr 2014 - -Changes with nginx 1.7.0 24 Apr 2014 - - *) Feature: backend SSL certificate verification. - - *) Feature: support for SNI while working with SSL backends. - - *) Feature: the $ssl_server_name variable. - - *) Feature: the "if" parameter of the "access_log" directive. + *) 1.6.x stable branch. Changes with nginx 1.5.13 08 Apr 2014 @@ -3591,7 +1066,7 @@ Changes with nginx 1.1.11 12 Dec 2011 Changes with nginx 1.1.10 30 Nov 2011 - *) Bugfix: a segmentation fault occurred in a worker process if AIO was + *) Bugfix: a segmentation fault occured in a worker process if AIO was used on Linux; the bug had appeared in 1.1.9. @@ -3700,7 +1175,7 @@ Changes with nginx 1.1.6 17 Oct 2011 sent to it after fail_timeout; the server will be considered alive if it will successfully respond to the request. - *) Change: now the 0x7F-0xFF characters are escaped as \xXX in an + *) Change: now the 0x7F-0x1F characters are escaped as \xXX in an access_log. *) Feature: "proxy/fastcgi/scgi/uwsgi_ignore_headers" directives support @@ -3868,7 +1343,7 @@ Changes with nginx 1.1.0 01 Aug 2011 and proxies to an HTTPS backend. Thanks to Maxim Dounin. - *) Bugfix: in parameter validation of a "proxy_pass" directive with + *) Bugfix: in parameter validaiton of a "proxy_pass" directive with variables. Thanks to Lanshun Zhou. @@ -5755,7 +3230,7 @@ Changes with nginx 0.7.11 18 Aug 2008 *) Feature: the "proxy_ssl_session_reuse" directive. *) Bugfix: a "proxy_pass" directive without URI part might use original - request after the "X-Accel-Redirect" redirection was used. + request after the "X-Accel-Redirect" redirection was used; *) Bugfix: if a directory has search only rights and the first index file was absent, then nginx returned the 500 status code. @@ -6633,7 +4108,7 @@ Changes with nginx 0.5.22 29 May 2007 Changes with nginx 0.5.21 28 May 2007 *) Bugfix: if server has more than about ten locations, then regex - locations might be chosen not in that order as they were specified. + locations might be choosen not in that order as they were specified. *) Bugfix: a worker process may got caught in an endless loop on 64-bit platform, if the 33-rd or next in succession backend has failed. @@ -6719,7 +4194,7 @@ Changes with nginx 0.5.17 02 Apr 2007 *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive. - *) Bugfix: in some cases non-cacheable variables (such as $uri variable) + *) Bugfix: in some cases non-cachable variables (such as $uri variable) returned old cached value. @@ -6744,7 +4219,7 @@ Changes with nginx 0.5.16 26 Mar 2007 Changes with nginx 0.5.15 19 Mar 2007 *) Feature: the mail proxy supports authenticated SMTP proxying and the - "smtp_auth", "smtp_capabilities", and "xclient" directives. + "smtp_auth", "smtp_capablities", and "xclient" directives. Thanks to Anton Yuzhaninov and Maxim Dounin. *) Feature: now the keep-alive connections are closed just after @@ -7845,7 +5320,7 @@ Changes with nginx 0.3.21 16 Jan 2006 *) Feature: the ngx_http_perl_module. - *) Change: the "valid_referers" directive allows the referrers without + *) Change: the "valid_referers" directive allows the referreres without URI part. @@ -7945,7 +5420,7 @@ Changes with nginx 0.3.15 07 Dec 2005 *) Feature: the "so_keepalive" directive in IMAP/POP3 proxy. *) Bugfix: if there are unclosed connection nginx now calls abort() only - on graceful quit and active "debug_points" directive. + on gracefull quit and active "debug_points" directive. Changes with nginx 0.3.14 05 Dec 2005 @@ -8486,7 +5961,7 @@ Changes with nginx 0.1.37 23 Jun 2005 *) Bugfix: the responses may be transferred not completely, if many parts or the big parts were included by SSI. - *) Bugfix: if all backends had returned the 404 response and the + *) Bugfix: if all backends had returned the 404 reponse and the "http_404" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives was used, then nginx started to request all backends again. diff --git a/CHANGES.ru b/CHANGES.ru index 0d1ba20..aa15be6 100644 --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,2446 +1,5 @@ -Изменения в nginx 1.26.3 05.02.2025 - - *) Безопасность: недостаточная проверка в обработке виртуальных серверов - при использовании SNI в TLSv1.3 позволяла повторно использовать - SSL-сессию в контексте другого виртуального сервера, чтобы обойти - проверку клиентских SSL-сертификатов (CVE-2025-23419). - - *) Исправление: в модуле ngx_http_mp4_module. - Спасибо Nils Bars. - - *) Изменение: при использовании zlib-ng в логах появлялись сообщения - "gzip filter failed to use preallocated memory". - - *) Исправление: nginx не мог собрать библиотеку libatomic из исходных - текстов, если использовался параметр --with-libatomic=DIR. - - *) Исправление: теперь nginx игнорирует пакеты согласования версий QUIC - от клиентов. - - *) Исправление: nginx не собирался на Solaris 10 и более ранних с - модулем ngx_http_v3_module. - - *) Исправления в HTTP/3. - - -Изменения в nginx 1.26.2 14.08.2024 - - *) Безопасность: обработка специально созданного mp4-файла модулем - ngx_http_mp4_module могла приводить к падению рабочего процесса - (CVE-2024-7347). - Спасибо Nils Bars. - - -Изменения в nginx 1.26.1 29.05.2024 - - *) Безопасность: при использовании HTTP/3 обработка специально созданной - QUIC-сессии могла приводить к падению рабочего процесса, отправке - клиенту содержимого памяти рабочего процесса на системах с MTU больше - 4096 байт, а также потенциально могла иметь другие последствия - (CVE-2024-32760, CVE-2024-31079, CVE-2024-35200, CVE-2024-34161). - Спасибо Nils Bars из CISPA. - - *) Исправление: уменьшено потребление памяти для долгоживущих запросов, - если используются директивы gzip, gunzip, ssi, sub_filter или - grpc_pass. - - *) Исправление: nginx не собирался gcc 14, если использовался параметр - --with-libatomic. - Спасибо Edgar Bonet. - - *) Исправление: в HTTP/3. - - -Изменения в nginx 1.26.0 23.04.2024 - - *) Стабильная ветка 1.26.x. - - -Изменения в nginx 1.25.5 16.04.2024 - - *) Добавление: виртуальные сервера в модуле stream. - - *) Добавление: модуль ngx_stream_pass_module. - - *) Добавление: параметры deferred, accept_filter и setfib директивы - listen в модуле stream. - - *) Добавление: определение размера строки кеша процессора для некоторых - архитектур. - Спасибо Piotr Sikora. - - *) Добавление: поддержка Homebrew на Apple Silicon. - Спасибо Piotr Sikora. - - *) Исправление: улучшения и исправления кросс-компиляции для Windows. - Спасибо Piotr Sikora. - - *) Исправление: неожиданное закрытие соединения при использовании 0-RTT - в QUIC. - Спасибо Владимиру Хомутову. - - -Изменения в nginx 1.25.4 14.02.2024 - - *) Безопасность: при использовании HTTP/3 в рабочем процессе мог - произойти segmentation fault во время обработки специально созданной - QUIC-сессии (CVE-2024-24989, CVE-2024-24990). - - *) Исправление: соединения с незавершенными AIO-операциями могли - закрываться преждевременно во время плавного завершения старых - рабочих процессов. - - *) Исправление: теперь nginx не пишет в лог сообщения об утечке сокетов, - если во время плавного завершения старых рабочих процессов было - запрошено быстрое завершение. - - *) Исправление: при использовании AIO в подзапросе могла происходить - ошибка на сокете, утечка сокетов, либо segmentation fault в рабочем - процессе (при SSL-проксировании). - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовалось SSL-проксирование и директива image_filter, а - ошибки с кодом 415 перенаправлялись с помощью директивы error_page. - - *) Исправления и улучшения в HTTP/3. - - -Изменения в nginx 1.25.3 24.10.2023 - - *) Изменение: улучшено детектирование некорректного поведения клиентов - при использовании HTTP/2. - - *) Добавление: уменьшение времени запуска при использовании большого - количества location'ов. - Спасибо Yusuke Nojima. - - *) Исправление: при использовании HTTP/2 без SSL в рабочем процессе мог - произойти segmentation fault; ошибка появилась в 1.25.1. - - *) Исправление: строка "Status" в заголовке ответа бэкенда с пустой - поясняющей фразой обрабатывалась некорректно. - - *) Исправление: утечки памяти во время переконфигурации при - использовании библиотеки PCRE2. - Спасибо ZhenZhong Wu. - - *) Исправления и улучшения в HTTP/3. - - -Изменения в nginx 1.25.2 15.08.2023 - - *) Добавление: path MTU discovery при использовании HTTP/3. - - *) Добавление: поддержка шифра TLS_AES_128_CCM_SHA256 при использовании - HTTP/3. - - *) Изменение: теперь при загрузке конфигурации OpenSSL nginx использует - appname "nginx". - - *) Изменение: теперь nginx не пытается загружать конфигурацию OpenSSL, - если для сборки OpenSSL использовался параметр --with-openssl и - переменная окружения OPENSSL_CONF не установлена. - - *) Исправление: в переменной $body_bytes_sent при использовании HTTP/3. - - *) Исправление: в HTTP/3. - - -Изменения в nginx 1.25.1 13.06.2023 - - *) Добавление: директива http2, позволяющая включать HTTP/2 в отдельных - блоках server; параметр http2 директивы listen объявлен устаревшим. - - *) Изменение: поддержка HTTP/2 server push упразднена. - - *) Изменение: устаревшая директива ssl больше не поддерживается. - - *) Исправление: в HTTP/3 при использовании OpenSSL. - - -Изменения в nginx 1.25.0 23.05.2023 - - *) Добавление: экспериментальная поддержка HTTP/3. - - -Изменения в nginx 1.23.4 28.03.2023 - - *) Изменение: теперь протокол TLSv1.3 разрешён по умолчанию. - - *) Изменение: теперь nginx выдаёт предупреждение при переопределении - параметров listen-сокета, задающих используемые протоколы. - - *) Изменение: теперь, если клиент использует pipelining, nginx закрывает - соединения с ожиданием дополнительных данных (lingering close). - - *) Добавление: поддержка byte ranges для ответов модуля - ngx_http_gzip_static_module. - - *) Исправление: диапазоны портов в директиве listen не работали; ошибка - появилась в 1.23.3. - Спасибо Валентину Бартеневу. - - *) Исправление: для обработки запроса мог быть выбран неверный location, - если в конфигурации использовался префиксный location длиннее 255 - символов. - - *) Исправление: не-ASCII символы в именах файлов на Windows не - поддерживались модулями ngx_http_autoindex_module и - ngx_http_dav_module, а также директивой include. - - *) Изменение: уровень логгирования ошибок SSL "data length too long", - "length too short", "bad legacy version", "no shared signature - algorithms", "bad digest length", "missing sigalgs extension", - "encrypted length too long", "bad length", "bad key update", "mixed - handshake and non handshake data", "ccs received early", "data - between ccs and finished", "packet length too long", "too many warn - alerts", "record too small", и "got a fin before a ccs" понижен с - уровня crit до info. - - *) Исправление: при использовании HTTP/2 и директивы error_page для - перенаправления ошибок с кодом 400 могла происходить утечка сокетов. - - *) Исправление: сообщения об ошибках записи в syslog не содержали - информации о том, что ошибки происходили в процессе записи в syslog. - Спасибо Safar Safarly. - - *) Изменение: при использовании zlib-ng в логах появлялись сообщения - "gzip filter failed to use preallocated memory". - - *) Исправление: в почтовом прокси-сервере. - - -Изменения в nginx 1.23.3 13.12.2022 - - *) Исправление: при чтении заголовка протокола PROXY версии 2, - содержащего большое количество TLV, могла возникать ошибка. - - *) Исправление: при использовании SSI для обработки подзапросов, - созданных другими модулями, в рабочем процессе мог произойти - segmentation fault. - Спасибо Ciel Zhao. - - *) Изменение: теперь, если при преобразовании в адреса имени хоста, - указанного в директиве listen, возвращается несколько адресов, nginx - игнорирует дубликаты среди этих адресов. - - *) Исправление: nginx мог нагружать процессор при небуферизированном - проксировании, если использовались SSL-соединения с бэкендами. - - -Изменения в nginx 1.23.2 19.10.2022 - - *) Безопасность: обработка специально созданного mp4-файла модулем - ngx_http_mp4_module могла приводить к падению рабочего процесса, - отправке клиенту части содержимого памяти рабочего процесса, а также - потенциально могла иметь другие последствия (CVE-2022-41741, - CVE-2022-41742). - - *) Добавление: переменные "$proxy_protocol_tlv_...". - - *) Добавление: ключи шифрования TLS session tickets теперь автоматически - меняются при использовании разделяемой памяти в ssl_session_cache. - - *) Изменение: уровень логгирования ошибок SSL "bad record type" понижен - с уровня crit до info. - Спасибо Murilo Andrade. - - *) Изменение: теперь при использовании разделяемой памяти в - ssl_session_cache сообщения "could not allocate new session" - логгируются на уровне warn вместо alert и не чаще одного раза в - секунду. - - *) Исправление: nginx/Windows не собирался с OpenSSL 3.0.x. - - *) Исправление: в логгировании ошибок протокола PROXY. - Спасибо Сергею Брестеру. - - *) Изменение: при использовании TLSv1.3 с OpenSSL разделяемая память из - ssl_session_cache расходовалась в том числе на сессии, использующие - TLS session tickets. - - *) Изменение: таймаут, заданный с помощью директивы ssl_session_timeout, - не работал при использовании TLSv1.3 с OpenSSL или BoringSSL. - - -Изменения в nginx 1.23.1 19.07.2022 - - *) Добавление: оптимизация использования памяти в конфигурациях с - SSL-проксированием. - - *) Добавление: теперь с помощью параметра "ipv4=off" директивы - "resolver" можно запретить поиск IPv4-адресов при преобразовании имён - в адреса. - - *) Изменение: уровень логгирования ошибок SSL "bad key share", "bad - extension", "bad cipher" и "bad ecpoint" понижен с уровня crit до - info. - - *) Исправление: при возврате диапазонов nginx не удалял строку заголовка - "Content-Range", если она присутствовала в исходном ответе бэкенда. - - *) Исправление: проксированный ответ мог быть отправлен не полностью при - переконфигурации на Linux; ошибка появилась в 1.17.5. - - -Изменения в nginx 1.23.0 21.06.2022 - - *) Изменение во внутреннем API: теперь строки заголовков представлены - связными списками. - - *) Изменение: теперь nginx объединяет произвольные строки заголовков с - одинаковыми именами при отправке на FastCGI-, SCGI- и uwsgi-бэкенды, - в методе $r->header_in() модуля ngx_http_perl_module, и при доступе - через переменные "$http_...", "$sent_http_...", "$sent_trailer_...", - "$upstream_http_..." и "$upstream_trailer_...". - - *) Исправление: если в заголовке ответа бэкенда было несколько строк - "Vary", при кэшировании nginx учитывал только последнюю из них. - - *) Исправление: если в заголовке ответа бэкенда было несколько строк - "WWW-Authenticate" и использовался перехват ошибок с кодом 401 от - бэкенда или директива auth_request, nginx пересылал клиенту только - первую из этих строк. - - *) Изменение: уровень логгирования ошибок SSL "application data after - close notify" понижен с уровня crit до info. - - *) Исправление: соединения могли зависать, если nginx был собран на - Linux 2.6.17 и новее, а использовался на системах без поддержки - EPOLLRDHUP, в частности, на системах с эмуляцией epoll; ошибка - появилась в 1.17.5. - Спасибо Marcus Ball. - - *) Исправление: nginx не кэшировал ответ, если строка заголовка ответа - "Expires" запрещала кэширование, а последующая строка заголовка - "Cache-Control" разрешала кэширование. - - -Изменения в nginx 1.21.6 25.01.2022 - - *) Исправление: при использование EPOLLEXCLUSIVE на Linux распределение - клиентских соединений между рабочими процессами было неравномерным. - - *) Исправление: во время плавного завершения старых рабочих процессов - nginx возвращал в ответах строку заголовка "Connection: keep-alive". - - *) Исправление: в директиве ssl_session_ticket_key при использовании - TLSv1.3. - - -Изменения в nginx 1.21.5 28.12.2021 - - *) Изменение: теперь nginx по умолчанию собирается с библиотекой PCRE2. - - *) Изменение: теперь nginx всегда использует sendfile(SF_NODISKIO) на - FreeBSD. - - *) Добавление: поддержка sendfile(SF_NOCACHE) на FreeBSD. - - *) Добавление: переменная $ssl_curve. - - *) Исправление: при использовании HTTP/2 без SSL вместе с директивами - sendfile и aio соединения могли зависать. - - -Изменения в nginx 1.21.4 02.11.2021 - - *) Изменение: поддержка NPN вместо ALPN для установления - HTTP/2-соединений упразднена. - - *) Изменение: теперь nginx закрывает SSL соединение, если клиент - использует ALPN, но nginx не поддерживает ни один из присланных - клиентом протоколов. - - *) Изменение: в директиве sendfile_max_chunk значение по умолчанию - изменено на 2 мегабайта. - - *) Добавление: директива proxy_half_close в модуле stream. - - *) Добавление: директива ssl_alpn в модуле stream. - - *) Добавление: переменная $ssl_alpn_protocol. - - *) Добавление: поддержка SSL_sendfile() при использовании OpenSSL 3.0. - - *) Добавление: директива mp4_start_key_frame в модуле - ngx_http_mp4_module. - Спасибо Tracey Jaquith. - - *) Исправление: в переменной $content_length при использовании chunked - transfer encoding. - - *) Исправление: при получении ответа некорректной длины от проксируемого - бэкенда nginx мог тем не менее закэшировать соединение. - Спасибо Awdhesh Mathpal. - - *) Исправление: некорректные заголовки от бэкендов логгировались на - уровне info вместо error; ошибка появилась в 1.21.1. - - *) Исправление: при использовании HTTP/2 и директивы aio_write запросы - могли зависать. - - -Изменения в nginx 1.21.3 07.09.2021 - - *) Изменение: оптимизация чтения тела запроса при использовании HTTP/2. - - *) Исправление: во внутреннем API для обработки тела запроса при - использовании HTTP/2 и буферизации обрабатываемых данных. - - -Изменения в nginx 1.21.2 31.08.2021 - - *) Изменение: теперь nginx возвращает ошибку, если в запросе по - протоколу HTTP/1.0 присутствует строка заголовка "Transfer-Encoding". - - *) Изменение: экспортные шифры больше не поддерживаются. - - *) Добавление: совместимость с OpenSSL 3.0. - - *) Добавление: теперь серверу аутентификации почтового прокси-сервера - передаются строки заголовка "Auth-SSL-Protocol" и "Auth-SSL-Cipher". - Спасибо Rob Mueller. - - *) Добавление: API для обработки тела запроса теперь позволяет - буферизировать обрабатываемые данные. - - *) Исправление: SSL-соединения к бэкендам в модуле stream могли зависать - после SSL handshake. - - *) Исправление: уровень безопасности, доступный в OpenSSL 1.1.0 и новее, - не учитывался при загрузке сертификатов сервера, если был задан через - "@SECLEVEL=N" в директиве ssl_ciphers. - - *) Исправление: SSL-соединения с gRPC-бэкендами могли зависать, если - использовались методы select, poll или /dev/poll. - - *) Исправление: при использовании HTTP/2 тело запроса всегда - записывалось на диск, если в запросе не было строки заголовка - "Content-Length". - - -Изменения в nginx 1.21.1 06.07.2021 - - *) Изменение: теперь nginx для метода CONNECT всегда возвращает ошибку. - - *) Изменение: теперь nginx всегда возвращает ошибку, если в запросе - одновременно присутствуют строки заголовка "Content-Length" и - "Transfer-Encoding". - - *) Изменение: теперь nginx всегда возвращает ошибку, если в строке - запроса используются пробелы или управляющие символы. - - *) Изменение: теперь nginx всегда возвращает ошибку, если в имени - заголовка используются пробелы или управляющие символы. - - *) Изменение: теперь nginx всегда возвращает ошибку, если в строке - "Host" заголовка запроса используются пробелы или управляющие - символы. - - *) Изменение: оптимизация тестирования конфигурации при использовании - большого количества listen-сокетов. - - *) Исправление: nginx не экранировал символы """, "<", ">", "\", "^", - "`", "{", "|", и "}" при проксировании с изменением URI запроса. - - *) Исправление: SSL-переменные могли быть пустыми при записи в лог; - ошибка появилась в 1.19.5. - - *) Исправление: keepalive-соединения с gRPC-бэкендами могли не - закрываться после получения GOAWAY-фрейма. - - *) Исправление: уменьшено потребление памяти для долгоживущих запросов - при проксировании с использованием более 64 буферов. - - -Изменения в nginx 1.21.0 25.05.2021 - - *) Безопасность: при использовании директивы resolver во время обработки - ответа DNS-сервера могла происходить перезапись одного байта памяти, - что позволяло атакующему, имеющему возможность подделывать UDP-пакеты - от DNS-сервера, вызвать падение рабочего процесса или, потенциально, - выполнение произвольного кода (CVE-2021-23017). - - *) Добавление: директивы proxy_ssl_certificate, - proxy_ssl_certificate_key, grpc_ssl_certificate, - grpc_ssl_certificate_key, uwsgi_ssl_certificate и - uwsgi_ssl_certificate_key поддерживают переменные. - - *) Добавление: директива max_errors в почтовом прокси-сервере. - - *) Добавление: почтовый прокси-сервер поддерживает POP3 и IMAP - pipelining. - - *) Добавление: параметр fastopen директивы listen в модуле stream. - Спасибо Anbang Wen. - - *) Исправление: специальные символы не экранировались при автоматическом - перенаправлении с добавлением завершающего слэша. - - *) Исправление: при использовании SMTP pipelining соединения с клиентами - в почтовом прокси-сервере могли неожиданно закрываться. - - -Изменения в nginx 1.19.10 13.04.2021 - - *) Изменение: в директиве keepalive_requests значение по умолчанию - изменено на 1000. - - *) Добавление: директива keepalive_time. - - *) Добавление: переменная $connection_time. - - *) Изменение: при использовании zlib-ng в логах появлялись сообщения - "gzip filter failed to use preallocated memory". - - -Изменения в nginx 1.19.9 30.03.2021 - - *) Исправление: nginx не собирался с почтовым прокси-сервером, но без - модуля ngx_mail_ssl_module; ошибка появилась в 1.19.8. - - *) Исправление: при работе с gRPC-бэкендами могли возникать ошибки - "upstream sent response body larger than indicated content length"; - ошибка появилась в 1.19.1. - - *) Исправление: если клиент закрывал соединение в момент отбрасывания - тела запроса, nginx мог не закрыть соединение до истечения - keepalive-таймаута. - - *) Исправление: при ожидании задержки limit_req или auth_delay, а также - при работе с бэкендами nginx мог не обнаружить, что соединение уже - закрыто клиентом. - - *) Исправление: в методе обработки соединений eventport. - - -Изменения в nginx 1.19.8 09.03.2021 - - *) Добавление: в директиве proxy_cookie_flags теперь флаги можно - задавать с помощью переменных. - - *) Добавление: параметр proxy_protocol в директиве listen, директивы - proxy_protocol и set_real_ip_from в почтовом прокси-сервере. - - *) Исправление: HTTP/2-соединения сразу закрывались при использовании - "keepalive_timeout 0"; ошибка появилась в 1.19.7. - - *) Исправление: некоторые ошибки логгировались как неизвестные, если - nginx был собран с glibc 2.32. - - *) Исправление: в методе обработки соединений eventport. - - -Изменения в nginx 1.19.7 16.02.2021 - - *) Изменение: обработка соединений в HTTP/2 была изменена и теперь более - соответствует HTTP/1.x; директивы http2_recv_timeout, - http2_idle_timeout и http2_max_requests упразднены, вместо них - следует использовать директивы keepalive_timeout и - keepalive_requests. - - *) Изменение: директивы http2_max_field_size и http2_max_header_size - упразднены, вместо них следует использовать директиву - large_client_header_buffers. - - *) Добавление: теперь при исчерпании свободных соединений nginx - закрывает не только keepalive-соединения, но и соединения в lingering - close. - - *) Исправление: в логах могли появляться сообщения "zero size buf in - output", если бэкенд возвращал некорректный ответ при - небуферизированном проксировании; ошибка появилась в 1.19.1. - - *) Исправление: при использовании директивы return вместе с image_filter - или xslt_stylesheet HEAD-запросы обрабатывались некорректно. - - *) Исправление: в директиве add_trailer. - - -Изменения в nginx 1.19.6 15.12.2020 - - *) Исправление: ошибки "no live upstreams", если server в блоке upstream - был помечен как down. - - *) Исправление: при использовании HTTPS в рабочем процессе мог произойти - segmentation fault; ошибка появилась в 1.19.5. - - *) Исправление: nginx возвращал ошибку 400 на запросы вида - "GET http://example.com?args HTTP/1.0". - - *) Исправление: в модулях ngx_http_flv_module и ngx_http_mp4_module. - Спасибо Chris Newton. - - -Изменения в nginx 1.19.5 24.11.2020 - - *) Добавление: ключ -e. - - *) Добавление: при сборке дополнительных модулей теперь можно указывать - одни и те же исходные файлы в разных модулях. - - *) Исправление: SSL shutdown не работал при закрытии соединений с - ожиданием дополнительных данных (lingering close). - - *) Исправление: при работе с gRPC-бэкендами могли возникать ошибки - "upstream sent frame for closed stream". - - *) Исправление: во внутреннем API для обработки тела запроса. - - -Изменения в nginx 1.19.4 27.10.2020 - - *) Добавление: директивы ssl_conf_command, proxy_ssl_conf_command, - grpc_ssl_conf_command и uwsgi_ssl_conf_command. - - *) Добавление: директива ssl_reject_handshake. - - *) Добавление: директива proxy_smtp_auth в почтовом прокси-сервере. - - -Изменения в nginx 1.19.3 29.09.2020 - - *) Добавление: модуль ngx_stream_set_module. - - *) Добавление: директива proxy_cookie_flags. - - *) Добавление: директива userid_flags. - - *) Исправление: расширение управления кэшированием stale-if-error - ошибочно применялось, если бэкенд возвращал ответ с кодом 500, 502, - 503, 504, 403, 404 или 429. - - *) Исправление: если использовалось кэширование и бэкенд возвращал - ответы с строкой заголовка Vary, в логах могли появляться сообщения - "[crit] cache file ... has too long header". - - *) Изменение: при использовании OpenSSL 1.1.1 в логах могли появляться - сообщения "[crit] SSL_write() failed". - - *) Исправление: в логах могли появляться сообщения "SSL_shutdown() - failed (SSL: ... bad write retry)"; ошибка появилась в 1.19.2. - - *) Исправление: при использовании HTTP/2 в рабочем процессе мог - произойти segmentation fault, если ошибки с кодом 400 с помощью - директивы error_page перенаправлялись в проксируемый location. - - *) Исправление: утечки сокетов при использовании HTTP/2 и подзапросов в - модуле njs. - - -Изменения в nginx 1.19.2 11.08.2020 - - *) Изменение: теперь nginx начинает закрывать keepalive-соединения, не - дожидаясь исчерпания всех свободных соединений, а также пишет об этом - предупреждение в лог ошибок. - - *) Изменение: оптимизация чтения тела запроса при использовании chunked - transfer encoding. - - *) Исправление: утечки памяти при использовании директивы ssl_ocsp. - - *) Исправление: в логах могли появляться сообщения "zero size buf in - output", если FastCGI-сервер возвращал некорректный ответ; ошибка - появилась в 1.19.1. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если размеры large_client_header_buffers отличались в разных - виртуальных серверах. - - *) Исправление: SSL shutdown мог не работать. - - *) Исправление: в логах могли появляться сообщения "SSL_shutdown() - failed (SSL: ... bad write retry)". - - *) Исправление: в модуле ngx_http_slice_module. - - *) Исправление: в модуле ngx_http_xslt_filter_module. - - -Изменения в nginx 1.19.1 07.07.2020 - - *) Изменение: директивы lingering_close, lingering_time и - lingering_timeout теперь работают при использовании HTTP/2. - - *) Изменение: теперь лишние данные, присланные бэкендом, всегда - отбрасываются. - - *) Изменение: теперь при получении слишком короткого ответа от - FastCGI-сервера nginx пытается отправить клиенту доступную часть - ответа, после чего закрывает соединение с клиентом. - - *) Изменение: теперь при получении ответа некорректной длины от - gRPC-бэкенда nginx прекращает обработку ответа с ошибкой. - - *) Добавление: параметр min_free в директивах proxy_cache_path, - fastcgi_cache_path, scgi_cache_path и uwsgi_cache_path. - Спасибо Adam Bambuch. - - *) Исправление: nginx не удалял unix domain listen-сокеты при плавном - завершении по сигналу SIGQUIT. - - *) Исправление: UDP-пакеты нулевого размера не проксировались. - - *) Исправление: проксирование на uwsgi-бэкенды с использованием SSL - могло не работать. - Спасибо Guanzhong Chen. - - *) Исправление: в обработке ошибок при использовании директивы ssl_ocsp. - - *) Исправление: при использовании файловых систем XFS и NFS размер кэша - на диске мог считаться некорректно. - - *) Исправление: если сервер memcached возвращал некорректный ответ, в - логах могли появляться сообщения "negative size buf in writer". - - -Изменения в nginx 1.19.0 26.05.2020 - - *) Добавление: проверка клиентских сертификатов с помощью OCSP. - - *) Исправление: при работе с gRPC-бэкендами могли возникать ошибки - "upstream sent frame for closed stream". - - *) Исправление: OCSP stapling мог не работать, если не была указана - директива resolver. - - *) Исправление: соединения с некорректным HTTP/2 preface не - логгировались. - - -Изменения в nginx 1.17.10 14.04.2020 - - *) Добавление: директива auth_delay. - - -Изменения в nginx 1.17.9 03.03.2020 - - *) Изменение: теперь nginx не разрешает несколько строк "Host" в - заголовке запроса. - - *) Исправление: nginx игнорировал дополнительные строки - "Transfer-Encoding" в заголовке запроса. - - *) Исправление: утечки сокетов при использовании HTTP/2. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовался OCSP stapling. - - *) Исправление: в модуле ngx_http_mp4_module. - - *) Исправление: при перенаправлении ошибок с кодом 494 с помощью - директивы error_page nginx возвращал ответ с кодом 494 вместо 400. - - *) Исправление: утечки сокетов при использовании подзапросов в модуле - njs и директивы aio. - - -Изменения в nginx 1.17.8 21.01.2020 - - *) Добавление: директива grpc_pass поддерживает переменные. - - *) Исправление: при обработке pipelined-запросов по SSL-соединению мог - произойти таймаут; ошибка появилась в 1.17.5. - - *) Исправление: в директиве debug_points при использовании HTTP/2. - Спасибо Даниилу Бондареву. - - -Изменения в nginx 1.17.7 24.12.2019 - - *) Исправление: на старте или во время переконфигурации мог произойти - segmentation fault, если в конфигурации использовалась директива - rewrite с пустой строкой замены. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если директива break использовалась совместно с директивой alias или - директивой proxy_pass с URI. - - *) Исправление: строка Location заголовка ответа могла содержать мусор, - если URI запроса был изменён на URI, содержащий нулевой символ. - - *) Исправление: при возврате перенаправлений с помощью директивы - error_page запросы с телом обрабатывались некорректно; ошибка - появилась в 0.7.12. - - *) Исправление: утечки сокетов при использовании HTTP/2. - - *) Исправление: при обработке pipelined-запросов по SSL-соединению мог - произойти таймаут; ошибка появилась в 1.17.5. - - *) Исправление: в модуле ngx_http_dav_module. - - -Изменения в nginx 1.17.6 19.11.2019 - - *) Добавление: переменные $proxy_protocol_server_addr и - $proxy_protocol_server_port. - - *) Добавление: директива limit_conn_dry_run. - - *) Добавление: переменные $limit_req_status и $limit_conn_status. - - -Изменения в nginx 1.17.5 22.10.2019 - - *) Добавление: теперь nginx использует вызов ioctl(FIONREAD), если он - доступен, чтобы избежать чтения из быстрого соединения в течение - долгого времени. - - *) Исправление: неполные закодированные символы в конце URI запроса - игнорировались. - - *) Исправление: "/." и "/.." в конце URI запроса не нормализовывались. - - *) Исправление: в директиве merge_slashes. - - *) Исправление: в директиве ignore_invalid_headers. - Спасибо Alan Kemp. - - *) Исправление: nginx не собирался с MinGW-w64 gcc 8.1 и новее. - - -Изменения в nginx 1.17.4 24.09.2019 - - *) Изменение: улучшено детектирование некорректного поведения клиентов в - HTTP/2. - - *) Изменение: в обработке непрочитанного тела запроса при возврате - ошибок в HTTP/2. - - *) Исправление: директива worker_shutdown_timeout могла не работать при - использовании HTTP/2. - - *) Исправление: при использовании HTTP/2 и директивы - proxy_request_buffering в рабочем процессе мог произойти segmentation - fault. - - *) Исправление: на Windows при использовании SSL уровень записи в лог - ошибки ECONNABORTED был "crit" вместо "error". - - *) Исправление: nginx игнорировал лишние данные при использовании - chunked transfer encoding. - - *) Исправление: если использовалась директива return и при чтении тела - запроса возникала ошибка, nginx всегда возвращал ошибку 500. - - *) Исправление: в обработке ошибок выделения памяти. - - -Изменения в nginx 1.17.3 13.08.2019 - - *) Безопасность: при использовании HTTP/2 клиент мог вызвать чрезмерное - потребление памяти и ресурсов процессора (CVE-2019-9511, - CVE-2019-9513, CVE-2019-9516). - - *) Исправление: при использовании сжатия в логах могли появляться - сообщения "zero size buf"; ошибка появилась в 1.17.2. - - *) Исправление: при использовании директивы resolver в SMTP - прокси-сервере в рабочем процессе мог произойти segmentation fault. - - -Изменения в nginx 1.17.2 23.07.2019 - - *) Изменение: минимальная поддерживаемая версия zlib - 1.2.0.4. - Спасибо Илье Леошкевичу. - - *) Изменение: метод $r->internal_redirect() встроенного перла теперь - ожидает закодированный URI. - - *) Добавление: теперь с помощью метода $r->internal_redirect() - встроенного перла можно перейти в именованный location. - - *) Исправление: в обработке ошибок во встроенном перле. - - *) Исправление: на старте или во время переконфигурации мог произойти - segmentation fault, если в конфигурации использовалось значение hash - bucket size больше 64 килобайт. - - *) Исправление: при использовании методов обработки соединений select, - poll и /dev/poll nginx мог нагружать процессор во время - небуферизованного проксирования и при проксировании - WebSocket-соединений. - - *) Исправление: в модуле ngx_http_xslt_filter_module. - - *) Исправление: в модуле ngx_http_ssi_filter_module. - - -Изменения в nginx 1.17.1 25.06.2019 - - *) Добавление: директива limit_req_dry_run. - - *) Добавление: при использовании директивы hash в блоке upstream пустой - ключ хэширования теперь приводит к переключению на round-robin - балансировку. - Спасибо Niklas Keller. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовалось кэширование и директива image_filter, а ошибки с - кодом 415 перенаправлялись с помощью директивы error_page; ошибка - появилась в 1.11.10. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовался встроенный перл; ошибка появилась в 1.7.3. - - -Изменения в nginx 1.17.0 21.05.2019 - - *) Добавление: директивы limit_rate и limit_rate_after поддерживают - переменные. - - *) Добавление: директивы proxy_upload_rate и proxy_download_rate в - модуле stream поддерживают переменные. - - *) Изменение: минимальная поддерживаемая версия OpenSSL - 0.9.8. - - *) Изменение: теперь postpone-фильтр собирается всегда. - - *) Исправление: директива include не работала в блоках if и - limit_except. - - *) Исправление: в обработке byte ranges. - - -Изменения в nginx 1.15.12 16.04.2019 - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если в директивах ssl_certificate или ssl_certificate_key - использовались переменные и был включён OCSP stapling. - - -Изменения в nginx 1.15.11 09.04.2019 - - *) Исправление: в директиве ssl_stapling_file на Windows. - - -Изменения в nginx 1.15.10 26.03.2019 - - *) Изменение: теперь при использовании имени хоста в директиве listen - nginx создаёт listen-сокеты для всех адресов, соответствующих этому - имени (ранее использовался только первый адрес). - - *) Добавление: диапазоны портов в директиве listen. - - *) Добавление: возможность загрузки SSL-сертификатов и секретных ключей - из переменных. - - *) Изменение: переменная $ssl_server_name могла быть пустой при - использовании OpenSSL 1.1.1. - - *) Исправление: nginx/Windows не собирался с Visual Studio 2015 и новее; - ошибка появилась в 1.15.9. - - -Изменения в nginx 1.15.9 26.02.2019 - - *) Добавление: директивы ssl_certificate и ssl_certificate_key - поддерживают переменные. - - *) Добавление: метод poll теперь доступен на Windows при использовании - Windows Vista и новее. - - *) Исправление: если при использовании метода select на Windows - происходила ошибка при установлении соединения с бэкендом, nginx - ожидал истечения таймаута на установление соединения. - - *) Исправление: директивы proxy_upload_rate и proxy_download_rate в - модуле stream работали некорректно при проксировании UDP-пакетов. - - -Изменения в nginx 1.15.8 25.12.2018 - - *) Добавление: переменная $upstream_bytes_sent. - Спасибо Piotr Sikora. - - *) Добавление: новые директивы в скриптах подсветки синтаксиса для vim. - Спасибо Геннадию Махомеду. - - *) Исправление: в директиве proxy_cache_background_update. - - *) Исправление: в директиве geo при использовании unix domain - listen-сокетов. - - *) Изменение: при использовании директивы ssl_early_data с OpenSSL в - логах могли появляться сообщения "ignoring stale global SSL error ... - bad length". - - *) Исправление: в nginx/Windows. - - *) Исправление: в модуле ngx_http_autoindex_module на 32-битных - платформах. - - -Изменения в nginx 1.15.7 27.11.2018 - - *) Добавление: директива proxy_requests в модуле stream. - - *) Добавление: параметр "delay" директивы "limit_req". - Спасибо Владиславу Шабанову и Петру Щучкину. - - *) Исправление: утечки памяти в случае ошибок при переконфигурации. - - *) Исправление: в переменных $upstream_response_time, - $upstream_connect_time и $upstream_header_time. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовался модуль ngx_http_mp4_module на 32-битных - платформах. - - -Изменения в nginx 1.15.6 06.11.2018 - - *) Безопасность: при использовании HTTP/2 клиент мог вызвать чрезмерное - потреблению памяти (CVE-2018-16843) и ресурсов процессора - (CVE-2018-16844). - - *) Безопасность: при обработке специально созданного mp4-файла модулем - ngx_http_mp4_module содержимое памяти рабочего процесса могло быть - отправлено клиенту (CVE-2018-16845). - - *) Добавление: директивы proxy_socket_keepalive, - fastcgi_socket_keepalive, grpc_socket_keepalive, - memcached_socket_keepalive, scgi_socket_keepalive и - uwsgi_socket_keepalive. - - *) Исправление: если nginx был собран с OpenSSL 1.1.0, а использовался с - OpenSSL 1.1.1, протокол TLS 1.3 всегда был разрешён. - - *) Исправление: при работе с gRPC-бэкендами могло расходоваться большое - количество памяти. - - -Изменения в nginx 1.15.5 02.10.2018 - - *) Исправление: при использовании OpenSSL 1.1.0h и новее в рабочем - процессе мог произойти segmentation fault; ошибка появилась в 1.15.4. - - *) Исправление: незначительных потенциальных ошибок. - - -Изменения в nginx 1.15.4 25.09.2018 - - *) Добавление: теперь директиву ssl_early_data можно использовать с - OpenSSL. - - *) Исправление: в модуле ngx_http_uwsgi_module. - Спасибо Chris Caputo. - - *) Исправление: соединения к некоторым gRPC-бэкендам могли не - кэшироваться при использовании директивы keepalive. - - *) Исправление: при использовании директивы error_page для - перенаправления ошибок, возникающих на ранних этапах обработки - запроса, в частности ошибок с кодом 400, могла происходить утечка - сокетов. - - *) Исправление: директива return при возврате ошибок не изменяла код - ответа, если запрос был перенаправлен с помощью директивы error_page. - - *) Исправление: стандартные сообщения об ошибках и ответы модуля - ngx_http_autoindex_module содержали атрибут bgcolor, что могло - приводить к их некорректному отображению при использовании - пользовательских настроек цветов в браузерах. - Спасибо Nova DasSarma. - - *) Изменение: уровень логгирования ошибок SSL "no suitable key share" и - "no suitable signature algorithm" понижен с уровня crit до info. - - -Изменения в nginx 1.15.3 28.08.2018 - - *) Добавление: теперь TLSv1.3 можно использовать с BoringSSL. - - *) Добавление: директива ssl_early_data, сейчас доступна при - использовании BoringSSL. - - *) Добавление: директивы keepalive_timeout и keepalive_requests в блоке - upstream. - - *) Исправление: модуль ngx_http_dav_module при копировании файла поверх - существующего файла с помощью метода COPY не обнулял целевой файл. - - *) Исправление: модуль ngx_http_dav_module при перемещении файла между - файловыми системами с помощью метода MOVE устанавливал нулевые права - доступа на результирующий файл и не сохранял время изменения файла. - - *) Исправление: модуль ngx_http_dav_module при копировании файла с - помощью метода COPY для результирующего файла использовал права - доступа по умолчанию. - - *) Изменение: некоторые клиенты могли не работать при использовании - HTTP/2; ошибка появилась в 1.13.5. - - *) Исправление: nginx не собирался с LibreSSL 2.8.0. - - -Изменения в nginx 1.15.2 24.07.2018 - - *) Добавление: переменная $ssl_preread_protocol в модуле - ngx_stream_ssl_preread_module. - - *) Добавление: теперь при использовании директивы - reset_timedout_connection nginx сбрасывает соединения, закрываемые с - кодом 444. - - *) Изменение: уровень логгирования ошибок SSL "http request", "https - proxy request", "unsupported protocol" и "version too low" понижен с - уровня crit до info. - - *) Исправление: запросы к DNS-серверу не отправлялись повторно, если при - первой попытке отправки происходила ошибка. - - *) Исправление: параметр reuseport директивы listen игнорировался, если - количество рабочих процессов было задано после директивы listen. - - *) Исправление: при использовании OpenSSL 1.1.0 и новее директиву - ssl_prefer_server_ciphers нельзя было выключить в виртуальном - сервере, если она была включена в сервере по умолчанию. - - *) Исправление: повторное использование SSL-сессий к бэкендам не - работало с протоколом TLS 1.3. - - -Изменения в nginx 1.15.1 03.07.2018 - - *) Добавление: директива random в блоке upstream. - - *) Добавление: улучшена производительность при использовании директив - hash и ip_hash совместно с директивой zone. - - *) Добавление: параметр reuseport директивы listen теперь использует - SO_REUSEPORT_LB на FreeBSD 12. - - *) Исправление: HTTP/2 server push не работал, если SSL терминировался - прокси-сервером перед nginx'ом. - - *) Исправление: директива tcp_nopush всегда использовалась для - соединений к бэкендам. - - *) Исправление: при отправке сохранённого на диск тела запроса на - gRPC-бэкенд могли возникать ошибки. - - -Изменения в nginx 1.15.0 05.06.2018 - - *) Изменение: директива "ssl" теперь считается устаревшей; вместо неё - следует использовать параметр ssl директивы listen. - - *) Изменение: теперь при использовании директивы listen с параметром ssl - nginx определяет отсутствие SSL-сертификатов при тестировании - конфигурации. - - *) Добавление: теперь модуль stream умеет обрабатывать несколько - входящих UDP-пакетов от клиента в рамках одной сессии. - - *) Исправление: в директиве proxy_cache_valid можно было указать - некорректный код ответа. - - *) Исправление: nginx не собирался gcc 8.1. - - *) Исправление: логгирование в syslog останавливалось при изменении - локального IP-адреса. - - *) Исправление: nginx не собирался компилятором clang, если был - установлен CUDA SDK; ошибка появилась в 1.13.8. - - *) Исправление: при использовании unix domain listen-сокетов на FreeBSD - в процессе обновления исполняемого файла в логе могли появляться - сообщения "getsockopt(TCP_FASTOPEN) ... failed". - - *) Исправление: nginx не собирался на Fedora 28 Linux. - - *) Исправление: при использовании директивы limit_req заданная скорость - обработки запросов могла не соблюдаться. - - *) Исправление: в обработке адресов клиентов при использовании unix - domain listen-сокетов для работы с датаграммами на Linux. - - *) Исправление: в обработке ошибок выделения памяти. - - -Изменения в nginx 1.13.12 10.04.2018 - - *) Исправление: при возврате большого ответа соединения с gRPC-бэкендами - могли неожиданно закрываться. - - -Изменения в nginx 1.13.11 03.04.2018 - - *) Добавление: параметр proxy_protocol директивы listen теперь - поддерживает протокол PROXY версии 2. - - *) Исправление: nginx не собирался с OpenSSL 1.1.1 статически на Linux. - - *) Исправление: в параметрах http_404, http_500 и им подобных директивы - proxy_next_upstream. - - -Изменения в nginx 1.13.10 20.03.2018 - - *) Добавление: теперь параметр set в SSI-директиве include позволяет - сохранять в переменную любые ответы; максимальный размер ответа - задаётся директивой subrequest_output_buffer_size. - - *) Добавление: теперь nginx использует вызов - clock_gettime(CLOCK_MONOTONIC), если он доступен, что позволяет - избежать некорректного срабатывания таймаутов при изменениях - системного времени. - - *) Добавление: параметр "escape=none" директивы log_format. - Спасибо Johannes Baiter и Calin Don. - - *) Добавление: переменная $ssl_preread_alpn_protocols в модуле - ngx_stream_ssl_preread_module. - - *) Добавление: модуль ngx_http_grpc_module. - - *) Исправление: в обработке ошибок выделения памяти в директиве geo. - - *) Исправление: при использовании переменных в директиве - auth_basic_user_file в лог мог выводиться символ '\0'. - Спасибо Вадиму Филимонову. - - -Изменения в nginx 1.13.9 20.02.2018 - - *) Добавление: поддержка HTTP/2 server push; директивы http2_push и - http2_push_preload. - - *) Исправление: при использовании кэша в логах могли появляться - сообщения "header already sent"; ошибка появилась в 1.9.13. - - *) Исправление: при использовании директивы ssl_verify_client в рабочем - процессе мог произойти segmentation fault, если в виртуальном сервере - не был указан SSL-сертификат. - - *) Исправление: в модуле ngx_http_v2_module. - - *) Исправление: в модуле ngx_http_dav_module. - - -Изменения в nginx 1.13.8 26.12.2017 - - *) Добавление: теперь при использовании параметра transparent директив - proxy_bind, fastcgi_bind, memcached_bind, scgi_bind и uwsgi_bind - nginx автоматически сохраняет capability CAP_NET_RAW в рабочих - процессах. - - *) Добавление: улучшения в определении размера строки кэша процессора. - Спасибо Debayan Ghosh. - - *) Добавление: новые директивы в скриптах подсветки синтаксиса для vim. - Спасибо Геннадию Махомеду. - - *) Исправление: процедура обновления исполняемого файла не работала, - если после завершения родительского процесса новым родительским - процессом nginx'а становился процесс с PID, отличным от 1. - - *) Исправление: модуль ngx_http_autoindex_module неправильно обрабатывал - запросы с телом. - - *) Исправление: в директиве proxy_limit_rate при использовании с - директивой keepalive. - - *) Исправление: при использовании "proxy_buffering off" часть ответа - могла буферизироваться, если клиентское соединение использовало SSL. - Спасибо Patryk Lesiewicz. - - *) Исправление: в директиве proxy_cache_background_update. - - *) Исправление: переменную вида "${name}" с именем в фигурных скобках - нельзя было использовать в начале параметра не заключив весь параметр - в кавычки. - - -Изменения в nginx 1.13.7 21.11.2017 - - *) Исправление: в переменной $upstream_status. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если бэкенд возвращал ответ "101 Switching Protocols" на подзапрос. - - *) Исправление: если при переконфигурации изменялся размер зоны - разделяемой памяти и переконфигурация завершалась неудачно, то в - главном процессе происходил segmentation fault. - - *) Исправление: в модуле ngx_http_fastcgi_module. - - *) Исправление: nginx возвращал ошибку 500, если в директиве - xslt_stylesheet были заданы параметры без использования переменных. - - *) Изменение: при использовании варианта библиотеки zlib от Intel в лог - писались сообщения "gzip filter failed to use preallocated memory". - - *) Исправление: директива worker_shutdown_timeout не работала при - использовании почтового прокси-сервера и при проксировании - WebSocket-соединений. - - -Изменения в nginx 1.13.6 10.10.2017 - - *) Исправление: при использовании директивы ssl_preread в модуле stream - не работало переключение на следующий бэкенд. - - *) Исправление: в модуле ngx_http_v2_module. - Спасибо Piotr Sikora. - - *) Исправление: nginx не поддерживал даты после 2038 года на 32-битных - платформах с 64-битным time_t. - - *) Исправление: в обработке дат до 1970 года и после 10000 года. - - *) Исправление: в модуле stream таймауты ожидания UDP-пакетов от - бэкендов не логгировались или логгировались на уровне info вместо - error. - - *) Исправление: при использовании HTTP/2 nginx мог вернуть ошибку 400, - не указав в логе причину. - - *) Исправление: в обработке повреждённых файлов кэша. - - *) Исправление: при кэшировании ошибок, перехваченных error_page, не - учитывались заголовки управления кэшированием. - - *) Исправление: при использовании HTTP/2 тело запроса могло быть - повреждено. - - *) Исправление: в обработке адресов клиентов при использовании unix - domain сокетов. - - *) Исправление: при использовании директивы "hash ... consistent" в - блоке upstream nginx нагружал процессор, если использовались большие - веса и все или почти все бэкенды были недоступны. - - -Изменения в nginx 1.13.5 05.09.2017 - - *) Добавление: переменная $ssl_client_escaped_cert. - - *) Исправление: директива ssl_session_ticket_key и параметр include - директивы geo не работали на Windows. - - *) Исправление: на 32-битных платформах при запросе более 4 гигабайт с - помощью нескольких диапазонов возвращалась некорректная длина ответа. - - *) Исправление: директива "expires modified" и обработка строки If-Range - заголовка запроса не учитывали время последнего изменения ответа, - если использовалось проксирование без кэширования. - - -Изменения в nginx 1.13.4 08.08.2017 - - *) Добавление: модуль ngx_http_mirror_module. - - *) Исправление: клиентские соединения могли сбрасываться при - тестировании конфигурации, если использовался параметр reuseport - директивы listen на Linux. - - *) Исправление: тело запроса могло быть недоступно в подзапросах, если - оно было сохранено в файл и использовалось проксирование. - - *) Исправление: очистка кэша по max_size не работала на Windows. - - *) Исправление: любое выделение разделяемой памяти на Windows требовало - 4096 байт памяти. - - *) Исправление: при использовании директивы zone в блоке upstream на - Windows рабочий процесс мог завершаться аварийно. - - -Изменения в nginx 1.13.3 11.07.2017 - - *) Безопасность: специально созданный запрос мог вызвать целочисленное - переполнение в range-фильтре и последующую некорректную обработку - запрошенных диапазонов, что потенциально могло привести к утечке - конфиденциальной информации (CVE-2017-7529). - - -Изменения в nginx 1.13.2 27.06.2017 - - *) Изменение: теперь при запросе диапазона, начинающегося с 0, из - пустого файла nginx возвращает ответ 200 вместо 416. - - *) Добавление: директива add_trailer. - Спасибо Piotr Sikora. - - *) Исправление: nginx не собирался под Cygwin и NetBSD; ошибка появилась - в 1.13.0. - - *) Исправление: nginx не собирался под MSYS2 / MinGW 64-bit. - Спасибо Orgad Shaneh. - - *) Исправление: при использовании SSI с большим количеством подзапросов - и proxy_pass с переменными в рабочем процессе мог произойти - segmentation fault. - - *) Исправление: в модуле ngx_http_v2_module. - Спасибо Piotr Sikora. - - -Изменения в nginx 1.13.1 30.05.2017 - - *) Добавление: теперь в качестве параметра директивы set_real_ip_from - можно указывать имя хоста. - - *) Добавление: улучшения в скриптах подсветки синтаксиса для vim. - - *) Добавление: директива worker_cpu_affinity теперь работает на - DragonFly BSD. - Спасибо Sepherosa Ziehau. - - *) Исправление: SSL renegotiation в соединениях к бэкендам не работал - при использовании OpenSSL до 1.1.0. - - *) Изменение: nginx не собирался с Oracle Developer Studio 12.5. - - *) Изменение: теперь cache manager пропускает заблокированные записи при - очистке кэша по max_size. - - *) Исправление: клиентские SSL-соединения сразу закрывались, если - использовался отложенный accept и параметр proxy_protocol директивы - listen. - - *) Исправление: в директиве proxy_cache_background_update. - - *) Изменение: теперь директива tcp_nodelay устанавливает опцию - TCP_NODELAY перед SSL handshake. - - -Изменения в nginx 1.13.0 25.04.2017 - - *) Изменение: теперь SSL renegotiation допускается в соединениях к - бэкендам. - - *) Добавление: параметры rcvbuf и sndbuf директив listen в почтовом - прокси-сервере и модуле stream. - - *) Добавление: директивы return и error_page теперь могут использоваться - для возврата перенаправлений с кодом 308. - Спасибо Simon Leblanc. - - *) Добавление: параметр TLSv1.3 в директиве ssl_protocols. - - *) Добавление: при логгировании сигналов теперь указывается PID - отправившего сигнал процесса. - - *) Исправление: в обработке ошибок выделения памяти. - - *) Исправление: если сервер в модуле stream слушал на wildcard-адресе, - исходящий адрес ответного UDP-пакета мог отличаться от адреса - назначения исходного пакета. - - -Изменения в nginx 1.11.13 04.04.2017 - - *) Добавление: параметр http_429 в директивах proxy_next_upstream, - fastcgi_next_upstream, scgi_next_upstream и uwsgi_next_upstream. - Спасибо Piotr Sikora. - - *) Исправление: в обработке ошибок выделения памяти. - - *) Исправление: при использовании директив sendfile и timer_resolution - на Linux запросы могли зависать. - - *) Исправление: при использовании с подзапросами директив sendfile и - aio_write запросы могли зависать. - - *) Исправление: в модуле ngx_http_v2_module. - Спасибо Piotr Sikora. - - *) Исправление: при использовании HTTP/2 в рабочем процессе мог - произойти segmentation fault. - - *) Исправление: запросы могли зависать при использовании с подзапросами - директив limit_rate, sendfile_max_chunk, limit_req или метода - $r->sleep() встроенного перла. - - *) Исправление: в модуле ngx_http_slice_module. - - -Изменения в nginx 1.11.12 24.03.2017 - - *) Исправление: nginx мог нагружать процессор; ошибка появилась в - 1.11.11. - - -Изменения в nginx 1.11.11 21.03.2017 - - *) Добавление: директива worker_shutdown_timeout. - - *) Добавление: улучшения в скриптах подсветки синтаксиса для vim. - Спасибо Wei-Ko Kao. - - *) Исправление: при попытке установить переменную $limit_rate в пустую - строку в рабочем процессе мог произойти segmentation fault. - - *) Исправление: директивы proxy_cache_background_update, - fastcgi_cache_background_update, scgi_cache_background_update и - uwsgi_cache_background_update могли работать некорректно, если - использовалась директива if. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если количество large_client_header_buffers в виртуальном сервере - отличалось от такового в сервере по умолчанию. - - *) Исправление: в почтовом прокси-сервере. - - -Изменения в nginx 1.11.10 14.02.2017 - - *) Изменение: формат заголовка кэша был изменен, ранее закэшированные - ответы будут загружены заново. - - *) Добавление: поддержка расширений stale-while-revalidate и - stale-if-error в строке "Cache-Control" в заголовке ответа бэкенда. - - *) Добавление: директивы proxy_cache_background_update, - fastcgi_cache_background_update, scgi_cache_background_update и - uwsgi_cache_background_update. - - *) Добавление: теперь nginx может кэшировать ответы со строкой Vary - заголовка длиной до 128 символов (вместо 42 символов в предыдущих - версиях). - - *) Добавление: параметр build директивы server_tokens. - Спасибо Tom Thorogood. - - *) Исправление: при обработке запросов со строкой "Expect: 100-continue" - в заголовке запроса в логах могли появляться сообщения "[crit] - SSL_write() failed". - - *) Исправление: модуль ngx_http_slice_module не работал в именованных - location'ах. - - *) Исправление: при использовании AIO после перенаправления запроса с - помощью X-Accel-Redirect в рабочем процессе мог произойти - segmentation fault. - - *) Исправление: уменьшено потребление памяти для долгоживущих запросов, - использующих сжатие. - - -Изменения в nginx 1.11.9 24.01.2017 - - *) Исправление: при использовании модуля stream nginx мог нагружать - процессор; ошибка появилась в 1.11.5. - - *) Исправление: метод аутентификации EXTERNAL в почтовом прокси-сервере - можно было использовать, даже если он не был разрешён в конфигурации. - - *) Исправление: при использовании директивы ssl_verify_client модуля - stream в рабочем процессе мог произойти segmentation fault. - - *) Исправление: директива ssl_verify_client модуля stream могла не - работать. - - *) Исправление: при исчерпании рабочим процессом свободных соединений - keepalive-соединения могли закрываться излишне агрессивно. - Спасибо Joel Cunningham. - - *) Исправление: при использовании директивы sendfile на FreeBSD и macOS - мог возвращаться некорректный ответ; ошибка появилась в 1.7.8. - - *) Исправление: при использовании директивы aio_write ответ мог - сохраняться в кэш не полностью. - - *) Исправление: при использовании директивы aio_write могла происходить - утечка сокетов. - - -Изменения в nginx 1.11.8 27.12.2016 - - *) Добавление: директива absolute_redirect. - - *) Добавление: параметр escape директивы log_format. - - *) Добавление: проверка клиентских SSL-сертификатов в модуле stream. - - *) Добавление: директива ssl_session_ticket_key поддерживает шифрование - TLS session tickets с помощью AES256 при использовании с 80-байтными - ключами. - - *) Добавление: поддержка vim-commentary в скриптах для vim. - Спасибо Armin Grodon. - - *) Исправление: рекурсия при получении значений переменных не - ограничивалась. - - *) Исправление: в модуле ngx_stream_ssl_preread_module. - - *) Исправление: если сервер, описанный в блоке upstream в модуле stream, - был признан неработающим, то после истечения fail_timeout он - признавался работающим только после завершения тестового соединения; - теперь достаточно, чтобы соединение было успешно установлено. - - *) Исправление: nginx/Windows не собирался с 64-битным Visual Studio. - - *) Исправление: nginx/Windows не собирался с OpenSSL 1.1.0. - - -Изменения в nginx 1.11.7 13.12.2016 - - *) Изменение: переменная $ssl_client_verify теперь в случае ошибки - проверки клиентского сертификата содержит строку с описанием ошибки, - например, "FAILED:certificate has expired". - - *) Добавление: переменные $ssl_ciphers, $ssl_curves, - $ssl_client_v_start, $ssl_client_v_end и $ssl_client_v_remain. - - *) Добавление: параметр volatile директивы map. - - *) Исправление: при сборке динамических модулей не учитывались заданные - для модуля зависимости. - - *) Исправление: при использовании HTTP/2 и директив limit_req или - auth_request тело запроса могло быть повреждено; ошибка появилась в - 1.11.0. - - *) Исправление: при использовании HTTP/2 в рабочем процессе мог - произойти segmentation fault; ошибка появилась в 1.11.3. - - *) Исправление: в модуле ngx_http_mp4_module. - Спасибо Congcong Hu. - - *) Исправление: в модуле ngx_http_perl_module. - - -Изменения в nginx 1.11.6 15.11.2016 - - *) Изменение: формат переменных $ssl_client_s_dn и $ssl_client_i_dn - изменён на соответствующий RFC 2253 (RFC 4514); значения в старом - формате доступны через переменные $ssl_client_s_dn_legacy и - $ssl_client_i_dn_legacy. - - *) Изменение: при сохранении временных файлов в каталоге кэша они теперь - располагаются не в отдельном подкаталоге для временных файлов, а в - том же подкаталоге, что и соответствующие файлы в кэше. - - *) Добавление: поддержка метода аутентификации EXTERNAL в почтовом - прокси-сервере. - Спасибо Robert Norris. - - *) Добавление: поддержка WebP в модуле ngx_http_image_filter_module. - - *) Добавление: директива proxy_method поддерживает переменные. - Спасибо Дмитрию Лазуркину. - - *) Добавление: директива http2_max_requests в модуле ngx_http_v2_module. - - *) Добавление: директивы proxy_cache_max_range_offset, - fastcgi_cache_max_range_offset, scgi_cache_max_range_offset и - uwsgi_cache_max_range_offset. - - *) Исправление: плавное завершение старых рабочих процессов могло - занимать бесконечное время при использовании HTTP/2. - - *) Исправление: в модуле ngx_http_mp4_module. - - *) Исправление: при проксировании WebSocket-соединений и включённом - кэшировании в логах могли появляться сообщения "ignore long locked - inactive cache entry". - - *) Исправление: если во время SSL handshake с бэкендом происходил - таймаут, nginx ничего не писал в лог и возвращал ответ с кодом 502 - вместо 504. - - -Изменения в nginx 1.11.5 11.10.2016 - - *) Изменение: параметр configure --with-ipv6 упразднён, поддержка IPv6 - теперь собирается автоматически. - - *) Изменение: теперь, если в блоке upstream не оказалось доступных - серверов, nginx не сбрасывает статистику ошибок всех серверов, как - делал ранее, а ожидает истечения fail_timeout. - - *) Добавление: модуль ngx_stream_ssl_preread_module. - - *) Добавление: директива server в блоке upstream поддерживает параметр - max_conns. - - *) Добавление: параметр configure --with-compat. - - *) Добавление: параметры manager_files, manager_threshold и - manager_sleep директив proxy_cache_path, fastcgi_cache_path, - scgi_cache_path и uwsgi_cache_path. - - *) Исправление: при сборке perl-модуля не использовались флаги, заданные - с помощью параметра configure --with-ld-opt. - - *) Исправление: в директиве add_after_body при использовании совместно с - директивой sub_filter. - - *) Исправление: в переменной $realip_remote_addr. - - *) Исправление: директивы dav_access, proxy_store_access, - fastcgi_store_access, scgi_store_access и uwsgi_store_access - игнорировали права, заданные для пользователя. - - *) Исправление: unix domain listen-сокеты могли не наследоваться при - обновлении исполняемого файла на Linux. - - *) Исправление: nginx возвращал ошибку 400 на запросы с символом "-" в - HTTP-методе. - - -Изменения в nginx 1.11.4 13.09.2016 - - *) Добавление: переменная $upstream_bytes_received. - - *) Добавление: переменные $bytes_received, $session_time, $protocol, - $status, $upstream_addr, $upstream_bytes_sent, - $upstream_bytes_received, $upstream_connect_time, - $upstream_first_byte_time и $upstream_session_time в модуле stream. - - *) Добавление: модуль ngx_stream_log_module. - - *) Добавление: параметр proxy_protocol в директиве listen, переменные - $proxy_protocol_addr и $proxy_protocol_port в модуле stream. - - *) Добавление: модуль ngx_stream_realip_module. - - *) Исправление: nginx не собирался с модулем stream и модулем - ngx_http_ssl_module, но без модуля ngx_stream_ssl_module; ошибка - появилась в 1.11.3. - - *) Добавление: опция сокета IP_BIND_ADDRESS_NO_PORT не использовалась; - ошибка появилась в 1.11.2. - - *) Исправление: в параметре ranges директивы geo. - - *) Исправление: при использовании директив "aio threads" и sendfile мог - возвращаться некорректный ответ; ошибка появилась в 1.9.13. - - -Изменения в nginx 1.11.3 26.07.2016 - - *) Изменение: теперь accept_mutex по умолчанию выключен. - - *) Добавление: теперь nginx использует EPOLLEXCLUSIVE на Linux. - - *) Добавление: модуль ngx_stream_geo_module. - - *) Добавление: модуль ngx_stream_geoip_module. - - *) Добавление: модуль ngx_stream_split_clients_module. - - *) Добавление: директивы proxy_pass и proxy_ssl_name в модуле stream - поддерживают переменные. - - *) Исправление: утечки сокетов при использовании HTTP/2. - - *) Исправление: в configure. - Спасибо Piotr Sikora. - - -Изменения в nginx 1.11.2 05.07.2016 - - *) Изменение: теперь nginx всегда использует внутренние реализации MD5 и - SHA1; параметры configure --with-md5 и --with-sha1 упразднены. - - *) Добавление: поддержка переменных в модуле stream. - - *) Добавление: модуль ngx_stream_map_module. - - *) Добавление: модуль ngx_stream_return_module. - - *) Добавление: в директивах proxy_bind, fastcgi_bind, memcached_bind, - scgi_bind и uwsgi_bind теперь можно указывать порт. - - *) Добавление: теперь nginx использует опцию сокета - IP_BIND_ADDRESS_NO_PORT, если она доступна. - - *) Исправление: при использовании HTTP/2 и директивы - proxy_request_buffering в рабочем процессе мог произойти segmentation - fault. - - *) Исправление: при использовании HTTP/2 к запросам, передаваемым на - бэкенд, всегда добавлялась строка заголовка "Content-Length", даже - если у запроса не было тела. - - *) Исправление: при использовании HTTP/2 в логах могли появляться - сообщения "http request count is zero". - - *) Исправление: при использовании директивы sub_filter могло - буферизироваться больше данных, чем это необходимо; проблема - появилась в 1.9.4. - - -Изменения в nginx 1.11.1 31.05.2016 - - *) Безопасность: при записи тела специально созданного запроса во - временный файл в рабочем процессе мог происходить segmentation fault - (CVE-2016-4450); ошибка появилась в 1.3.9. - - -Изменения в nginx 1.11.0 24.05.2016 - - *) Добавление: параметр transparent директив proxy_bind, fastcgi_bind, - memcached_bind, scgi_bind и uwsgi_bind. - - *) Добавление: переменная $request_id. - - *) Добавление: директива map поддерживает комбинации нескольких - переменных в качестве результирующих значений. - - *) Добавление: теперь при использовании метода epoll nginx проверяет, - поддерживает ли ядро события EPOLLRDHUP, и соответственно - оптимизирует обработку соединений. - - *) Добавление: директивы ssl_certificate и ssl_certificate_key теперь - можно указывать несколько раз для загрузки сертификатов разных типов - (например, RSA и ECDSA). - - *) Добавление: при использовании OpenSSL 1.0.2 и новее с помощью - директивы ssl_ecdh_curve теперь можно задать список кривых; по - умолчанию используется встроенный в OpenSSL список кривых. - - *) Изменение: для использования DHE-шифров теперь надо явно задавать - файл параметров с помощью директивы ssl_dhparam. - - *) Добавление: переменная $proxy_protocol_port. - - *) Добавление: переменная $realip_remote_port в модуле - ngx_http_realip_module. - - *) Добавление: модуль ngx_http_realip_module теперь позволяет - устанавливать не только адрес, но и порт клиента. - - *) Изменение: при попытке запросить виртуальный сервер, отличающийся от - согласованного в процессе SSL handshake, теперь возвращается ответ - "421 Misdirected Request"; это улучшает совместимость с некоторыми - HTTP/2-клиентами в случае использования клиентских сертификатов. - - *) Изменение: HTTP/2-клиенты теперь могут сразу присылать тело запроса; - директива http2_body_preread_size позволяет указать размер буфера, - который будет использоваться до того, как nginx начнёт читать тело. - - *) Исправление: при использовании директивы proxy_cache_bypass не - обновлялись закэшированные ошибочные ответы. - - -Изменения в nginx 1.9.15 19.04.2016 - - *) Исправление: при использовании HHVM в качестве FastCGI-сервера могли - возникать ошибки "recv() failed". - - *) Исправление: при использовании HTTP/2 и директив limit_req или - auth_request при чтении тела запроса мог произойти таймаут или ошибка - "client violated flow control"; ошибка появилась в 1.9.14. - - *) Изменение: при использовании HTTP/2 ответ мог не показываться - некоторыми браузерами, если тело запроса было прочитано не целиком; - ошибка появилась в 1.9.14. - - *) Исправление: при использовании директивы "aio threads" соединения - могли зависать. - Спасибо Mindaugas Rasiukevicius. - - -Изменения в nginx 1.9.14 05.04.2016 - - *) Добавление: совместимость с OpenSSL 1.1.0. - - *) Добавление: директивы proxy_request_buffering, - fastcgi_request_buffering, scgi_request_buffering и - uwsgi_request_buffering теперь работают при использовании HTTP/2. - - *) Исправление: при использовании HTTP/2 в логах могли появляться - сообщения "zero size buf in output". - - *) Исправление: при использовании HTTP/2 директива client_max_body_size - могла работать неверно. - - *) Исправление: незначительных ошибок логгирования. - - -Изменения в nginx 1.9.13 29.03.2016 - - *) Изменение: неидемпотентные запросы (POST, LOCK, PATCH) теперь по - умолчанию не передаются на другой сервер, если запрос уже был - отправлен на бэкенд; параметр non_idempotent директивы - proxy_next_upstream явно разрешает повторять такие запросы. - - *) Добавление: модуль ngx_http_perl_module теперь можно собрать - динамически. - - *) Добавление: поддержка UDP в модуле stream. - - *) Добавление: директива aio_write. - - *) Добавление: теперь cache manager следит за количеством элементов в - кэше и старается не допускать переполнений зоны разделяемой памяти. - - *) Исправление: при использовании директив sendfile и aio с подзапросами - в логах могли появляться сообщения "task already active" и "second - aio post". - - *) Исправление: при использовании кэширования в логах могли появляться - сообщения "zero size buf in output", если клиент закрывал соединение - преждевременно. - - *) Исправление: при использовании кэширования соединения с клиентами - могли закрываться без необходимости. - Спасибо Justin Li. - - *) Исправление: nginx мог нагружать процессор при использовании - директивы sendfile на Linux и Solaris, если отправляемый файл был - изменён в процессе отправки. - - *) Исправление: при использовании директив sendfile и "aio threads" - соединения могли зависать. - - *) Исправление: в директивах proxy_pass, fastcgi_pass, scgi_pass и - uwsgi_pass при использовании переменных. - Спасибо Piotr Sikora. - - *) Исправление: в модуле ngx_http_sub_filter_module. - - *) Исправление: если в закэшированном соединении к бэкенду происходила - ошибка, запрос передавался на другой сервер без учёта директивы - proxy_next_upstream. - - *) Исправление: ошибки "CreateFile() failed" при создании временных - файлов на Windows. - - -Изменения в nginx 1.9.12 24.02.2016 - - *) Добавление: кодирование Хаффмана заголовков ответов в HTTP/2. - Спасибо Владу Краснову. - - *) Добавление: директива worker_cpu_affinity теперь поддерживает более - 64 процессоров. - - *) Исправление: совместимость со сторонними модулями на C++; ошибка - появилась в 1.9.11. - Спасибо Piotr Sikora. - - *) Исправление: nginx не собирался статически с OpenSSL на Linux; ошибка - появилась в 1.9.11. - - *) Исправление: директива "add_header ... always" с пустым значением не - удаляла из заголовков ошибочных ответов строки Last-Modified и ETag. - - *) Изменение: при использовании OpenSSL 1.0.2f в логах могли появляться - сообщения "called a function you should not call" и "shutdown while - in init". - - *) Исправление: ошибочные заголовки могли логгироваться некорректно. - - *) Исправление: утечки сокетов при использовании HTTP/2. - - *) Исправление: в модуле ngx_http_v2_module. - - -Изменения в nginx 1.9.11 09.02.2016 - - *) Добавление: теперь resolver поддерживает TCP. - - *) Добавление: динамические модули. - - *) Исправление: при использовании HTTP/2 переменная $request_length не - учитывала размер заголовков запроса. - - *) Исправление: в модуле ngx_http_v2_module. - - -Изменения в nginx 1.9.10 26.01.2016 - - *) Безопасность: при использовании директивы resolver во время обработки - ответов DNS-сервера могло происходить разыменование некорректного - адреса, что позволяло атакующему, имеющему возможность подделывать - UDP-пакеты от DNS-сервера, вызвать segmentation fault в рабочем - процессе (CVE-2016-0742). - - *) Безопасность: при использовании директивы resolver во время обработки - CNAME-записей могло произойти обращение к ранее освобождённой памяти, - что позволяло атакующему, имеющему возможность инициировать - преобразование произвольных имён в адреса, вызвать segmentation fault - в рабочем процессе, а также потенциально могло иметь другие - последствия (CVE-2016-0746). - - *) Безопасность: при использовании директивы resolver во время обработки - CNAME-записей не во всех случаях проверялось ограничение на - максимальное количество записей в цепочке, что позволяло атакующему, - имеющему возможность инициировать преобразование произвольных имён в - адреса, вызвать чрезмерное потребление ресурсов рабочими процессами - (CVE-2016-0747). - - *) Добавление: параметр auto директивы worker_cpu_affinity. - - *) Исправление: параметр proxy_protocol директивы listen не работал с - IPv6 listen-сокетами. - - *) Исправление: при использовании директивы keepalive соединения к - бэкендам могли кэшироваться некорректно. - - *) Исправление: после перенаправления запроса с помощью X-Accel-Redirect - при проксировании использовался HTTP-метод оригинального запроса. - - -Изменения в nginx 1.9.9 09.12.2015 - - *) Исправление: проксирование в unix domain сокеты не работало при - использовании переменных; ошибка появилась в 1.9.8. - - -Изменения в nginx 1.9.8 08.12.2015 - - *) Добавление: поддержка pwritev(). - - *) Добавление: директива include в блоке upstream. - - *) Добавление: модуль ngx_http_slice_module. - - *) Исправление: при использовании LibreSSL в рабочем процессе мог - произойти segmentation fault; ошибка появилась в 1.9.6. - - *) Исправление: nginx мог не собираться на OS X. - - -Изменения в nginx 1.9.7 17.11.2015 - - *) Добавление: параметр nohostname логгирования в syslog. - - *) Добавление: директива proxy_cache_convert_head. - - *) Добавление: переменная $realip_remote_addr в модуле - ngx_http_realip_module. - - *) Исправление: директива expires могла не срабатывать при использовании - переменных. - - *) Исправление: при использовании HTTP/2 в рабочем процессе мог - произойти segmentation fault; ошибка появилась в 1.9.6. - - *) Исправление: если nginx был собран с модулем ngx_http_v2_module, - протокол HTTP/2 мог быть использован клиентом, даже если не был - указан параметр http2 директивы listen. - - *) Исправление: в модуле ngx_http_v2_module. - - -Изменения в nginx 1.9.6 27.10.2015 - - *) Исправление: при использовании HTTP/2 в рабочем процессе мог - произойти segmentation fault. - Спасибо Piotr Sikora и Denis Andzakovic. - - *) Исправление: при использовании HTTP/2 переменная $server_protocol - была пустой. - - *) Исправление: SSL-соединения к бэкендам в модуле stream могли - неожиданно завершаться по таймауту. - - *) Исправление: при использовании различных настроек ssl_session_cache в - разных виртуальных серверах в рабочем процессе мог произойти - segmentation fault. - - *) Исправление: nginx/Windows не собирался с MinGW gcc; ошибка появилась - в 1.9.4. - Спасибо Kouhei Sutou. - - *) Исправление: при использовании директивы timer_resolution на Windows - время не обновлялось. - - *) Незначительные исправления и улучшения. - Спасибо Markus Linnala, Kurtis Nusbaum и Piotr Sikora. - - -Изменения в nginx 1.9.5 22.09.2015 - - *) Добавление: модуль ngx_http_v2_module (заменяет модуль - ngx_http_spdy_module). - Спасибо Dropbox и Automattic за спонсирование разработки. - - *) Изменение: теперь по умолчанию директива output_buffers использует - два буфера. - - *) Изменение: теперь nginx ограничивает максимальную вложенность - подзапросов, а не количество одновременных подзапросов. - - *) Изменение: теперь при возврате ответов из кэша nginx проверяет ключ - полностью. - Спасибо Геннадию Махомеду и Сергею Брестеру. - - *) Исправление: при использовании кэша в логах могли появляться - сообщения "header already sent"; ошибка появилась в 1.7.5. - - *) Исправление: при использовании CephFS и директивы timer_resolution на - Linux в логах могли появляться сообщения "writev() failed (4: - Interrupted system call)". - - *) Исправление: в обработке ошибок конфигурации. - Спасибо Markus Linnala. - - *) Исправление: при использовании директивы sub_filter на уровне http в - рабочем процессе происходил segmentation fault; ошибка появилась в - 1.9.4. - - -Изменения в nginx 1.9.4 18.08.2015 - - *) Изменение: директивы proxy_downstream_buffer и proxy_upstream_buffer - в модуле stream заменены директивой proxy_buffer_size. - - *) Добавление: директива tcp_nodelay в модуле stream. - - *) Добавление: теперь можно указать несколько директив sub_filter - одновременно. - - *) Добавление: директива sub_filter поддерживает переменные в строке - поиска. - - *) Изменение: тестирование конфигурации могло не работать под Linux - OpenVZ. - Спасибо Геннадию Махомеду. - - *) Исправление: после переконфигурации старые рабочие процессы могли - сильно нагружать процессор при больших значениях worker_connections. - - *) Исправление: при совместном использовании директив try_files и alias - внутри location'а, заданного регулярным выражением, в рабочем - процессе мог произойти segmentation fault; ошибка появилась в 1.7.1. - - *) Исправление: директива try_files внутри вложенного location'а, - заданного регулярным выражением, работала неправильно, если во - внешнем location'е использовалась директива alias. - - *) Исправление: в обработке ошибок при построении хэш-таблиц. - - *) Исправление: nginx не собирался с Visual Studio 2015. - - -Изменения в nginx 1.9.3 14.07.2015 - - *) Изменение: дублирующиеся блоки http, mail и stream теперь запрещены. - - *) Добавление: ограничение количества соединений в модуле stream. - - *) Добавление: ограничение скорости в модуле stream. - - *) Исправление: директива zone в блоке upstream не работала на Windows. - - *) Исправление: совместимость с LibreSSL в модуле stream. - Спасибо Piotr Sikora. - - *) Исправление: в параметре --builddir в configure. - Спасибо Piotr Sikora. - - *) Исправление: директива ssl_stapling_file не работала; ошибка - появилась в 1.9.2. - Спасибо Faidon Liambotis и Brandon Black. - - *) Исправление: при использовании директивы ssl_stapling в рабочем - процессе мог произойти segmentation fault; ошибка появилась в 1.9.2. - Спасибо Matthew Baldwin. - - -Изменения в nginx 1.9.2 16.06.2015 - - *) Добавление: параметр backlog директивы listen в почтовом - прокси-сервере и модуле stream. - - *) Добавление: директивы allow и deny в модуле stream. - - *) Добавление: директива proxy_bind в модуле stream. - - *) Добавление: директива proxy_protocol в модуле stream. - - *) Добавление: ключ -T. - - *) Добавление: параметр REQUEST_SCHEME добавлен в стандартные - конфигурационные файлы fastcgi.conf, fastcgi_params, scgi_params и - uwsgi_params. - - *) Исправление: параметр reuseport директивы listen в модуле stream не - работал. - - *) Исправление: OCSP stapling в некоторых случаях мог вернуть устаревший - OCSP-ответ. - - -Изменения в nginx 1.9.1 26.05.2015 - - *) Изменение: теперь протокол SSLv3 по умолчанию запрещён. - - *) Изменение: некоторые давно устаревшие директивы больше не - поддерживаются. - - *) Добавление: параметр reuseport директивы listen. - Спасибо Yingqi Lu из Intel и Sepherosa Ziehau. - - *) Добавление: переменная $upstream_connect_time. - - *) Исправление: в директиве hash на big-endian платформах. - - *) Исправление: nginx мог не запускаться на некоторых старых версиях - Linux; ошибка появилась в 1.7.11. - - *) Исправление: в парсинге IP-адресов. - Спасибо Сергею Половко. - - -Изменения в nginx 1.9.0 28.04.2015 - - *) Изменение: устаревшие методы обработки соединений aio и rtsig больше - не поддерживаются. - - *) Добавление: директива zone в блоке upstream. - - *) Добавление: модуль stream. - - *) Добавление: поддержка byte ranges для ответов модуля - ngx_http_memcached_module. - Спасибо Martin Mlynář. - - *) Добавление: разделяемую память теперь можно использовать на версиях - Windows с рандомизацией адресного пространства. - Спасибо Сергею Брестеру. - - *) Добавление: директиву error_log теперь можно использовать на уровнях - mail и server в почтовом прокси-сервере. - - *) Исправление: параметр proxy_protocol директивы listen не работал, - если не был указан в первой директиве listen для данного - listen-сокета. - - -Изменения в nginx 1.7.12 07.04.2015 - - *) Добавление: теперь директива tcp_nodelay работает для SSL-соединений - с бэкендами. - - *) Добавление: теперь потоки могут использоваться для чтения заголовков - файлов в кэше. - - *) Исправление: в директиве proxy_request_buffering. - - *) Исправление: при использовании потоков на Linux в рабочем процессе - мог произойти segmentation fault. - - *) Исправление: в обработке ошибок при использовании директивы - ssl_stapling. - Спасибо Filipe da Silva. - - *) Исправление: в модуле ngx_http_spdy_module. - - -Изменения в nginx 1.7.11 24.03.2015 - - *) Изменение: параметр sendfile директивы aio более не нужен; теперь - nginx автоматически использует AIO для подгрузки данных для sendfile, - если одновременно используются директивы aio и sendfile. - - *) Добавление: экспериментальная поддержка потоков. - - *) Добавление: директивы proxy_request_buffering, - fastcgi_request_buffering, scgi_request_buffering и - uwsgi_request_buffering. - - *) Добавление: экспериментальное API для обработки тела запроса. - - *) Добавление: проверка клиентских SSL-сертификатов в почтовом - прокси-сервере. - Спасибо Sven Peter, Franck Levionnois и Filipe Da Silva. - - *) Добавление: уменьшение времени запуска при использовании директивы - "hash ... consistent" в блоке upstream. - Спасибо Wai Keen Woon. - - *) Добавление: отладочное логгирование в кольцевой буфер в памяти. - - *) Исправление: в обработке хэш-таблиц. - Спасибо Chris West. - - *) Исправление: в директиве proxy_cache_revalidate. - - *) Исправление: SSL-соединения могли зависать, если использовался - отложенный accept или параметр proxy_protocol директивы listen. - Спасибо James Hamlin. - - *) Исправление: переменная $upstream_response_time могла содержать - неверное значение при использовании директивы image_filter. - - *) Исправление: в обработке целочисленных переполнений. - Спасибо Régis Leroy. - - *) Исправление: при использовании LibreSSL было невозможно включить - поддержку SSLv3. - - *) Исправление: при использовании LibreSSL в логах появлялись сообщения - "ignoring stale global SSL error ... called a function you should not - call". - - *) Исправление: сертификаты, указанные в директивах - ssl_client_certificate и ssl_trusted_certificate, использовались для - автоматического построения цепочек сертификатов. - - -Изменения в nginx 1.7.10 10.02.2015 - - *) Добавление: параметр use_temp_path директив proxy_cache_path, - fastcgi_cache_path, scgi_cache_path и uwsgi_cache_path. - - *) Добавление: переменная $upstream_header_time. - - *) Изменение: теперь при переполнении диска nginx пытается писать - error_log'и только раз в секунду. - - *) Исправление: директива try_files при тестировании каталогов не - игнорировала обычные файлы. - Спасибо Damien Tournoud. - - *) Исправление: при использовании директивы sendfile на OS X возникали - ошибки "sendfile() failed"; ошибка появилась в nginx 1.7.8. - - *) Исправление: в лог могли писаться сообщения "sem_post() failed". - - *) Исправление: nginx не собирался с musl libc. - Спасибо James Taylor. - - *) Исправление: nginx не собирался на Tru64 UNIX. - Спасибо Goetz T. Fischer. - - -Изменения в nginx 1.7.9 23.12.2014 - - *) Добавление: директивы proxy_cache, fastcgi_cache, scgi_cache и - uwsgi_cache поддерживают переменные. - - *) Добавление: директива expires поддерживает переменные. - - *) Добавление: возможность загрузки секретных ключей с аппаратных - устройств с помощью OpenSSL engines. - Спасибо Дмитрию Пичулину. - - *) Добавление: директива autoindex_format. - - *) Исправление: ревалидация элементов кэша теперь используется только - для ответов с кодами 200 и 206. - Спасибо Piotr Sikora. - - *) Исправление: строка "TE" заголовка запроса клиента передавалась на - бэкенд при проксировании. - - *) Исправление: директивы proxy_pass, fastcgi_pass, scgi_pass и - uwsgi_pass могли неправильно работать внутри блоков if и - limit_except. - - *) Исправление: директива proxy_store с параметром "on" игнорировалась, - если на предыдущем уровне использовалась директива proxy_store с явно - заданным путём к файлам. - - *) Исправление: nginx не собирался с BoringSSL. - Спасибо Lukas Tribus. - - -Изменения в nginx 1.7.8 02.12.2014 - - *) Изменение: теперь строки "If-Modified-Since", "If-Range" и им - подобные в заголовке запроса клиента передаются бэкенду при - включённом кэшировании, если nginx заранее знает, что не будет - кэшировать ответ (например, при использовании proxy_cache_min_uses). - - *) Изменение: теперь после истечения proxy_cache_lock_timeout nginx - отправляет запрос на бэкенд без кэширования; новые директивы - proxy_cache_lock_age, fastcgi_cache_lock_age, scgi_cache_lock_age и - uwsgi_cache_lock_age позволяют указать, через какое время блокировка - будет принудительно снята и будет сделана ещё одна попытка - закэшировать ответ. - - *) Изменение: директива log_format теперь может использоваться только на - уровне http. - - *) Добавление: директивы proxy_ssl_certificate, - proxy_ssl_certificate_key, proxy_ssl_password_file, - uwsgi_ssl_certificate, uwsgi_ssl_certificate_key и - uwsgi_ssl_password_file. - Спасибо Piotr Sikora. - - *) Добавление: теперь с помощью X-Accel-Redirect можно перейти в - именованный location. - Спасибо Toshikuni Fukaya. - - *) Добавление: теперь директива tcp_nodelay работает для - SPDY-соединений. - - *) Добавление: новые директивы в скриптах подсветки синтаксиса для vim. - Спасибо Peter Wu. - - *) Исправление: nginx игнорировал значение "s-maxage" в строке - "Cache-Control" в заголовке ответа бэкенда. - Спасибо Piotr Sikora. - - *) Исправление: в модуле ngx_http_spdy_module. - Спасибо Piotr Sikora. - - *) Исправление: в директиве ssl_password_file при использовании OpenSSL - 0.9.8zc, 1.0.0o, 1.0.1j. - - *) Исправление: при использовании директивы post_action в лог писались - сообщения "header already sent"; ошибка появилась в nginx 1.5.4. - - *) Исправление: при использовании директивы "postpone_output 0" с - SSI-подзапросами в лог могли писаться сообщения "the http output - chain is empty". - - *) Исправление: в директиве proxy_cache_lock при использовании - SSI-подзапросов. - Спасибо Yichun Zhang. - - -Изменения в nginx 1.7.7 28.10.2014 - - *) Изменение: теперь nginx учитывает при кэшировании строку "Vary" в - заголовке ответа бэкенда. - - *) Добавление: директивы proxy_force_ranges, fastcgi_force_ranges, - scgi_force_ranges и uwsgi_force_ranges. - - *) Добавление: директивы proxy_limit_rate, fastcgi_limit_rate, - scgi_limit_rate и uwsgi_limit_rate. - - *) Добавление: параметр Vary директив proxy_ignore_headers, - fastcgi_ignore_headers, scgi_ignore_headers и uwsgi_ignore_headers. - - *) Исправление: последняя часть ответа, полученного от бэкенда при - небуферизированном проксировании, могла не отправляться клиенту, если - использовались директивы gzip или gunzip. - - *) Исправление: в директиве proxy_cache_revalidate. - Спасибо Piotr Sikora. - - *) Исправление: в обработке ошибок. - Спасибо Yichun Zhang и Даниилу Бондареву. - - *) Исправление: в директивах proxy_next_upstream_tries и - proxy_next_upstream_timeout. - Спасибо Feng Gu. - - *) Исправление: nginx/Windows не собирался с MinGW-w64 gcc. - Спасибо Kouhei Sutou. - - -Изменения в nginx 1.7.6 30.09.2014 - - *) Изменение: устаревшая директива limit_zone больше не поддерживается. - - *) Добавление: в директивах limit_conn_zone и limit_req_zone теперь - можно использовать комбинации нескольких переменных. - - *) Исправление: при повторной отправке FastCGI-запроса на бэкенд тело - запроса могло передаваться неправильно. - - *) Исправление: в логгировании в syslog. - - -Изменения в nginx 1.7.5 16.09.2014 +Изменения в nginx 1.6.2 16.09.2014 *) Безопасность: при использовании общего для нескольких блоков server разделяемого кэша SSL-сессий или общего ключа для шифрования TLS @@ -2448,172 +7,32 @@ контексте другого блока server (CVE-2014-3616). Спасибо Antoine Delignat-Lavaud. - *) Изменение: директиву stub_status теперь можно указывать без - параметров. - - *) Добавление: параметр always директивы add_header. - - *) Добавление: директивы proxy_next_upstream_tries, - proxy_next_upstream_timeout, fastcgi_next_upstream_tries, - fastcgi_next_upstream_timeout, memcached_next_upstream_tries, - memcached_next_upstream_timeout, scgi_next_upstream_tries, - scgi_next_upstream_timeout, uwsgi_next_upstream_tries и - uwsgi_next_upstream_timeout. - - *) Исправление: в параметре if директивы access_log. - - *) Исправление: в модуле ngx_http_perl_module. - Спасибо Piotr Sikora. - - *) Исправление: директива listen почтового прокси-сервера не позволяла - указать более двух параметров. - - *) Исправление: директива sub_filter не работала с заменяемой строкой из - одного символа. + *) Исправление: запросы могли зависать, если использовался resolver и + DNS-сервер возвращал некорректный ответ; ошибка появилась в 1.5.8. *) Исправление: запросы могли зависать, если использовался resolver и в процессе обращения к DNS-серверу происходил таймаут. - *) Исправление: в модуле ngx_http_spdy_module при использовании - совместно с AIO. - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если с помощью директивы set изменялись переменные "$http_...", - "$sent_http_..." или "$upstream_http_...". - - *) Исправление: в обработке ошибок выделения памяти. - Спасибо Markus Linnala и Feng Gu. - - -Изменения в nginx 1.7.4 05.08.2014 +Изменения в nginx 1.6.1 05.08.2014 *) Безопасность: pipelined-команды не отбрасывались после команды STARTTLS в SMTP прокси-сервере (CVE-2014-3556); ошибка появилась в 1.5.6. Спасибо Chris Boulton. - *) Изменение: экранирование символов в URI теперь использует - шестнадцатеричные цифры в верхнем регистре. - Спасибо Piotr Sikora. - - *) Добавление: теперь nginx можно собрать с BoringSSL и LibreSSL. - Спасибо Piotr Sikora. - - *) Исправление: запросы могли зависать, если использовался resolver и - DNS-сервер возвращал некорректный ответ; ошибка появилась в 1.5.8. - - *) Исправление: в модуле ngx_http_spdy_module. - Спасибо Piotr Sikora. - *) Исправление: переменная $uri могла содержать мусор при возврате ошибок с кодом 400. Спасибо Сергею Боброву. - *) Исправление: в обработке ошибок в директиве proxy_store и в модуле - ngx_http_dav_module. - Спасибо Feng Gu. - - *) Исправление: при логгировании ошибок в syslog мог происходить - segmentation fault; ошибка появилась в 1.7.1. - - *) Исправление: переменные $geoip_latitude, $geoip_longitude, - $geoip_dma_code и $geoip_area_code могли не работать. - Спасибо Yichun Zhang. - - *) Исправление: в обработке ошибок выделения памяти. - Спасибо Tatsuhiko Kubo и Piotr Sikora. - - -Изменения в nginx 1.7.3 08.07.2014 - - *) Добавление: weak entity tags теперь не удаляются при изменениях - ответа, а strong entity tags преобразуются в weak. - - *) Добавление: ревалидация элементов кэша теперь, если это возможно, - использует заголовок If-None-Match. - - *) Добавление: директива ssl_password_file. - - *) Исправление: при возврате ответа из кэша заголовок запроса - If-None-Match игнорировался, если в ответе не было заголовка - Last-Modified. - - *) Исправление: сообщения "peer closed connection in SSL handshake" при - соединении с бэкендами логгировались на уровне info вместо error. - - *) Исправление: в модуле ngx_http_dav_module в nginx/Windows. - - *) Исправление: SPDY-соединения могли неожиданно закрываться, если - использовалось кэширование. - - -Изменения в nginx 1.7.2 17.06.2014 - - *) Добавление: директива hash в блоке upstream. - - *) Добавление: дефрагментация свободных блоков разделяемой памяти. - Спасибо Wandenberg Peixoto и Yichun Zhang. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовалось значение access_log по умолчанию; ошибка - появилась в 1.7.0. - Спасибо Piotr Sikora. - - *) Исправление: завершающий слэш ошибочно удалялся из последнего - параметра директивы try_files. - - *) Исправление: nginx мог не собираться на OS X. - - *) Исправление: в модуле ngx_http_spdy_module. - - -Изменения в nginx 1.7.1 27.05.2014 - - *) Добавление: переменные "$upstream_cookie_...". - - *) Добавление: переменная $ssl_client_fingerprint. - - *) Добавление: директивы error_log и access_log теперь поддерживают - логгирование в syslog. - - *) Добавление: почтовый прокси-сервер теперь логгирует порт клиента при - соединении. - - *) Исправление: утечки памяти при использовании директивы - "ssl_stapling". - Спасибо Filipe da Silva. - - *) Исправление: директива alias внутри location'а, заданного регулярным - выражением, работала неправильно, если использовались директивы if - или limit_except. - - *) Исправление: директива charset не ставила кодировку для сжатых - ответов бэкендов. - - *) Исправление: директива proxy_pass без URI могла использовать - оригинальный запрос после установки переменной $args. - Спасибо Yichun Zhang. - *) Исправление: в работе параметра none директивы smtp_auth; ошибка появилась в 1.5.6. Спасибо Святославу Никольскому. - *) Исправление: при совместном использовании sub_filter и SSI ответы - могли передаваться неверно. - *) Исправление: nginx не собирался с параметром --with-file-aio на - Linux/aarch64. +Изменения в nginx 1.6.0 24.04.2014 - -Изменения в nginx 1.7.0 24.04.2014 - - *) Добавление: проверка SSL-сертификатов бэкендов. - - *) Добавление: поддержка SNI при работе с бэкендами по SSL. - - *) Добавление: переменная $ssl_server_name. - - *) Добавление: параметр if директивы access_log. + *) Стабильная ветка 1.6.x. Изменения в nginx 1.5.13 08.04.2014 @@ -4139,7 +1558,7 @@ Изменения в nginx 0.9.2 06.12.2010 *) Добавление: поддержка строки "If-Unmodified-Since" в заголовке - запроса клиента. + запросе клиента. *) Изменение: использование accept(), если accept4() не реализован; ошибка появилась в 0.9.0. @@ -6087,7 +3506,7 @@ Изменения в nginx 0.6.31 12.05.2008 *) Исправление: nginx не обрабатывал ответ FastCGI-сервера, если строка - заголовка ответа была в конце записи FastCGI; ошибка появилась в + заголовка ответ была в конце записи FastCGI; ошибка появилась в 0.6.2. Спасибо Сергею Серову. @@ -6887,8 +4306,7 @@ Изменения в nginx 0.5.15 19.03.2007 *) Добавление: почтовый прокси-сервер поддерживает аутентифицированное - SMTP-проксирование и директивы smtp_auth, smtp_capabilities и - xclient. + SMTP-проксирование и директивы smtp_auth, smtp_capablities и xclient. Спасибо Антону Южанинову и Максиму Дунину. *) Добавление: теперь keep-alive соединения закрываются сразу же по @@ -7164,7 +4582,7 @@ *) Добавление: директива ip_hash в блоке upstream. - *) Добавление: статус WAIT в строке "Auth-Status" в заголовке ответа + *) Добавление: статус WAIT в строке "Auth-Status" в заголовка ответа сервера аутентификации IMAP/POP3 прокси. *) Исправление: nginx не собирался на 64-битных платформах; ошибка @@ -7238,7 +4656,7 @@ Изменения в nginx 0.4.11 25.10.2006 - *) Добавление: POP3 прокси поддерживает AUTH LOGIN PLAIN и CRAM-MD5. + *) Добавление: POP3 прокси поддерживает AUTH LOIGN PLAIN и CRAM-MD5. *) Добавление: модуль ngx_http_perl_module поддерживает метод $r->allow_ranges. @@ -8093,7 +5511,7 @@ *) Добавление: директива so_keepalive в IMAP/POP3 прокси. *) Исправление: nginx теперь вызывает abort() при обнаружении незакрытых - соединений только при плавном выходе и включённой директиве + соединений только при планом выходе и включённой директиве debug_points. @@ -8649,7 +6067,7 @@ Изменения в nginx 0.1.36 15.06.2005 - *) Изменение: если в заголовке запроса есть дублирующиеся строки "Host", + *) Изменение: если в заголовке запросе есть дублирующиеся строки "Host", "Connection", "Content-Length" и "Authorization", то nginx теперь выдаёт ошибку 400. diff --git a/LICENSE b/LICENSE index 985470e..4ed7a6f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ /* - * Copyright (C) 2002-2021 Igor Sysoev - * Copyright (C) 2011-2024 Nginx, Inc. + * Copyright (C) 2002-2014 Igor Sysoev + * Copyright (C) 2011-2014 Nginx, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/auto/cc/acc b/auto/cc/acc index 64fa671..6baee67 100644 --- a/auto/cc/acc +++ b/auto/cc/acc @@ -12,3 +12,4 @@ CC_TEST_FLAGS="-Ae" PCRE_OPT="$PCRE_OPT -Ae" ZLIB_OPT="$ZLIB_OPT -Ae" +MD5_OPT="$MD5_OPT -Ae" diff --git a/auto/cc/bcc b/auto/cc/bcc index e990a9f..ec82e60 100644 --- a/auto/cc/bcc +++ b/auto/cc/bcc @@ -62,6 +62,7 @@ ngx_include_opt="-I" ngx_objout="-o" ngx_binout="-e" ngx_objext="obj" +ngx_binext=".exe" ngx_long_start='@&&| ' diff --git a/auto/cc/clang b/auto/cc/clang index a962ee2..baaf4ba 100644 --- a/auto/cc/clang +++ b/auto/cc/clang @@ -5,9 +5,8 @@ # clang -NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \ - | sed -n -e 's/^.*clang version \(.*\)/\1/p' \ - -e 's/^.*LLVM version \(.*\)/\1/p'` +NGX_CLANG_VER=`$CC -v 2>&1 | grep '\(clang\|LLVM\) version' 2>&1 \ + | sed -e 's/^.* version \(.*\)/\1/'` echo " + clang version: $NGX_CLANG_VER" @@ -67,6 +66,12 @@ else PCRE_OPT="$PCRE_OPT -pipe" fi +if [ ".$MD5_OPT" = "." ]; then + MD5_OPT="-O2 -pipe $CPU_OPT" +else + MD5_OPT="$MD5_OPT -pipe" +fi + if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O2 -pipe $CPU_OPT" else @@ -83,11 +88,6 @@ CFLAGS="$CFLAGS -Wconditional-uninitialized" # we have a lot of unused function arguments CFLAGS="$CFLAGS -Wno-unused-parameter" -# deprecated system OpenSSL library on OS X -if [ "$NGX_SYSTEM" = "Darwin" ]; then - CFLAGS="$CFLAGS -Wno-deprecated-declarations" -fi - # stop on warning CFLAGS="$CFLAGS -Werror" diff --git a/auto/cc/conf b/auto/cc/conf index ba31cb8..edc6d74 100644 --- a/auto/cc/conf +++ b/auto/cc/conf @@ -5,17 +5,12 @@ LINK="\$(CC)" -MAIN_LINK= -MODULE_LINK="-shared" - ngx_include_opt="-I " ngx_compile_opt="-c" -ngx_pic_opt="-fPIC" ngx_objout="-o " ngx_binout="-o " ngx_objext="o" ngx_binext= -ngx_modext=".so" ngx_long_start= ngx_long_end= @@ -50,9 +45,6 @@ if test -n "$CFLAGS"; then sunc) - MAIN_LINK= - MODULE_LINK="-G" - case "$NGX_MACHINE" in i86pc) @@ -117,7 +109,7 @@ else . auto/cc/acc ;; - msvc) + msvc*) # MSVC++ 6.0 SP2, MSVC++ Toolkit 2003 . auto/cc/msvc @@ -164,40 +156,22 @@ if [ "$NGX_PLATFORM" != win32 ]; then fi - ngx_feature="-Wl,-E switch" - ngx_feature_name= - ngx_feature_run=no + ngx_feature="gcc builtin atomic operations" + ngx_feature_name=NGX_HAVE_GCC_ATOMIC + ngx_feature_run=yes ngx_feature_incs= ngx_feature_path= - ngx_feature_libs=-Wl,-E - ngx_feature_test= + ngx_feature_libs= + ngx_feature_test="long n = 0; + if (!__sync_bool_compare_and_swap(&n, 0, 1)) + return 1; + if (__sync_fetch_and_add(&n, 1) != 1) + return 1; + if (n != 2) + return 1; + __sync_synchronize();" . auto/feature - if [ $ngx_found = yes ]; then - MAIN_LINK="-Wl,-E" - fi - - - if [ "$NGX_CC_NAME" = "sunc" ]; then - echo "checking for gcc builtin atomic operations ... disabled" - else - ngx_feature="gcc builtin atomic operations" - ngx_feature_name=NGX_HAVE_GCC_ATOMIC - ngx_feature_run=yes - ngx_feature_incs= - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test="long n = 0; - if (!__sync_bool_compare_and_swap(&n, 0, 1)) - return 1; - if (__sync_fetch_and_add(&n, 1) != 1) - return 1; - if (n != 2) - return 1; - __sync_synchronize();" - . auto/feature - fi - if [ "$NGX_CC_NAME" = "ccc" ]; then echo "checking for C99 variadic macros ... disabled" @@ -213,7 +187,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then var(0, buf, \"%d\", 1); if (buf[0] != '1') return 1" . auto/feature - fi + fi ngx_feature="gcc variadic macros" @@ -229,16 +203,6 @@ if [ "$NGX_PLATFORM" != win32 ]; then . auto/feature - ngx_feature="gcc builtin 64 bit byteswap" - ngx_feature_name="NGX_HAVE_GCC_BSWAP64" - ngx_feature_run=no - ngx_feature_incs= - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test="if (__builtin_bswap64(0)) return 1" - . auto/feature - - # ngx_feature="inline" # ngx_feature_name= # ngx_feature_run=no diff --git a/auto/cc/gcc b/auto/cc/gcc index a5c5c18..c27d857 100644 --- a/auto/cc/gcc +++ b/auto/cc/gcc @@ -128,6 +128,12 @@ else PCRE_OPT="$PCRE_OPT $PIPE" fi +if [ ".$MD5_OPT" = "." ]; then + MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" +else + MD5_OPT="$MD5_OPT $PIPE" +fi + if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" else @@ -145,22 +151,18 @@ CFLAGS="$CFLAGS -Wall -Wpointer-arith" #CFLAGS="$CFLAGS -Winline" #CFLAGS="$CFLAGS -Wmissing-prototypes" -case "$NGX_GCC_VER" in - 2.*) - # we have a lot of the unused function arguments - CFLAGS="$CFLAGS -Wno-unused" - ;; - *) +case "$NGX_GCC_VER" in + 3.* | 4.* ) # we have a lot of the unused function arguments CFLAGS="$CFLAGS -Wno-unused-parameter" # 4.2.1 shows the warning in wrong places #CFLAGS="$CFLAGS -Wunreachable-code" + ;; - # deprecated system OpenSSL library on OS X - if [ "$NGX_SYSTEM" = "Darwin" ]; then - CFLAGS="$CFLAGS -Wno-deprecated-declarations" - fi + *) + # we have a lot of the unused function arguments + CFLAGS="$CFLAGS -Wno-unused" ;; esac diff --git a/auto/cc/icc b/auto/cc/icc index c47f6e4..1d83ed3 100644 --- a/auto/cc/icc +++ b/auto/cc/icc @@ -43,6 +43,10 @@ if [ ".$PCRE_OPT" = "." ]; then PCRE_OPT="-O $CPU_OPT" fi +if [ ".$MD5_OPT" = "." ]; then + MD5_OPT="-O $CPU_OPT" +fi + if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O $CPU_OPT" fi @@ -85,7 +89,7 @@ CFLAGS="$CFLAGS -wd1419" case "$NGX_ICC_VER" in 9.*) - # "cc" clobber ignored, warnings for Linux's htonl()/htons() + # "cc" clobber ignored, warnings for Liunx's htonl()/htons() CFLAGS="$CFLAGS -wd1469" # explicit conversion of a 64-bit integral type to a smaller # integral type @@ -99,7 +103,7 @@ case "$NGX_ICC_VER" in ;; 8.*) - # "cc" clobber ignored, warnings for Linux's htonl()/htons() + # "cc" clobber ignored, warnings for Liunx's htonl()/htons() CFLAGS="$CFLAGS -wd1469" # floating-point equality and inequality comparisons are unreliable, # warning on SvTRUE() diff --git a/auto/cc/msvc b/auto/cc/msvc index 567bac7..393ba32 100644 --- a/auto/cc/msvc +++ b/auto/cc/msvc @@ -3,39 +3,9 @@ # Copyright (C) Nginx, Inc. -# MSVC 6.0 SP2 cl 12.00 -# MSVC Toolkit 2003 (7.1) cl 13.10 -# MSVC 2005 Express Edition SP1 (8.0) cl 14.00 -# MSVC 2008 Express Edition (9.0) cl 15.00 -# MSVC 2010 (10.0) cl 16.00 -# MSVC 2015 (14.0) cl 19.00 - - -NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'C/C++.* [0-9][0-9]*\.[0-9]' 2>&1 \ - | sed -e 's/^.* \([0-9][0-9]*\.[0-9].*\)/\1/'` - -echo " + cl version: $NGX_MSVC_VER" - -have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define - - -ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'` - - -# detect x64 builds - -case "$NGX_MSVC_VER" in - - *x64) - NGX_MACHINE=amd64 - ;; - - *) - NGX_MACHINE=i386 - ;; - -esac - +# MSVC 6.0 SP2 +# MSVC Toolkit 2003 (7.1) +# MSVC 2005 Express Edition SP1 (8.0) # optimizations @@ -120,17 +90,17 @@ CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib" #CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup" # debug -# msvc under Wine issues -# C1902: Program database manager mismatch; please check your installation -if [ -z "$NGX_WINE" ]; then - CFLAGS="$CFLAGS -Zi -Fd$NGX_OBJS/nginx.pdb" +# msvc8 under Wine issues +# Program database manager mismatch; please check your installation +if [ $NGX_CC_NAME != msvc8 ]; then + CFLAGS="$CFLAGS -Zi" CORE_LINK="$CORE_LINK -debug" fi # MSVC 2005 supports C99 variadic macros -if [ "$ngx_msvc_ver" -ge 14 ]; then - have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have +if [ $NGX_CC_NAME = msvc8 ]; then + have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have fi @@ -148,15 +118,10 @@ NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC" CORE_LINK="$NGX_RES $CORE_LINK" -# dynamic modules -#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def" -#MODULE_LINK="-LD $NGX_OBJS/nginx.lib" - - -ngx_pic_opt= ngx_objout="-Fo" ngx_binout="-Fe" ngx_objext="obj" +ngx_binext=".exe" ngx_long_start='@<< ' diff --git a/auto/cc/name b/auto/cc/name index ded93f5..51a7ed9 100644 --- a/auto/cc/name +++ b/auto/cc/name @@ -25,8 +25,31 @@ fi if [ "$CC" = cl ]; then - NGX_CC_NAME=msvc - echo " + using Microsoft Visual C++ compiler" + if `$NGX_WINE $CC -v 2>&1 \ + | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16' \ + >/dev/null 2>&1`; then + + NGX_CC_NAME=msvc10 + echo " + using Microsoft Visual C++ 10 compiler" + + elif `$NGX_WINE $CC -v 2>&1 \ + | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14' \ + >/dev/null 2>&1`; then + + NGX_CC_NAME=msvc8 + echo " + using Microsoft Visual C++ 8 compiler" + + elif `$NGX_WINE $CC -v 2>&1 \ + | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13' \ + >/dev/null 2>&1`; then + + NGX_CC_NAME=msvc7 + echo " + using Microsoft Visual C++ 7 compiler" + + else + NGX_CC_NAME=msvc + echo " + using Microsoft Visual C++ compiler" + fi elif [ "$CC" = wcl386 ]; then NGX_CC_NAME=owc @@ -44,11 +67,7 @@ elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then NGX_CC_NAME=gcc echo " + using GNU C compiler" -elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then - NGX_CC_NAME=clang - echo " + using Clang C compiler" - -elif `$CC -v 2>&1 | grep 'LLVM version' >/dev/null 2>&1`; then +elif `$CC -v 2>&1 | grep '\(clang\|LLVM\) version' >/dev/null 2>&1`; then NGX_CC_NAME=clang echo " + using Clang C compiler" diff --git a/auto/cc/owc b/auto/cc/owc index f7fd88c..a063aa3 100644 --- a/auto/cc/owc +++ b/auto/cc/owc @@ -84,6 +84,7 @@ ngx_include_opt="-i=" ngx_objout="-fo" ngx_binout="-fe=" ngx_objext="obj" +ngx_binext=".exe" ngx_regex_dirsep='\\' ngx_dirsep="\\" diff --git a/auto/cc/sunc b/auto/cc/sunc index 552c2d3..8f12d7c 100644 --- a/auto/cc/sunc +++ b/auto/cc/sunc @@ -8,10 +8,7 @@ # Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12 # Sun C 5.9 SunOS_sparc 2007/05/03 # Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1 -# Sun C 5.11 SunOS_i386 2010/08/13 Oracle Solaris Studio 12.2 -# Sun C 5.12 SunOS_i386 2011/11/16 Oracle Solaris Studio 12.3 -# Sun C 5.13 SunOS_i386 2014/10/20 Oracle Solaris Studio 12.4 -# Sun C 5.14 SunOS_i386 2016/05/31 Oracle Developer Studio 12.5 +# Sun C 5.11 SunOS_i386 2010/08/13 Sun Studio 12.2 NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \ | sed -e 's/^.* Sun C \(.*\)/\1/'` @@ -23,10 +20,7 @@ have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define cat << END > $NGX_AUTOTEST.c -int main(void) { - printf("%d", __SUNPRO_C); - return 0; -} +int main() { printf("%d", __SUNPRO_C); } END @@ -63,9 +57,6 @@ case "$NGX_MACHINE" in esac -MAIN_LINK= -MODULE_LINK="-G" - # optimizations @@ -151,6 +142,10 @@ if [ ".$PCRE_OPT" = "." ]; then PCRE_OPT="$ngx_fast $IPO $CPU_OPT" fi +if [ ".$MD5_OPT" = "." ]; then + MD5_OPT="$ngx_fast $IPO $CPU_OPT" +fi + if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="$ngx_fast $IPO $CPU_OPT" fi diff --git a/auto/endianness b/auto/endianness index 1b552b6..93da2f8 100644 --- a/auto/endianness +++ b/auto/endianness @@ -4,18 +4,13 @@ echo $ngx_n "checking for system byte ordering ...$ngx_c" - -cat << END >> $NGX_AUTOCONF_ERR - ----------------------------------------- -checking for system byte ordering - -END +echo >> $NGX_ERR +echo "checking for system byte ordering" >> $NGX_ERR cat << END > $NGX_AUTOTEST.c -int main(void) { +int main() { int i = 0x11223344; char *p; diff --git a/auto/feature b/auto/feature index 3561f59..1145f28 100644 --- a/auto/feature +++ b/auto/feature @@ -31,7 +31,7 @@ cat << END > $NGX_AUTOTEST.c $NGX_INCLUDE_UNISTD_H $ngx_feature_incs -int main(void) { +int main() { $ngx_feature_test; return 0; } diff --git a/auto/include b/auto/include index c1bd364..e34dabd 100644 --- a/auto/include +++ b/auto/include @@ -20,7 +20,7 @@ cat << END > $NGX_AUTOTEST.c $NGX_INCLUDE_SYS_PARAM_H #include <$ngx_include> -int main(void) { +int main() { return 0; } @@ -45,6 +45,9 @@ if [ -x $NGX_AUTOTEST ]; then eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'" + #STUB + eval "NGX_$ngx_name='#include <$ngx_include>'" + else echo " not found" diff --git a/auto/init b/auto/init index f816dfc..910f529 100644 --- a/auto/init +++ b/auto/init @@ -48,6 +48,4 @@ default: build clean: rm -rf Makefile $NGX_OBJS - -.PHONY: default clean END diff --git a/auto/install b/auto/install index 7f73e4b..254f9bc 100644 --- a/auto/install +++ b/auto/install @@ -3,7 +3,7 @@ # Copyright (C) Nginx, Inc. -if [ $USE_PERL != NO ]; then +if [ $USE_PERL = YES ]; then cat << END >> $NGX_MAKEFILE @@ -20,24 +20,16 @@ case ".$NGX_SBIN_PATH" in ./*) ;; + .) + NGX_SBIN_PATH=$NGX_PREFIX/sbin/nginx + ;; + *) NGX_SBIN_PATH=$NGX_PREFIX/$NGX_SBIN_PATH ;; esac -case ".$NGX_MODULES_PATH" in - ./*) - ;; - - *) - NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH - ;; -esac - -NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.` - - case ".$NGX_CONF_PATH" in ./*) ;; @@ -104,57 +96,58 @@ $NGX_OBJS/nginx.8: $NGX_MAN $NGX_AUTO_CONFIG_H -e "s|%%ERROR_LOG_PATH%%|${NGX_ERROR_LOG_PATH:-stderr}|" \\ < $NGX_MAN > \$@ -install: build $NGX_INSTALL_PERL_MODULES +install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \ + $NGX_INSTALL_PERL_MODULES test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX' - test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \\ + test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \ || mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' - test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \\ - || mv '\$(DESTDIR)$NGX_SBIN_PATH' \\ + test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \ + || mv '\$(DESTDIR)$NGX_SBIN_PATH' \ '\$(DESTDIR)$NGX_SBIN_PATH.old' - cp $NGX_OBJS/nginx$ngx_binext '\$(DESTDIR)$NGX_SBIN_PATH' + cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH' - test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\ + test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \ || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \\ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \ || cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \\ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \ || cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/fastcgi_params \\ + cp conf/fastcgi_params \ '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \\ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \ || cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \\ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \ || cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/uwsgi_params \\ + cp conf/uwsgi_params \ '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \\ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \ || cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/scgi_params \\ + cp conf/scgi_params \ '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PATH' \\ + test -f '\$(DESTDIR)$NGX_CONF_PATH' \ || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH' cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default' - test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\ + test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \ || mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' - test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' \\ - || mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' + test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' || \ + mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' - test -d '\$(DESTDIR)$NGX_PREFIX/html' \\ + test -d '\$(DESTDIR)$NGX_PREFIX/html' \ || cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX' END @@ -162,51 +155,24 @@ END if test -n "$NGX_ERROR_LOG_PATH"; then cat << END >> $NGX_MAKEFILE - test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' \\ - || mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' + test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' || \ + mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' END fi -if test -n "$DYNAMIC_MODULES"; then - cat << END >> $NGX_MAKEFILE - - test -d '\$(DESTDIR)$NGX_MODULES_PATH' \\ - || mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH' -END - -fi - - -for ngx_module in $DYNAMIC_MODULES -do - ngx_module=$ngx_module$ngx_modext - - cat << END >> $NGX_MAKEFILE - - test ! -f '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\ - || mv '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\ - '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module.old' - cp $NGX_OBJS/$ngx_module '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' -END - -done - - # create Makefile cat << END >> Makefile build: \$(MAKE) -f $NGX_MAKEFILE + \$(MAKE) -f $NGX_MAKEFILE manpage install: \$(MAKE) -f $NGX_MAKEFILE install -modules: - \$(MAKE) -f $NGX_MAKEFILE modules - upgrade: $NGX_SBIN_PATH -t @@ -215,6 +181,4 @@ upgrade: test -f $NGX_PID_PATH.oldbin kill -QUIT \`cat $NGX_PID_PATH.oldbin\` - -.PHONY: build install modules upgrade END diff --git a/auto/lib/conf b/auto/lib/conf index 2c7af10..e1e4475 100644 --- a/auto/lib/conf +++ b/auto/lib/conf @@ -7,7 +7,7 @@ if [ $USE_PCRE = YES -o $PCRE != NONE ]; then . auto/lib/pcre/conf else - if [ $USE_PCRE = DISABLED -a $HTTP = YES -a $HTTP_REWRITE = YES ]; then + if [ $USE_PCRE = DISABLED -a $HTTP_REWRITE = YES ]; then cat << END @@ -25,23 +25,52 @@ if [ $USE_OPENSSL = YES ]; then . auto/lib/openssl/conf fi +if [ $USE_MD5 = YES ]; then + + if [ $USE_OPENSSL = YES ]; then + have=NGX_HAVE_OPENSSL_MD5_H . auto/have + have=NGX_OPENSSL_MD5 . auto/have + have=NGX_HAVE_MD5 . auto/have + MD5=YES + MD5_LIB=OpenSSL + + else + . auto/lib/md5/conf + fi + +fi + +if [ $USE_SHA1 = YES ]; then + + if [ $USE_OPENSSL = YES ]; then + have=NGX_HAVE_OPENSSL_SHA1_H . auto/have + have=NGX_HAVE_SHA1 . auto/have + SHA1=YES + SHA1_LIB=OpenSSL + + else + . auto/lib/sha1/conf + fi + +fi + if [ $USE_ZLIB = YES ]; then . auto/lib/zlib/conf fi -if [ $USE_LIBXSLT != NO ]; then +if [ $USE_LIBXSLT = YES ]; then . auto/lib/libxslt/conf fi -if [ $USE_LIBGD != NO ]; then +if [ $USE_LIBGD = YES ]; then . auto/lib/libgd/conf fi -if [ $USE_PERL != NO ]; then +if [ $USE_PERL = YES ]; then . auto/lib/perl/conf fi -if [ $USE_GEOIP != NO ]; then +if [ $HTTP_GEOIP = YES ]; then . auto/lib/geoip/conf fi diff --git a/auto/lib/geoip/conf b/auto/lib/geoip/conf index 47165b1..53c274d 100644 --- a/auto/lib/geoip/conf +++ b/auto/lib/geoip/conf @@ -64,43 +64,23 @@ if [ $ngx_found = no ]; then fi -if [ $ngx_found = no ]; then - - # Homebrew on Apple Silicon - - ngx_feature="GeoIP library in /opt/homebrew/" - ngx_feature_path="/opt/homebrew/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/homebrew/lib -L/opt/homebrew/lib -lGeoIP" - else - ngx_feature_libs="-L/opt/homebrew/lib -lGeoIP" - fi - - . auto/feature -fi - - if [ $ngx_found = yes ]; then CORE_INCS="$CORE_INCS $ngx_feature_path" + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - if [ $USE_GEOIP = YES ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + if [ $NGX_IPV6 = YES ]; then + ngx_feature="GeoIP IPv6 support" + ngx_feature_name="NGX_HAVE_GEOIP_V6" + ngx_feature_run=no + ngx_feature_incs="#include + #include " + #ngx_feature_path= + #ngx_feature_libs= + ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);" + . auto/feature fi - NGX_LIB_GEOIP=$ngx_feature_libs - - ngx_feature="GeoIP IPv6 support" - ngx_feature_name="NGX_HAVE_GEOIP_V6" - ngx_feature_run=no - ngx_feature_incs="#include - #include " - #ngx_feature_path= - #ngx_feature_libs= - ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);" - . auto/feature - else cat << END diff --git a/auto/lib/google-perftools/conf b/auto/lib/google-perftools/conf index 94dadac..7a9de30 100644 --- a/auto/lib/google-perftools/conf +++ b/auto/lib/google-perftools/conf @@ -9,8 +9,7 @@ ngx_feature_incs= ngx_feature_path= ngx_feature_libs="-lprofiler" - ngx_feature_test="void ProfilerStop(void); - ProfilerStop()" + ngx_feature_test="ProfilerStop()" . auto/feature @@ -46,22 +45,6 @@ if [ $ngx_found = no ]; then fi -if [ $ngx_found = no ]; then - - # Homebrew on Apple Silicon - - ngx_feature="Google perftools in /opt/homebrew/" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/homebrew/lib -L/opt/homebrew/lib -lprofiler" - else - ngx_feature_libs="-L/opt/homebrew/lib -lprofiler" - fi - - . auto/feature -fi - - if [ $ngx_found = yes ]; then CORE_LIBS="$CORE_LIBS $ngx_feature_libs" @@ -69,7 +52,7 @@ else cat << END -$0: error: the Google perftools module requires the Google perftools +$0: error: the Google perftool module requires the Google perftools library. You can either do not enable the module or install the library. END diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf index dfdc1a6..d1e484a 100644 --- a/auto/lib/libatomic/conf +++ b/auto/lib/libatomic/conf @@ -7,8 +7,8 @@ if [ $NGX_LIBATOMIC != YES ]; then have=NGX_HAVE_LIBATOMIC . auto/have CORE_INCS="$CORE_INCS $NGX_LIBATOMIC/src" - LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/build/lib/libatomic_ops.a" - CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/build/lib/libatomic_ops.a" + LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/src/libatomic_ops.a" + CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/src/libatomic_ops.a" else @@ -19,7 +19,7 @@ else #include " ngx_feature_path= ngx_feature_libs="-latomic_ops" - ngx_feature_test="AO_t n = 0; + ngx_feature_test="long n = 0; if (!AO_compare_and_swap(&n, 0, 1)) return 1; if (AO_fetch_and_add(&n, 1) != 1) diff --git a/auto/lib/libatomic/make b/auto/lib/libatomic/make index 530c746..c90318e 100644 --- a/auto/lib/libatomic/make +++ b/auto/lib/libatomic/make @@ -3,19 +3,14 @@ # Copyright (C) Nginx, Inc. - case $NGX_LIBATOMIC in - /*) ngx_prefix="$NGX_LIBATOMIC/build" ;; - *) ngx_prefix="$PWD/$NGX_LIBATOMIC/build" ;; - esac - cat << END >> $NGX_MAKEFILE -$NGX_LIBATOMIC/build/lib/libatomic_ops.a: $NGX_LIBATOMIC/Makefile - cd $NGX_LIBATOMIC && \$(MAKE) && \$(MAKE) install +$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile + cd $NGX_LIBATOMIC && \$(MAKE) $NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE cd $NGX_LIBATOMIC \\ && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ - && ./configure --prefix=$ngx_prefix + && ./configure END diff --git a/auto/lib/libgd/conf b/auto/lib/libgd/conf index 07f5656..ff99054 100644 --- a/auto/lib/libgd/conf +++ b/auto/lib/libgd/conf @@ -9,8 +9,7 @@ ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs="-lgd" - ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL); - (void) img" + ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);" . auto/feature @@ -65,38 +64,10 @@ if [ $ngx_found = no ]; then fi -if [ $ngx_found = no ]; then - - # Homebrew on Apple Silicon - - ngx_feature="GD library in /opt/homebrew/" - ngx_feature_path="/opt/homebrew/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/homebrew/lib -L/opt/homebrew/lib -lgd" - else - ngx_feature_libs="-L/opt/homebrew/lib -lgd" - fi - - . auto/feature -fi - - if [ $ngx_found = yes ]; then CORE_INCS="$CORE_INCS $ngx_feature_path" - - if [ $USE_LIBGD = YES ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - fi - - NGX_LIB_LIBGD=$ngx_feature_libs - - ngx_feature="GD WebP support" - ngx_feature_name="NGX_HAVE_GD_WEBP" - ngx_feature_test="gdImagePtr img = gdImageCreateFromWebpPtr(1, NULL); - (void) img" - . auto/feature + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" else diff --git a/auto/lib/libxslt/conf b/auto/lib/libxslt/conf index 3063ac7..bc19d83 100644 --- a/auto/lib/libxslt/conf +++ b/auto/lib/libxslt/conf @@ -16,8 +16,8 @@ ngx_feature_libs="-lxml2 -lxslt" ngx_feature_test="xmlParserCtxtPtr ctxt = NULL; xsltStylesheetPtr sheet = NULL; - xmlDocPtr doc = NULL; - xmlParseChunk(ctxt, NULL, 0, 0); + xmlDocPtr doc; + doc = xmlParseChunk(ctxt, NULL, 0, 0); xsltApplyStylesheet(sheet, doc, NULL);" . auto/feature @@ -76,12 +76,7 @@ fi if [ $ngx_found = yes ]; then CORE_INCS="$CORE_INCS $ngx_feature_path" - - if [ $USE_LIBXSLT = YES ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - fi - - NGX_LIB_LIBXSLT=$ngx_feature_libs + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" else @@ -157,9 +152,5 @@ fi if [ $ngx_found = yes ]; then - if [ $USE_LIBXSLT = YES ]; then - CORE_LIBS="$CORE_LIBS -lexslt" - fi - - NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt" + CORE_LIBS="$CORE_LIBS -lexslt" fi diff --git a/auto/lib/make b/auto/lib/make index b64e329..58a84a3 100644 --- a/auto/lib/make +++ b/auto/lib/make @@ -7,6 +7,14 @@ if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then . auto/lib/pcre/make fi +if [ $MD5 != NONE -a $MD5 != NO -a $MD5 != YES ]; then + . auto/lib/md5/make +fi + +if [ $SHA1 != NONE -a $SHA1 != NO -a $SHA1 != YES ]; then + . auto/lib/sha1/make +fi + if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then . auto/lib/openssl/make fi @@ -19,6 +27,6 @@ if [ $NGX_LIBATOMIC != NO -a $NGX_LIBATOMIC != YES ]; then . auto/lib/libatomic/make fi -if [ $USE_PERL != NO ]; then +if [ $USE_PERL = YES ]; then . auto/lib/perl/make fi diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf new file mode 100644 index 0000000..eb5dfd1 --- /dev/null +++ b/auto/lib/md5/conf @@ -0,0 +1,103 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $MD5 != NONE ]; then + + if grep MD5_Init $MD5/md5.h 2>&1 >/dev/null; then + # OpenSSL md5 + OPENSSL_MD5=YES + have=NGX_HAVE_OPENSSL_MD5 . auto/have + have=NGX_OPENSSL_MD5 . auto/have + else + # rsaref md5 + OPENSSL_MD5=NO + fi + + have=NGX_HAVE_MD5 . auto/have + CORE_INCS="$CORE_INCS $MD5" + + case "$NGX_CC_NAME" in + + msvc* | owc* | bcc) + LINK_DEPS="$LINK_DEPS $MD5/md5.lib" + CORE_LIBS="$CORE_LIBS $MD5/md5.lib" + ;; + + icc*) + LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $MD5/md5_dgst.o" + + if [ $MD5_ASM = YES ]; then + CORE_LIBS="$CORE_LIBS $MD5/asm/mx86-elf.o" + fi + ;; + + *) + LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" + CORE_LIBS="$CORE_LIBS $MD5/libmd5.a" + #CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5" + ;; + + esac + +else + + if [ "$NGX_PLATFORM" != win32 ]; then + + MD5=NO + + # FreeBSD, Solaris 10 + + ngx_feature="md5 in system md library" + ngx_feature_name=NGX_HAVE_MD5 + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lmd" + ngx_feature_test="MD5_CTX md5; MD5Init(&md5)" + . auto/feature + + ngx_md5_lib="system md" + + if [ $ngx_found = no ]; then + + # Solaris 8/9 + + ngx_feature="md5 in system md5 library" + ngx_feature_libs="-lmd5" + . auto/feature + + ngx_md5_lib="system md5" + fi + + if [ $ngx_found = no ]; then + + # OpenSSL crypto library + + ngx_feature="md5 in system OpenSSL crypto library" + ngx_feature_name="NGX_OPENSSL_MD5" + ngx_feature_incs="#include " + ngx_feature_libs="-lcrypto" + ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)" + . auto/feature + + ngx_md5_lib="system crypto" + + if [ $ngx_found = yes ]; then + have=NGX_HAVE_OPENSSL_MD5_H . auto/have + have=NGX_HAVE_MD5 . auto/have + fi + fi + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + MD5=YES + MD5_LIB=$ngx_md5_lib + fi + fi + +fi diff --git a/auto/lib/md5/make b/auto/lib/md5/make new file mode 100644 index 0000000..81f138a --- /dev/null +++ b/auto/lib/md5/make @@ -0,0 +1,96 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +case "$NGX_CC_NAME" in + + msvc*) + ngx_makefile=makefile.msvc + ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC MD5_ASM=$MD5_ASM" + ngx_md5="MD5=\"$MD5\"" + ;; + + owc*) + ngx_makefile=makefile.owc + ngx_opt="CPU_OPT=\"$CPU_OPT\"" + ngx_md5=`echo MD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + bcc) + ngx_makefile=makefile.bcc + ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DMD5_ASM=$MD5_ASM" + ngx_md5=`echo \-DMD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + +esac + + +done=NO + + +case "$NGX_PLATFORM" in + + win32) + cat << END >> $NGX_MAKEFILE + +`echo "$MD5/md5.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/md5/$ngx_makefile $ngx_opt $ngx_md5 + +END + + done=YES + ;; + + SunOS:*:i86pc) + if [ $MD5_ASM = YES ]; then + + cat << END >> $NGX_MAKEFILE + +$MD5/libmd5.a: $NGX_MAKEFILE + cd $MD5 \\ + && \$(MAKE) CFLAGS="$MD5_OPT -DSOL -DMD5_ASM -DL_ENDIAN" \\ + CC="\$(CC)" CPP="\$(CPP)" \\ + MD5_ASM_OBJ=asm/mx86-sol.o clean libmd5.a + +END + + done=YES + fi + ;; + + # FreeBSD: i386 + # Linux: i686 + + *:i386 | *:i686) + if [ $MD5_ASM = YES ]; then + + cat << END >> $NGX_MAKEFILE + +$MD5/libmd5.a: $NGX_MAKEFILE + cd $MD5 \\ + && \$(MAKE) CFLAGS="$MD5_OPT -DELF -DMD5_ASM -DL_ENDIAN" \\ + CC="\$(CC)" CPP="\$(CPP)" \\ + MD5_ASM_OBJ=asm/mx86-elf.o clean libmd5.a + +END + + done=YES + fi + ;; + +esac + + +if [ $done = NO ]; then + + cat << END >> $NGX_MAKEFILE + +$MD5/libmd5.a: $NGX_MAKEFILE + cd $MD5 \\ + && \$(MAKE) CFLAGS="$MD5_OPT" \\ + CC="\$(CC)" MD5_ASM_OBJ= clean libmd5.a + +END + +fi diff --git a/auto/lib/md5/makefile.bcc b/auto/lib/md5/makefile.bcc new file mode 100644 index 0000000..eb6fb62 --- /dev/null +++ b/auto/lib/md5/makefile.bcc @@ -0,0 +1,22 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN + +!if "$(MD5_ASM)" == "YES" + +md5.lib: + cd $(MD5) + bcc32 -c $(CFLAGS) -DMD5_ASM md5_dgst.c + tlib md5.lib +md5_dgst.obj +"asm\m-win32.obj" + +!else + +md5.lib: + cd $(MD5) + bcc32 -c $(CFLAGS) md5_dgst.c + tlib md5.lib +md5_dgst.obj + +!endif diff --git a/auto/lib/md5/makefile.msvc b/auto/lib/md5/makefile.msvc new file mode 100644 index 0000000..90d62fa --- /dev/null +++ b/auto/lib/md5/makefile.msvc @@ -0,0 +1,22 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN + +!IF "$(MD5_ASM)" == "YES" + +md5.lib: + cd $(MD5) + cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c + link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj + +!ELSE + +md5.lib: + cd $(MD5) + cl -c $(CFLAGS) md5_dgst.c + link -lib -out:md5.lib md5_dgst.obj + +!ENDIF diff --git a/auto/lib/md5/makefile.owc b/auto/lib/md5/makefile.owc new file mode 100644 index 0000000..78c1e61 --- /dev/null +++ b/auto/lib/md5/makefile.owc @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) + +md5.lib: + cd $(MD5) + wcl386 -c $(CFLAGS) -dL_ENDIAN md5_dgst.c + wlib -n md5.lib md5_dgst.obj diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf index fdf430d..a65815f 100644 --- a/auto/lib/openssl/conf +++ b/auto/lib/openssl/conf @@ -5,33 +5,18 @@ if [ $OPENSSL != NONE ]; then - have=NGX_OPENSSL . auto/have - have=NGX_SSL . auto/have - - have=NGX_OPENSSL_NO_CONFIG . auto/have - - if [ $USE_OPENSSL_QUIC = YES ]; then - have=NGX_QUIC . auto/have - have=NGX_QUIC_OPENSSL_COMPAT . auto/have - fi - case "$CC" in cl | bcc32) + have=NGX_OPENSSL . auto/have + have=NGX_SSL . auto/have + CFLAGS="$CFLAGS -DNO_SYS_TYPES_H" CORE_INCS="$CORE_INCS $OPENSSL/openssl/include" CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h" - - if [ -f $OPENSSL/ms/do_ms.bat ]; then - # before OpenSSL 1.1.0 - CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib" - CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib" - else - # OpenSSL 1.1.0+ - CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.lib" - CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.lib" - fi + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib" + CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib" # libeay32.lib requires gdi32.lib CORE_LIBS="$CORE_LIBS gdi32.lib" @@ -40,12 +25,14 @@ if [ $OPENSSL != NONE ]; then ;; *) + have=NGX_OPENSSL . auto/have + have=NGX_SSL . auto/have + CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include" CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h" CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a" CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a" CORE_LIBS="$CORE_LIBS $NGX_LIBDL" - CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD" if [ "$NGX_PLATFORM" = win32 ]; then CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32" @@ -64,116 +51,14 @@ else ngx_feature_run=no ngx_feature_incs="#include " ngx_feature_path= - ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD" - ngx_feature_test="SSL_CTX_set_options(NULL, 0)" + ngx_feature_libs="-lssl -lcrypto" + ngx_feature_test="SSL_library_init()" . auto/feature - if [ $ngx_found = no ]; then - - # FreeBSD port - - ngx_feature="OpenSSL library in /usr/local/" - ngx_feature_path="/usr/local/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto" - else - ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto" - fi - - ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" - - . auto/feature - fi - - if [ $ngx_found = no ]; then - - # NetBSD port - - ngx_feature="OpenSSL library in /usr/pkg/" - ngx_feature_path="/usr/pkg/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto" - else - ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto" - fi - - ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" - - . auto/feature - fi - - if [ $ngx_found = no ]; then - - # MacPorts - - ngx_feature="OpenSSL library in /opt/local/" - ngx_feature_path="/opt/local/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto" - else - ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto" - fi - - ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" - - . auto/feature - fi - - if [ $ngx_found = no ]; then - - # Homebrew on Apple Silicon - - ngx_feature="OpenSSL library in /opt/homebrew/" - ngx_feature_path="/opt/homebrew/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/homebrew/lib -L/opt/homebrew/lib -lssl -lcrypto" - else - ngx_feature_libs="-L/opt/homebrew/lib -lssl -lcrypto" - fi - - ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD" - - . auto/feature - fi - if [ $ngx_found = yes ]; then have=NGX_SSL . auto/have - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + CORE_LIBS="$CORE_LIBS $ngx_feature_libs $NGX_LIBDL" OPENSSL=YES - - if [ $USE_OPENSSL_QUIC = YES ]; then - - ngx_feature="OpenSSL QUIC support" - ngx_feature_name="NGX_QUIC" - ngx_feature_test="SSL_set_quic_method(NULL, NULL)" - . auto/feature - - if [ $ngx_found = no ]; then - have=NGX_QUIC_OPENSSL_COMPAT . auto/have - - ngx_feature="OpenSSL QUIC compatibility" - ngx_feature_test="SSL_CTX_add_custom_ext(NULL, 0, 0, - NULL, NULL, NULL, NULL, NULL)" - . auto/feature - fi - - if [ $ngx_found = no ]; then -cat << END - -$0: error: certain modules require OpenSSL QUIC support. -You can either do not enable the modules, or install the OpenSSL library with -QUIC support into the system, or build the OpenSSL library with QUIC support -statically from the source with nginx by using --with-openssl= option. - -END - exit 1 - fi - fi fi fi diff --git a/auto/lib/openssl/make b/auto/lib/openssl/make index a7e9369..e64acd9 100644 --- a/auto/lib/openssl/make +++ b/auto/lib/openssl/make @@ -7,24 +7,11 @@ case "$CC" in cl) - case "$NGX_MACHINE" in - - amd64) - OPENSSL_TARGET=VC-WIN64A - ;; - - *) - OPENSSL_TARGET=VC-WIN32 - ;; - - esac - cat << END >> $NGX_MAKEFILE $OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE \$(MAKE) -f auto/lib/openssl/makefile.msvc \ - OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" \ - OPENSSL_TARGET="$OPENSSL_TARGET" + OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" END @@ -54,6 +41,11 @@ END ;; *) + case $USE_THREADS in + NO) OPENSSL_OPT="$OPENSSL_OPT no-threads" ;; + *) OPENSSL_OPT="$OPENSSL_OPT threads" ;; + esac + case $OPENSSL in /*) ngx_prefix="$OPENSSL/.openssl" ;; *) ngx_prefix="$PWD/$OPENSSL/.openssl" ;; @@ -64,9 +56,9 @@ END $OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE cd $OPENSSL \\ && if [ -f Makefile ]; then \$(MAKE) clean; fi \\ - && ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\ + && ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\ && \$(MAKE) \\ - && \$(MAKE) install_sw LIBDIR=lib + && \$(MAKE) install LIBDIR=lib END diff --git a/auto/lib/openssl/makefile.msvc b/auto/lib/openssl/makefile.msvc index ed17cde..fc9e578 100644 --- a/auto/lib/openssl/makefile.msvc +++ b/auto/lib/openssl/makefile.msvc @@ -6,16 +6,9 @@ all: cd $(OPENSSL) - perl Configure $(OPENSSL_TARGET) no-shared no-threads \ - --prefix="%cd%/openssl" \ - --openssldir="%cd%/openssl/ssl" \ - $(OPENSSL_OPT) + perl Configure VC-WIN32 no-shared --prefix=openssl $(OPENSSL_OPT) - if exist ms\do_ms.bat ( \ - ms\do_ms \ - && $(MAKE) -f ms\nt.mak \ - && $(MAKE) -f ms\nt.mak install \ - ) else ( \ - $(MAKE) \ - && $(MAKE) install_sw \ - ) + ms\do_ms + + $(MAKE) -f ms\nt.mak + $(MAKE) -f ms\nt.mak install diff --git a/auto/lib/pcre/conf b/auto/lib/pcre/conf index cdf1809..939f01b 100644 --- a/auto/lib/pcre/conf +++ b/auto/lib/pcre/conf @@ -4,62 +4,87 @@ if [ $PCRE != NONE ]; then + CORE_INCS="$CORE_INCS $PCRE" - if [ -f $PCRE/src/pcre2.h.generic ]; then + case "$NGX_CC_NAME" in - PCRE_LIBRARY=PCRE2 - - have=NGX_PCRE . auto/have - have=NGX_PCRE2 . auto/have - - if [ "$NGX_PLATFORM" = win32 ]; then - have=PCRE2_STATIC . auto/have - fi - - CORE_INCS="$CORE_INCS $PCRE/src/" - CORE_DEPS="$CORE_DEPS $PCRE/src/pcre2.h" - - case "$NGX_CC_NAME" in - - msvc) - LINK_DEPS="$LINK_DEPS $PCRE/src/pcre2-8.lib" - CORE_LIBS="$CORE_LIBS $PCRE/src/pcre2-8.lib" - ;; - - *) - LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre2-8.a" - CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre2-8.a" - ;; - - esac - - else - - PCRE_LIBRARY=PCRE - - have=NGX_PCRE . auto/have - - if [ "$NGX_PLATFORM" = win32 ]; then + msvc* | owc* | bcc) + have=NGX_PCRE . auto/have have=PCRE_STATIC . auto/have - fi + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" + CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" + ;; - CORE_INCS="$CORE_INCS $PCRE" - CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + icc* ) + have=NGX_PCRE . auto/have + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" - case "$NGX_CC_NAME" in + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" - msvc | owc | bcc) - LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib" - CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib" - ;; + echo $ngx_n "checking for PCRE library ...$ngx_c" - *) - LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" - CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" - ;; + if [ -f $PCRE/pcre.h ]; then + ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \ + | sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'` + + else if [ -f $PCRE/configure.in ]; then + ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \ + | sed -e 's/^.*=\(.*\)$/\1/'` + + else + ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \ + | sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'` + fi + fi + + echo " $ngx_pcre_ver major version found" + + # to allow -ipo optimization we link with the *.o but not library + + case "$ngx_pcre_ver" in + 4|5) + CORE_LIBS="$CORE_LIBS $PCRE/pcre.o" + ;; + + 6) + CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o" + ;; + + *) + CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o" + CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o" + ;; + + esac + ;; + + *) + have=NGX_PCRE . auto/have + + if [ "$NGX_PLATFORM" = win32 ]; then + have=PCRE_STATIC . auto/have + fi + + CORE_DEPS="$CORE_DEPS $PCRE/pcre.h" + LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a" + CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a" + ;; + + esac - esac - fi if [ $PCRE_JIT = YES ]; then have=NGX_HAVE_PCRE_JIT . auto/have @@ -69,48 +94,8 @@ if [ $PCRE != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + PCRE=NO - fi - - if [ $PCRE = NO -a $PCRE2 != DISABLED ]; then - - ngx_feature="PCRE2 library" - ngx_feature_name="NGX_PCRE2" - ngx_feature_run=no - ngx_feature_incs="#define PCRE2_CODE_UNIT_WIDTH 8 - #include " - ngx_feature_path= - ngx_feature_libs="-lpcre2-8" - ngx_feature_test="pcre2_code *re; - re = pcre2_compile(NULL, 0, 0, NULL, NULL, NULL); - if (re == NULL) return 1" - . auto/feature - - if [ $ngx_found = no ]; then - - # pcre2-config - - ngx_pcre2_prefix=`pcre2-config --prefix 2>/dev/null` - - if [ -n "$ngx_pcre2_prefix" ]; then - ngx_feature="PCRE2 library in $ngx_pcre2_prefix" - ngx_feature_path=`pcre2-config --cflags \ - | sed -n -e 's/.*-I *\([^ ][^ ]*\).*/\1/p'` - ngx_feature_libs=`pcre2-config --libs8` - . auto/feature - fi - fi - - if [ $ngx_found = yes ]; then - have=NGX_PCRE . auto/have - CORE_INCS="$CORE_INCS $ngx_feature_path" - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - PCRE=YES - PCRE_LIBRARY=PCRE2 - fi - fi - - if [ $PCRE = NO ]; then ngx_feature="PCRE library" ngx_feature_name="NGX_PCRE" @@ -182,27 +167,10 @@ else . auto/feature fi - if [ $ngx_found = no ]; then - - # Homebrew on Apple Silicon - - ngx_feature="PCRE library in /opt/homebrew/" - ngx_feature_path="/opt/homebrew/include" - - if [ $NGX_RPATH = YES ]; then - ngx_feature_libs="-R/opt/homebrew/lib -L/opt/homebrew/lib -lpcre" - else - ngx_feature_libs="-L/opt/homebrew/lib -lpcre" - fi - - . auto/feature - fi - if [ $ngx_found = yes ]; then CORE_INCS="$CORE_INCS $ngx_feature_path" CORE_LIBS="$CORE_LIBS $ngx_feature_libs" PCRE=YES - PCRE_LIBRARY=PCRE fi if [ $PCRE = YES ]; then diff --git a/auto/lib/pcre/make b/auto/lib/pcre/make index 182590a..0a27a11 100644 --- a/auto/lib/pcre/make +++ b/auto/lib/pcre/make @@ -3,139 +3,36 @@ # Copyright (C) Nginx, Inc. -if [ $PCRE_LIBRARY = PCRE2 ]; then +case "$NGX_CC_NAME" in - # PCRE2 + msvc*) + ngx_makefile=makefile.msvc + ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" + ngx_pcre="PCRE=\"$PCRE\"" + ;; - if [ $NGX_CC_NAME = msvc ]; then + owc*) + ngx_makefile=makefile.owc + ngx_opt="CPU_OPT=\"$CPU_OPT\"" + ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; - # With PCRE2, it is not possible to compile all sources. - # Since list of source files changes between versions, we - # test files which might not be present. + bcc) + ngx_makefile=makefile.bcc + ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" + ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; - ngx_pcre_srcs="pcre2_auto_possess.c \ - pcre2_chartables.c \ - pcre2_compile.c \ - pcre2_config.c \ - pcre2_context.c \ - pcre2_dfa_match.c \ - pcre2_error.c \ - pcre2_jit_compile.c \ - pcre2_maketables.c \ - pcre2_match.c \ - pcre2_match_data.c \ - pcre2_newline.c \ - pcre2_ord2utf.c \ - pcre2_pattern_info.c \ - pcre2_string_utils.c \ - pcre2_study.c \ - pcre2_substitute.c \ - pcre2_substring.c \ - pcre2_tables.c \ - pcre2_ucd.c \ - pcre2_valid_utf.c \ - pcre2_xclass.c" + *) + ngx_makefile= + ;; - ngx_pcre_test="pcre2_chkdint.c \ - pcre2_convert.c \ - pcre2_extuni.c \ - pcre2_find_bracket.c \ - pcre2_script_run.c \ - pcre2_serialize.c" - - for ngx_src in $ngx_pcre_test - do - if [ -f $PCRE/src/$ngx_src ]; then - ngx_pcre_srcs="$ngx_pcre_srcs $ngx_src" - fi - done - - ngx_pcre_objs=`echo $ngx_pcre_srcs \ - | sed -e "s#\([^ ]*\.\)c#\1$ngx_objext#g"` - - ngx_pcre_srcs=`echo $ngx_pcre_srcs \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"` - ngx_pcre_objs=`echo $ngx_pcre_objs \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"` - - cat << END >> $NGX_MAKEFILE - -PCRE_CFLAGS = -O2 -Ob1 -Oi -Gs $LIBC $CPU_OPT -PCRE_FLAGS = -DHAVE_CONFIG_H -DPCRE2_STATIC -DPCRE2_CODE_UNIT_WIDTH=8 \\ - -DHAVE_MEMMOVE - -PCRE_SRCS = $ngx_pcre_srcs -PCRE_OBJS = $ngx_pcre_objs - -$PCRE/src/pcre2.h: - cd $PCRE/src \\ - && copy /y config.h.generic config.h \\ - && copy /y pcre2.h.generic pcre2.h \\ - && copy /y pcre2_chartables.c.dist pcre2_chartables.c - -$PCRE/src/pcre2-8.lib: $PCRE/src/pcre2.h $NGX_MAKEFILE - cd $PCRE/src \\ - && cl -nologo -c \$(PCRE_CFLAGS) -I . \$(PCRE_FLAGS) \$(PCRE_SRCS) \\ - && link -lib -out:pcre2-8.lib -verbose:lib \$(PCRE_OBJS) - -END - - else - - cat << END >> $NGX_MAKEFILE - -$PCRE/src/pcre2.h: $PCRE/Makefile - -$PCRE/Makefile: $NGX_MAKEFILE - cd $PCRE \\ - && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ - && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\ - ./configure --disable-shared $PCRE_CONF_OPT - -$PCRE/.libs/libpcre2-8.a: $PCRE/Makefile - cd $PCRE \\ - && \$(MAKE) libpcre2-8.la - -END - - fi +esac -else +if [ -n "$ngx_makefile" ]; then - # PCRE - - case "$NGX_CC_NAME" in - - msvc) - ngx_makefile=makefile.msvc - ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" - ngx_pcre="PCRE=\"$PCRE\"" - ;; - - owc) - ngx_makefile=makefile.owc - ngx_opt="CPU_OPT=\"$CPU_OPT\"" - ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - - bcc) - ngx_makefile=makefile.bcc - ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" - ngx_pcre=`echo \-DPCRE=\"$PCRE\" \ - | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - - *) - ngx_makefile= - ;; - - esac - - - if [ -n "$ngx_makefile" ]; then - - cat << END >> $NGX_MAKEFILE + cat << END >> $NGX_MAKEFILE `echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \ | sed -e "s/\//$ngx_regex_dirsep/g"` @@ -146,9 +43,9 @@ else END - else +else - cat << END >> $NGX_MAKEFILE + cat << END >> $NGX_MAKEFILE $PCRE/pcre.h: $PCRE/Makefile @@ -164,6 +61,4 @@ $PCRE/.libs/libpcre.a: $PCRE/Makefile END - fi - fi diff --git a/auto/lib/perl/conf b/auto/lib/perl/conf index e16a1bc..2fbaa76 100644 --- a/auto/lib/perl/conf +++ b/auto/lib/perl/conf @@ -12,9 +12,9 @@ NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \ if test -n "$NGX_PERL_VER"; then echo " + perl version: $NGX_PERL_VER" - if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then + if [ "`$NGX_PERL -e 'use 5.006001; print "OK"'`" != "OK" ]; then echo - echo "$0: error: perl 5.8.6 or higher is required" + echo "$0: error: perl 5.6.1 or higher is required" echo exit 1; @@ -28,10 +28,8 @@ if test -n "$NGX_PERL_VER"; then exit 1; fi - NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts` - NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'` - NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`" + NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts` # gcc 4.1/4.2 warn about unused values in pTHX_ NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ @@ -43,8 +41,6 @@ if test -n "$NGX_PERL_VER"; then ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts` ngx_perl_dlext=`$NGX_PERL -MConfig -e 'print $Config{dlext}'` - ngx_perl_libdir="src/http/modules/perl/blib/arch/auto" - ngx_perl_module="$ngx_perl_libdir/nginx/nginx.$ngx_perl_dlext" if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then have=NGX_HAVE_PERL_MULTIPLICITY . auto/have @@ -56,17 +52,8 @@ if test -n "$NGX_PERL_VER"; then ngx_perl_ldopts=`echo $ngx_perl_ldopts | sed 's/ -pthread//'` fi - if [ "$NGX_SYSTEM" = "Darwin" ]; then - # OS X system perl wants to link universal binaries - ngx_perl_ldopts=`echo $ngx_perl_ldopts \ - | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` - fi - - if [ $USE_PERL = YES ]; then - CORE_LINK="$CORE_LINK $ngx_perl_ldopts" - fi - - NGX_LIB_PERL="$ngx_perl_ldopts" + CORE_LINK="$CORE_LINK $ngx_perl_ldopts" + LINK_DEPS="$LINK_DEPS $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.$ngx_perl_dlext" if test -n "$NGX_PERL_MODULES"; then have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" @@ -76,7 +63,7 @@ if test -n "$NGX_PERL_VER"; then else echo - echo "$0: error: perl 5.8.6 or higher is required" + echo "$0: error: perl 5.6.1 or higher is required" echo exit 1; diff --git a/auto/lib/perl/make b/auto/lib/perl/make index 74e0f3a..d1c1b9e 100644 --- a/auto/lib/perl/make +++ b/auto/lib/perl/make @@ -3,12 +3,12 @@ # Copyright (C) Nginx, Inc. +v=`grep 'define NGINX_VERSION' src/core/nginx.h | sed -e 's/^.*"\(.*\)".*/\1/'` + + cat << END >> $NGX_MAKEFILE -$NGX_OBJS/src/http/modules/perl/ngx_http_perl_module.o: \\ - $NGX_OBJS/$ngx_perl_module - -$NGX_OBJS/$ngx_perl_module: \\ +$NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.$ngx_perl_dlext: \\ \$(CORE_DEPS) \$(HTTP_DEPS) \\ src/http/modules/perl/ngx_http_perl_module.h \\ $NGX_OBJS/src/http/modules/perl/Makefile @@ -24,11 +24,7 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\ src/http/modules/perl/nginx.pm \\ src/http/modules/perl/nginx.xs \\ src/http/modules/perl/typemap - grep 'define NGINX_VERSION' src/core/nginx.h \\ - | sed -e 's/^.*"\(.*\)".*/\1/' > \\ - $NGX_OBJS/src/http/modules/perl/version - sed "s/%%VERSION%%/\`cat $NGX_OBJS/src/http/modules/perl/version\`/" \\ - src/http/modules/perl/nginx.pm > \\ + sed "s/%%VERSION%%/$v/" src/http/modules/perl/nginx.pm > \\ $NGX_OBJS/src/http/modules/perl/nginx.pm cp -p src/http/modules/perl/nginx.xs $NGX_OBJS/src/http/modules/perl/ cp -p src/http/modules/perl/typemap $NGX_OBJS/src/http/modules/perl/ @@ -36,7 +32,6 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\ cd $NGX_OBJS/src/http/modules/perl \\ && NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \\ - NGX_PM_LDFLAGS="$NGX_LD_OPT \$(NGX_PM_LDFLAGS)" \\ NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \\ NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\ $NGX_PERL Makefile.PL \\ diff --git a/auto/lib/sha1/conf b/auto/lib/sha1/conf new file mode 100644 index 0000000..fd69afd --- /dev/null +++ b/auto/lib/sha1/conf @@ -0,0 +1,79 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +if [ $SHA1 != NONE ]; then + + have=NGX_HAVE_SHA1 . auto/have + CORE_INCS="$CORE_INCS $SHA1" + + case "$NGX_CC_NAME" in + + msvc* | owc* | bcc) + LINK_DEPS="$LINK_DEPS $SHA1/sha1.lib" + CORE_LIBS="$CORE_LIBS $SHA1/sha1.lib" + ;; + + icc*) + LINK_DEPS="$LINK_DEPS $SHA1/libsha.a" + + # to allow -ipo optimization we link with the *.o but not library + CORE_LIBS="$CORE_LIBS $SHA1/sha1_dgst.o" + + if [ $SHA1_ASM = YES ]; then + CORE_LIBS="$CORE_LIBS $SHA1/asm/sx86-elf.o" + fi + ;; + + *) + LINK_DEPS="$LINK_DEPS $SHA1/libsha.a" + CORE_LIBS="$CORE_LIBS $SHA1/libsha.a" + #CORE_LIBS="$CORE_LIBS -L $SHA1 -lsha" + ;; + + esac + +else + + if [ "$NGX_PLATFORM" != win32 ]; then + + SHA1=NO + + # FreeBSD + + ngx_feature="sha1 in system md library" + ngx_feature_name=NGX_HAVE_SHA1 + ngx_feature_run=no + ngx_feature_incs="#include " + ngx_feature_path= + ngx_feature_libs="-lmd" + ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)" + . auto/feature + + ngx_sha1_lib="system md" + + if [ $ngx_found = no ]; then + + # OpenSSL crypto library + + ngx_feature="sha1 in system OpenSSL crypto library" + ngx_feature_incs="#include " + ngx_feature_libs="-lcrypto" + . auto/feature + + ngx_sha1_lib="system crypto" + + if [ $ngx_found = yes ]; then + have=NGX_HAVE_OPENSSL_SHA1_H . auto/have + fi + fi + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + SHA1=YES + SHA1_LIB=$ngx_sha1_lib + fi + fi + +fi diff --git a/auto/lib/sha1/make b/auto/lib/sha1/make new file mode 100644 index 0000000..fc10aae --- /dev/null +++ b/auto/lib/sha1/make @@ -0,0 +1,96 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +case "$NGX_CC_NAME" in + + msvc*) + ngx_makefile=makefile.msvc + ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC SHA1_ASM=$SHA1_ASM" + ngx_sha1="SHA1=\"$SHA1\"" + ;; + + owc*) + ngx_makefile=makefile.owc + ngx_opt="CPU_OPT=\"$CPU_OPT\"" + ngx_sha1=`echo SHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + + bcc) + ngx_makefile=makefile.bcc + ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DSHA1_ASM=$SHA1_ASM" + ngx_sha1=`echo \-DSHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"` + ;; + +esac + + +done=NO + + +case "$NGX_PLATFORM" in + + win32) + cat << END >> $NGX_MAKEFILE + +`echo "$SHA1/sha1.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` + \$(MAKE) -f auto/lib/sha1/$ngx_makefile $ngx_opt $ngx_sha1 + +END + + done=YES + ;; + + SunOS:*:i86pc) + if [ $SHA1_ASM = YES ]; then + + cat << END >> $NGX_MAKEFILE + +$SHA1/libsha.a: $NGX_MAKEFILE + cd $SHA1 \\ + && \$(MAKE) CFLAGS="$SHA1_OPT -DSOL -DSHA1_ASM -DL_ENDIAN" \\ + CC="\$(CC)" CPP="\$(CPP)" \\ + SHA_ASM_OBJ=asm/sx86-sol.o clean libsha.a + +END + + done=YES + fi + ;; + + # FreeBSD: i386 + # Linux: i686 + + *:i386 | *:i686) + if [ $SHA1_ASM = YES ]; then + + cat << END >> $NGX_MAKEFILE + +$SHA1/libsha.a: $NGX_MAKEFILE + cd $SHA1 \\ + && \$(MAKE) CFLAGS="$SHA1_OPT -DELF -DSHA1_ASM -DL_ENDIAN" \\ + CC="\$(CC)" CPP="\$(CPP)" \\ + SHA_ASM_OBJ=asm/sx86-elf.o clean libsha.a + +END + + done=YES + fi + ;; + +esac + + +if [ $done = NO ]; then + + cat << END >> $NGX_MAKEFILE + +$SHA1/libsha.a: $NGX_MAKEFILE + cd $SHA1 \\ + && \$(MAKE) CFLAGS="$SHA1_OPT" \\ + CC="\$(CC)" SHA_ASM_OBJ= clean libsha.a + +END + +fi diff --git a/auto/lib/sha1/makefile.bcc b/auto/lib/sha1/makefile.bcc new file mode 100644 index 0000000..b0685fa --- /dev/null +++ b/auto/lib/sha1/makefile.bcc @@ -0,0 +1,22 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN + +!if "$(SHA1_ASM)" == "YES" + +sha1.lib: + cd $(SHA1) + bcc32 -c $(CFLAGS) -DSHA1_ASM sha1dgst.c + tlib sha1.lib +sha1dgst.obj +"asm\s-win32.obj" + +!else + +sha1.lib: + cd $(SHA1) + bcc32 -c $(CFLAGS) sha1dgst.c + tlib sha1.lib +sha1dgst.obj + +!endif diff --git a/auto/lib/sha1/makefile.msvc b/auto/lib/sha1/makefile.msvc new file mode 100644 index 0000000..3cbd21b --- /dev/null +++ b/auto/lib/sha1/makefile.msvc @@ -0,0 +1,22 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN + +!IF "$(SHA1_ASM)" == "YES" + +sha1.lib: + cd $(SHA1) + cl -c $(CFLAGS) -D SHA1_ASM sha1dgst.c + link -lib -out:sha1.lib sha1dgst.obj asm/s-win32.obj + +!ELSE + +sha1.lib: + cd $(SHA1) + cl -c $(CFLAGS) sha1dgst.c + link -lib -out:sha1.lib sha1dgst.obj + +!ENDIF diff --git a/auto/lib/sha1/makefile.owc b/auto/lib/sha1/makefile.owc new file mode 100644 index 0000000..fc095cc --- /dev/null +++ b/auto/lib/sha1/makefile.owc @@ -0,0 +1,11 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) + +sha1.lib: + cd $(SHA1) + wcl386 -c $(CFLAGS) -dL_ENDIAN sha1dgst.c + wlib -n sha1.lib sha1dgst.obj diff --git a/auto/lib/test b/auto/lib/test new file mode 100644 index 0000000..ba943a2 --- /dev/null +++ b/auto/lib/test @@ -0,0 +1,40 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) Nginx, Inc. + + +echo $ngx_n "checking for $ngx_lib ...$ngx_c" + +cat << END >> $NGX_AUTOCONF_ERR + +---------------------------------------- +checking for $ngx_lib + +END + +ngx_found=no + +cat << END > $NGX_AUTOTEST.c + +$ngx_lib_incs + +int main() { + $ngx_lib_test; + return 0; +} + + +eval "$CC $cc_test_flags $ngx_lib_cflags \ + -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \ + >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + + ngx_found=yes + +else + echo " not found" +fi + +rm -rf $NGX_AUTOTEST* diff --git a/auto/lib/zlib/conf b/auto/lib/zlib/conf index 239592e..26db642 100644 --- a/auto/lib/zlib/conf +++ b/auto/lib/zlib/conf @@ -8,13 +8,13 @@ if [ $ZLIB != NONE ]; then case "$NGX_CC_NAME" in - msvc | owc | bcc) + msvc* | owc* | bcc) have=NGX_ZLIB . auto/have LINK_DEPS="$LINK_DEPS $ZLIB/zlib.lib" CORE_LIBS="$CORE_LIBS $ZLIB/zlib.lib" ;; - icc) + icc*) have=NGX_ZLIB . auto/have LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" diff --git a/auto/lib/zlib/make b/auto/lib/zlib/make index 0082ad5..7875ef6 100644 --- a/auto/lib/zlib/make +++ b/auto/lib/zlib/make @@ -5,14 +5,14 @@ case "$NGX_CC_NAME" in - msvc) + msvc*) ngx_makefile=makefile.msvc ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" ngx_zlib="ZLIB=\"$ZLIB\"" ;; - owc) + owc*) ngx_makefile=makefile.owc ngx_opt="CPU_OPT=\"$CPU_OPT\"" ngx_zlib=`echo ZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"` diff --git a/auto/lib/zlib/patch.zlib.h b/auto/lib/zlib/patch.zlib.h new file mode 100644 index 0000000..122f7fa --- /dev/null +++ b/auto/lib/zlib/patch.zlib.h @@ -0,0 +1,10 @@ +--- zlib.h Thu Jul 9 20:06:56 1998 ++++ zlib-1.1.3/zlib.h Tue Mar 22 13:41:04 2005 +@@ -709,7 +709,6 @@ + (0 in case of error). + */ + +-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); + /* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of diff --git a/auto/make b/auto/make index fad0844..05b7454 100644 --- a/auto/make +++ b/auto/make @@ -2,21 +2,14 @@ # Copyright (C) Igor Sysoev # Copyright (C) Nginx, Inc. -basename_last2() { - local basename_1=`basename \`dirname $1\`` - local basename_2=$(basename "$1") - echo $(printf "$basename_1/$basename_2" | sed 's/\.\.\///') -} echo "creating $NGX_MAKEFILE" mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \ - $NGX_OBJS/src/event/quic \ $NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \ - $NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/v3 \ - $NGX_OBJS/src/http/modules $NGX_OBJS/src/http/modules/perl \ + $NGX_OBJS/src/http $NGX_OBJS/src/http/modules \ + $NGX_OBJS/src/http/modules/perl \ $NGX_OBJS/src/mail \ - $NGX_OBJS/src/stream \ $NGX_OBJS/src/misc @@ -37,13 +30,12 @@ END if test -n "$NGX_PERL_CFLAGS"; then echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS >> $NGX_MAKEFILE - echo NGX_PM_LDFLAGS = $NGX_PM_LDFLAGS >> $NGX_MAKEFILE fi # ALL_INCS, required by the addons and by OpenWatcom C precompiled headers -ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS $STREAM_INCS\ +ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS\ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \ -e "s/\//$ngx_regex_dirsep/g"` @@ -57,7 +49,7 @@ END ngx_all_srcs="$CORE_SRCS" -# the core dependencies and include paths +# the core dependences and include paths ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \ @@ -77,7 +69,7 @@ CORE_INCS = $ngx_include_opt$ngx_incs END -# the http dependencies and include paths +# the http dependences and include paths if [ $HTTP = YES ]; then @@ -103,13 +95,11 @@ END fi -# the mail dependencies and include paths +# the mail dependences and include paths -if [ $MAIL != NO ]; then +if [ $MAIL = YES ]; then - if [ $MAIL = YES ]; then - ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS" - fi + ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS" ngx_deps=`echo $MAIL_DEPS \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \ @@ -131,38 +121,10 @@ END fi -# the stream dependencies and include paths - -if [ $STREAM != NO ]; then - - if [ $STREAM = YES ]; then - ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS" - fi - - ngx_deps=`echo $STREAM_DEPS \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \ - -e "s/\//$ngx_regex_dirsep/g"` - - ngx_incs=`echo $STREAM_INCS \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \ - -e "s/\//$ngx_regex_dirsep/g"` - - cat << END >> $NGX_MAKEFILE - -STREAM_DEPS = $ngx_deps +ngx_all_srcs="$ngx_all_srcs $NGX_MISC_SRCS" -STREAM_INCS = $ngx_include_opt$ngx_incs - -END - -fi - - -ngx_all_srcs="$ngx_all_srcs $MISC_SRCS" - - -if test -n "$NGX_ADDON_SRCS$DYNAMIC_MODULES"; then +if test -n "$NGX_ADDON_SRCS"; then cat << END >> $NGX_MAKEFILE @@ -179,7 +141,7 @@ ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"` for ngx_src in $NGX_ADDON_SRCS do - ngx_obj="addon/`basename_last2 \`dirname $ngx_src\``" + ngx_obj="addon/`basename \`dirname $ngx_src\``" test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj @@ -215,7 +177,6 @@ ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \ -e "s/\//$ngx_regex_dirsep/g"` -ngx_libs= if test -n "$NGX_LD_OPT$CORE_LIBS"; then ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"` @@ -224,22 +185,13 @@ fi ngx_link=${CORE_LINK:+`echo $CORE_LINK \ | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`} -ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \ - | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`} - cat << END >> $NGX_MAKEFILE -build: binary modules manpage - -binary: $NGX_OBJS${ngx_dirsep}nginx$ngx_binext - -$NGX_OBJS${ngx_dirsep}nginx$ngx_binext: $ngx_deps$ngx_spacer - \$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_binext$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link +$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer + \$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link $ngx_rcc -$ngx_long_end - -modules: +${ngx_long_end} END @@ -288,7 +240,7 @@ if [ $HTTP = YES ]; then ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" else ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)" - ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS)" + ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS) " ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)" fi @@ -319,7 +271,7 @@ $ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src END fi - done + done fi @@ -349,48 +301,18 @@ $ngx_obj: \$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX END - done - -fi - - -# the stream sources - -if [ $STREAM = YES ]; then - - if test -n "$NGX_PCH"; then - ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" - else - ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(STREAM_INCS)" - fi - - for ngx_src in $STREAM_SRCS - do - ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"` - ngx_obj=`echo $ngx_src \ - | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"` - - cat << END >> $NGX_MAKEFILE - -$ngx_obj: \$(CORE_DEPS) \$(STREAM_DEPS)$ngx_cont$ngx_src - $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX - -END - done + done fi # the misc sources -if test -n "$MISC_SRCS"; then +if test -n "$NGX_MISC_SRCS"; then ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" - for ngx_src in $MISC_SRCS + for ngx_src in $NGX_MISC_SRCS do ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"` ngx_obj=`echo $ngx_src \ @@ -405,7 +327,7 @@ $ngx_obj: \$(CORE_DEPS) $ngx_cont$ngx_src $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX END - done + done fi @@ -418,7 +340,7 @@ if test -n "$NGX_ADDON_SRCS"; then for ngx_src in $NGX_ADDON_SRCS do - ngx_obj="addon/`basename_last2 \`dirname $ngx_src\``" + ngx_obj="addon/`basename \`dirname $ngx_src\``" ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \ | sed -e "s/\//$ngx_regex_dirsep/g"` @@ -437,16 +359,16 @@ $ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX END - done + done fi # the addons config.make -if test -n "$NGX_ADDONS$DYNAMIC_ADDONS"; then +if test -n "$NGX_ADDONS"; then - for ngx_addon_dir in $NGX_ADDONS $DYNAMIC_ADDONS + for ngx_addon_dir in $NGX_ADDONS do if test -f $ngx_addon_dir/config.make; then . $ngx_addon_dir/config.make @@ -493,187 +415,3 @@ $ngx_pch END fi - - -# dynamic modules - -if test -n "$NGX_PCH"; then - ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" -else - ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)" - ngx_perl_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(NGX_PERL_CFLAGS)" - ngx_perl_cc="$ngx_perl_cc \$(ALL_INCS)" -fi - -for ngx_module in $DYNAMIC_MODULES -do - eval ngx_module_srcs="\$${ngx_module}_SRCS" - eval ngx_module_shrd="\$${ngx_module}_SHRD" - eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\"" - - eval ngx_module_modules="\$${ngx_module}_MODULES" - eval ngx_module_order="\$${ngx_module}_ORDER" - - ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.c - - cat << END > $ngx_modules_c - -#include -#include - -END - - for mod in $ngx_module_modules - do - echo "extern ngx_module_t $mod;" >> $ngx_modules_c - done - - echo >> $ngx_modules_c - echo 'ngx_module_t *ngx_modules[] = {' >> $ngx_modules_c - - for mod in $ngx_module_modules - do - echo " &$mod," >> $ngx_modules_c - done - - cat << END >> $ngx_modules_c - NULL -}; - -END - - echo 'char *ngx_module_names[] = {' >> $ngx_modules_c - - for mod in $ngx_module_modules - do - echo " \"$mod\"," >> $ngx_modules_c - done - - cat << END >> $ngx_modules_c - NULL -}; - -END - - echo 'char *ngx_module_order[] = {' >> $ngx_modules_c - - for mod in $ngx_module_order - do - echo " \"$mod\"," >> $ngx_modules_c - done - - cat << END >> $ngx_modules_c - NULL -}; - -END - - ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"` - - ngx_modules_obj=`echo $ngx_modules_c \ - | sed -e "s/\(.*\.\)c/\1$ngx_objext/"` - - ngx_module_objs= - for ngx_src in $ngx_module_srcs $ngx_module_shrd - do - case "$ngx_src" in - src/*) - ngx_obj=$ngx_src - ;; - *) - ngx_obj="addon/`basename_last2 \`dirname $ngx_src\``" - mkdir -p $NGX_OBJS/$ngx_obj - ngx_obj="$ngx_obj/`basename $ngx_src`" - ;; - esac - - ngx_module_objs="$ngx_module_objs $ngx_obj" - done - - ngx_module_objs=`echo $ngx_module_objs \ - | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \ - -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \ - -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \ - -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"` - - ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \ - -e "s/\//$ngx_regex_dirsep/g"` - - ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \ - | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \ - -e "s/\//$ngx_regex_dirsep/g"` - - ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modext - - if [ "$NGX_PLATFORM" = win32 ]; then - ngx_module_libs="$CORE_LIBS $ngx_module_libs" - fi - - ngx_libs= - if test -n "$NGX_LD_OPT$ngx_module_libs"; then - ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \ - | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"` - fi - - ngx_link=${CORE_LINK:+`echo $CORE_LINK \ - | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`} - - ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \ - | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`} - - - cat << END >> $NGX_MAKEFILE - -modules: $ngx_obj - -$ngx_obj: $ngx_deps$ngx_spacer - \$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_module_link -$ngx_long_end - -$ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c - $ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX - -END - - for ngx_source in $ngx_module_srcs - do - case "$ngx_source" in - src/*) - ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - *) - ngx_obj="addon/`basename_last2 \`dirname $ngx_source\``" - ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \ - | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - esac - - ngx_obj=`echo $ngx_obj \ - | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \ - -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"` - - ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"` - - if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then - - cat << END >> $NGX_MAKEFILE - -$ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src - $ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX - -END - else - - cat << END >> $NGX_MAKEFILE - -$ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src - $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX - -END - - fi - done -done diff --git a/auto/module b/auto/module deleted file mode 100644 index 3857d04..0000000 --- a/auto/module +++ /dev/null @@ -1,178 +0,0 @@ - -# Copyright (C) Ruslan Ermilov -# Copyright (C) Nginx, Inc. - - -case $ngx_module_type in - HTTP_*) ngx_var=HTTP ;; - *) ngx_var=$ngx_module_type ;; -esac - - -if [ "$ngx_module_link" = DYNAMIC ]; then - - for ngx_module in $ngx_module_name; do - # extract the first name - break - done - - DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module" - - eval ${ngx_module}_MODULES=\"$ngx_module_name\" - - if [ -z "$ngx_module_order" -a \ - \( "$ngx_module_type" = "HTTP_FILTER" \ - -o "$ngx_module_type" = "HTTP_AUX_FILTER" \) ] - then - eval ${ngx_module}_ORDER=\"$ngx_module_name \ - ngx_http_copy_filter_module\" - else - eval ${ngx_module}_ORDER=\"$ngx_module_order\" - fi - - srcs= - shrd= - for src in $ngx_module_srcs - do - found=no - for old in $DYNAMIC_MODULES_SRCS - do - if [ $src = $old ]; then - found=yes - break - fi - done - - if [ $found = no ]; then - srcs="$srcs $src" - else - shrd="$shrd $src" - fi - done - eval ${ngx_module}_SRCS=\"$srcs\" - eval ${ngx_module}_SHRD=\"$shrd\" - - DYNAMIC_MODULES_SRCS="$DYNAMIC_MODULES_SRCS $srcs" - - if test -n "$ngx_module_incs"; then - CORE_INCS="$CORE_INCS $ngx_module_incs" - fi - - if test -n "$ngx_module_deps"; then - NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps" - fi - - libs= - for lib in $ngx_module_libs - do - case $lib in - - LIBXSLT | LIBGD | GEOIP | PERL) - libs="$libs \$NGX_LIB_$lib" - - if eval [ "\$USE_${lib}" = NO ] ; then - eval USE_${lib}=DYNAMIC - fi - ;; - - PCRE | OPENSSL | ZLIB) - eval USE_${lib}=YES - ;; - - MD5 | SHA1) - # obsolete - ;; - - *) - libs="$libs $lib" - ;; - - esac - done - eval ${ngx_module}_LIBS=\'$libs\' - -elif [ "$ngx_module_link" = YES ]; then - - eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \ - $ngx_module_name\" - - eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\" - - if test -n "$ngx_module_incs"; then - eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\" - fi - - if test -n "$ngx_module_deps"; then - eval ${ngx_var}_DEPS=\"\$${ngx_var}_DEPS $ngx_module_deps\" - fi - - for lib in $ngx_module_libs - do - case $lib in - - PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) - eval USE_${lib}=YES - ;; - - MD5 | SHA1) - # obsolete - ;; - - *) - CORE_LIBS="$CORE_LIBS $lib" - ;; - - esac - done - -elif [ "$ngx_module_link" = ADDON ]; then - - eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \ - $ngx_module_name\" - - srcs= - for src in $ngx_module_srcs - do - found=no - for old in $NGX_ADDON_SRCS - do - if [ $src = $old ]; then - found=yes - break - fi - done - - if [ $found = no ]; then - srcs="$srcs $src" - fi - done - - NGX_ADDON_SRCS="$NGX_ADDON_SRCS $srcs" - - if test -n "$ngx_module_incs"; then - eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\" - fi - - if test -n "$ngx_module_deps"; then - NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps" - fi - - for lib in $ngx_module_libs - do - case $lib in - - PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) - eval USE_${lib}=YES - ;; - - MD5 | SHA1) - # obsolete - ;; - - *) - CORE_LIBS="$CORE_LIBS $lib" - ;; - - esac - done -fi diff --git a/auto/modules b/auto/modules index 1a5e421..e1eda94 100644 --- a/auto/modules +++ b/auto/modules @@ -43,1203 +43,355 @@ fi if [ $NGX_TEST_BUILD_EPOLL = YES ]; then have=NGX_HAVE_EPOLL . auto/have have=NGX_HAVE_EPOLLRDHUP . auto/have - have=NGX_HAVE_EPOLLEXCLUSIVE . auto/have have=NGX_HAVE_EVENTFD . auto/have have=NGX_TEST_BUILD_EPOLL . auto/have EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" fi +if [ $NGX_TEST_BUILD_RTSIG = YES ]; then + have=NGX_HAVE_RTSIG . auto/have + have=NGX_TEST_BUILD_RTSIG . auto/have + EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" + CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" +fi + if [ $NGX_TEST_BUILD_SOLARIS_SENDFILEV = YES ]; then have=NGX_TEST_BUILD_SOLARIS_SENDFILEV . auto/have CORE_SRCS="$CORE_SRCS $SOLARIS_SENDFILEV_SRCS" fi -if [ $HTTP = YES ]; then - HTTP_MODULES= - HTTP_DEPS= - HTTP_INCS= - - ngx_module_type=HTTP - - if :; then - ngx_module_name="ngx_http_module \ - ngx_http_core_module \ - ngx_http_log_module \ - ngx_http_upstream_module" - ngx_module_incs="src/http src/http/modules" - ngx_module_deps="src/http/ngx_http.h \ - src/http/ngx_http_request.h \ - src/http/ngx_http_config.h \ - src/http/ngx_http_core_module.h \ - src/http/ngx_http_cache.h \ - src/http/ngx_http_variables.h \ - src/http/ngx_http_script.h \ - src/http/ngx_http_upstream.h \ - src/http/ngx_http_upstream_round_robin.h" - ngx_module_srcs="src/http/ngx_http.c \ - src/http/ngx_http_core_module.c \ - src/http/ngx_http_special_response.c \ - src/http/ngx_http_request.c \ - src/http/ngx_http_parse.c \ - src/http/modules/ngx_http_log_module.c \ - src/http/ngx_http_request_body.c \ - src/http/ngx_http_variables.c \ - src/http/ngx_http_script.c \ - src/http/ngx_http_upstream.c \ - src/http/ngx_http_upstream_round_robin.c" - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - - if [ $HTTP_CACHE = YES ]; then - have=NGX_HTTP_CACHE . auto/have - HTTP_SRCS="$HTTP_SRCS $HTTP_FILE_CACHE_SRCS" - fi - - - if [ $HTTP_V2 = YES -o $HTTP_V3 = YES ]; then - HTTP_SRCS="$HTTP_SRCS $HTTP_HUFF_SRCS" - fi - - - # the module order is important - # ngx_http_static_module - # ngx_http_gzip_static_module - # ngx_http_dav_module - # ngx_http_autoindex_module - # ngx_http_index_module - # ngx_http_random_index_module - # - # ngx_http_access_module - # ngx_http_realip_module - # - # - # the filter order is important - # ngx_http_write_filter - # ngx_http_header_filter - # ngx_http_chunked_filter - # ngx_http_v2_filter - # ngx_http_v3_filter - # ngx_http_range_header_filter - # ngx_http_gzip_filter - # ngx_http_postpone_filter - # ngx_http_ssi_filter - # ngx_http_charset_filter - # ngx_http_xslt_filter - # ngx_http_image_filter - # ngx_http_sub_filter - # ngx_http_addition_filter - # ngx_http_gunzip_filter - # ngx_http_userid_filter - # ngx_http_headers_filter - # ngx_http_copy_filter - # ngx_http_range_body_filter - # ngx_http_not_modified_filter - # ngx_http_slice_filter - - ngx_module_type=HTTP_FILTER - HTTP_FILTER_MODULES= - - ngx_module_order="ngx_http_static_module \ - ngx_http_gzip_static_module \ - ngx_http_dav_module \ - ngx_http_autoindex_module \ - ngx_http_index_module \ - ngx_http_random_index_module \ - ngx_http_access_module \ - ngx_http_realip_module \ - ngx_http_write_filter_module \ - ngx_http_header_filter_module \ - ngx_http_chunked_filter_module \ - ngx_http_v2_filter_module \ - ngx_http_v3_filter_module \ - ngx_http_range_header_filter_module \ - ngx_http_gzip_filter_module \ - ngx_http_postpone_filter_module \ - ngx_http_ssi_filter_module \ - ngx_http_charset_filter_module \ - ngx_http_xslt_filter_module \ - ngx_http_image_filter_module \ - ngx_http_sub_filter_module \ - ngx_http_addition_filter_module \ - ngx_http_gunzip_filter_module \ - ngx_http_userid_filter_module \ - ngx_http_headers_filter_module \ - ngx_http_copy_filter_module \ - ngx_http_range_body_filter_module \ - ngx_http_not_modified_filter_module \ - ngx_http_slice_filter_module" - - if :; then - ngx_module_name=ngx_http_write_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/ngx_http_write_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_header_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/ngx_http_header_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_chunked_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_chunked_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_V2 = YES ]; then - ngx_module_name=ngx_http_v2_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/v2/ngx_http_v2_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_V2 - - . auto/module - fi - - if [ $HTTP_V3 = YES ]; then - ngx_module_name=ngx_http_v3_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/v3/ngx_http_v3_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_V3 - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_range_header_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_range_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_GZIP = YES ]; then - have=NGX_HTTP_GZIP . auto/have - USE_ZLIB=YES - - ngx_module_name=ngx_http_gzip_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_gzip_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_GZIP - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_postpone_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/ngx_http_postpone_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_SSI = YES ]; then - have=NGX_HTTP_SSI . auto/have - - ngx_module_name=ngx_http_ssi_filter_module - ngx_module_incs= - ngx_module_deps=src/http/modules/ngx_http_ssi_filter_module.h - ngx_module_srcs=src/http/modules/ngx_http_ssi_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SSI - - . auto/module - fi - - if [ $HTTP_CHARSET = YES ]; then - ngx_module_name=ngx_http_charset_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_charset_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_CHARSET - - . auto/module - fi - - if [ $HTTP_XSLT != NO ]; then - ngx_module_name=ngx_http_xslt_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_xslt_filter_module.c - ngx_module_libs=LIBXSLT - ngx_module_link=$HTTP_XSLT - - . auto/module - fi - - if [ $HTTP_IMAGE_FILTER != NO ]; then - ngx_module_name=ngx_http_image_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_image_filter_module.c - ngx_module_libs=LIBGD - ngx_module_link=$HTTP_IMAGE_FILTER - - . auto/module - fi - - if [ $HTTP_SUB = YES ]; then - ngx_module_name=ngx_http_sub_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_sub_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SUB - - . auto/module - fi - - if [ $HTTP_ADDITION = YES ]; then - ngx_module_name=ngx_http_addition_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_addition_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_ADDITION - - . auto/module - fi - - if [ $HTTP_GUNZIP = YES ]; then - have=NGX_HTTP_GZIP . auto/have - USE_ZLIB=YES - - ngx_module_name=ngx_http_gunzip_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_gunzip_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_GUNZIP - - . auto/module - fi - - if [ $HTTP_USERID = YES ]; then - ngx_module_name=ngx_http_userid_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_userid_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_USERID - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_headers_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_headers_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - - ngx_module_type=HTTP_INIT_FILTER - HTTP_INIT_FILTER_MODULES= - - if :; then - ngx_module_name=ngx_http_copy_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/ngx_http_copy_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_range_body_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs= - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_not_modified_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_not_modified_filter_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_SLICE = YES ]; then - ngx_module_name=ngx_http_slice_filter_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_slice_filter_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SLICE - - . auto/module - fi - - - ngx_module_type=HTTP - - if [ $HTTP_V2 = YES ]; then - have=NGX_HTTP_V2 . auto/have - - ngx_module_name=ngx_http_v2_module - ngx_module_incs=src/http/v2 - ngx_module_deps="src/http/v2/ngx_http_v2.h \ - src/http/v2/ngx_http_v2_module.h" - ngx_module_srcs="src/http/v2/ngx_http_v2.c \ - src/http/v2/ngx_http_v2_table.c \ - src/http/v2/ngx_http_v2_encode.c \ - src/http/v2/ngx_http_v2_module.c" - ngx_module_libs= - ngx_module_link=$HTTP_V2 - - . auto/module - fi - - if [ $HTTP_V3 = YES ]; then - USE_OPENSSL_QUIC=YES - HTTP_SSL=YES - - have=NGX_HTTP_V3 . auto/have - - ngx_module_name=ngx_http_v3_module - ngx_module_incs=src/http/v3 - ngx_module_deps="src/http/v3/ngx_http_v3.h \ - src/http/v3/ngx_http_v3_encode.h \ - src/http/v3/ngx_http_v3_parse.h \ - src/http/v3/ngx_http_v3_table.h \ - src/http/v3/ngx_http_v3_uni.h" - ngx_module_srcs="src/http/v3/ngx_http_v3.c \ - src/http/v3/ngx_http_v3_encode.c \ - src/http/v3/ngx_http_v3_parse.c \ - src/http/v3/ngx_http_v3_table.c \ - src/http/v3/ngx_http_v3_uni.c \ - src/http/v3/ngx_http_v3_request.c \ - src/http/v3/ngx_http_v3_module.c" - ngx_module_libs= - ngx_module_link=$HTTP_V3 - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_static_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_static_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_GZIP_STATIC = YES ]; then - have=NGX_HTTP_GZIP . auto/have - - ngx_module_name=ngx_http_gzip_static_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_gzip_static_module.c - ngx_module_libs= - ngx_module_link=$HTTP_GZIP_STATIC - - . auto/module - fi - - if [ $HTTP_DAV = YES ]; then - have=NGX_HTTP_DAV . auto/have - - ngx_module_name=ngx_http_dav_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_dav_module.c - ngx_module_libs= - ngx_module_link=$HTTP_DAV - - . auto/module - fi - - if [ $HTTP_AUTOINDEX = YES ]; then - ngx_module_name=ngx_http_autoindex_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_autoindex_module.c - ngx_module_libs= - ngx_module_link=$HTTP_AUTOINDEX - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_index_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_index_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_RANDOM_INDEX = YES ]; then - ngx_module_name=ngx_http_random_index_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_random_index_module.c - ngx_module_libs= - ngx_module_link=$HTTP_RANDOM_INDEX - - . auto/module - fi - - if [ $HTTP_MIRROR = YES ]; then - ngx_module_name=ngx_http_mirror_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_mirror_module.c - ngx_module_libs= - ngx_module_link=$HTTP_MIRROR - - . auto/module - fi - - if :; then - ngx_module_name=ngx_http_try_files_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_try_files_module.c - ngx_module_libs= - ngx_module_link=YES - - . auto/module - fi - - if [ $HTTP_AUTH_REQUEST = YES ]; then - ngx_module_name=ngx_http_auth_request_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_auth_request_module.c - ngx_module_libs= - ngx_module_link=$HTTP_AUTH_REQUEST - - . auto/module - fi - - if [ $HTTP_AUTH_BASIC = YES ]; then - have=NGX_CRYPT . auto/have - - ngx_module_name=ngx_http_auth_basic_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_auth_basic_module.c - ngx_module_libs=$CRYPT_LIB - ngx_module_link=$HTTP_AUTH_BASIC - - . auto/module - fi - - if [ $HTTP_ACCESS = YES ]; then - ngx_module_name=ngx_http_access_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_access_module.c - ngx_module_libs= - ngx_module_link=$HTTP_ACCESS - - . auto/module - fi - - if [ $HTTP_LIMIT_CONN = YES ]; then - ngx_module_name=ngx_http_limit_conn_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_limit_conn_module.c - ngx_module_libs= - ngx_module_link=$HTTP_LIMIT_CONN - - . auto/module - fi - - if [ $HTTP_LIMIT_REQ = YES ]; then - ngx_module_name=ngx_http_limit_req_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_limit_req_module.c - ngx_module_libs= - ngx_module_link=$HTTP_LIMIT_REQ - - . auto/module - fi - - if [ $HTTP_REALIP = YES ]; then - have=NGX_HTTP_REALIP . auto/have - have=NGX_HTTP_X_FORWARDED_FOR . auto/have - - ngx_module_name=ngx_http_realip_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_realip_module.c - ngx_module_libs= - ngx_module_link=$HTTP_REALIP - - . auto/module - fi - - if [ $HTTP_STATUS = YES ]; then - ngx_module_name=ngx_http_status_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_status_module.c - ngx_module_libs= - ngx_module_link=$HTTP_STATUS - - . auto/module - fi - - if [ $HTTP_GEO = YES ]; then - have=NGX_HTTP_X_FORWARDED_FOR . auto/have - - ngx_module_name=ngx_http_geo_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_geo_module.c - ngx_module_libs= - ngx_module_link=$HTTP_GEO - - . auto/module - fi - - if [ $HTTP_GEOIP != NO ]; then - have=NGX_HTTP_X_FORWARDED_FOR . auto/have - - ngx_module_name=ngx_http_geoip_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_geoip_module.c - ngx_module_libs=GEOIP - ngx_module_link=$HTTP_GEOIP - - . auto/module - fi - - if [ $HTTP_MAP = YES ]; then - ngx_module_name=ngx_http_map_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_map_module.c - ngx_module_libs= - ngx_module_link=$HTTP_MAP - - . auto/module - fi - - if [ $HTTP_SPLIT_CLIENTS = YES ]; then - ngx_module_name=ngx_http_split_clients_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_split_clients_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SPLIT_CLIENTS - - . auto/module - fi - - if [ $HTTP_REFERER = YES ]; then - ngx_module_name=ngx_http_referer_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_referer_module.c - ngx_module_libs= - ngx_module_link=$HTTP_REFERER - - . auto/module - fi - - if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then - USE_PCRE=YES - - ngx_module_name=ngx_http_rewrite_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_rewrite_module.c - ngx_module_libs= - ngx_module_link=$HTTP_REWRITE - - . auto/module - fi - - if [ $HTTP_SSL = YES ]; then - USE_OPENSSL=YES - have=NGX_HTTP_SSL . auto/have - - ngx_module_name=ngx_http_ssl_module - ngx_module_incs= - ngx_module_deps=src/http/modules/ngx_http_ssl_module.h - ngx_module_srcs=src/http/modules/ngx_http_ssl_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SSL - - . auto/module - fi - - if [ $HTTP_PROXY = YES ]; then - have=NGX_HTTP_X_FORWARDED_FOR . auto/have - - ngx_module_name=ngx_http_proxy_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_proxy_module.c - ngx_module_libs= - ngx_module_link=$HTTP_PROXY - - . auto/module - fi - - if [ $HTTP_FASTCGI = YES ]; then - ngx_module_name=ngx_http_fastcgi_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_fastcgi_module.c - ngx_module_libs= - ngx_module_link=$HTTP_FASTCGI - - . auto/module - fi - - if [ $HTTP_UWSGI = YES ]; then - ngx_module_name=ngx_http_uwsgi_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_uwsgi_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UWSGI - - . auto/module - fi - - if [ $HTTP_SCGI = YES ]; then - ngx_module_name=ngx_http_scgi_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_scgi_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SCGI - - . auto/module - fi - - if [ $HTTP_GRPC = YES -a $HTTP_V2 = YES ]; then - ngx_module_name=ngx_http_grpc_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_grpc_module.c - ngx_module_libs= - ngx_module_link=$HTTP_GRPC - - . auto/module - fi - - if [ $HTTP_PERL != NO ]; then - ngx_module_name=ngx_http_perl_module - ngx_module_incs=src/http/modules/perl - ngx_module_deps=src/http/modules/perl/ngx_http_perl_module.h - ngx_module_srcs=src/http/modules/perl/ngx_http_perl_module.c - ngx_module_libs=PERL - ngx_module_link=$HTTP_PERL - - . auto/module - fi - - if [ $HTTP_MEMCACHED = YES ]; then - ngx_module_name=ngx_http_memcached_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_memcached_module.c - ngx_module_libs= - ngx_module_link=$HTTP_MEMCACHED - - . auto/module - fi - - if [ $HTTP_EMPTY_GIF = YES ]; then - ngx_module_name=ngx_http_empty_gif_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_empty_gif_module.c - ngx_module_libs= - ngx_module_link=$HTTP_EMPTY_GIF - - . auto/module - fi - - if [ $HTTP_BROWSER = YES ]; then - ngx_module_name=ngx_http_browser_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_browser_module.c - ngx_module_libs= - ngx_module_link=$HTTP_BROWSER - - . auto/module - fi - - if [ $HTTP_SECURE_LINK = YES ]; then - ngx_module_name=ngx_http_secure_link_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_secure_link_module.c - ngx_module_libs= - ngx_module_link=$HTTP_SECURE_LINK - - . auto/module - fi - - if [ $HTTP_DEGRADATION = YES ]; then - have=NGX_HTTP_DEGRADATION . auto/have - - ngx_module_name=ngx_http_degradation_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_degradation_module.c - ngx_module_libs= - ngx_module_link=$HTTP_DEGRADATION - - . auto/module - fi - - if [ $HTTP_FLV = YES ]; then - ngx_module_name=ngx_http_flv_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_flv_module.c - ngx_module_libs= - ngx_module_link=$HTTP_FLV - - . auto/module - fi - - if [ $HTTP_MP4 = YES ]; then - ngx_module_name=ngx_http_mp4_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_mp4_module.c - ngx_module_libs= - ngx_module_link=$HTTP_MP4 - - . auto/module - fi - - if [ $HTTP_UPSTREAM_HASH = YES ]; then - ngx_module_name=ngx_http_upstream_hash_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_hash_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_HASH - - . auto/module - fi - - if [ $HTTP_UPSTREAM_IP_HASH = YES ]; then - ngx_module_name=ngx_http_upstream_ip_hash_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_ip_hash_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_IP_HASH - - . auto/module - fi - - if [ $HTTP_UPSTREAM_LEAST_CONN = YES ]; then - ngx_module_name=ngx_http_upstream_least_conn_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_least_conn_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_LEAST_CONN - - . auto/module - fi - - if [ $HTTP_UPSTREAM_RANDOM = YES ]; then - ngx_module_name=ngx_http_upstream_random_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_random_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_RANDOM - - . auto/module - fi - - if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then - ngx_module_name=ngx_http_upstream_keepalive_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_keepalive_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_KEEPALIVE - - . auto/module - fi - - if [ $HTTP_UPSTREAM_ZONE = YES ]; then - have=NGX_HTTP_UPSTREAM_ZONE . auto/have - - ngx_module_name=ngx_http_upstream_zone_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_upstream_zone_module.c - ngx_module_libs= - ngx_module_link=$HTTP_UPSTREAM_ZONE - - . auto/module - fi - - if [ $HTTP_STUB_STATUS = YES ]; then - have=NGX_STAT_STUB . auto/have - - ngx_module_name=ngx_http_stub_status_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/http/modules/ngx_http_stub_status_module.c - ngx_module_libs= - ngx_module_link=$HTTP_STUB_STATUS - - . auto/module - fi +if [ $HTTP != YES ]; then + have=NGX_CRYPT . auto/nohave + CRYPT_LIB= fi -if [ $MAIL != NO ]; then - MAIL_MODULES= - MAIL_DEPS= - MAIL_INCS= - - ngx_module_type=MAIL - ngx_module_libs= - ngx_module_link=YES - - ngx_module_order= - - ngx_module_name="ngx_mail_module ngx_mail_core_module" - ngx_module_incs="src/mail" - ngx_module_deps="src/mail/ngx_mail.h" - ngx_module_srcs="src/mail/ngx_mail.c \ - src/mail/ngx_mail_core_module.c \ - src/mail/ngx_mail_handler.c \ - src/mail/ngx_mail_parse.c" - - . auto/module - - ngx_module_incs= - - if [ $MAIL_SSL = YES ]; then - USE_OPENSSL=YES - have=NGX_MAIL_SSL . auto/have - - ngx_module_name=ngx_mail_ssl_module - ngx_module_deps=src/mail/ngx_mail_ssl_module.h - ngx_module_srcs=src/mail/ngx_mail_ssl_module.c - - . auto/module - fi - - if [ $MAIL_POP3 = YES ]; then - ngx_module_name=ngx_mail_pop3_module - ngx_module_deps=src/mail/ngx_mail_pop3_module.h - ngx_module_srcs="src/mail/ngx_mail_pop3_module.c \ - src/mail/ngx_mail_pop3_handler.c" - - . auto/module - fi - - if [ $MAIL_IMAP = YES ]; then - ngx_module_name=ngx_mail_imap_module - ngx_module_deps=src/mail/ngx_mail_imap_module.h - ngx_module_srcs="src/mail/ngx_mail_imap_module.c \ - src/mail/ngx_mail_imap_handler.c" - - . auto/module - fi - - if [ $MAIL_SMTP = YES ]; then - ngx_module_name=ngx_mail_smtp_module - ngx_module_deps=src/mail/ngx_mail_smtp_module.h - ngx_module_srcs="src/mail/ngx_mail_smtp_module.c \ - src/mail/ngx_mail_smtp_handler.c" - - . auto/module - fi - - ngx_module_name=ngx_mail_auth_http_module - ngx_module_deps= - ngx_module_srcs=src/mail/ngx_mail_auth_http_module.c - - . auto/module - - ngx_module_name=ngx_mail_proxy_module - ngx_module_deps= - ngx_module_srcs=src/mail/ngx_mail_proxy_module.c - - . auto/module - - ngx_module_name=ngx_mail_realip_module - ngx_module_deps= - ngx_module_srcs=src/mail/ngx_mail_realip_module.c - - . auto/module +if [ $HTTP_CACHE = YES ]; then + USE_MD5=YES + have=NGX_HTTP_CACHE . auto/have + HTTP_SRCS="$HTTP_SRCS $HTTP_FILE_CACHE_SRCS" fi -if [ $STREAM != NO ]; then - STREAM_MODULES= - STREAM_DEPS= - STREAM_INCS= - - ngx_module_type=STREAM - ngx_module_libs= - ngx_module_link=YES - - ngx_module_order= - - ngx_module_name="ngx_stream_module \ - ngx_stream_core_module \ - ngx_stream_log_module \ - ngx_stream_proxy_module \ - ngx_stream_upstream_module \ - ngx_stream_write_filter_module" - ngx_module_incs="src/stream" - ngx_module_deps="src/stream/ngx_stream.h \ - src/stream/ngx_stream_variables.h \ - src/stream/ngx_stream_script.h \ - src/stream/ngx_stream_upstream.h \ - src/stream/ngx_stream_upstream_round_robin.h" - ngx_module_srcs="src/stream/ngx_stream.c \ - src/stream/ngx_stream_variables.c \ - src/stream/ngx_stream_script.c \ - src/stream/ngx_stream_handler.c \ - src/stream/ngx_stream_core_module.c \ - src/stream/ngx_stream_log_module.c \ - src/stream/ngx_stream_proxy_module.c \ - src/stream/ngx_stream_upstream.c \ - src/stream/ngx_stream_upstream_round_robin.c \ - src/stream/ngx_stream_write_filter_module.c" - - . auto/module - - ngx_module_incs= - - if [ $STREAM_SSL = YES ]; then - USE_OPENSSL=YES - have=NGX_STREAM_SSL . auto/have - - ngx_module_name=ngx_stream_ssl_module - ngx_module_deps=src/stream/ngx_stream_ssl_module.h - ngx_module_srcs=src/stream/ngx_stream_ssl_module.c - ngx_module_libs= - ngx_module_link=$STREAM_SSL - - . auto/module - fi - - if [ $STREAM_REALIP = YES ]; then - ngx_module_name=ngx_stream_realip_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_realip_module.c - ngx_module_libs= - ngx_module_link=$STREAM_REALIP - - . auto/module - fi - - if [ $STREAM_LIMIT_CONN = YES ]; then - ngx_module_name=ngx_stream_limit_conn_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_limit_conn_module.c - ngx_module_libs= - ngx_module_link=$STREAM_LIMIT_CONN - - . auto/module - fi - - if [ $STREAM_ACCESS = YES ]; then - ngx_module_name=ngx_stream_access_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_access_module.c - ngx_module_libs= - ngx_module_link=$STREAM_ACCESS - - . auto/module - fi - - if [ $STREAM_GEO = YES ]; then - ngx_module_name=ngx_stream_geo_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_geo_module.c - ngx_module_libs= - ngx_module_link=$STREAM_GEO - - . auto/module - fi - - if [ $STREAM_GEOIP != NO ]; then - ngx_module_name=ngx_stream_geoip_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_geoip_module.c - ngx_module_libs=GEOIP - ngx_module_link=$STREAM_GEOIP - - . auto/module - fi - - if [ $STREAM_MAP = YES ]; then - ngx_module_name=ngx_stream_map_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_map_module.c - ngx_module_libs= - ngx_module_link=$STREAM_MAP - - . auto/module - fi - - if [ $STREAM_SPLIT_CLIENTS = YES ]; then - ngx_module_name=ngx_stream_split_clients_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_split_clients_module.c - ngx_module_libs= - ngx_module_link=$STREAM_SPLIT_CLIENTS - - . auto/module - fi - - if [ $STREAM_RETURN = YES ]; then - ngx_module_name=ngx_stream_return_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_return_module.c - ngx_module_libs= - ngx_module_link=$STREAM_RETURN - - . auto/module - fi - - if [ $STREAM_PASS = YES ]; then - ngx_module_name=ngx_stream_pass_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_pass_module.c - ngx_module_libs= - ngx_module_link=$STREAM_PASS - - . auto/module - fi - - if [ $STREAM_SET = YES ]; then - ngx_module_name=ngx_stream_set_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_set_module.c - ngx_module_libs= - ngx_module_link=$STREAM_SET - - . auto/module - fi - - if [ $STREAM_UPSTREAM_HASH = YES ]; then - ngx_module_name=ngx_stream_upstream_hash_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_upstream_hash_module.c - ngx_module_libs= - ngx_module_link=$STREAM_UPSTREAM_HASH - - . auto/module - fi - - if [ $STREAM_UPSTREAM_LEAST_CONN = YES ]; then - ngx_module_name=ngx_stream_upstream_least_conn_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_upstream_least_conn_module.c - ngx_module_libs= - ngx_module_link=$STREAM_UPSTREAM_LEAST_CONN - - . auto/module - fi - - if [ $STREAM_UPSTREAM_RANDOM = YES ]; then - ngx_module_name=ngx_stream_upstream_random_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_upstream_random_module.c - ngx_module_libs= - ngx_module_link=$STREAM_UPSTREAM_RANDOM - - . auto/module - fi - - if [ $STREAM_UPSTREAM_ZONE = YES ]; then - have=NGX_STREAM_UPSTREAM_ZONE . auto/have - - ngx_module_name=ngx_stream_upstream_zone_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_upstream_zone_module.c - ngx_module_libs= - ngx_module_link=$STREAM_UPSTREAM_ZONE - - . auto/module - fi - - if [ $STREAM_SSL_PREREAD = YES ]; then - ngx_module_name=ngx_stream_ssl_preread_module - ngx_module_deps= - ngx_module_srcs=src/stream/ngx_stream_ssl_preread_module.c - ngx_module_libs= - ngx_module_link=$STREAM_SSL_PREREAD - - . auto/module - fi +if [ $HTTP_SSI = YES ]; then + HTTP_POSTPONE=YES fi +if [ $HTTP_ADDITION = YES ]; then + HTTP_POSTPONE=YES +fi + + +# the module order is important +# ngx_http_static_module +# ngx_http_gzip_static_module +# ngx_http_dav_module +# ngx_http_autoindex_module +# ngx_http_index_module +# ngx_http_random_index_module +# +# ngx_http_access_module +# ngx_http_realip_module +# +# +# the filter order is important +# ngx_http_write_filter +# ngx_http_header_filter +# ngx_http_chunked_filter +# ngx_http_spdy_filter +# ngx_http_range_header_filter +# ngx_http_gzip_filter +# ngx_http_postpone_filter +# ngx_http_ssi_filter +# ngx_http_charset_filter +# ngx_http_xslt_filter +# ngx_http_image_filter +# ngx_http_sub_filter +# ngx_http_addition_filter +# ngx_http_gunzip_filter +# ngx_http_userid_filter +# ngx_http_headers_filter +# ngx_http_copy_filter +# ngx_http_range_body_filter +# ngx_http_not_modified_filter + +HTTP_FILTER_MODULES="$HTTP_WRITE_FILTER_MODULE \ + $HTTP_HEADER_FILTER_MODULE \ + $HTTP_CHUNKED_FILTER_MODULE" + +if [ $HTTP_SPDY = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SPDY_FILTER_MODULE" +fi + +HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_RANGE_HEADER_FILTER_MODULE" + +if [ $HTTP_GZIP = YES ]; then + have=NGX_HTTP_GZIP . auto/have + USE_ZLIB=YES + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GZIP_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_SRCS" +fi + +if [ $HTTP_POSTPONE = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_POSTPONE_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS" +fi + +if [ $HTTP_SSI = YES ]; then + have=NGX_HTTP_SSI . auto/have + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE" + HTTP_DEPS="$HTTP_DEPS $HTTP_SSI_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS" +fi + +if [ $HTTP_CHARSET = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS" +fi + +if [ $HTTP_XSLT = YES ]; then + USE_LIBXSLT=YES + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_XSLT_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_XSLT_SRCS" +fi + +if [ $HTTP_IMAGE_FILTER = YES ]; then + USE_LIBGD=YES + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_IMAGE_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_IMAGE_SRCS" +fi + +if [ $HTTP_SUB = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SUB_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_SUB_SRCS" +fi + +if [ $HTTP_ADDITION = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_ADDITION_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_ADDITION_SRCS" +fi + +if [ $HTTP_GUNZIP = YES ]; then + have=NGX_HTTP_GZIP . auto/have + USE_ZLIB=YES + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_GUNZIP_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GUNZIP_SRCS" +fi + +if [ $HTTP_USERID = YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_USERID_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_USERID_SRCS" +fi + + +if [ $HTTP_SPDY = YES ]; then + have=NGX_HTTP_SPDY . auto/have + USE_ZLIB=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_SPDY_MODULE" + HTTP_DEPS="$HTTP_DEPS $HTTP_SPDY_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_SPDY_SRCS" +fi + +HTTP_MODULES="$HTTP_MODULES $HTTP_STATIC_MODULE" + +if [ $HTTP_GZIP_STATIC = YES ]; then + have=NGX_HTTP_GZIP . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_GZIP_STATIC_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GZIP_STATIC_SRCS" +fi + +if [ $HTTP_DAV = YES ]; then + have=NGX_HTTP_DAV . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_DAV_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_DAV_SRCS" +fi + +if [ $HTTP_AUTOINDEX = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_AUTOINDEX_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_AUTOINDEX_SRCS" +fi + +HTTP_MODULES="$HTTP_MODULES $HTTP_INDEX_MODULE" + +if [ $HTTP_RANDOM_INDEX = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_RANDOM_INDEX_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_RANDOM_INDEX_SRCS" +fi + +if [ $HTTP_AUTH_REQUEST = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_REQUEST_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_REQUEST_SRCS" +fi + +if [ $HTTP_AUTH_BASIC = YES ]; then + USE_MD5=YES + USE_SHA1=YES + have=NGX_CRYPT . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_BASIC_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_BASIC_SRCS" + CORE_LIBS="$CORE_LIBS $CRYPT_LIB" +fi + +if [ $HTTP_ACCESS = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_ACCESS_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_ACCESS_SRCS" +fi + +if [ $HTTP_LIMIT_CONN = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_CONN_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_CONN_SRCS" +fi + +if [ $HTTP_LIMIT_REQ = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_LIMIT_REQ_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_LIMIT_REQ_SRCS" +fi + +if [ $HTTP_REALIP = YES ]; then + have=NGX_HTTP_REALIP . auto/have + have=NGX_HTTP_X_FORWARDED_FOR . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_REALIP_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_REALIP_SRCS" +fi + +if [ $HTTP_STATUS = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_STATUS_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_STATUS_SRCS" +fi + +if [ $HTTP_GEO = YES ]; then + have=NGX_HTTP_X_FORWARDED_FOR . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS" +fi + +if [ $HTTP_GEOIP = YES ]; then + have=NGX_HTTP_X_FORWARDED_FOR . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS" +fi + +if [ $HTTP_MAP = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_MAP_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_MAP_SRCS" +fi + +if [ $HTTP_SPLIT_CLIENTS = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_SPLIT_CLIENTS_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_SPLIT_CLIENTS_SRCS" +fi + +if [ $HTTP_REFERER = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_REFERER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_REFERER_SRCS" +fi + +if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then + USE_PCRE=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS" +fi + +if [ $HTTP_SSL = YES ]; then + USE_OPENSSL=YES + have=NGX_HTTP_SSL . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_SSL_MODULE" + HTTP_DEPS="$HTTP_DEPS $HTTP_SSL_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_SSL_SRCS" +fi + +if [ $HTTP_PROXY = YES ]; then + have=NGX_HTTP_X_FORWARDED_FOR . auto/have + #USE_MD5=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE" + HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_PROXY_SRCS" +fi + +if [ $HTTP_FASTCGI = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_FASTCGI_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_FASTCGI_SRCS" +fi + +if [ $HTTP_UWSGI = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_UWSGI_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_UWSGI_SRCS" +fi + +if [ $HTTP_SCGI = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_SCGI_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_SCGI_SRCS" +fi + +if [ $HTTP_PERL = YES ]; then + USE_PERL=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_PERL_MODULE" + HTTP_INCS="$HTTP_INCS $HTTP_PERL_INCS" + HTTP_DEPS="$HTTP_DEPS $HTTP_PERL_DEPS" + HTTP_SRCS="$HTTP_SRCS $HTTP_PERL_SRCS" +fi + +if [ $HTTP_MEMCACHED = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_MEMCACHED_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_MEMCACHED_SRCS" +fi + +if [ $HTTP_EMPTY_GIF = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_EMPTY_GIF_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_EMPTY_GIF_SRCS" +fi + +if [ $HTTP_BROWSER = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_BROWSER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_BROWSER_SRCS" +fi + +if [ $HTTP_SECURE_LINK = YES ]; then + USE_MD5=YES + HTTP_MODULES="$HTTP_MODULES $HTTP_SECURE_LINK_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_SECURE_LINK_SRCS" +fi + +if [ $HTTP_DEGRADATION = YES ]; then + have=NGX_HTTP_DEGRADATION . auto/have + HTTP_MODULES="$HTTP_MODULES $HTTP_DEGRADATION_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_DEGRADATION_SRCS" +fi + +if [ $HTTP_FLV = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_FLV_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_FLV_SRCS" +fi + +if [ $HTTP_MP4 = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_MP4_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_MP4_SRCS" +fi + +if [ $HTTP_UPSTREAM_IP_HASH = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_IP_HASH_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_IP_HASH_SRCS" +fi + +if [ $HTTP_UPSTREAM_LEAST_CONN = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_LEAST_CONN_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_LEAST_CONN_SRCS" +fi + +if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then + HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_KEEPALIVE_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_KEEPALIVE_SRCS" +fi + +if [ $HTTP_STUB_STATUS = YES ]; then + have=NGX_STAT_STUB . auto/have + HTTP_MODULES="$HTTP_MODULES ngx_http_stub_status_module" + HTTP_SRCS="$HTTP_SRCS src/http/modules/ngx_http_stub_status_module.c" +fi + #if [ -r $NGX_OBJS/auto ]; then # . $NGX_OBJS/auto #fi @@ -1253,15 +405,6 @@ if test -n "$NGX_ADDONS"; then do echo "adding module in $ngx_addon_dir" - ngx_module_type= - ngx_module_name= - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs= - ngx_module_libs= - ngx_module_order= - ngx_module_link=ADDON - if test -f $ngx_addon_dir/config; then . $ngx_addon_dir/config @@ -1275,216 +418,85 @@ if test -n "$NGX_ADDONS"; then fi -if test -n "$DYNAMIC_ADDONS"; then - - echo configuring additional dynamic modules - - for ngx_addon_dir in $DYNAMIC_ADDONS - do - echo "adding module in $ngx_addon_dir" - - ngx_module_type= - ngx_module_name= - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs= - ngx_module_libs= - ngx_module_order= - ngx_module_link=DYNAMIC - - if test -f $ngx_addon_dir/config; then - . $ngx_addon_dir/config - - echo " + $ngx_addon_name was configured" - - else - echo "$0: error: no $ngx_addon_dir/config was found" - exit 1 - fi - done -fi - - -if [ $USE_OPENSSL = YES ]; then - ngx_module_type=CORE - ngx_module_name=ngx_openssl_module - ngx_module_incs= - ngx_module_deps=src/event/ngx_event_openssl.h - ngx_module_srcs="src/event/ngx_event_openssl.c - src/event/ngx_event_openssl_stapling.c" - ngx_module_libs= - ngx_module_link=YES - ngx_module_order= - - . auto/module -fi - - -if [ $USE_OPENSSL_QUIC = YES ]; then - ngx_module_type=CORE - ngx_module_name=ngx_quic_module - ngx_module_incs= - ngx_module_deps="src/event/quic/ngx_event_quic.h \ - src/event/quic/ngx_event_quic_transport.h \ - src/event/quic/ngx_event_quic_protection.h \ - src/event/quic/ngx_event_quic_connection.h \ - src/event/quic/ngx_event_quic_frames.h \ - src/event/quic/ngx_event_quic_connid.h \ - src/event/quic/ngx_event_quic_migration.h \ - src/event/quic/ngx_event_quic_streams.h \ - src/event/quic/ngx_event_quic_ssl.h \ - src/event/quic/ngx_event_quic_tokens.h \ - src/event/quic/ngx_event_quic_ack.h \ - src/event/quic/ngx_event_quic_output.h \ - src/event/quic/ngx_event_quic_socket.h \ - src/event/quic/ngx_event_quic_openssl_compat.h" - ngx_module_srcs="src/event/quic/ngx_event_quic.c \ - src/event/quic/ngx_event_quic_udp.c \ - src/event/quic/ngx_event_quic_transport.c \ - src/event/quic/ngx_event_quic_protection.c \ - src/event/quic/ngx_event_quic_frames.c \ - src/event/quic/ngx_event_quic_connid.c \ - src/event/quic/ngx_event_quic_migration.c \ - src/event/quic/ngx_event_quic_streams.c \ - src/event/quic/ngx_event_quic_ssl.c \ - src/event/quic/ngx_event_quic_tokens.c \ - src/event/quic/ngx_event_quic_ack.c \ - src/event/quic/ngx_event_quic_output.c \ - src/event/quic/ngx_event_quic_socket.c \ - src/event/quic/ngx_event_quic_openssl_compat.c" - - ngx_module_libs= - ngx_module_link=YES - ngx_module_order= - - . auto/module - - if [ $QUIC_BPF = YES -a $SO_COOKIE_FOUND = YES ]; then - ngx_module_type=CORE - ngx_module_name=ngx_quic_bpf_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs="src/event/quic/ngx_event_quic_bpf.c \ - src/event/quic/ngx_event_quic_bpf_code.c" - ngx_module_libs= - ngx_module_link=YES - ngx_module_order= - - . auto/module - - have=NGX_QUIC_BPF . auto/have - fi -fi - - -if [ $USE_PCRE = YES ]; then - ngx_module_type=CORE - ngx_module_name=ngx_regex_module - ngx_module_incs= - ngx_module_deps=src/core/ngx_regex.h - ngx_module_srcs=src/core/ngx_regex.c - ngx_module_libs= - ngx_module_link=YES - ngx_module_order= - - . auto/module +if [ $MAIL_SSL = YES ]; then + have=NGX_MAIL_SSL . auto/have + USE_OPENSSL=YES fi modules="$CORE_MODULES $EVENT_MODULES" -# thread pool module should be initialized after events -if [ $USE_THREADS = YES ]; then - modules="$modules $THREAD_POOL_MODULE" +if [ $USE_OPENSSL = YES ]; then + modules="$modules $OPENSSL_MODULE" + CORE_DEPS="$CORE_DEPS $OPENSSL_DEPS" + CORE_SRCS="$CORE_SRCS $OPENSSL_SRCS" fi +if [ $USE_PCRE = YES ]; then + modules="$modules $REGEX_MODULE" + CORE_DEPS="$CORE_DEPS $REGEX_DEPS" + CORE_SRCS="$CORE_SRCS $REGEX_SRCS" +fi if [ $HTTP = YES ]; then modules="$modules $HTTP_MODULES $HTTP_FILTER_MODULES \ - $HTTP_AUX_FILTER_MODULES $HTTP_INIT_FILTER_MODULES" + $HTTP_HEADERS_FILTER_MODULE \ + $HTTP_AUX_FILTER_MODULES \ + $HTTP_COPY_FILTER_MODULE \ + $HTTP_RANGE_BODY_FILTER_MODULE \ + $HTTP_NOT_MODIFIED_FILTER_MODULE" NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(HTTP_DEPS)" fi -if [ $MAIL != NO ]; then +if [ $MAIL = YES ]; then + modules="$modules $MAIL_MODULES" - if [ $MAIL = YES ]; then - modules="$modules $MAIL_MODULES" - - elif [ $MAIL = DYNAMIC ]; then - ngx_module_name=$MAIL_MODULES - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=$MAIL_SRCS - ngx_module_libs= - ngx_module_link=DYNAMIC - - . auto/module + if [ $MAIL_SSL = YES ]; then + modules="$modules $MAIL_SSL_MODULE" + MAIL_DEPS="$MAIL_DEPS $MAIL_SSL_DEPS" + MAIL_SRCS="$MAIL_SRCS $MAIL_SSL_SRCS" fi + if [ $MAIL_POP3 = YES ]; then + modules="$modules $MAIL_POP3_MODULE" + MAIL_DEPS="$MAIL_DEPS $MAIL_POP3_DEPS" + MAIL_SRCS="$MAIL_SRCS $MAIL_POP3_SRCS" + fi + + if [ $MAIL_IMAP = YES ]; then + modules="$modules $MAIL_IMAP_MODULE" + MAIL_DEPS="$MAIL_DEPS $MAIL_IMAP_DEPS" + MAIL_SRCS="$MAIL_SRCS $MAIL_IMAP_SRCS" + fi + + if [ $MAIL_SMTP = YES ]; then + modules="$modules $MAIL_SMTP_MODULE" + MAIL_DEPS="$MAIL_DEPS $MAIL_SMTP_DEPS" + MAIL_SRCS="$MAIL_SRCS $MAIL_SMTP_SRCS" + fi + + modules="$modules $MAIL_AUTH_HTTP_MODULE" + MAIL_SRCS="$MAIL_SRCS $MAIL_AUTH_HTTP_SRCS" + + modules="$modules $MAIL_PROXY_MODULE" + MAIL_SRCS="$MAIL_SRCS $MAIL_PROXY_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(MAIL_DEPS)" fi -if [ $STREAM != NO ]; then - - if [ $STREAM = YES ]; then - modules="$modules $STREAM_MODULES" - - elif [ $STREAM = DYNAMIC ]; then - ngx_module_name=$STREAM_MODULES - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=$STREAM_SRCS - ngx_module_libs= - ngx_module_link=DYNAMIC - - . auto/module - fi - - NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(STREAM_DEPS)" -fi - - -ngx_module_type=MISC -MISC_MODULES= - if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then - ngx_module_name=ngx_google_perftools_module - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/misc/ngx_google_perftools_module.c - ngx_module_libs= - ngx_module_link=$NGX_GOOGLE_PERFTOOLS - - . auto/module + modules="$modules $NGX_GOOGLE_PERFTOOLS_MODULE" + NGX_MISC_SRCS="$NGX_MISC_SRCS $NGX_GOOGLE_PERFTOOLS_SRCS" fi + if [ $NGX_CPP_TEST = YES ]; then - ngx_module_name= - ngx_module_incs= - ngx_module_deps= - ngx_module_srcs=src/misc/ngx_cpp_test_module.cpp - ngx_module_libs=-lstdc++ - ngx_module_link=$NGX_CPP_TEST - - . auto/module -fi - -modules="$modules $MISC_MODULES" - - -if [ $NGX_COMPAT = YES ]; then - have=NGX_COMPAT . auto/have - have=NGX_HTTP_GZIP . auto/have - have=NGX_HTTP_DAV . auto/have - have=NGX_HTTP_REALIP . auto/have - have=NGX_HTTP_X_FORWARDED_FOR . auto/have - have=NGX_HTTP_HEADERS . auto/have - have=NGX_HTTP_UPSTREAM_ZONE . auto/have - have=NGX_STREAM_UPSTREAM_ZONE . auto/have + NGX_MISC_SRCS="$NGX_MISC_SRCS $NGX_CPP_TEST_SRCS" + CORE_LIBS="$CORE_LIBS -lstdc++" fi @@ -1515,16 +527,3 @@ cat << END >> $NGX_MODULES_C }; END - -echo 'char *ngx_module_names[] = {' >> $NGX_MODULES_C - -for mod in $modules -do - echo " \"$mod\"," >> $NGX_MODULES_C -done - -cat << END >> $NGX_MODULES_C - NULL -}; - -END diff --git a/auto/options b/auto/options index 6a6e990..6cea8c7 100644 --- a/auto/options +++ b/auto/options @@ -7,7 +7,6 @@ help=no NGX_PREFIX= NGX_SBIN_PATH= -NGX_MODULES_PATH= NGX_CONF_PREFIX= NGX_CONF_PATH= NGX_ERROR_LOG_PATH= @@ -15,7 +14,6 @@ NGX_PID_PATH= NGX_LOCK_PATH= NGX_USER= NGX_GROUP= -NGX_BUILD= CC=${CC:-cc} CPP= @@ -31,6 +29,7 @@ NGX_RPATH=NO NGX_TEST_BUILD_DEVPOLL=NO NGX_TEST_BUILD_EVENTPORT=NO NGX_TEST_BUILD_EPOLL=NO +NGX_TEST_BUILD_RTSIG=NO NGX_TEST_BUILD_SOLARIS_SENDFILEV=NO NGX_PLATFORM= @@ -38,14 +37,15 @@ NGX_WINE= EVENT_FOUND=NO +EVENT_RTSIG=NO EVENT_SELECT=NO EVENT_POLL=NO +EVENT_AIO=NO USE_THREADS=NO NGX_FILE_AIO=NO - -QUIC_BPF=NO +NGX_IPV6=NO HTTP=YES @@ -60,9 +60,9 @@ HTTP_CACHE=YES HTTP_CHARSET=YES HTTP_GZIP=YES HTTP_SSL=NO -HTTP_V2=NO -HTTP_V3=NO +HTTP_SPDY=NO HTTP_SSI=YES +HTTP_POSTPONE=NO HTTP_REALIP=NO HTTP_XSLT=NO HTTP_IMAGE_FILTER=NO @@ -72,9 +72,7 @@ HTTP_DAV=NO HTTP_ACCESS=YES HTTP_AUTH_BASIC=YES HTTP_AUTH_REQUEST=NO -HTTP_MIRROR=YES HTTP_USERID=YES -HTTP_SLICE=NO HTTP_AUTOINDEX=YES HTTP_RANDOM_INDEX=NO HTTP_STATUS=NO @@ -88,7 +86,6 @@ HTTP_PROXY=YES HTTP_FASTCGI=YES HTTP_UWSGI=YES HTTP_SCGI=YES -HTTP_GRPC=YES HTTP_PERL=NO HTTP_MEMCACHED=YES HTTP_LIMIT_CONN=YES @@ -101,12 +98,9 @@ HTTP_FLV=NO HTTP_MP4=NO HTTP_GUNZIP=NO HTTP_GZIP_STATIC=NO -HTTP_UPSTREAM_HASH=YES HTTP_UPSTREAM_IP_HASH=YES HTTP_UPSTREAM_LEAST_CONN=YES -HTTP_UPSTREAM_RANDOM=YES HTTP_UPSTREAM_KEEPALIVE=YES -HTTP_UPSTREAM_ZONE=YES # STUB HTTP_STUB_STATUS=NO @@ -117,45 +111,27 @@ MAIL_POP3=YES MAIL_IMAP=YES MAIL_SMTP=YES -STREAM=NO -STREAM_SSL=NO -STREAM_REALIP=NO -STREAM_LIMIT_CONN=YES -STREAM_ACCESS=YES -STREAM_GEO=YES -STREAM_GEOIP=NO -STREAM_MAP=YES -STREAM_SPLIT_CLIENTS=YES -STREAM_RETURN=YES -STREAM_PASS=YES -STREAM_SET=YES -STREAM_UPSTREAM_HASH=YES -STREAM_UPSTREAM_LEAST_CONN=YES -STREAM_UPSTREAM_RANDOM=YES -STREAM_UPSTREAM_ZONE=YES -STREAM_SSL_PREREAD=NO - -DYNAMIC_MODULES= -DYNAMIC_MODULES_SRCS= - NGX_ADDONS= -NGX_ADDON_SRCS= -NGX_ADDON_DEPS= -DYNAMIC_ADDONS= - -NGX_COMPAT=NO USE_PCRE=NO PCRE=NONE PCRE_OPT= PCRE_CONF_OPT= PCRE_JIT=NO -PCRE2=YES USE_OPENSSL=NO -USE_OPENSSL_QUIC=NO OPENSSL=NONE +USE_MD5=NO +MD5=NONE +MD5_OPT= +MD5_ASM=NO + +USE_SHA1=NO +SHA1=NONE +SHA1_OPT= +SHA1_ASM=NO + USE_ZLIB=NO ZLIB=NONE ZLIB_OPT= @@ -166,13 +142,10 @@ NGX_PERL=perl USE_LIBXSLT=NO USE_LIBGD=NO -USE_GEOIP=NO NGX_GOOGLE_PERFTOOLS=NO NGX_CPP_TEST=NO -SO_COOKIE_FOUND=NO - NGX_LIBATOMIC=NO NGX_CPU_CACHE_LINE= @@ -196,7 +169,6 @@ do --prefix=) NGX_PREFIX="!" ;; --prefix=*) NGX_PREFIX="$value" ;; --sbin-path=*) NGX_SBIN_PATH="$value" ;; - --modules-path=*) NGX_MODULES_PATH="$value" ;; --conf-path=*) NGX_CONF_PATH="$value" ;; --error-log-path=*) NGX_ERROR_LOG_PATH="$value";; --pid-path=*) NGX_PID_PATH="$value" ;; @@ -206,24 +178,20 @@ do --crossbuild=*) NGX_PLATFORM="$value" ;; - --build=*) NGX_BUILD="$value" ;; --builddir=*) NGX_OBJS="$value" ;; + --with-rtsig_module) EVENT_RTSIG=YES ;; --with-select_module) EVENT_SELECT=YES ;; --without-select_module) EVENT_SELECT=NONE ;; --with-poll_module) EVENT_POLL=YES ;; --without-poll_module) EVENT_POLL=NONE ;; + --with-aio_module) EVENT_AIO=YES ;; - --with-threads) USE_THREADS=YES ;; + #--with-threads=*) USE_THREADS="$value" ;; + #--with-threads) USE_THREADS="pthreads" ;; --with-file-aio) NGX_FILE_AIO=YES ;; - - --without-quic_bpf_module) QUIC_BPF=NONE ;; - - --with-ipv6) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-ipv6\" option is deprecated" - ;; + --with-ipv6) NGX_IPV6=YES ;; --without-http) HTTP=NO ;; --without-http-cache) HTTP_CACHE=NO ;; @@ -236,18 +204,12 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --http-scgi-temp-path=*) NGX_HTTP_SCGI_TEMP_PATH="$value" ;; --with-http_ssl_module) HTTP_SSL=YES ;; - --with-http_v2_module) HTTP_V2=YES ;; - --with-http_v3_module) HTTP_V3=YES ;; + --with-http_spdy_module) HTTP_SPDY=YES ;; --with-http_realip_module) HTTP_REALIP=YES ;; --with-http_addition_module) HTTP_ADDITION=YES ;; --with-http_xslt_module) HTTP_XSLT=YES ;; - --with-http_xslt_module=dynamic) HTTP_XSLT=DYNAMIC ;; --with-http_image_filter_module) HTTP_IMAGE_FILTER=YES ;; - --with-http_image_filter_module=dynamic) - HTTP_IMAGE_FILTER=DYNAMIC ;; --with-http_geoip_module) HTTP_GEOIP=YES ;; - --with-http_geoip_module=dynamic) - HTTP_GEOIP=DYNAMIC ;; --with-http_sub_module) HTTP_SUB=YES ;; --with-http_dav_module) HTTP_DAV=YES ;; --with-http_flv_module) HTTP_FLV=YES ;; @@ -258,7 +220,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --with-http_random_index_module) HTTP_RANDOM_INDEX=YES ;; --with-http_secure_link_module) HTTP_SECURE_LINK=YES ;; --with-http_degradation_module) HTTP_DEGRADATION=YES ;; - --with-http_slice_module) HTTP_SLICE=YES ;; --without-http_charset_module) HTTP_CHARSET=NO ;; --without-http_gzip_module) HTTP_GZIP=NO ;; @@ -266,7 +227,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --without-http_userid_module) HTTP_USERID=NO ;; --without-http_access_module) HTTP_ACCESS=NO ;; --without-http_auth_basic_module) HTTP_AUTH_BASIC=NO ;; - --without-http_mirror_module) HTTP_MIRROR=NO ;; --without-http_autoindex_module) HTTP_AUTOINDEX=NO ;; --without-http_status_module) HTTP_STATUS=NO ;; --without-http_geo_module) HTTP_GEO=NO ;; @@ -278,23 +238,23 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --without-http_fastcgi_module) HTTP_FASTCGI=NO ;; --without-http_uwsgi_module) HTTP_UWSGI=NO ;; --without-http_scgi_module) HTTP_SCGI=NO ;; - --without-http_grpc_module) HTTP_GRPC=NO ;; --without-http_memcached_module) HTTP_MEMCACHED=NO ;; + --without-http_limit_zone_module) + HTTP_LIMIT_CONN=NO + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--without-http_limit_zone_module\" option is deprecated, \ +use the \"--without-http_limit_conn_module\" option instead" + ;; --without-http_limit_conn_module) HTTP_LIMIT_CONN=NO ;; --without-http_limit_req_module) HTTP_LIMIT_REQ=NO ;; --without-http_empty_gif_module) HTTP_EMPTY_GIF=NO ;; --without-http_browser_module) HTTP_BROWSER=NO ;; - --without-http_upstream_hash_module) HTTP_UPSTREAM_HASH=NO ;; --without-http_upstream_ip_hash_module) HTTP_UPSTREAM_IP_HASH=NO ;; --without-http_upstream_least_conn_module) HTTP_UPSTREAM_LEAST_CONN=NO ;; - --without-http_upstream_random_module) - HTTP_UPSTREAM_RANDOM=NO ;; --without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;; - --without-http_upstream_zone_module) HTTP_UPSTREAM_ZONE=NO ;; --with-http_perl_module) HTTP_PERL=YES ;; - --with-http_perl_module=dynamic) HTTP_PERL=DYNAMIC ;; --with-perl_modules_path=*) NGX_PERL_MODULES="$value" ;; --with-perl=*) NGX_PERL="$value" ;; @@ -302,60 +262,18 @@ $0: warning: the \"--with-ipv6\" option is deprecated" --with-http_stub_status_module) HTTP_STUB_STATUS=YES ;; --with-mail) MAIL=YES ;; - --with-mail=dynamic) MAIL=DYNAMIC ;; --with-mail_ssl_module) MAIL_SSL=YES ;; # STUB - --with-imap) - MAIL=YES - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-imap\" option is deprecated, \ -use the \"--with-mail\" option instead" - ;; - --with-imap_ssl_module) - MAIL_SSL=YES - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-imap_ssl_module\" option is deprecated, \ -use the \"--with-mail_ssl_module\" option instead" - ;; + --with-imap) MAIL=YES ;; + --with-imap_ssl_module) MAIL_SSL=YES ;; --without-mail_pop3_module) MAIL_POP3=NO ;; --without-mail_imap_module) MAIL_IMAP=NO ;; --without-mail_smtp_module) MAIL_SMTP=NO ;; - --with-stream) STREAM=YES ;; - --with-stream=dynamic) STREAM=DYNAMIC ;; - --with-stream_ssl_module) STREAM_SSL=YES ;; - --with-stream_realip_module) STREAM_REALIP=YES ;; - --with-stream_geoip_module) STREAM_GEOIP=YES ;; - --with-stream_geoip_module=dynamic) - STREAM_GEOIP=DYNAMIC ;; - --with-stream_ssl_preread_module) - STREAM_SSL_PREREAD=YES ;; - --without-stream_limit_conn_module) - STREAM_LIMIT_CONN=NO ;; - --without-stream_access_module) STREAM_ACCESS=NO ;; - --without-stream_geo_module) STREAM_GEO=NO ;; - --without-stream_map_module) STREAM_MAP=NO ;; - --without-stream_split_clients_module) - STREAM_SPLIT_CLIENTS=NO ;; - --without-stream_return_module) STREAM_RETURN=NO ;; - --without-stream_pass_module) STREAM_PASS=NO ;; - --without-stream_set_module) STREAM_SET=NO ;; - --without-stream_upstream_hash_module) - STREAM_UPSTREAM_HASH=NO ;; - --without-stream_upstream_least_conn_module) - STREAM_UPSTREAM_LEAST_CONN=NO ;; - --without-stream_upstream_random_module) - STREAM_UPSTREAM_RANDOM=NO ;; - --without-stream_upstream_zone_module) - STREAM_UPSTREAM_ZONE=NO ;; - --with-google_perftools_module) NGX_GOOGLE_PERFTOOLS=YES ;; --with-cpp_test_module) NGX_CPP_TEST=YES ;; --add-module=*) NGX_ADDONS="$NGX_ADDONS $value" ;; - --add-dynamic-module=*) DYNAMIC_ADDONS="$DYNAMIC_ADDONS $value" ;; - - --with-compat) NGX_COMPAT=YES ;; --with-cc=*) CC="$value" ;; --with-cpp=*) CPP="$value" ;; @@ -369,36 +287,17 @@ use the \"--with-mail_ssl_module\" option instead" --with-pcre=*) PCRE="$value" ;; --with-pcre-opt=*) PCRE_OPT="$value" ;; --with-pcre-jit) PCRE_JIT=YES ;; - --without-pcre2) PCRE2=DISABLED ;; --with-openssl=*) OPENSSL="$value" ;; --with-openssl-opt=*) OPENSSL_OPT="$value" ;; - --with-md5=*) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-md5\" option is deprecated" - ;; - --with-md5-opt=*) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-md5-opt\" option is deprecated" - ;; - --with-md5-asm) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-md5-asm\" option is deprecated" - ;; + --with-md5=*) MD5="$value" ;; + --with-md5-opt=*) MD5_OPT="$value" ;; + --with-md5-asm) MD5_ASM=YES ;; - --with-sha1=*) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-sha1\" option is deprecated" - ;; - --with-sha1-opt=*) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-sha1-opt\" option is deprecated" - ;; - --with-sha1-asm) - NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG -$0: warning: the \"--with-sha1-asm\" option is deprecated" - ;; + --with-sha1=*) SHA1="$value" ;; + --with-sha1-opt=*) SHA1_OPT="$value" ;; + --with-sha1-asm) SHA1_ASM=YES ;; --with-zlib=*) ZLIB="$value" ;; --with-zlib-opt=*) ZLIB_OPT="$value" ;; @@ -410,6 +309,7 @@ $0: warning: the \"--with-sha1-asm\" option is deprecated" --test-build-devpoll) NGX_TEST_BUILD_DEVPOLL=YES ;; --test-build-eventport) NGX_TEST_BUILD_EVENTPORT=YES ;; --test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;; + --test-build-rtsig) NGX_TEST_BUILD_RTSIG=YES ;; --test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;; *) @@ -431,7 +331,6 @@ cat << END --prefix=PATH set installation prefix --sbin-path=PATH set nginx binary pathname - --modules-path=PATH set modules path --conf-path=PATH set nginx.conf pathname --error-log-path=PATH set error log pathname --pid-path=PATH set nginx.pid pathname @@ -442,32 +341,24 @@ cat << END --group=GROUP set non-privileged group for worker processes - --build=NAME set build name --builddir=DIR set build directory + --with-rtsig_module enable rtsig module --with-select_module enable select module --without-select_module disable select module --with-poll_module enable poll module --without-poll_module disable poll module - --with-threads enable thread pool support - --with-file-aio enable file AIO support - - --without-quic_bpf_module disable ngx_quic_bpf_module + --with-ipv6 enable IPv6 support --with-http_ssl_module enable ngx_http_ssl_module - --with-http_v2_module enable ngx_http_v2_module - --with-http_v3_module enable ngx_http_v3_module + --with-http_spdy_module enable ngx_http_spdy_module --with-http_realip_module enable ngx_http_realip_module --with-http_addition_module enable ngx_http_addition_module --with-http_xslt_module enable ngx_http_xslt_module - --with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module --with-http_image_filter_module enable ngx_http_image_filter_module - --with-http_image_filter_module=dynamic - enable dynamic ngx_http_image_filter_module --with-http_geoip_module enable ngx_http_geoip_module - --with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module --with-http_sub_module enable ngx_http_sub_module --with-http_dav_module enable ngx_http_dav_module --with-http_flv_module enable ngx_http_flv_module @@ -478,7 +369,6 @@ cat << END --with-http_random_index_module enable ngx_http_random_index_module --with-http_secure_link_module enable ngx_http_secure_link_module --with-http_degradation_module enable ngx_http_degradation_module - --with-http_slice_module enable ngx_http_slice_module --with-http_stub_status_module enable ngx_http_stub_status_module --without-http_charset_module disable ngx_http_charset_module @@ -487,7 +377,6 @@ cat << END --without-http_userid_module disable ngx_http_userid_module --without-http_access_module disable ngx_http_access_module --without-http_auth_basic_module disable ngx_http_auth_basic_module - --without-http_mirror_module disable ngx_http_mirror_module --without-http_autoindex_module disable ngx_http_autoindex_module --without-http_geo_module disable ngx_http_geo_module --without-http_map_module disable ngx_http_map_module @@ -498,27 +387,19 @@ cat << END --without-http_fastcgi_module disable ngx_http_fastcgi_module --without-http_uwsgi_module disable ngx_http_uwsgi_module --without-http_scgi_module disable ngx_http_scgi_module - --without-http_grpc_module disable ngx_http_grpc_module --without-http_memcached_module disable ngx_http_memcached_module --without-http_limit_conn_module disable ngx_http_limit_conn_module --without-http_limit_req_module disable ngx_http_limit_req_module --without-http_empty_gif_module disable ngx_http_empty_gif_module --without-http_browser_module disable ngx_http_browser_module - --without-http_upstream_hash_module - disable ngx_http_upstream_hash_module --without-http_upstream_ip_hash_module disable ngx_http_upstream_ip_hash_module --without-http_upstream_least_conn_module disable ngx_http_upstream_least_conn_module - --without-http_upstream_random_module - disable ngx_http_upstream_random_module --without-http_upstream_keepalive_module disable ngx_http_upstream_keepalive_module - --without-http_upstream_zone_module - disable ngx_http_upstream_zone_module --with-http_perl_module enable ngx_http_perl_module - --with-http_perl_module=dynamic enable dynamic ngx_http_perl_module --with-perl_modules_path=PATH set Perl modules path --with-perl=PATH set perl binary pathname @@ -538,44 +419,15 @@ cat << END --without-http-cache disable HTTP cache --with-mail enable POP3/IMAP4/SMTP proxy module - --with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module --with-mail_ssl_module enable ngx_mail_ssl_module --without-mail_pop3_module disable ngx_mail_pop3_module --without-mail_imap_module disable ngx_mail_imap_module --without-mail_smtp_module disable ngx_mail_smtp_module - --with-stream enable TCP/UDP proxy module - --with-stream=dynamic enable dynamic TCP/UDP proxy module - --with-stream_ssl_module enable ngx_stream_ssl_module - --with-stream_realip_module enable ngx_stream_realip_module - --with-stream_geoip_module enable ngx_stream_geoip_module - --with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module - --with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module - --without-stream_limit_conn_module disable ngx_stream_limit_conn_module - --without-stream_access_module disable ngx_stream_access_module - --without-stream_geo_module disable ngx_stream_geo_module - --without-stream_map_module disable ngx_stream_map_module - --without-stream_split_clients_module - disable ngx_stream_split_clients_module - --without-stream_return_module disable ngx_stream_return_module - --without-stream_pass_module disable ngx_stream_pass_module - --without-stream_set_module disable ngx_stream_set_module - --without-stream_upstream_hash_module - disable ngx_stream_upstream_hash_module - --without-stream_upstream_least_conn_module - disable ngx_stream_upstream_least_conn_module - --without-stream_upstream_random_module - disable ngx_stream_upstream_random_module - --without-stream_upstream_zone_module - disable ngx_stream_upstream_zone_module - --with-google_perftools_module enable ngx_google_perftools_module --with-cpp_test_module enable ngx_cpp_test_module - --add-module=PATH enable external module - --add-dynamic-module=PATH enable dynamic external module - - --with-compat dynamic modules compatibility + --add-module=PATH enable an external module --with-cc=PATH set C compiler pathname --with-cpp=PATH set C preprocessor pathname @@ -590,7 +442,14 @@ cat << END --with-pcre=DIR set path to PCRE library sources --with-pcre-opt=OPTIONS set additional build options for PCRE --with-pcre-jit build PCRE with JIT compilation support - --without-pcre2 do not use PCRE2 library + + --with-md5=DIR set path to md5 library sources + --with-md5-opt=OPTIONS set additional build options for md5 + --with-md5-asm use md5 assembler sources + + --with-sha1=DIR set path to sha1 library sources + --with-sha1-opt=OPTIONS set additional build options for sha1 + --with-sha1-asm use sha1 assembler sources --with-zlib=DIR set path to zlib library sources --with-zlib-opt=OPTIONS set additional build options for zlib @@ -612,13 +471,24 @@ END fi +if [ $HTTP = NO ]; then + HTTP_CHARSET=NO + HTTP_GZIP=NO + HTTP_SSI=NO + HTTP_USERID=NO + HTTP_ACCESS=NO + HTTP_STATUS=NO + HTTP_REWRITE=NO + HTTP_PROXY=NO + HTTP_FASTCGI=NO +fi + + if [ ".$NGX_PLATFORM" = ".win32" ]; then NGX_WINE=$WINE fi -NGX_SBIN_PATH=${NGX_SBIN_PATH:-sbin/nginx} -NGX_MODULES_PATH=${NGX_MODULES_PATH:-modules} NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf} NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH` NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid} diff --git a/auto/os/conf b/auto/os/conf index bb0ce4e..fe72016 100644 --- a/auto/os/conf +++ b/auto/os/conf @@ -41,14 +41,6 @@ case "$NGX_PLATFORM" in ' ;; - NetBSD:*) - CORE_INCS="$UNIX_INCS" - CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" - CORE_SRCS="$UNIX_SRCS" - - NGX_RPATH=YES - ;; - HP-UX:*) # HP/UX have=NGX_HPUX . auto/have_headers @@ -68,15 +60,6 @@ case "$NGX_PLATFORM" in CORE_SRCS="$UNIX_SRCS" ;; - GNU:*) - # GNU Hurd - have=NGX_GNU_HURD . auto/have_headers - CORE_INCS="$UNIX_INCS" - CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" - CORE_SRCS="$UNIX_SRCS" - CC_AUX_FLAGS="$CC_AUX_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" - ;; - *) CORE_INCS="$UNIX_INCS" CORE_DEPS="$UNIX_DEPS $POSIX_DEPS" @@ -110,26 +93,6 @@ case "$NGX_MACHINE" in NGX_MACH_CACHE_LINE=64 ;; - aarch64 | arm64) - have=NGX_ALIGNMENT value=16 . auto/define - NGX_MACH_CACHE_LINE=64 - ;; - - ppc64* | powerpc64*) - have=NGX_ALIGNMENT value=16 . auto/define - NGX_MACH_CACHE_LINE=128 - ;; - - riscv64) - have=NGX_ALIGNMENT value=16 . auto/define - NGX_MACH_CACHE_LINE=64 - ;; - - s390x) - have=NGX_ALIGNMENT value=16 . auto/define - NGX_MACH_CACHE_LINE=256 - ;; - *) have=NGX_ALIGNMENT value=16 . auto/define NGX_MACH_CACHE_LINE=32 diff --git a/auto/os/darwin b/auto/os/darwin index 429468f..b97518a 100644 --- a/auto/os/darwin +++ b/auto/os/darwin @@ -14,12 +14,6 @@ CORE_SRCS="$UNIX_SRCS $DARWIN_SRCS" ngx_spacer=' ' -MAIN_LINK= -MODULE_LINK="-shared -Wl,-undefined,dynamic_lookup" - -CC_AUX_FLAGS="$CC_AUX_FLAGS -D__APPLE_USE_RFC_3542" - - # kqueue echo " + kqueue found" @@ -89,6 +83,7 @@ ngx_feature_test="int kq; # sendfile() +CC_AUX_FLAGS="$CC_AUX_FLAGS" ngx_feature="sendfile()" ngx_feature_name="NGX_HAVE_SENDFILE" ngx_feature_run=yes @@ -105,6 +100,7 @@ ngx_feature_test="int s = 0, fd = 1; . auto/feature if [ $ngx_found = yes ]; then + have=NGX_HAVE_SENDFILE . auto/have CORE_SRCS="$CORE_SRCS $DARWIN_SENDFILE_SRCS" fi @@ -115,6 +111,6 @@ ngx_feature_run=no ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test="int32_t lock = 0; - if (!OSAtomicCompareAndSwap32Barrier(0, 1, &lock)) return 1" +ngx_feature_test="int32_t lock, n; + n = OSAtomicCompareAndSwap32Barrier(0, 1, &lock)" . auto/feature diff --git a/auto/os/freebsd b/auto/os/freebsd index 870bac4..6aa823f 100644 --- a/auto/os/freebsd +++ b/auto/os/freebsd @@ -44,10 +44,10 @@ if [ $osreldate -gt 300007 ]; then CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS" fi -if [ $osreldate -gt 1100093 ]; then +if [ $osreldate -gt 502103 ]; then echo " + sendfile()'s SF_NODISKIO found" - have=NGX_HAVE_SENDFILE_NODISKIO . auto/have + have=NGX_HAVE_AIO_SENDFILE . auto/have fi # POSIX semaphores @@ -78,7 +78,7 @@ fi NGX_KQUEUE_CHECKED=YES -# kqueue's NOTE_LOWAT +# kqueue's NOTE_LAWAT if [ \( $version -lt 500000 -a $version -ge 430000 \) \ -o $version -ge 500018 ] @@ -97,6 +97,45 @@ then fi +if [ $USE_THREADS = "rfork" ]; then + + echo " + using rfork()" + +# # kqueue's EVFILT_SIGNAL is safe +# +# if [ $version -gt 460101 ]; then +# echo " + kqueue's EVFILT_SIGNAL is safe" +# have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have +# else +# echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this" +# echo "FreeBSD version, so --with-threads=rfork could not be used" +# echo +# +# exit 1 +# fi +fi + + +if [ $EVENT_AIO = YES ]; then + if [ \( $version -lt 500000 -a $version -ge 430000 \) \ + -o $version -ge 500014 ] + then + have=NGX_HAVE_AIO . auto/have + EVENT_MODULES="$EVENT_MODULES $AIO_MODULE" + CORE_SRCS="$CORE_SRCS $AIO_SRCS" + else + +cat << END + +$0: error: the kqueue does not support AIO on this FreeBSD version + +END + + exit 1 + fi +fi + + # cpuset_setaffinity() if [ $version -ge 701000 ]; then diff --git a/auto/os/linux b/auto/os/linux index bc0556b..19bf832 100644 --- a/auto/os/linux +++ b/auto/os/linux @@ -26,6 +26,18 @@ version=$((`uname -r \ version=${version:-0} +# enable the rt signals on Linux between 2.2.19 and 2.6.17 + +if [ \( $version -ge 131603 -a $version -lt 132626 \) -o $EVENT_RTSIG = YES ] +then + echo " + rt signals found" + have=NGX_HAVE_RTSIG . auto/have + EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE" + CORE_SRCS="$CORE_SRCS $RTSIG_SRCS" + EVENT_FOUND=YES +fi + + # posix_fadvise64() had been implemented in 2.5.60 if [ $version -lt 132412 ]; then @@ -44,7 +56,6 @@ ngx_feature_test="int efd = 0; struct epoll_event ee; ee.events = EPOLLIN|EPOLLOUT|EPOLLET; ee.data.ptr = NULL; - (void) ee; efd = epoll_create(100); if (efd == -1) return 1;" . auto/feature @@ -70,47 +81,6 @@ if [ $ngx_found = yes ]; then ee.data.ptr = NULL; epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" . auto/feature - - - # EPOLLEXCLUSIVE appeared in Linux 4.5, glibc 2.24 - - ngx_feature="EPOLLEXCLUSIVE" - ngx_feature_name="NGX_HAVE_EPOLLEXCLUSIVE" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test="int efd = 0, fd = 0; - struct epoll_event ee; - ee.events = EPOLLIN|EPOLLEXCLUSIVE; - ee.data.ptr = NULL; - epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" - . auto/feature - - - # eventfd() - - ngx_feature="eventfd()" - ngx_feature_name="NGX_HAVE_EVENTFD" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test="(void) eventfd(0, 0)" - . auto/feature - - if [ $ngx_found = yes ]; then - have=NGX_HAVE_SYS_EVENTFD_H . auto/have - fi - - - if [ $ngx_found = no ]; then - - ngx_feature="eventfd() (SYS_eventfd)" - ngx_feature_incs="#include " - ngx_feature_test="(void) SYS_eventfd" - . auto/feature - fi fi @@ -182,37 +152,17 @@ ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1" . auto/feature -# prctl(PR_SET_KEEPCAPS) +# sched_setaffinity() -ngx_feature="prctl(PR_SET_KEEPCAPS)" -ngx_feature_name="NGX_HAVE_PR_SET_KEEPCAPS" -ngx_feature_run=yes -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1) return 1" -. auto/feature - - -# capabilities - -ngx_feature="capabilities" -ngx_feature_name="NGX_HAVE_CAPABILITIES" +ngx_feature="sched_setaffinity()" +ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY" ngx_feature_run=no -ngx_feature_incs="#include - #include " +ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test="struct __user_cap_data_struct data; - struct __user_cap_header_struct header; - - header.version = _LINUX_CAPABILITY_VERSION_1; - data.effective = CAP_TO_MASK(CAP_NET_RAW); - data.permitted = 0; - - (void) header; - (void) data; - (void) SYS_capset" +ngx_feature_test="cpu_set_t mask; + CPU_ZERO(&mask); + sched_setaffinity(0, sizeof(cpu_set_t), &mask)" . auto/feature @@ -228,71 +178,8 @@ ngx_feature_test="struct crypt_data cd; crypt_r(\"key\", \"salt\", &cd);" . auto/feature -if [ $ngx_found = yes ]; then - CRYPT_LIB="-lcrypt" -fi - ngx_include="sys/vfs.h"; . auto/include -# BPF sockhash - -ngx_feature="BPF sockhash" -ngx_feature_name="NGX_HAVE_BPF" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="union bpf_attr attr = { 0 }; - - attr.map_flags = 0; - attr.map_type = BPF_MAP_TYPE_SOCKHASH; - - syscall(__NR_bpf, 0, &attr, 0);" -. auto/feature - -if [ $ngx_found = yes ]; then - CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c" - CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h" - - if [ $QUIC_BPF != NONE ]; then - QUIC_BPF=YES - fi -fi - - -ngx_feature="SO_COOKIE" -ngx_feature_name="NGX_HAVE_SO_COOKIE" -ngx_feature_run=no -ngx_feature_incs="#include - $NGX_INCLUDE_INTTYPES_H" -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="socklen_t optlen = sizeof(uint64_t); - uint64_t cookie; - getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)" -. auto/feature - -if [ $ngx_found = yes ]; then - SO_COOKIE_FOUND=YES -fi - - -# UDP segmentation offloading - -ngx_feature="UDP_SEGMENT" -ngx_feature_name="NGX_HAVE_UDP_SEGMENT" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="socklen_t optlen = sizeof(int); - int val; - getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)" -. auto/feature - - CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" diff --git a/auto/os/solaris b/auto/os/solaris index 1dcfe84..d39df0b 100644 --- a/auto/os/solaris +++ b/auto/os/solaris @@ -52,7 +52,7 @@ ngx_feature_run=no ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test="(void) port_create()" +ngx_feature_test="int n = port_create()" . auto/feature if [ $ngx_found = yes ]; then diff --git a/auto/os/win32 b/auto/os/win32 index bce764b..0b9b461 100644 --- a/auto/os/win32 +++ b/auto/os/win32 @@ -11,18 +11,11 @@ CORE_SRCS="$WIN32_SRCS $IOCP_SRCS" OS_CONFIG="$WIN32_CONFIG" NGX_ICONS="$NGX_WIN32_ICONS" SELECT_SRCS=$WIN32_SELECT_SRCS -POLL_SRCS=$WIN32_POLL_SRCS - -ngx_pic_opt= -ngx_binext=".exe" case "$NGX_CC_NAME" in - clang | gcc) + gcc) CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32" - MAIN_LINK="$MAIN_LINK -Wl,--export-all-symbols" - MAIN_LINK="$MAIN_LINK -Wl,--out-implib=$NGX_OBJS/libnginx.a" - MODULE_LINK="-shared -L $NGX_OBJS -lnginx" ;; *) @@ -32,8 +25,16 @@ case "$NGX_CC_NAME" in esac EVENT_MODULES="$EVENT_MODULES $IOCP_MODULE" -#EVENT_FOUND=YES +EVENT_FOUND=YES -have=NGX_HAVE_INET6 . auto/have +if [ $EVENT_SELECT = NO ]; then + CORE_SRCS="$CORE_SRCS $SELECT_SRCS" + EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE" +fi +if [ $NGX_IPV6 = YES ]; then + have=NGX_HAVE_INET6 . auto/have +fi + +have=NGX_HAVE_AIO . auto/have have=NGX_HAVE_IOCP . auto/have diff --git a/auto/sources b/auto/sources index 46408ee..bff0eb1 100644 --- a/auto/sources +++ b/auto/sources @@ -19,7 +19,6 @@ CORE_DEPS="src/core/nginx.h \ src/core/ngx_queue.h \ src/core/ngx_string.h \ src/core/ngx_parse.h \ - src/core/ngx_parse_time.h \ src/core/ngx_inet.h \ src/core/ngx_file.h \ src/core/ngx_crc.h \ @@ -29,19 +28,16 @@ CORE_DEPS="src/core/nginx.h \ src/core/ngx_sha1.h \ src/core/ngx_rbtree.h \ src/core/ngx_radix_tree.h \ - src/core/ngx_rwlock.h \ src/core/ngx_slab.h \ src/core/ngx_times.h \ src/core/ngx_shmtx.h \ src/core/ngx_connection.h \ src/core/ngx_cycle.h \ src/core/ngx_conf_file.h \ - src/core/ngx_module.h \ src/core/ngx_resolver.h \ src/core/ngx_open_file_cache.h \ src/core/ngx_crypt.h \ - src/core/ngx_proxy_protocol.h \ - src/core/ngx_syslog.h" + src/core/ngx_proxy_protocol.h" CORE_SRCS="src/core/nginx.c \ @@ -55,13 +51,11 @@ CORE_SRCS="src/core/nginx.c \ src/core/ngx_output_chain.c \ src/core/ngx_string.c \ src/core/ngx_parse.c \ - src/core/ngx_parse_time.c \ src/core/ngx_inet.c \ src/core/ngx_file.c \ src/core/ngx_crc32.c \ src/core/ngx_murmurhash.c \ src/core/ngx_md5.c \ - src/core/ngx_sha1.c \ src/core/ngx_rbtree.c \ src/core/ngx_radix_tree.c \ src/core/ngx_slab.c \ @@ -70,33 +64,41 @@ CORE_SRCS="src/core/nginx.c \ src/core/ngx_connection.c \ src/core/ngx_cycle.c \ src/core/ngx_spinlock.c \ - src/core/ngx_rwlock.c \ src/core/ngx_cpuinfo.c \ src/core/ngx_conf_file.c \ - src/core/ngx_module.c \ src/core/ngx_resolver.c \ src/core/ngx_open_file_cache.c \ src/core/ngx_crypt.c \ - src/core/ngx_proxy_protocol.c \ - src/core/ngx_syslog.c" + src/core/ngx_proxy_protocol.c" + + +REGEX_MODULE=ngx_regex_module +REGEX_DEPS=src/core/ngx_regex.h +REGEX_SRCS=src/core/ngx_regex.c + + +OPENSSL_MODULE=ngx_openssl_module +OPENSSL_DEPS=src/event/ngx_event_openssl.h +OPENSSL_SRCS="src/event/ngx_event_openssl.c \ + src/event/ngx_event_openssl_stapling.c" EVENT_MODULES="ngx_events_module ngx_event_core_module" -EVENT_INCS="src/event src/event/modules src/event/quic" +EVENT_INCS="src/event src/event/modules" EVENT_DEPS="src/event/ngx_event.h \ src/event/ngx_event_timer.h \ src/event/ngx_event_posted.h \ + src/event/ngx_event_busy_lock.h \ src/event/ngx_event_connect.h \ - src/event/ngx_event_pipe.h \ - src/event/ngx_event_udp.h" + src/event/ngx_event_pipe.h" EVENT_SRCS="src/event/ngx_event.c \ src/event/ngx_event_timer.c \ src/event/ngx_event_posted.c \ + src/event/ngx_event_busy_lock.c \ src/event/ngx_event_accept.c \ - src/event/ngx_event_udp.c \ src/event/ngx_event_connect.c \ src/event/ngx_event_pipe.c" @@ -107,7 +109,6 @@ WIN32_SELECT_SRCS=src/event/modules/ngx_win32_select_module.c POLL_MODULE=ngx_poll_module POLL_SRCS=src/event/modules/ngx_poll_module.c -WIN32_POLL_SRCS=src/event/modules/ngx_win32_poll_module.c KQUEUE_MODULE=ngx_kqueue_module KQUEUE_SRCS=src/event/modules/ngx_kqueue_module.c @@ -121,9 +122,19 @@ EVENTPORT_SRCS=src/event/modules/ngx_eventport_module.c EPOLL_MODULE=ngx_epoll_module EPOLL_SRCS=src/event/modules/ngx_epoll_module.c +RTSIG_MODULE=ngx_rtsig_module +RTSIG_SRCS=src/event/modules/ngx_rtsig_module.c + IOCP_MODULE=ngx_iocp_module IOCP_SRCS=src/event/modules/ngx_iocp_module.c +AIO_MODULE=ngx_aio_module +AIO_SRCS="src/event/modules/ngx_aio_module.c \ + src/os/unix/ngx_aio_read.c \ + src/os/unix/ngx_aio_write.c \ + src/os/unix/ngx_aio_read_chain.c \ + src/os/unix/ngx_aio_write_chain.c" + FILE_AIO_SRCS="src/os/unix/ngx_file_aio_read.c" LINUX_AIO_SRCS="src/os/unix/ngx_linux_aio_read.c" @@ -145,7 +156,6 @@ UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \ src/os/unix/ngx_socket.h \ src/os/unix/ngx_os.h \ src/os/unix/ngx_user.h \ - src/os/unix/ngx_dlopen.h \ src/os/unix/ngx_process_cycle.h" # add to UNIX_DEPS @@ -169,8 +179,6 @@ UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \ src/os/unix/ngx_udp_recv.c \ src/os/unix/ngx_send.c \ src/os/unix/ngx_writev_chain.c \ - src/os/unix/ngx_udp_send.c \ - src/os/unix/ngx_udp_sendmsg_chain.c \ src/os/unix/ngx_channel.c \ src/os/unix/ngx_shmem.c \ src/os/unix/ngx_process.c \ @@ -179,21 +187,18 @@ UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \ src/os/unix/ngx_setproctitle.c \ src/os/unix/ngx_posix_init.c \ src/os/unix/ngx_user.c \ - src/os/unix/ngx_dlopen.c \ src/os/unix/ngx_process_cycle.c" POSIX_DEPS=src/os/unix/ngx_posix_config.h -THREAD_POOL_MODULE=ngx_thread_pool_module -THREAD_POOL_DEPS=src/core/ngx_thread_pool.h -THREAD_POOL_SRCS="src/core/ngx_thread_pool.c - src/os/unix/ngx_thread_cond.c - src/os/unix/ngx_thread_mutex.c - src/os/unix/ngx_thread_id.c" - FREEBSD_DEPS="src/os/unix/ngx_freebsd_config.h src/os/unix/ngx_freebsd.h" FREEBSD_SRCS=src/os/unix/ngx_freebsd_init.c FREEBSD_SENDFILE_SRCS=src/os/unix/ngx_freebsd_sendfile_chain.c +FREEBSD_RFORK_DEPS="src/os/unix/ngx_freebsd_rfork_thread.h" +FREEBSD_RFORK_SRCS="src/os/unix/ngx_freebsd_rfork_thread.c" +FREEBSD_RFORK_THREAD_SRCS="src/os/unix/rfork_thread.S" + +PTHREAD_SRCS="src/os/unix/ngx_pthread_thread.c" LINUX_DEPS="src/os/unix/ngx_linux_config.h src/os/unix/ngx_linux.h" LINUX_SRCS=src/os/unix/ngx_linux_init.c @@ -225,7 +230,6 @@ WIN32_DEPS="$CORE_DEPS $EVENT_DEPS \ src/os/win32/ngx_socket.h \ src/os/win32/ngx_os.h \ src/os/win32/ngx_user.h \ - src/os/win32/ngx_dlopen.h \ src/os/win32/ngx_process_cycle.h" WIN32_CONFIG=src/os/win32/ngx_win32_config.h @@ -246,7 +250,6 @@ WIN32_SRCS="$CORE_SRCS $EVENT_SRCS \ src/os/win32/ngx_wsasend_chain.c \ src/os/win32/ngx_win32_init.c \ src/os/win32/ngx_user.c \ - src/os/win32/ngx_dlopen.c \ src/os/win32/ngx_event_log.c \ src/os/win32/ngx_process_cycle.c \ src/event/ngx_event_acceptex.c" @@ -255,7 +258,294 @@ NGX_WIN32_ICONS="src/os/win32/nginx.ico" NGX_WIN32_RC="src/os/win32/nginx.rc" +# the http modules that have their logging formats +# must be after ngx_http_log_module + +HTTP_MODULES="ngx_http_module \ + ngx_http_core_module \ + ngx_http_log_module \ + ngx_http_upstream_module" + +HTTP_WRITE_FILTER_MODULE="ngx_http_write_filter_module" +HTTP_HEADER_FILTER_MODULE="ngx_http_header_filter_module" + +HTTP_POSTPONE_FILTER_MODULE=ngx_http_postpone_filter_module +HTTP_COPY_FILTER_MODULE=ngx_http_copy_filter_module + +HTTP_CHUNKED_FILTER_MODULE=ngx_http_chunked_filter_module +HTTP_HEADERS_FILTER_MODULE=ngx_http_headers_filter_module + +HTTP_RANGE_HEADER_FILTER_MODULE=ngx_http_range_header_filter_module +HTTP_RANGE_BODY_FILTER_MODULE=ngx_http_range_body_filter_module + +HTTP_NOT_MODIFIED_FILTER_MODULE=ngx_http_not_modified_filter_module + +HTTP_STATIC_MODULE=ngx_http_static_module +HTTP_INDEX_MODULE=ngx_http_index_module + +HTTP_INCS="src/http src/http/modules" + +HTTP_DEPS="src/http/ngx_http.h \ + src/http/ngx_http_request.h \ + src/http/ngx_http_config.h \ + src/http/ngx_http_core_module.h \ + src/http/ngx_http_cache.h \ + src/http/ngx_http_variables.h \ + src/http/ngx_http_script.h \ + src/http/ngx_http_upstream.h \ + src/http/ngx_http_upstream_round_robin.h \ + src/http/ngx_http_busy_lock.h" + +HTTP_SRCS="src/http/ngx_http.c \ + src/http/ngx_http_core_module.c \ + src/http/ngx_http_special_response.c \ + src/http/ngx_http_request.c \ + src/http/ngx_http_parse.c \ + src/http/ngx_http_header_filter_module.c \ + src/http/ngx_http_write_filter_module.c \ + src/http/ngx_http_copy_filter_module.c \ + src/http/modules/ngx_http_log_module.c \ + src/http/ngx_http_request_body.c \ + src/http/ngx_http_variables.c \ + src/http/ngx_http_script.c \ + src/http/ngx_http_upstream.c \ + src/http/ngx_http_upstream_round_robin.c \ + src/http/ngx_http_parse_time.c \ + src/http/modules/ngx_http_static_module.c \ + src/http/modules/ngx_http_index_module.c \ + src/http/modules/ngx_http_chunked_filter_module.c \ + src/http/modules/ngx_http_range_filter_module.c \ + src/http/modules/ngx_http_headers_filter_module.c \ + src/http/modules/ngx_http_not_modified_filter_module.c" + +# STUB +HTTP_SRCS="$HTTP_SRCS src/http/ngx_http_busy_lock.c" + +HTTP_POSTPONE_FILTER_SRCS=src/http/ngx_http_postpone_filter_module.c + HTTP_FILE_CACHE_SRCS=src/http/ngx_http_file_cache.c -HTTP_HUFF_SRCS="src/http/ngx_http_huff_decode.c - src/http/ngx_http_huff_encode.c" + +HTTP_SPDY_MODULE=ngx_http_spdy_module +HTTP_SPDY_FILTER_MODULE=ngx_http_spdy_filter_module +HTTP_SPDY_DEPS="src/http/ngx_http_spdy.h \ + src/http/ngx_http_spdy_module.h" +HTTP_SPDY_SRCS="src/http/ngx_http_spdy.c \ + src/http/ngx_http_spdy_module.c \ + src/http/ngx_http_spdy_filter_module.c" + + +HTTP_CHARSET_FILTER_MODULE=ngx_http_charset_filter_module +HTTP_CHARSET_SRCS=src/http/modules/ngx_http_charset_filter_module.c + + +HTTP_GZIP_FILTER_MODULE=ngx_http_gzip_filter_module +HTTP_GZIP_SRCS=src/http/modules/ngx_http_gzip_filter_module.c + + +HTTP_GUNZIP_FILTER_MODULE=ngx_http_gunzip_filter_module +HTTP_GUNZIP_SRCS=src/http/modules/ngx_http_gunzip_filter_module.c + + +HTTP_SSI_FILTER_MODULE=ngx_http_ssi_filter_module +HTTP_SSI_DEPS=src/http/modules/ngx_http_ssi_filter_module.h +HTTP_SSI_SRCS=src/http/modules/ngx_http_ssi_filter_module.c + + +HTTP_XSLT_FILTER_MODULE=ngx_http_xslt_filter_module +HTTP_XSLT_SRCS=src/http/modules/ngx_http_xslt_filter_module.c + + +HTTP_IMAGE_FILTER_MODULE=ngx_http_image_filter_module +HTTP_IMAGE_SRCS=src/http/modules/ngx_http_image_filter_module.c + + +HTTP_SUB_FILTER_MODULE=ngx_http_sub_filter_module +HTTP_SUB_SRCS=src/http/modules/ngx_http_sub_filter_module.c + + +HTTP_USERID_FILTER_MODULE=ngx_http_userid_filter_module +HTTP_USERID_SRCS=src/http/modules/ngx_http_userid_filter_module.c + + +HTTP_REALIP_MODULE=ngx_http_realip_module +HTTP_REALIP_SRCS=src/http/modules/ngx_http_realip_module.c + + +HTTP_ADDITION_FILTER_MODULE=ngx_http_addition_filter_module +HTTP_ADDITION_SRCS=src/http/modules/ngx_http_addition_filter_module.c + + +HTTP_DAV_MODULE=ngx_http_dav_module +HTTP_DAV_SRCS=src/http/modules/ngx_http_dav_module.c + + +HTTP_ACCESS_MODULE=ngx_http_access_module +HTTP_ACCESS_SRCS=src/http/modules/ngx_http_access_module.c + + +HTTP_AUTH_BASIC_MODULE=ngx_http_auth_basic_module +HTTP_AUTH_BASIC_SRCS=src/http/modules/ngx_http_auth_basic_module.c + + +HTTP_AUTH_REQUEST_MODULE=ngx_http_auth_request_module +HTTP_AUTH_REQUEST_SRCS=src/http/modules/ngx_http_auth_request_module.c + + +HTTP_AUTOINDEX_MODULE=ngx_http_autoindex_module +HTTP_AUTOINDEX_SRCS=src/http/modules/ngx_http_autoindex_module.c + + +HTTP_RANDOM_INDEX_MODULE=ngx_http_random_index_module +HTTP_RANDOM_INDEX_SRCS=src/http/modules/ngx_http_random_index_module.c + + +HTTP_STATUS_MODULE=ngx_http_status_module +HTTP_STATUS_SRCS=src/http/modules/ngx_http_status_module.c + + +HTTP_GEO_MODULE=ngx_http_geo_module +HTTP_GEO_SRCS=src/http/modules/ngx_http_geo_module.c + + +HTTP_GEOIP_MODULE=ngx_http_geoip_module +HTTP_GEOIP_SRCS=src/http/modules/ngx_http_geoip_module.c + + +HTTP_MAP_MODULE=ngx_http_map_module +HTTP_MAP_SRCS=src/http/modules/ngx_http_map_module.c + + +HTTP_SPLIT_CLIENTS_MODULE=ngx_http_split_clients_module +HTTP_SPLIT_CLIENTS_SRCS=src/http/modules/ngx_http_split_clients_module.c + + +HTTP_REFERER_MODULE=ngx_http_referer_module +HTTP_REFERER_SRCS=src/http/modules/ngx_http_referer_module.c + + +HTTP_REWRITE_MODULE=ngx_http_rewrite_module +HTTP_REWRITE_SRCS=src/http/modules/ngx_http_rewrite_module.c + + +HTTP_SSL_MODULE=ngx_http_ssl_module +HTTP_SSL_DEPS=src/http/modules/ngx_http_ssl_module.h +HTTP_SSL_SRCS=src/http/modules/ngx_http_ssl_module.c + + +HTTP_PROXY_MODULE=ngx_http_proxy_module +HTTP_PROXY_SRCS=src/http/modules/ngx_http_proxy_module.c + + +HTTP_FASTCGI_MODULE=ngx_http_fastcgi_module +HTTP_FASTCGI_SRCS=src/http/modules/ngx_http_fastcgi_module.c + + +HTTP_UWSGI_MODULE=ngx_http_uwsgi_module +HTTP_UWSGI_SRCS=src/http/modules/ngx_http_uwsgi_module.c + + +HTTP_SCGI_MODULE=ngx_http_scgi_module +HTTP_SCGI_SRCS=src/http/modules/ngx_http_scgi_module.c + + +HTTP_PERL_MODULE=ngx_http_perl_module +HTTP_PERL_INCS=src/http/modules/perl +HTTP_PERL_DEPS=src/http/modules/perl/ngx_http_perl_module.h +HTTP_PERL_SRCS=src/http/modules/perl/ngx_http_perl_module.c + + +HTTP_MEMCACHED_MODULE=ngx_http_memcached_module +HTTP_MEMCACHED_SRCS=src/http/modules/ngx_http_memcached_module.c + + +HTTP_LIMIT_CONN_MODULE=ngx_http_limit_conn_module +HTTP_LIMIT_CONN_SRCS=src/http/modules/ngx_http_limit_conn_module.c + + +HTTP_LIMIT_REQ_MODULE=ngx_http_limit_req_module +HTTP_LIMIT_REQ_SRCS=src/http/modules/ngx_http_limit_req_module.c + + +HTTP_EMPTY_GIF_MODULE=ngx_http_empty_gif_module +HTTP_EMPTY_GIF_SRCS=src/http/modules/ngx_http_empty_gif_module.c + + +HTTP_BROWSER_MODULE=ngx_http_browser_module +HTTP_BROWSER_SRCS=src/http/modules/ngx_http_browser_module.c + + +HTTP_SECURE_LINK_MODULE=ngx_http_secure_link_module +HTTP_SECURE_LINK_SRCS=src/http/modules/ngx_http_secure_link_module.c + + +HTTP_DEGRADATION_MODULE=ngx_http_degradation_module +HTTP_DEGRADATION_SRCS=src/http/modules/ngx_http_degradation_module.c + + +HTTP_FLV_MODULE=ngx_http_flv_module +HTTP_FLV_SRCS=src/http/modules/ngx_http_flv_module.c + + +HTTP_MP4_MODULE=ngx_http_mp4_module +HTTP_MP4_SRCS=src/http/modules/ngx_http_mp4_module.c + + +HTTP_GZIP_STATIC_MODULE=ngx_http_gzip_static_module +HTTP_GZIP_STATIC_SRCS=src/http/modules/ngx_http_gzip_static_module.c + + +HTTP_UPSTREAM_IP_HASH_MODULE=ngx_http_upstream_ip_hash_module +HTTP_UPSTREAM_IP_HASH_SRCS=src/http/modules/ngx_http_upstream_ip_hash_module.c + + +HTTP_UPSTREAM_LEAST_CONN_MODULE=ngx_http_upstream_least_conn_module +HTTP_UPSTREAM_LEAST_CONN_SRCS=" \ + src/http/modules/ngx_http_upstream_least_conn_module.c" + + +HTTP_UPSTREAM_KEEPALIVE_MODULE=ngx_http_upstream_keepalive_module +HTTP_UPSTREAM_KEEPALIVE_SRCS=" \ + src/http/modules/ngx_http_upstream_keepalive_module.c" + + +MAIL_INCS="src/mail" + +MAIL_DEPS="src/mail/ngx_mail.h" + +MAIL_MODULES="ngx_mail_module ngx_mail_core_module" + +MAIL_SRCS="src/mail/ngx_mail.c \ + src/mail/ngx_mail_core_module.c \ + src/mail/ngx_mail_handler.c \ + src/mail/ngx_mail_parse.c" + +MAIL_POP3_MODULE="ngx_mail_pop3_module" +MAIL_POP3_DEPS="src/mail/ngx_mail_pop3_module.h" +MAIL_POP3_SRCS="src/mail/ngx_mail_pop3_module.c \ + src/mail/ngx_mail_pop3_handler.c" + +MAIL_IMAP_MODULE="ngx_mail_imap_module" +MAIL_IMAP_DEPS="src/mail/ngx_mail_imap_module.h" +MAIL_IMAP_SRCS="src/mail/ngx_mail_imap_module.c \ + src/mail/ngx_mail_imap_handler.c" + +MAIL_SMTP_MODULE="ngx_mail_smtp_module" +MAIL_SMTP_DEPS="src/mail/ngx_mail_smtp_module.h" +MAIL_SMTP_SRCS="src/mail/ngx_mail_smtp_module.c \ + src/mail/ngx_mail_smtp_handler.c" + +MAIL_SSL_MODULE="ngx_mail_ssl_module" +MAIL_SSL_DEPS="src/mail/ngx_mail_ssl_module.h" +MAIL_SSL_SRCS="src/mail/ngx_mail_ssl_module.c" + +MAIL_AUTH_HTTP_MODULE="ngx_mail_auth_http_module" +MAIL_AUTH_HTTP_SRCS="src/mail/ngx_mail_auth_http_module.c" + +MAIL_PROXY_MODULE="ngx_mail_proxy_module" +MAIL_PROXY_SRCS="src/mail/ngx_mail_proxy_module.c" + +NGX_GOOGLE_PERFTOOLS_MODULE=ngx_google_perftools_module +NGX_GOOGLE_PERFTOOLS_SRCS=src/misc/ngx_google_perftools_module.c + +NGX_CPP_TEST_SRCS=src/misc/ngx_cpp_test_module.cpp diff --git a/auto/summary b/auto/summary index b3c07ee..dcebec9 100644 --- a/auto/summary +++ b/auto/summary @@ -3,22 +3,43 @@ # Copyright (C) Nginx, Inc. +### STUB + +if [ $USE_THREADS != NO ]; then + +cat << END + +$0: error: the threads support is broken now. + +END + exit 1 + fi + +### + + echo echo "Configuration summary" -if [ $USE_THREADS = YES ]; then - echo " + using threads" -fi +#case $USE_THREADS in +# rfork) echo " + using rfork()ed threads" ;; +# pthreads) echo " + using libpthread threads library" ;; +# libthr) echo " + using FreeBSD libthr threads library" ;; +# libc_r) echo " + using FreeBSD libc_r threads library" ;; +# linuxthreads) echo " + using FreeBSD LinuxThreads port library" ;; +# NO) echo " + threads are not used" ;; +# *) echo " + using lib$USE_THREADS threads library" ;; +#esac if [ $USE_PCRE = DISABLED ]; then echo " + PCRE library is disabled" else case $PCRE in - YES) echo " + using system $PCRE_LIBRARY library" ;; + YES) echo " + using system PCRE library" ;; NONE) echo " + PCRE library is not used" ;; - *) echo " + using $PCRE_LIBRARY library: $PCRE" ;; + *) echo " + using PCRE library: $PCRE" ;; esac fi @@ -28,6 +49,20 @@ case $OPENSSL in *) echo " + using OpenSSL library: $OPENSSL" ;; esac +case $MD5 in + YES) echo " + md5: using $MD5_LIB library" ;; + NONE) echo " + md5 library is not used" ;; + NO) echo " + using builtin md5 code" ;; + *) echo " + using md5 library: $MD5" ;; +esac + +case $SHA1 in + YES) echo " + sha1: using $SHA1_LIB library" ;; + NONE) echo " + sha1 library is not used" ;; + NO) echo " + sha1 library is not found" ;; + *) echo " + using sha1 library: $SHA1" ;; +esac + case $ZLIB in YES) echo " + using system zlib library" ;; NONE) echo " + zlib library is not used" ;; @@ -46,7 +81,6 @@ echo cat << END nginx path prefix: "$NGX_PREFIX" nginx binary file: "$NGX_SBIN_PATH" - nginx modules path: "$NGX_MODULES_PATH" nginx configuration prefix: "$NGX_CONF_PREFIX" nginx configuration file: "$NGX_CONF_PATH" nginx pid file: "$NGX_PID_PATH" diff --git a/auto/threads b/auto/threads deleted file mode 100644 index 943127f..0000000 --- a/auto/threads +++ /dev/null @@ -1,21 +0,0 @@ - -# Copyright (C) Nginx, Inc. - - -if [ $USE_THREADS = YES ]; then - - if [ "$NGX_PLATFORM" = win32 ]; then - cat << END - -$0: --with-threads is not supported on Windows - -END - exit 1 - fi - - have=NGX_THREADS . auto/have - CORE_DEPS="$CORE_DEPS $THREAD_POOL_DEPS" - CORE_SRCS="$CORE_SRCS $THREAD_POOL_SRCS" - CORE_LIBS="$CORE_LIBS -lpthread" - NGX_LIBPTHREAD="-lpthread" -fi diff --git a/auto/types/sizeof b/auto/types/sizeof index 480d8cf..9215a54 100644 --- a/auto/types/sizeof +++ b/auto/types/sizeof @@ -25,7 +25,7 @@ $NGX_INCLUDE_UNISTD_H $NGX_INCLUDE_INTTYPES_H $NGX_INCLUDE_AUTO_CONFIG_H -int main(void) { +int main() { printf("%d", (int) sizeof($ngx_type)); return 0; } @@ -45,14 +45,27 @@ if [ -x $NGX_AUTOTEST ]; then fi +rm -rf $NGX_AUTOTEST* + + case $ngx_size in 4) - ngx_max_value=2147483647 + if [ "$ngx_type"="long" ]; then + ngx_max_value=2147483647L + else + ngx_max_value=2147483647 + fi + ngx_max_len='(sizeof("-2147483648") - 1)' ;; 8) - ngx_max_value=9223372036854775807LL + if [ "$ngx_type"="long long" ]; then + ngx_max_value=9223372036854775807LL + else + ngx_max_value=9223372036854775807L + fi + ngx_max_len='(sizeof("-9223372036854775808") - 1)' ;; @@ -66,11 +79,6 @@ case $ngx_size in echo $ngx_test >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR - rm -rf $NGX_AUTOTEST* - exit 1 esac - -rm -rf $NGX_AUTOTEST* - diff --git a/auto/types/typedef b/auto/types/typedef index d54c289..8b5c368 100644 --- a/auto/types/typedef +++ b/auto/types/typedef @@ -27,7 +27,7 @@ do #include $NGX_INCLUDE_INTTYPES_H -int main(void) { +int main() { $ngx_try i = 0; return (int) i; } @@ -49,23 +49,18 @@ END fi fi + rm -rf $NGX_AUTOTEST* + if [ $ngx_found = no ]; then - if [ $ngx_try = $ngx_type ]; then - echo $ngx_n " $ngx_try not found$ngx_c" - else - echo $ngx_n ", $ngx_try not found$ngx_c" - fi + echo $ngx_n " $ngx_try not found$ngx_c" echo "----------" >> $NGX_AUTOCONF_ERR cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR echo $ngx_test >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR - fi - rm -rf $NGX_AUTOTEST* - - if [ $ngx_found != no ]; then + else break fi done diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t index a33d6d0..f3cdccb 100644 --- a/auto/types/uintptr_t +++ b/auto/types/uintptr_t @@ -4,22 +4,17 @@ echo $ngx_n "checking for uintptr_t ...$ngx_c" - -cat << END >> $NGX_AUTOCONF_ERR - ----------------------------------------- -checking for uintptr_t - -END +echo >> $NGX_AUTOCONF_ERR +echo "checking for uintptr_t" >> $NGX_AUTOCONF_ERR found=no cat << END > $NGX_AUTOTEST.c #include -$NGX_INCLUDE_INTTYPES_H +$NGX_INTTYPES_H -int main(void) { +int main() { uintptr_t i = 0; return (int) i; } diff --git a/auto/unix b/auto/unix old mode 100644 new mode 100755 index f29e69c..10fd3d2 --- a/auto/unix +++ b/auto/unix @@ -75,7 +75,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= - ngx_feature_test="(void) kqueue()" + ngx_feature_test="int kq; kq = kqueue()" . auto/feature if [ $ngx_found = yes ]; then @@ -92,8 +92,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then ngx_feature_path= ngx_feature_libs= ngx_feature_test="struct kevent kev; - kev.fflags = NOTE_LOWAT; - (void) kev" + kev.fflags = NOTE_LOWAT;" . auto/feature @@ -256,23 +255,22 @@ ngx_feature_test="struct statvfs fs; ngx_feature="dlopen()" -ngx_feature_name="NGX_HAVE_DLOPEN" +ngx_feature_name= ngx_feature_run=no ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, \"\")" +ngx_feature_test="dlopen(NULL, 0)" . auto/feature -if [ $ngx_found = no ]; then +if [ $ngx_found != yes ]; then ngx_feature="dlopen() in libdl" ngx_feature_libs="-ldl" . auto/feature if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS -ldl" NGX_LIBDL="-ldl" fi fi @@ -288,7 +286,7 @@ ngx_feature_test="sched_yield()" . auto/feature -if [ $ngx_found = no ]; then +if [ $ngx_found != yes ]; then ngx_feature="sched_yield() in librt" ngx_feature_libs="-lrt" @@ -300,35 +298,13 @@ if [ $ngx_found = no ]; then fi -ngx_feature="sched_setaffinity()" -ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY" -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="cpu_set_t mask; - CPU_ZERO(&mask); - sched_setaffinity(0, sizeof(cpu_set_t), &mask)" -. auto/feature - - ngx_feature="SO_SETFIB" ngx_feature_name="NGX_HAVE_SETFIB" ngx_feature_run=no ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 0)" -. auto/feature - - -ngx_feature="SO_REUSEPORT" -ngx_feature_name="NGX_HAVE_REUSEPORT" -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_REUSEPORT, NULL, 0)" +ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)" . auto/feature @@ -342,160 +318,6 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)" . auto/feature -# OpenBSD bind to any address for transparent proxying - -ngx_feature="SO_BINDANY" -ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY" -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0)" -. auto/feature - - -# Linux transparent proxying - -ngx_feature="IP_TRANSPARENT" -ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_TRANSPARENT, NULL, 0)" -. auto/feature - - -# FreeBSD bind to any address for transparent proxying - -ngx_feature="IP_BINDANY" -ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0)" -. auto/feature - - -# Linux IP_BIND_ADDRESS_NO_PORT - -ngx_feature="IP_BIND_ADDRESS_NO_PORT" -ngx_feature_name="NGX_HAVE_IP_BIND_ADDRESS_NO_PORT" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, NULL, 0)" -. auto/feature - - -# BSD way to get IPv4 datagram destination address - -ngx_feature="IP_RECVDSTADDR" -ngx_feature_name="NGX_HAVE_IP_RECVDSTADDR" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)" -. auto/feature - - -# BSD way to set IPv4 datagram source address - -ngx_feature="IP_SENDSRCADDR" -ngx_feature_name="NGX_HAVE_IP_SENDSRCADDR" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0)" -. auto/feature - - -# Linux way to get IPv4 datagram destination address - -ngx_feature="IP_PKTINFO" -ngx_feature_name="NGX_HAVE_IP_PKTINFO" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="struct in_pktinfo pkt; - pkt.ipi_spec_dst.s_addr = INADDR_ANY; - (void) pkt; - setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)" -. auto/feature - - -# RFC 3542 way to get IPv6 datagram destination address - -ngx_feature="IPV6_RECVPKTINFO" -ngx_feature_name="NGX_HAVE_IPV6_RECVPKTINFO" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IPV6, IPV6_RECVPKTINFO, NULL, 0)" -. auto/feature - - -# IP packet fragmentation - -ngx_feature="IP_MTU_DISCOVER" -ngx_feature_name="NGX_HAVE_IP_MTU_DISCOVER" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="(void) IP_PMTUDISC_DO; - setsockopt(0, IPPROTO_IP, IP_MTU_DISCOVER, NULL, 0)" -. auto/feature - - -ngx_feature="IPV6_MTU_DISCOVER" -ngx_feature_name="NGX_HAVE_IPV6_MTU_DISCOVER" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="(void) IPV6_PMTUDISC_DO; - setsockopt(0, IPPROTO_IPV6, IPV6_MTU_DISCOVER, NULL, 0)" -. auto/feature - - -ngx_feature="IP_DONTFRAG" -ngx_feature_name="NGX_HAVE_IP_DONTFRAG" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_DONTFRAG, NULL, 0)" -. auto/feature - - -ngx_feature="IPV6_DONTFRAG" -ngx_feature_name="NGX_HAVE_IPV6_DONTFRAG" -ngx_feature_run=no -ngx_feature_incs="#include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_IP, IPV6_DONTFRAG, NULL, 0)" -. auto/feature - - ngx_feature="TCP_DEFER_ACCEPT" ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT" ngx_feature_run=no @@ -569,66 +391,43 @@ if [ $NGX_FILE_AIO = YES ]; then ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= - ngx_feature_test="struct aiocb iocb; + ngx_feature_test="int n; struct aiocb iocb; iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; - (void) aio_read(&iocb)" + n = aio_read(&iocb)" . auto/feature if [ $ngx_found = yes ]; then CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS" - fi - if [ $ngx_found = no ]; then + elif [ $ngx_found = no ]; then ngx_feature="Linux AIO support" ngx_feature_name="NGX_HAVE_FILE_AIO" ngx_feature_run=no ngx_feature_incs="#include - #include " + #include " ngx_feature_path= ngx_feature_libs= - ngx_feature_test="struct iocb iocb; + ngx_feature_test="int n = SYS_eventfd; + struct iocb iocb; iocb.aio_lio_opcode = IOCB_CMD_PREAD; iocb.aio_flags = IOCB_FLAG_RESFD; - iocb.aio_resfd = -1; - (void) iocb; - (void) eventfd(0, 0)" - . auto/feature - - if [ $ngx_found = yes ]; then - have=NGX_HAVE_EVENTFD . auto/have - have=NGX_HAVE_SYS_EVENTFD_H . auto/have - CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS" - fi - fi - - if [ $ngx_found = no ]; then - - ngx_feature="Linux AIO support (SYS_eventfd)" - ngx_feature_incs="#include - #include " - ngx_feature_test="struct iocb iocb; - iocb.aio_lio_opcode = IOCB_CMD_PREAD; - iocb.aio_flags = IOCB_FLAG_RESFD; - iocb.aio_resfd = -1; - (void) iocb; - (void) SYS_eventfd" + iocb.aio_resfd = -1;" . auto/feature if [ $ngx_found = yes ]; then have=NGX_HAVE_EVENTFD . auto/have CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS" - fi - fi - if [ $ngx_found = no ]; then - cat << END + else + cat << END $0: no supported file AIO was found Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only END - exit 1 + exit 1 + fi fi fi @@ -652,9 +451,15 @@ ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value # POSIX types -NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\"" +case "$NGX_AUTO_CONFIG_H" in + /*) + NGX_INCLUDE_AUTO_CONFIG_H="#include \"$NGX_AUTO_CONFIG_H\"" + ;; + *) + NGX_INCLUDE_AUTO_CONFIG_H="#include \"../$NGX_AUTO_CONFIG_H\"" + ;; +esac -ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef @@ -663,7 +468,7 @@ ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value ngx_type="socklen_t"; ngx_types="int"; . auto/types/typedef -ngx_type="in_addr_t"; ngx_types="uint32_t u_int32_t"; . auto/types/typedef +ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef @@ -684,24 +489,24 @@ ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value ngx_type="time_t"; . auto/types/sizeof ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value -ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value # syscalls, libc calls and some features -ngx_feature="AF_INET6" -ngx_feature_name="NGX_HAVE_INET6" -ngx_feature_run=no -ngx_feature_incs="#include - #include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="struct sockaddr_in6 sin6; - sin6.sin6_family = AF_INET6; - (void) sin6" -. auto/feature +if [ $NGX_IPV6 = YES ]; then + ngx_feature="AF_INET6" + ngx_feature_name="NGX_HAVE_INET6" + ngx_feature_run=no + ngx_feature_incs="#include + #include + #include " + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="struct sockaddr_in6 sin6; + sin6.sin6_family = AF_INET6;" + . auto/feature +fi ngx_feature="setproctitle()" @@ -736,49 +541,17 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0); . auto/feature -# pwritev() was introduced in FreeBSD 6 and Linux 2.6.30, glibc 2.10 - -ngx_feature="pwritev()" -ngx_feature_name="NGX_HAVE_PWRITEV" -ngx_feature_run=no -ngx_feature_incs='#include ' +ngx_feature="sys_nerr" +ngx_feature_name="NGX_SYS_NERR" +ngx_feature_run=value +ngx_feature_incs='#include + #include ' ngx_feature_path= ngx_feature_libs= -ngx_feature_test="char buf[1]; struct iovec vec[1]; ssize_t n; - vec[0].iov_base = buf; - vec[0].iov_len = 1; - n = pwritev(1, vec, 1, 0); - if (n == -1) return 1" +ngx_feature_test='printf("%d", sys_nerr);' . auto/feature -# strerrordesc_np(), introduced in glibc 2.32 - -ngx_feature="strerrordesc_np()" -ngx_feature_name="NGX_HAVE_STRERRORDESC_NP" -ngx_feature_run=no -ngx_feature_incs='#include ' -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="char *p; p = strerrordesc_np(0); - if (p == NULL) return 1" -. auto/feature - - -if [ $ngx_found = no ]; then - - ngx_feature="sys_nerr" - ngx_feature_name="NGX_SYS_NERR" - ngx_feature_run=value - ngx_feature_incs='#include - #include ' - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test='printf("%d", sys_nerr);' - . auto/feature -fi - - if [ $ngx_found = no ]; then # Cygiwn defines _sys_nerr @@ -794,6 +567,34 @@ if [ $ngx_found = no ]; then fi +if [ $ngx_found = no ]; then + + # Solaris has no sys_nerr + ngx_feature='maximum errno' + ngx_feature_name=NGX_SYS_NERR + ngx_feature_run=value + ngx_feature_incs='#include + #include + #include ' + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test='int n; + char *p; + for (n = 1; n < 1000; n++) { + errno = 0; + p = strerror(n); + if (errno == EINVAL + || p == NULL + || strncmp(p, "Unknown error", 13) == 0) + { + break; + } + } + printf("%d", n);' + . auto/feature +fi + + ngx_feature="localtime_r()" ngx_feature_name="NGX_HAVE_LOCALTIME_R" ngx_feature_run=no @@ -804,30 +605,6 @@ ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)" . auto/feature -ngx_feature="clock_gettime(CLOCK_MONOTONIC)" -ngx_feature_name="NGX_HAVE_CLOCK_MONOTONIC" -ngx_feature_run=no -ngx_feature_incs="#include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts)" -. auto/feature - - -if [ $ngx_found = no ]; then - - # Linux before glibc 2.17, notably CentOS 6 - - ngx_feature="clock_gettime(CLOCK_MONOTONIC) in librt" - ngx_feature_libs="-lrt" - . auto/feature - - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS -lrt" - fi -fi - - ngx_feature="posix_memalign()" ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN" ngx_feature_run=no @@ -914,7 +691,6 @@ if [ $ngx_found = no ]; then if [ $ngx_found = yes ]; then CORE_LIBS="$CORE_LIBS -lpthread" - NGX_LIBPTHREAD="-lpthread" fi fi @@ -956,18 +732,6 @@ ngx_feature_test="int i = FIONBIO; printf(\"%d\", i)" . auto/feature -ngx_feature="ioctl(FIONREAD)" -ngx_feature_name="NGX_HAVE_FIONREAD" -ngx_feature_run=no -ngx_feature_incs="#include - #include - $NGX_INCLUDE_SYS_FILIO_H" -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="int i = FIONREAD; printf(\"%d\", i)" -. auto/feature - - ngx_feature="struct tm.tm_gmtoff" ngx_feature_name="NGX_HAVE_GMTOFF" ngx_feature_run=no @@ -1014,16 +778,6 @@ ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)" . auto/feature -ngx_feature="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)" -ngx_feature_name="NGX_HAVE_LEVEL1_DCACHE_LINESIZE" -ngx_feature_run=no -ngx_feature_incs= -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)" -. auto/feature - - ngx_feature="openat(), fstatat()" ngx_feature_name="NGX_HAVE_OPENAT" ngx_feature_run=no diff --git a/conf/fastcgi.conf b/conf/fastcgi.conf index 091738c..ac9ff92 100644 --- a/conf/fastcgi.conf +++ b/conf/fastcgi.conf @@ -10,7 +10,6 @@ fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; -fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; diff --git a/conf/fastcgi_params b/conf/fastcgi_params index 28decb9..71e2c2e 100644 --- a/conf/fastcgi_params +++ b/conf/fastcgi_params @@ -9,7 +9,6 @@ fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; -fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; diff --git a/conf/mime.types b/conf/mime.types index 1c00d70..89be9a4 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -1,99 +1,89 @@ types { - text/html html htm shtml; - text/css css; - text/xml xml; - image/gif gif; - image/jpeg jpeg jpg; - application/javascript js; - application/atom+xml atom; - application/rss+xml rss; + text/html html htm shtml; + text/css css; + text/xml xml; + image/gif gif; + image/jpeg jpeg jpg; + application/javascript js; + application/atom+xml atom; + application/rss+xml rss; - text/mathml mml; - text/plain txt; - text/vnd.sun.j2me.app-descriptor jad; - text/vnd.wap.wml wml; - text/x-component htc; + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; - image/avif avif; - image/png png; - image/svg+xml svg svgz; - image/tiff tif tiff; - image/vnd.wap.wbmp wbmp; - image/webp webp; - image/x-icon ico; - image/x-jng jng; - image/x-ms-bmp bmp; + image/png png; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + image/svg+xml svg svgz; + image/webp webp; - font/woff woff; - font/woff2 woff2; + application/font-woff woff; + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.apple.mpegurl m3u8; + application/vnd.ms-excel xls; + application/vnd.ms-fontobject eot; + application/vnd.ms-powerpoint ppt; + application/vnd.wap.wmlc wmlc; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/xspf+xml xspf; + application/zip zip; - application/java-archive jar war ear; - application/json json; - application/mac-binhex40 hqx; - application/msword doc; - application/pdf pdf; - application/postscript ps eps ai; - application/rtf rtf; - application/vnd.apple.mpegurl m3u8; - application/vnd.google-earth.kml+xml kml; - application/vnd.google-earth.kmz kmz; - application/vnd.ms-excel xls; - application/vnd.ms-fontobject eot; - application/vnd.ms-powerpoint ppt; - application/vnd.oasis.opendocument.graphics odg; - application/vnd.oasis.opendocument.presentation odp; - application/vnd.oasis.opendocument.spreadsheet ods; - application/vnd.oasis.opendocument.text odt; - application/vnd.openxmlformats-officedocument.presentationml.presentation - pptx; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - xlsx; - application/vnd.openxmlformats-officedocument.wordprocessingml.document - docx; - application/vnd.wap.wmlc wmlc; - application/wasm wasm; - application/x-7z-compressed 7z; - application/x-cocoa cco; - application/x-java-archive-diff jardiff; - application/x-java-jnlp-file jnlp; - application/x-makeself run; - application/x-perl pl pm; - application/x-pilot prc pdb; - application/x-rar-compressed rar; - application/x-redhat-package-manager rpm; - application/x-sea sea; - application/x-shockwave-flash swf; - application/x-stuffit sit; - application/x-tcl tcl tk; - application/x-x509-ca-cert der pem crt; - application/x-xpinstall xpi; - application/xhtml+xml xhtml; - application/xspf+xml xspf; - application/zip zip; + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + application/octet-stream iso img; + application/octet-stream msi msp msm; - application/octet-stream bin exe dll; - application/octet-stream deb; - application/octet-stream dmg; - application/octet-stream iso img; - application/octet-stream msi msp msm; + application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; + application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; - audio/midi mid midi kar; - audio/mpeg mp3; - audio/ogg ogg; - audio/x-m4a m4a; - audio/x-realaudio ra; + audio/midi mid midi kar; + audio/mpeg mp3; + audio/ogg ogg; + audio/x-m4a m4a; + audio/x-realaudio ra; - video/3gpp 3gpp 3gp; - video/mp2t ts; - video/mp4 mp4; - video/mpeg mpeg mpg; - video/quicktime mov; - video/webm webm; - video/x-flv flv; - video/x-m4v m4v; - video/x-mng mng; - video/x-ms-asf asx asf; - video/x-ms-wmv wmv; - video/x-msvideo avi; + video/3gpp 3gpp 3gp; + video/mp2t ts; + video/mp4 mp4; + video/mpeg mpeg mpg; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-m4v m4v; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; } diff --git a/conf/scgi_params b/conf/scgi_params index 6d4ce4f..47348ca 100644 --- a/conf/scgi_params +++ b/conf/scgi_params @@ -8,7 +8,6 @@ scgi_param DOCUMENT_URI $document_uri; scgi_param DOCUMENT_ROOT $document_root; scgi_param SCGI 1; scgi_param SERVER_PROTOCOL $server_protocol; -scgi_param REQUEST_SCHEME $scheme; scgi_param HTTPS $https if_not_empty; scgi_param REMOTE_ADDR $remote_addr; diff --git a/conf/uwsgi_params b/conf/uwsgi_params index 09c732c..f539451 100644 --- a/conf/uwsgi_params +++ b/conf/uwsgi_params @@ -8,7 +8,6 @@ uwsgi_param REQUEST_URI $request_uri; uwsgi_param PATH_INFO $document_uri; uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param SERVER_PROTOCOL $server_protocol; -uwsgi_param REQUEST_SCHEME $scheme; uwsgi_param HTTPS $https if_not_empty; uwsgi_param REMOTE_ADDR $remote_addr; diff --git a/configure b/configure index 5b88ebb..d7d8189 100755 --- a/configure +++ b/configure @@ -11,7 +11,7 @@ export LC_ALL . auto/init . auto/sources -test -d $NGX_OBJS || mkdir -p $NGX_OBJS +test -d $NGX_OBJS || mkdir $NGX_OBJS echo > $NGX_AUTO_HEADERS_H echo > $NGX_AUTOCONF_ERR @@ -36,7 +36,7 @@ if test -z "$NGX_PLATFORM"; then NGX_PLATFORM="$NGX_SYSTEM:$NGX_RELEASE:$NGX_MACHINE"; case "$NGX_SYSTEM" in - MINGW32_* | MINGW64_* | MSYS_*) + MINGW32_*) NGX_PLATFORM=win32 ;; esac @@ -44,7 +44,6 @@ if test -z "$NGX_PLATFORM"; then else echo "building for $NGX_PLATFORM" NGX_SYSTEM=$NGX_PLATFORM - NGX_MACHINE=i386 fi . auto/cc/conf @@ -59,7 +58,6 @@ if [ "$NGX_PLATFORM" != win32 ]; then . auto/unix fi -. auto/threads . auto/modules . auto/lib/conf @@ -88,10 +86,6 @@ have=NGX_PID_PATH value="\"$NGX_PID_PATH\"" . auto/define have=NGX_LOCK_PATH value="\"$NGX_LOCK_PATH\"" . auto/define have=NGX_ERROR_LOG_PATH value="\"$NGX_ERROR_LOG_PATH\"" . auto/define -if [ ".$NGX_ERROR_LOG_PATH" = "." ]; then - have=NGX_ERROR_LOG_STDERR . auto/have -fi - have=NGX_HTTP_LOG_PATH value="\"$NGX_HTTP_LOG_PATH\"" . auto/define have=NGX_HTTP_CLIENT_TEMP_PATH value="\"$NGX_HTTP_CLIENT_TEMP_PATH\"" . auto/define @@ -114,8 +108,4 @@ have=NGX_HTTP_SCGI_TEMP_PATH value="\"$NGX_HTTP_SCGI_TEMP_PATH\"" have=NGX_USER value="\"$NGX_USER\"" . auto/define have=NGX_GROUP value="\"$NGX_GROUP\"" . auto/define -if [ ".$NGX_BUILD" != "." ]; then - have=NGX_BUILD value="\"$NGX_BUILD\"" . auto/define -fi - . auto/summary diff --git a/configure.docker.sh b/configure.docker.sh deleted file mode 100755 index 4131c20..0000000 --- a/configure.docker.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -./configure \ - --with-cc-opt="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -I/tmp/build/quickjs/" \ - --with-ld-opt="-Wl,-z,relro -Wl,-z,now -fPIC -L/tmp/build/quickjs/" \ - --sbin-path=/usr/local/sbin/nginx \ - --conf-path=/video_server/nginx/nginx.conf \ - --error-log-path=/var/log/nginx/error.log \ - --pid-path=/var/run/nginx/nginx.pid \ - --lock-path=/var/lock/nginx/nginx.lock \ - --http-log-path=/var/log/nginx/access.log \ - --http-client-body-temp-path=/tmp/nginx-client-body \ - --with-compat \ - --with-debug \ - --with-pcre-jit \ - --with-http_ssl_module \ - --with-http_stub_status_module \ - --with-http_realip_module \ - --with-http_auth_request_module \ - --with-http_v2_module \ - --with-http_dav_module \ - --with-http_slice_module \ - --with-threads \ - --with-http_addition_module \ - --with-http_flv_module \ - --with-http_gunzip_module \ - --with-http_gzip_static_module \ - --with-http_mp4_module \ - --with-http_random_index_module \ - --with-http_secure_link_module \ - --with-http_sub_module \ - --with-mail_ssl_module \ - --with-stream_ssl_module \ - --with-stream_ssl_preread_module \ - --with-stream_realip_module \ - --with-http_geoip_module=dynamic \ - --with-http_image_filter_module=dynamic \ - --with-http_perl_module=dynamic \ - --with-http_xslt_module=dynamic \ - --with-mail=dynamic \ - --with-stream=dynamic \ - --with-stream_geoip_module=dynamic \ - --add-module=./modules_deb/libnginx-mod-http-ndk-0.3.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-brotli-1.0.0~rc \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-cache-purge-2.5.3 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-echo-0.63 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-geoip2-3.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-headers-more-filter-0.38 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-memc-0.20 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-set-misc-0.33 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-srcache-filter-0.33 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-subs-filter-0.6.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409 \ - --add-dynamic-module=./modules_deb/libnginx-mod-nchan-1.3.7+dfsg \ - --add-dynamic-module=./modules/njs/nginx \ - --add-dynamic-module=./modules/nginx-vod-module \ - --add-module=./modules/media-framework/nginx-common \ - --add-dynamic-module=./modules/nginx-stream-preread-str-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-in-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-out-module \ - --add-dynamic-module=./modules/media-framework/nginx-rtmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-rtmp-kmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-mpegts-module \ - --add-dynamic-module=./modules/media-framework/nginx-mpegts-kmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-cc-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-rtmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-live-module \ - --add-dynamic-module=./modules/nginx-srt-module \ - --add-dynamic-module=./modules/media-framework/nginx-pckg-module \ - --add-dynamic-module=./modules/nginx-secure-token-module \ No newline at end of file diff --git a/configure.sh b/configure.sh deleted file mode 100755 index 3d780fe..0000000 --- a/configure.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -./configure \ - --with-cc-opt="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -I/usr/local/include/quickjs/" \ - --with-ld-opt="-Wl,-z,relro -Wl,-z,now -fPIC -L/usr/local/lib/quickjs/" \ - --prefix=/usr/local/temp/nginx/ \ - --error-log-path=stderr \ - --lock-path=/var/lock/nginx.lock \ - --pid-path=/run/nginx.pid \ - --with-compat \ - --with-debug \ - --with-pcre-jit \ - --with-http_ssl_module \ - --with-http_stub_status_module \ - --with-http_realip_module \ - --with-http_auth_request_module \ - --with-http_v2_module \ - --with-http_dav_module \ - --with-http_slice_module \ - --with-threads \ - --with-http_addition_module \ - --with-http_flv_module \ - --with-http_gunzip_module \ - --with-http_gzip_static_module \ - --with-http_mp4_module \ - --with-http_random_index_module \ - --with-http_secure_link_module \ - --with-http_sub_module \ - --with-mail_ssl_module \ - --with-stream_ssl_module \ - --with-stream_ssl_preread_module \ - --with-stream_realip_module \ - --with-http_geoip_module=dynamic \ - --with-http_image_filter_module=dynamic \ - --with-http_perl_module=dynamic \ - --with-http_xslt_module=dynamic \ - --with-mail=dynamic \ - --with-stream=dynamic \ - --with-stream_geoip_module=dynamic \ - --add-module=./modules_deb/libnginx-mod-http-ndk-0.3.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-brotli-1.0.0~rc \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-cache-purge-2.5.3 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-echo-0.63 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-geoip2-3.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-headers-more-filter-0.38 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-memc-0.20 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-set-misc-0.33 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-srcache-filter-0.33 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-subs-filter-0.6.4 \ - --add-dynamic-module=./modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409 \ - --add-dynamic-module=./modules_deb/libnginx-mod-nchan-1.3.7+dfsg \ - --add-dynamic-module=./modules/njs/nginx \ - --add-dynamic-module=./modules/nginx-vod-module \ - --add-module=./modules/media-framework/nginx-common \ - --add-dynamic-module=./modules/nginx-stream-preread-str-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-in-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-out-module \ - --add-dynamic-module=./modules/media-framework/nginx-rtmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-rtmp-kmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-mpegts-module \ - --add-dynamic-module=./modules/media-framework/nginx-mpegts-kmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-cc-module \ - --add-dynamic-module=./modules/media-framework/nginx-kmp-rtmp-module \ - --add-dynamic-module=./modules/media-framework/nginx-live-module \ - --add-dynamic-module=./modules/nginx-srt-module \ - --add-dynamic-module=./modules/media-framework/nginx-pckg-module \ - --add-dynamic-module=./modules/nginx-secure-token-module \ No newline at end of file diff --git a/contrib/unicode2nginx/unicode-to-nginx.pl b/contrib/unicode2nginx/unicode-to-nginx.pl index d113fed..daaf354 100755 --- a/contrib/unicode2nginx/unicode-to-nginx.pl +++ b/contrib/unicode2nginx/unicode-to-nginx.pl @@ -10,7 +10,7 @@ # Needs perl 5.6 or later. -# Written by Maxim Dounin, mdounin@mdounin.ru +# Written by Maxim Dounin, mdounin@rambler-co.ru ############################################################################### @@ -33,10 +33,7 @@ while (<>) { # Produce UTF-8 sequence from character code; - my $un_utf8 = join('', - map { sprintf("%02X", $_) } - unpack("U0C*", pack("U", hex($un_code))) - ); + my $un_utf8 = join('', map { sprintf("%02X", $_) } unpack("C*", pack("U", hex($un_code)))); print " $cs_code $un_utf8 ; $un_name\n"; diff --git a/contrib/vim/ftplugin/nginx.vim b/contrib/vim/ftplugin/nginx.vim deleted file mode 100644 index 463eea9..0000000 --- a/contrib/vim/ftplugin/nginx.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal commentstring=#\ %s diff --git a/contrib/vim/syntax/nginx.vim b/contrib/vim/syntax/nginx.vim index 29eef7a..50d809b 100644 --- a/contrib/vim/syntax/nginx.vim +++ b/contrib/vim/syntax/nginx.vim @@ -5,1975 +5,699 @@ if exists("b:current_syntax") finish end -let s:save_cpo = &cpo -set cpo&vim +setlocal iskeyword+=. +setlocal iskeyword+=/ +setlocal iskeyword+=: -" general syntax - -if has("patch-7.4.1142") - " except control characters, ";", "{", and "}" - syn iskeyword 33-58,60-122,124,126-255 -endif - -syn match ngxName '\([^;{} \t\\]\|\\.\)\+' - \ contains=@ngxDirectives - \ nextgroup=@ngxParams skipwhite skipempty -syn match ngxParam '\(\${\|[^;{ \t\\]\|\\.\)\+' - \ contained - \ contains=ngxVariable - \ nextgroup=@ngxParams skipwhite skipempty -syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ - \ contains=ngxVariableString - \ nextgroup=@ngxParams skipwhite skipempty -syn match ngxParamComment '#.*$' - \ nextgroup=@ngxParams skipwhite skipempty -syn match ngxSemicolon ';' contained -syn region ngxBlock start=+{+ end=+}+ contained - \ contains=@ngxTopLevel -syn match ngxComment '#.*$' - -syn match ngxVariable '\$\(\w\+\|{\w\+}\)' contained +syn match ngxVariable '\$\(\w\+\|{\w\+}\)' +syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained - -syn cluster ngxTopLevel - \ contains=ngxName,ngxString,ngxComment -syn cluster ngxDirectives - \ contains=ngxDirective,ngxDirectiveBlock,ngxDirectiveImportant - \ add=ngxDirectiveControl,ngxDirectiveError,ngxDirectiveDeprecated - \ add=ngxDirectiveThirdParty,ngxDirectiveThirdPartyDeprecated -syn cluster ngxParams - \ contains=ngxParam,ngxString,ngxParamComment,ngxSemicolon,ngxBlock - -" boolean parameters - -syn keyword ngxBoolean contained on off - \ nextgroup=@ngxParams skipwhite skipempty -syn cluster ngxParams add=ngxBoolean - -" listen directive - -syn cluster ngxTopLevel add=ngxDirectiveListen -syn keyword ngxDirectiveListen listen - \ nextgroup=@ngxListenParams skipwhite skipempty -syn match ngxListenParam '\(\${\|[^;{ \t\\]\|\\.\)\+' - \ contained - \ nextgroup=@ngxListenParams skipwhite skipempty -syn region ngxListenString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ - \ contained - \ nextgroup=@ngxListenParams skipwhite skipempty -syn match ngxListenComment '#.*$' - \ contained - \ nextgroup=@ngxListenParams skipwhite skipempty -syn keyword ngxListenOptions contained - \ default_server ssl quic proxy_protocol - \ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind - \ ipv6only reuseport so_keepalive - \ nextgroup=@ngxListenParams skipwhite skipempty -syn keyword ngxListenOptionsDeprecated contained - \ http2 - \ nextgroup=@ngxListenParams skipwhite skipempty -syn cluster ngxListenParams - \ contains=ngxListenParam,ngxListenString,ngxListenComment - \ add=ngxListenOptions,ngxListenOptionsDeprecated - -syn keyword ngxDirectiveBlock contained http -syn keyword ngxDirectiveBlock contained stream -syn keyword ngxDirectiveBlock contained mail -syn keyword ngxDirectiveBlock contained events -syn keyword ngxDirectiveBlock contained server -syn keyword ngxDirectiveBlock contained types -syn keyword ngxDirectiveBlock contained location -syn keyword ngxDirectiveBlock contained upstream -syn keyword ngxDirectiveBlock contained charset_map -syn keyword ngxDirectiveBlock contained limit_except -syn keyword ngxDirectiveBlock contained if -syn keyword ngxDirectiveBlock contained geo -syn keyword ngxDirectiveBlock contained map -syn keyword ngxDirectiveBlock contained split_clients - -syn keyword ngxDirectiveImportant contained include -syn keyword ngxDirectiveImportant contained root -syn keyword ngxDirectiveImportant contained server_name -syn keyword ngxDirectiveImportant contained internal -syn keyword ngxDirectiveImportant contained proxy_pass -syn keyword ngxDirectiveImportant contained memcached_pass -syn keyword ngxDirectiveImportant contained fastcgi_pass -syn keyword ngxDirectiveImportant contained scgi_pass -syn keyword ngxDirectiveImportant contained uwsgi_pass -syn keyword ngxDirectiveImportant contained try_files - -syn keyword ngxDirectiveControl contained break -syn keyword ngxDirectiveControl contained return -syn keyword ngxDirectiveControl contained rewrite -syn keyword ngxDirectiveControl contained set - -syn keyword ngxDirectiveError contained error_page -syn keyword ngxDirectiveError contained post_action - -syn keyword ngxDirectiveDeprecated contained proxy_downstream_buffer -syn keyword ngxDirectiveDeprecated contained proxy_upstream_buffer -syn keyword ngxDirectiveDeprecated contained http2_idle_timeout -syn keyword ngxDirectiveDeprecated contained http2_max_field_size -syn keyword ngxDirectiveDeprecated contained http2_max_header_size -syn keyword ngxDirectiveDeprecated contained http2_max_requests -syn keyword ngxDirectiveDeprecated contained http2_recv_timeout - -syn keyword ngxDirective contained absolute_redirect -syn keyword ngxDirective contained accept_mutex -syn keyword ngxDirective contained accept_mutex_delay -syn keyword ngxDirective contained acceptex_read -syn keyword ngxDirective contained access_log -syn keyword ngxDirective contained add_after_body -syn keyword ngxDirective contained add_before_body -syn keyword ngxDirective contained add_header -syn keyword ngxDirective contained add_trailer -syn keyword ngxDirective contained addition_types -syn keyword ngxDirective contained aio -syn keyword ngxDirective contained aio_write -syn keyword ngxDirective contained alias -syn keyword ngxDirective contained allow -syn keyword ngxDirective contained ancient_browser -syn keyword ngxDirective contained ancient_browser_value -syn keyword ngxDirective contained auth_basic -syn keyword ngxDirective contained auth_basic_user_file -syn keyword ngxDirective contained auth_delay -syn keyword ngxDirective contained auth_http -syn keyword ngxDirective contained auth_http_header -syn keyword ngxDirective contained auth_http_pass_client_cert -syn keyword ngxDirective contained auth_http_timeout -syn keyword ngxDirective contained auth_request -syn keyword ngxDirective contained auth_request_set -syn keyword ngxDirective contained autoindex -syn keyword ngxDirective contained autoindex_exact_size -syn keyword ngxDirective contained autoindex_format -syn keyword ngxDirective contained autoindex_localtime -syn keyword ngxDirective contained charset -syn keyword ngxDirective contained charset_types -syn keyword ngxDirective contained chunked_transfer_encoding -syn keyword ngxDirective contained client_body_buffer_size -syn keyword ngxDirective contained client_body_in_file_only -syn keyword ngxDirective contained client_body_in_single_buffer -syn keyword ngxDirective contained client_body_temp_path -syn keyword ngxDirective contained client_body_timeout -syn keyword ngxDirective contained client_header_buffer_size -syn keyword ngxDirective contained client_header_timeout -syn keyword ngxDirective contained client_max_body_size -syn keyword ngxDirective contained connection_pool_size -syn keyword ngxDirective contained create_full_put_path -syn keyword ngxDirective contained daemon -syn keyword ngxDirective contained dav_access -syn keyword ngxDirective contained dav_methods -syn keyword ngxDirective contained debug_connection -syn keyword ngxDirective contained debug_points -syn keyword ngxDirective contained default_type -syn keyword ngxDirective contained degradation -syn keyword ngxDirective contained degrade -syn keyword ngxDirective contained deny -syn keyword ngxDirective contained devpoll_changes -syn keyword ngxDirective contained devpoll_events -syn keyword ngxDirective contained directio -syn keyword ngxDirective contained directio_alignment -syn keyword ngxDirective contained disable_symlinks -syn keyword ngxDirective contained empty_gif -syn keyword ngxDirective contained env -syn keyword ngxDirective contained epoll_events -syn keyword ngxDirective contained error_log -syn keyword ngxDirective contained etag -syn keyword ngxDirective contained eventport_events -syn keyword ngxDirective contained expires -syn keyword ngxDirective contained fastcgi_bind -syn keyword ngxDirective contained fastcgi_buffer_size -syn keyword ngxDirective contained fastcgi_buffering -syn keyword ngxDirective contained fastcgi_buffers -syn keyword ngxDirective contained fastcgi_busy_buffers_size -syn keyword ngxDirective contained fastcgi_cache -syn keyword ngxDirective contained fastcgi_cache_background_update -syn keyword ngxDirective contained fastcgi_cache_bypass -syn keyword ngxDirective contained fastcgi_cache_key -syn keyword ngxDirective contained fastcgi_cache_lock -syn keyword ngxDirective contained fastcgi_cache_lock_age -syn keyword ngxDirective contained fastcgi_cache_lock_timeout -syn keyword ngxDirective contained fastcgi_cache_max_range_offset -syn keyword ngxDirective contained fastcgi_cache_methods -syn keyword ngxDirective contained fastcgi_cache_min_uses -syn keyword ngxDirective contained fastcgi_cache_path -syn keyword ngxDirective contained fastcgi_cache_revalidate -syn keyword ngxDirective contained fastcgi_cache_use_stale -syn keyword ngxDirective contained fastcgi_cache_valid -syn keyword ngxDirective contained fastcgi_catch_stderr -syn keyword ngxDirective contained fastcgi_connect_timeout -syn keyword ngxDirective contained fastcgi_force_ranges -syn keyword ngxDirective contained fastcgi_hide_header -syn keyword ngxDirective contained fastcgi_ignore_client_abort -syn keyword ngxDirective contained fastcgi_ignore_headers -syn keyword ngxDirective contained fastcgi_index -syn keyword ngxDirective contained fastcgi_intercept_errors -syn keyword ngxDirective contained fastcgi_keep_conn -syn keyword ngxDirective contained fastcgi_limit_rate -syn keyword ngxDirective contained fastcgi_max_temp_file_size -syn keyword ngxDirective contained fastcgi_next_upstream -syn keyword ngxDirective contained fastcgi_next_upstream_timeout -syn keyword ngxDirective contained fastcgi_next_upstream_tries -syn keyword ngxDirective contained fastcgi_no_cache -syn keyword ngxDirective contained fastcgi_param -syn keyword ngxDirective contained fastcgi_pass_header -syn keyword ngxDirective contained fastcgi_pass_request_body -syn keyword ngxDirective contained fastcgi_pass_request_headers -syn keyword ngxDirective contained fastcgi_read_timeout -syn keyword ngxDirective contained fastcgi_request_buffering -syn keyword ngxDirective contained fastcgi_send_lowat -syn keyword ngxDirective contained fastcgi_send_timeout -syn keyword ngxDirective contained fastcgi_socket_keepalive -syn keyword ngxDirective contained fastcgi_split_path_info -syn keyword ngxDirective contained fastcgi_store -syn keyword ngxDirective contained fastcgi_store_access -syn keyword ngxDirective contained fastcgi_temp_file_write_size -syn keyword ngxDirective contained fastcgi_temp_path -syn keyword ngxDirective contained flv -syn keyword ngxDirective contained geoip_city -syn keyword ngxDirective contained geoip_country -syn keyword ngxDirective contained geoip_org -syn keyword ngxDirective contained geoip_proxy -syn keyword ngxDirective contained geoip_proxy_recursive -syn keyword ngxDirective contained google_perftools_profiles -syn keyword ngxDirective contained grpc_bind -syn keyword ngxDirective contained grpc_buffer_size -syn keyword ngxDirective contained grpc_connect_timeout -syn keyword ngxDirective contained grpc_hide_header -syn keyword ngxDirective contained grpc_ignore_headers -syn keyword ngxDirective contained grpc_intercept_errors -syn keyword ngxDirective contained grpc_next_upstream -syn keyword ngxDirective contained grpc_next_upstream_timeout -syn keyword ngxDirective contained grpc_next_upstream_tries -syn keyword ngxDirective contained grpc_pass -syn keyword ngxDirective contained grpc_pass_header -syn keyword ngxDirective contained grpc_read_timeout -syn keyword ngxDirective contained grpc_send_timeout -syn keyword ngxDirective contained grpc_set_header -syn keyword ngxDirective contained grpc_socket_keepalive -syn keyword ngxDirective contained grpc_ssl_certificate -syn keyword ngxDirective contained grpc_ssl_certificate_key -syn keyword ngxDirective contained grpc_ssl_ciphers -syn keyword ngxDirective contained grpc_ssl_conf_command -syn keyword ngxDirective contained grpc_ssl_crl -syn keyword ngxDirective contained grpc_ssl_name -syn keyword ngxDirective contained grpc_ssl_password_file -syn keyword ngxDirective contained grpc_ssl_protocols -syn keyword ngxDirective contained grpc_ssl_server_name -syn keyword ngxDirective contained grpc_ssl_session_reuse -syn keyword ngxDirective contained grpc_ssl_trusted_certificate -syn keyword ngxDirective contained grpc_ssl_verify -syn keyword ngxDirective contained grpc_ssl_verify_depth -syn keyword ngxDirective contained gunzip -syn keyword ngxDirective contained gunzip_buffers -syn keyword ngxDirective contained gzip -syn keyword ngxDirective contained gzip_buffers -syn keyword ngxDirective contained gzip_comp_level -syn keyword ngxDirective contained gzip_disable -syn keyword ngxDirective contained gzip_hash -syn keyword ngxDirective contained gzip_http_version -syn keyword ngxDirective contained gzip_min_length -syn keyword ngxDirective contained gzip_no_buffer -syn keyword ngxDirective contained gzip_proxied -syn keyword ngxDirective contained gzip_static -syn keyword ngxDirective contained gzip_types -syn keyword ngxDirective contained gzip_vary -syn keyword ngxDirective contained gzip_window -syn keyword ngxDirective contained hash -syn keyword ngxDirective contained http2 -syn keyword ngxDirective contained http2_body_preread_size -syn keyword ngxDirective contained http2_chunk_size -syn keyword ngxDirective contained http2_max_concurrent_pushes -syn keyword ngxDirective contained http2_max_concurrent_streams -syn keyword ngxDirective contained http2_pool_size -syn keyword ngxDirective contained http2_push -syn keyword ngxDirective contained http2_push_preload -syn keyword ngxDirective contained http2_recv_buffer_size -syn keyword ngxDirective contained http2_streams_index_size -syn keyword ngxDirective contained http3 -syn keyword ngxDirective contained http3_hq -syn keyword ngxDirective contained http3_max_concurrent_streams -syn keyword ngxDirective contained http3_stream_buffer_size -syn keyword ngxDirective contained if_modified_since -syn keyword ngxDirective contained ignore_invalid_headers -syn keyword ngxDirective contained image_filter -syn keyword ngxDirective contained image_filter_buffer -syn keyword ngxDirective contained image_filter_interlace -syn keyword ngxDirective contained image_filter_jpeg_quality -syn keyword ngxDirective contained image_filter_sharpen -syn keyword ngxDirective contained image_filter_transparency -syn keyword ngxDirective contained image_filter_webp_quality -syn keyword ngxDirective contained imap_auth -syn keyword ngxDirective contained imap_capabilities -syn keyword ngxDirective contained imap_client_buffer -syn keyword ngxDirective contained index -syn keyword ngxDirective contained iocp_threads -syn keyword ngxDirective contained ip_hash -syn keyword ngxDirective contained js_access -syn keyword ngxDirective contained js_body_filter -syn keyword ngxDirective contained js_content -syn keyword ngxDirective contained js_fetch_buffer_size -syn keyword ngxDirective contained js_fetch_ciphers -syn keyword ngxDirective contained js_fetch_max_response_buffer_size -syn keyword ngxDirective contained js_fetch_protocols -syn keyword ngxDirective contained js_fetch_timeout -syn keyword ngxDirective contained js_fetch_trusted_certificate -syn keyword ngxDirective contained js_fetch_verify -syn keyword ngxDirective contained js_fetch_verify_depth -syn keyword ngxDirective contained js_filter -syn keyword ngxDirective contained js_header_filter -syn keyword ngxDirective contained js_import -syn keyword ngxDirective contained js_path -syn keyword ngxDirective contained js_preload_object -syn keyword ngxDirective contained js_preread -syn keyword ngxDirective contained js_set -syn keyword ngxDirective contained js_shared_dict_zone -syn keyword ngxDirective contained js_var -syn keyword ngxDirective contained keepalive -syn keyword ngxDirective contained keepalive_disable -syn keyword ngxDirective contained keepalive_requests -syn keyword ngxDirective contained keepalive_time -syn keyword ngxDirective contained keepalive_timeout -syn keyword ngxDirective contained kqueue_changes -syn keyword ngxDirective contained kqueue_events -syn keyword ngxDirective contained large_client_header_buffers -syn keyword ngxDirective contained least_conn -syn keyword ngxDirective contained limit_conn -syn keyword ngxDirective contained limit_conn_dry_run -syn keyword ngxDirective contained limit_conn_log_level -syn keyword ngxDirective contained limit_conn_status -syn keyword ngxDirective contained limit_conn_zone -syn keyword ngxDirective contained limit_rate -syn keyword ngxDirective contained limit_rate_after -syn keyword ngxDirective contained limit_req -syn keyword ngxDirective contained limit_req_dry_run -syn keyword ngxDirective contained limit_req_log_level -syn keyword ngxDirective contained limit_req_status -syn keyword ngxDirective contained limit_req_zone -syn keyword ngxDirective contained lingering_close -syn keyword ngxDirective contained lingering_time -syn keyword ngxDirective contained lingering_timeout -syn keyword ngxDirective contained load_module -syn keyword ngxDirective contained lock_file -syn keyword ngxDirective contained log_format -syn keyword ngxDirective contained log_not_found -syn keyword ngxDirective contained log_subrequest -syn keyword ngxDirective contained map_hash_bucket_size -syn keyword ngxDirective contained map_hash_max_size -syn keyword ngxDirective contained master_process -syn keyword ngxDirective contained max_errors -syn keyword ngxDirective contained max_ranges -syn keyword ngxDirective contained memcached_bind -syn keyword ngxDirective contained memcached_buffer_size -syn keyword ngxDirective contained memcached_connect_timeout -syn keyword ngxDirective contained memcached_gzip_flag -syn keyword ngxDirective contained memcached_next_upstream -syn keyword ngxDirective contained memcached_next_upstream_timeout -syn keyword ngxDirective contained memcached_next_upstream_tries -syn keyword ngxDirective contained memcached_read_timeout -syn keyword ngxDirective contained memcached_send_timeout -syn keyword ngxDirective contained memcached_socket_keepalive -syn keyword ngxDirective contained merge_slashes -syn keyword ngxDirective contained min_delete_depth -syn keyword ngxDirective contained mirror -syn keyword ngxDirective contained mirror_request_body -syn keyword ngxDirective contained modern_browser -syn keyword ngxDirective contained modern_browser_value -syn keyword ngxDirective contained mp4 -syn keyword ngxDirective contained mp4_buffer_size -syn keyword ngxDirective contained mp4_max_buffer_size -syn keyword ngxDirective contained mp4_start_key_frame -syn keyword ngxDirective contained msie_padding -syn keyword ngxDirective contained msie_refresh -syn keyword ngxDirective contained multi_accept -syn keyword ngxDirective contained open_file_cache -syn keyword ngxDirective contained open_file_cache_errors -syn keyword ngxDirective contained open_file_cache_events -syn keyword ngxDirective contained open_file_cache_min_uses -syn keyword ngxDirective contained open_file_cache_valid -syn keyword ngxDirective contained open_log_file_cache -syn keyword ngxDirective contained output_buffers -syn keyword ngxDirective contained override_charset -syn keyword ngxDirective contained pcre_jit -syn keyword ngxDirective contained perl -syn keyword ngxDirective contained perl_modules -syn keyword ngxDirective contained perl_require -syn keyword ngxDirective contained perl_set -syn keyword ngxDirective contained pid -syn keyword ngxDirective contained pop3_auth -syn keyword ngxDirective contained pop3_capabilities -syn keyword ngxDirective contained port_in_redirect -syn keyword ngxDirective contained post_acceptex -syn keyword ngxDirective contained postpone_gzipping -syn keyword ngxDirective contained postpone_output -syn keyword ngxDirective contained preread_buffer_size -syn keyword ngxDirective contained preread_timeout -syn keyword ngxDirective contained protocol -syn keyword ngxDirective contained proxy -syn keyword ngxDirective contained proxy_bind -syn keyword ngxDirective contained proxy_buffer -syn keyword ngxDirective contained proxy_buffer_size -syn keyword ngxDirective contained proxy_buffering -syn keyword ngxDirective contained proxy_buffers -syn keyword ngxDirective contained proxy_busy_buffers_size -syn keyword ngxDirective contained proxy_cache -syn keyword ngxDirective contained proxy_cache_background_update -syn keyword ngxDirective contained proxy_cache_bypass -syn keyword ngxDirective contained proxy_cache_convert_head -syn keyword ngxDirective contained proxy_cache_key -syn keyword ngxDirective contained proxy_cache_lock -syn keyword ngxDirective contained proxy_cache_lock_age -syn keyword ngxDirective contained proxy_cache_lock_timeout -syn keyword ngxDirective contained proxy_cache_max_range_offset -syn keyword ngxDirective contained proxy_cache_methods -syn keyword ngxDirective contained proxy_cache_min_uses -syn keyword ngxDirective contained proxy_cache_path -syn keyword ngxDirective contained proxy_cache_revalidate -syn keyword ngxDirective contained proxy_cache_use_stale -syn keyword ngxDirective contained proxy_cache_valid -syn keyword ngxDirective contained proxy_connect_timeout -syn keyword ngxDirective contained proxy_cookie_domain -syn keyword ngxDirective contained proxy_cookie_flags -syn keyword ngxDirective contained proxy_cookie_path -syn keyword ngxDirective contained proxy_download_rate -syn keyword ngxDirective contained proxy_force_ranges -syn keyword ngxDirective contained proxy_half_close -syn keyword ngxDirective contained proxy_headers_hash_bucket_size -syn keyword ngxDirective contained proxy_headers_hash_max_size -syn keyword ngxDirective contained proxy_hide_header -syn keyword ngxDirective contained proxy_http_version -syn keyword ngxDirective contained proxy_ignore_client_abort -syn keyword ngxDirective contained proxy_ignore_headers -syn keyword ngxDirective contained proxy_intercept_errors -syn keyword ngxDirective contained proxy_limit_rate -syn keyword ngxDirective contained proxy_max_temp_file_size -syn keyword ngxDirective contained proxy_method -syn keyword ngxDirective contained proxy_next_upstream -syn keyword ngxDirective contained proxy_next_upstream_timeout -syn keyword ngxDirective contained proxy_next_upstream_tries -syn keyword ngxDirective contained proxy_no_cache -syn keyword ngxDirective contained proxy_pass_error_message -syn keyword ngxDirective contained proxy_pass_header -syn keyword ngxDirective contained proxy_pass_request_body -syn keyword ngxDirective contained proxy_pass_request_headers -syn keyword ngxDirective contained proxy_protocol -syn keyword ngxDirective contained proxy_protocol_timeout -syn keyword ngxDirective contained proxy_read_timeout -syn keyword ngxDirective contained proxy_redirect -syn keyword ngxDirective contained proxy_request_buffering -syn keyword ngxDirective contained proxy_requests -syn keyword ngxDirective contained proxy_responses -syn keyword ngxDirective contained proxy_send_lowat -syn keyword ngxDirective contained proxy_send_timeout -syn keyword ngxDirective contained proxy_set_body -syn keyword ngxDirective contained proxy_set_header -syn keyword ngxDirective contained proxy_smtp_auth -syn keyword ngxDirective contained proxy_socket_keepalive -syn keyword ngxDirective contained proxy_ssl -syn keyword ngxDirective contained proxy_ssl_certificate -syn keyword ngxDirective contained proxy_ssl_certificate_key -syn keyword ngxDirective contained proxy_ssl_ciphers -syn keyword ngxDirective contained proxy_ssl_conf_command -syn keyword ngxDirective contained proxy_ssl_crl -syn keyword ngxDirective contained proxy_ssl_name -syn keyword ngxDirective contained proxy_ssl_password_file -syn keyword ngxDirective contained proxy_ssl_protocols -syn keyword ngxDirective contained proxy_ssl_server_name -syn keyword ngxDirective contained proxy_ssl_session_reuse -syn keyword ngxDirective contained proxy_ssl_trusted_certificate -syn keyword ngxDirective contained proxy_ssl_verify -syn keyword ngxDirective contained proxy_ssl_verify_depth -syn keyword ngxDirective contained proxy_store -syn keyword ngxDirective contained proxy_store_access -syn keyword ngxDirective contained proxy_temp_file_write_size -syn keyword ngxDirective contained proxy_temp_path -syn keyword ngxDirective contained proxy_timeout -syn keyword ngxDirective contained proxy_upload_rate -syn keyword ngxDirective contained quic_active_connection_id_limit -syn keyword ngxDirective contained quic_bpf -syn keyword ngxDirective contained quic_gso -syn keyword ngxDirective contained quic_host_key -syn keyword ngxDirective contained quic_retry -syn keyword ngxDirective contained random -syn keyword ngxDirective contained random_index -syn keyword ngxDirective contained read_ahead -syn keyword ngxDirective contained real_ip_header -syn keyword ngxDirective contained real_ip_recursive -syn keyword ngxDirective contained recursive_error_pages -syn keyword ngxDirective contained referer_hash_bucket_size -syn keyword ngxDirective contained referer_hash_max_size -syn keyword ngxDirective contained request_pool_size -syn keyword ngxDirective contained reset_timedout_connection -syn keyword ngxDirective contained resolver -syn keyword ngxDirective contained resolver_timeout -syn keyword ngxDirective contained rewrite_log -syn keyword ngxDirective contained satisfy -syn keyword ngxDirective contained scgi_bind -syn keyword ngxDirective contained scgi_buffer_size -syn keyword ngxDirective contained scgi_buffering -syn keyword ngxDirective contained scgi_buffers -syn keyword ngxDirective contained scgi_busy_buffers_size -syn keyword ngxDirective contained scgi_cache -syn keyword ngxDirective contained scgi_cache_background_update -syn keyword ngxDirective contained scgi_cache_bypass -syn keyword ngxDirective contained scgi_cache_key -syn keyword ngxDirective contained scgi_cache_lock -syn keyword ngxDirective contained scgi_cache_lock_age -syn keyword ngxDirective contained scgi_cache_lock_timeout -syn keyword ngxDirective contained scgi_cache_max_range_offset -syn keyword ngxDirective contained scgi_cache_methods -syn keyword ngxDirective contained scgi_cache_min_uses -syn keyword ngxDirective contained scgi_cache_path -syn keyword ngxDirective contained scgi_cache_revalidate -syn keyword ngxDirective contained scgi_cache_use_stale -syn keyword ngxDirective contained scgi_cache_valid -syn keyword ngxDirective contained scgi_connect_timeout -syn keyword ngxDirective contained scgi_force_ranges -syn keyword ngxDirective contained scgi_hide_header -syn keyword ngxDirective contained scgi_ignore_client_abort -syn keyword ngxDirective contained scgi_ignore_headers -syn keyword ngxDirective contained scgi_intercept_errors -syn keyword ngxDirective contained scgi_limit_rate -syn keyword ngxDirective contained scgi_max_temp_file_size -syn keyword ngxDirective contained scgi_next_upstream -syn keyword ngxDirective contained scgi_next_upstream_timeout -syn keyword ngxDirective contained scgi_next_upstream_tries -syn keyword ngxDirective contained scgi_no_cache -syn keyword ngxDirective contained scgi_param -syn keyword ngxDirective contained scgi_pass_header -syn keyword ngxDirective contained scgi_pass_request_body -syn keyword ngxDirective contained scgi_pass_request_headers -syn keyword ngxDirective contained scgi_read_timeout -syn keyword ngxDirective contained scgi_request_buffering -syn keyword ngxDirective contained scgi_send_timeout -syn keyword ngxDirective contained scgi_socket_keepalive -syn keyword ngxDirective contained scgi_store -syn keyword ngxDirective contained scgi_store_access -syn keyword ngxDirective contained scgi_temp_file_write_size -syn keyword ngxDirective contained scgi_temp_path -syn keyword ngxDirective contained secure_link -syn keyword ngxDirective contained secure_link_md5 -syn keyword ngxDirective contained secure_link_secret -syn keyword ngxDirective contained send_lowat -syn keyword ngxDirective contained send_timeout -syn keyword ngxDirective contained sendfile -syn keyword ngxDirective contained sendfile_max_chunk -syn keyword ngxDirective contained server_name_in_redirect -syn keyword ngxDirective contained server_names_hash_bucket_size -syn keyword ngxDirective contained server_names_hash_max_size -syn keyword ngxDirective contained server_tokens -syn keyword ngxDirective contained set_real_ip_from -syn keyword ngxDirective contained slice -syn keyword ngxDirective contained smtp_auth -syn keyword ngxDirective contained smtp_capabilities -syn keyword ngxDirective contained smtp_client_buffer -syn keyword ngxDirective contained smtp_greeting_delay -syn keyword ngxDirective contained source_charset -syn keyword ngxDirective contained ssi -syn keyword ngxDirective contained ssi_ignore_recycled_buffers -syn keyword ngxDirective contained ssi_last_modified -syn keyword ngxDirective contained ssi_min_file_chunk -syn keyword ngxDirective contained ssi_silent_errors -syn keyword ngxDirective contained ssi_types -syn keyword ngxDirective contained ssi_value_length -syn keyword ngxDirective contained ssl_alpn -syn keyword ngxDirective contained ssl_buffer_size -syn keyword ngxDirective contained ssl_certificate -syn keyword ngxDirective contained ssl_certificate_key -syn keyword ngxDirective contained ssl_ciphers -syn keyword ngxDirective contained ssl_client_certificate -syn keyword ngxDirective contained ssl_conf_command -syn keyword ngxDirective contained ssl_crl -syn keyword ngxDirective contained ssl_dhparam -syn keyword ngxDirective contained ssl_early_data -syn keyword ngxDirective contained ssl_ecdh_curve -syn keyword ngxDirective contained ssl_engine -syn keyword ngxDirective contained ssl_handshake_timeout -syn keyword ngxDirective contained ssl_ocsp -syn keyword ngxDirective contained ssl_ocsp_cache -syn keyword ngxDirective contained ssl_ocsp_responder -syn keyword ngxDirective contained ssl_password_file -syn keyword ngxDirective contained ssl_prefer_server_ciphers -syn keyword ngxDirective contained ssl_preread -syn keyword ngxDirective contained ssl_protocols -syn keyword ngxDirective contained ssl_reject_handshake -syn keyword ngxDirective contained ssl_session_cache -syn keyword ngxDirective contained ssl_session_ticket_key -syn keyword ngxDirective contained ssl_session_tickets -syn keyword ngxDirective contained ssl_session_timeout -syn keyword ngxDirective contained ssl_stapling -syn keyword ngxDirective contained ssl_stapling_file -syn keyword ngxDirective contained ssl_stapling_responder -syn keyword ngxDirective contained ssl_stapling_verify -syn keyword ngxDirective contained ssl_trusted_certificate -syn keyword ngxDirective contained ssl_verify_client -syn keyword ngxDirective contained ssl_verify_depth -syn keyword ngxDirective contained starttls -syn keyword ngxDirective contained stub_status -syn keyword ngxDirective contained sub_filter -syn keyword ngxDirective contained sub_filter_last_modified -syn keyword ngxDirective contained sub_filter_once -syn keyword ngxDirective contained sub_filter_types -syn keyword ngxDirective contained subrequest_output_buffer_size -syn keyword ngxDirective contained tcp_nodelay -syn keyword ngxDirective contained tcp_nopush -syn keyword ngxDirective contained thread_pool -syn keyword ngxDirective contained timeout -syn keyword ngxDirective contained timer_resolution -syn keyword ngxDirective contained types_hash_bucket_size -syn keyword ngxDirective contained types_hash_max_size -syn keyword ngxDirective contained underscores_in_headers -syn keyword ngxDirective contained uninitialized_variable_warn -syn keyword ngxDirective contained use -syn keyword ngxDirective contained user -syn keyword ngxDirective contained userid -syn keyword ngxDirective contained userid_domain -syn keyword ngxDirective contained userid_expires -syn keyword ngxDirective contained userid_flags -syn keyword ngxDirective contained userid_mark -syn keyword ngxDirective contained userid_name -syn keyword ngxDirective contained userid_p3p -syn keyword ngxDirective contained userid_path -syn keyword ngxDirective contained userid_service -syn keyword ngxDirective contained uwsgi_bind -syn keyword ngxDirective contained uwsgi_buffer_size -syn keyword ngxDirective contained uwsgi_buffering -syn keyword ngxDirective contained uwsgi_buffers -syn keyword ngxDirective contained uwsgi_busy_buffers_size -syn keyword ngxDirective contained uwsgi_cache -syn keyword ngxDirective contained uwsgi_cache_background_update -syn keyword ngxDirective contained uwsgi_cache_bypass -syn keyword ngxDirective contained uwsgi_cache_key -syn keyword ngxDirective contained uwsgi_cache_lock -syn keyword ngxDirective contained uwsgi_cache_lock_age -syn keyword ngxDirective contained uwsgi_cache_lock_timeout -syn keyword ngxDirective contained uwsgi_cache_max_range_offset -syn keyword ngxDirective contained uwsgi_cache_methods -syn keyword ngxDirective contained uwsgi_cache_min_uses -syn keyword ngxDirective contained uwsgi_cache_path -syn keyword ngxDirective contained uwsgi_cache_revalidate -syn keyword ngxDirective contained uwsgi_cache_use_stale -syn keyword ngxDirective contained uwsgi_cache_valid -syn keyword ngxDirective contained uwsgi_connect_timeout -syn keyword ngxDirective contained uwsgi_force_ranges -syn keyword ngxDirective contained uwsgi_hide_header -syn keyword ngxDirective contained uwsgi_ignore_client_abort -syn keyword ngxDirective contained uwsgi_ignore_headers -syn keyword ngxDirective contained uwsgi_intercept_errors -syn keyword ngxDirective contained uwsgi_limit_rate -syn keyword ngxDirective contained uwsgi_max_temp_file_size -syn keyword ngxDirective contained uwsgi_modifier1 -syn keyword ngxDirective contained uwsgi_modifier2 -syn keyword ngxDirective contained uwsgi_next_upstream -syn keyword ngxDirective contained uwsgi_next_upstream_timeout -syn keyword ngxDirective contained uwsgi_next_upstream_tries -syn keyword ngxDirective contained uwsgi_no_cache -syn keyword ngxDirective contained uwsgi_param -syn keyword ngxDirective contained uwsgi_pass_header -syn keyword ngxDirective contained uwsgi_pass_request_body -syn keyword ngxDirective contained uwsgi_pass_request_headers -syn keyword ngxDirective contained uwsgi_read_timeout -syn keyword ngxDirective contained uwsgi_request_buffering -syn keyword ngxDirective contained uwsgi_send_timeout -syn keyword ngxDirective contained uwsgi_socket_keepalive -syn keyword ngxDirective contained uwsgi_ssl_certificate -syn keyword ngxDirective contained uwsgi_ssl_certificate_key -syn keyword ngxDirective contained uwsgi_ssl_ciphers -syn keyword ngxDirective contained uwsgi_ssl_conf_command -syn keyword ngxDirective contained uwsgi_ssl_crl -syn keyword ngxDirective contained uwsgi_ssl_name -syn keyword ngxDirective contained uwsgi_ssl_password_file -syn keyword ngxDirective contained uwsgi_ssl_protocols -syn keyword ngxDirective contained uwsgi_ssl_server_name -syn keyword ngxDirective contained uwsgi_ssl_session_reuse -syn keyword ngxDirective contained uwsgi_ssl_trusted_certificate -syn keyword ngxDirective contained uwsgi_ssl_verify -syn keyword ngxDirective contained uwsgi_ssl_verify_depth -syn keyword ngxDirective contained uwsgi_store -syn keyword ngxDirective contained uwsgi_store_access -syn keyword ngxDirective contained uwsgi_string -syn keyword ngxDirective contained uwsgi_temp_file_write_size -syn keyword ngxDirective contained uwsgi_temp_path -syn keyword ngxDirective contained valid_referers -syn keyword ngxDirective contained variables_hash_bucket_size -syn keyword ngxDirective contained variables_hash_max_size -syn keyword ngxDirective contained worker_aio_requests -syn keyword ngxDirective contained worker_connections -syn keyword ngxDirective contained worker_cpu_affinity -syn keyword ngxDirective contained worker_priority -syn keyword ngxDirective contained worker_processes -syn keyword ngxDirective contained worker_rlimit_core -syn keyword ngxDirective contained worker_rlimit_nofile -syn keyword ngxDirective contained worker_shutdown_timeout -syn keyword ngxDirective contained working_directory -syn keyword ngxDirective contained xclient -syn keyword ngxDirective contained xml_entities -syn keyword ngxDirective contained xslt_last_modified -syn keyword ngxDirective contained xslt_param -syn keyword ngxDirective contained xslt_string_param -syn keyword ngxDirective contained xslt_stylesheet -syn keyword ngxDirective contained xslt_types -syn keyword ngxDirective contained zone - -" nginx-plus commercial extensions directives - -syn keyword ngxDirectiveBlock contained match -syn keyword ngxDirectiveBlock contained otel_exporter - -syn keyword ngxDirective contained api -syn keyword ngxDirective contained auth_jwt -syn keyword ngxDirective contained auth_jwt_claim_set -syn keyword ngxDirective contained auth_jwt_header_set -syn keyword ngxDirective contained auth_jwt_key_cache -syn keyword ngxDirective contained auth_jwt_key_file -syn keyword ngxDirective contained auth_jwt_key_request -syn keyword ngxDirective contained auth_jwt_leeway -syn keyword ngxDirective contained auth_jwt_require -syn keyword ngxDirective contained auth_jwt_type -syn keyword ngxDirective contained f4f -syn keyword ngxDirective contained f4f_buffer_size -syn keyword ngxDirective contained fastcgi_cache_purge -syn keyword ngxDirective contained health_check -syn keyword ngxDirective contained health_check_timeout -syn keyword ngxDirective contained hls -syn keyword ngxDirective contained hls_buffers -syn keyword ngxDirective contained hls_forward_args -syn keyword ngxDirective contained hls_fragment -syn keyword ngxDirective contained hls_mp4_buffer_size -syn keyword ngxDirective contained hls_mp4_max_buffer_size -syn keyword ngxDirective contained internal_redirect -syn keyword ngxDirective contained keyval -syn keyword ngxDirective contained keyval_zone -syn keyword ngxDirective contained least_time -syn keyword ngxDirective contained mp4_limit_rate -syn keyword ngxDirective contained mp4_limit_rate_after -syn keyword ngxDirective contained mqtt -syn keyword ngxDirective contained mqtt_preread -syn keyword ngxDirective contained mqtt_rewrite_buffer_size -syn keyword ngxDirective contained mqtt_set_connect -syn keyword ngxDirective contained ntlm -syn keyword ngxDirective contained otel_service_name -syn keyword ngxDirective contained otel_span_attr -syn keyword ngxDirective contained otel_span_name -syn keyword ngxDirective contained otel_trace -syn keyword ngxDirective contained otel_trace_context -syn keyword ngxDirective contained proxy_cache_purge -syn keyword ngxDirective contained proxy_session_drop -syn keyword ngxDirective contained queue -syn keyword ngxDirective contained scgi_cache_purge -syn keyword ngxDirective contained session_log -syn keyword ngxDirective contained session_log_format -syn keyword ngxDirective contained session_log_zone -syn keyword ngxDirective contained state -syn keyword ngxDirective contained status -syn keyword ngxDirective contained status_format -syn keyword ngxDirective contained status_zone -syn keyword ngxDirective contained sticky -syn keyword ngxDirective contained uwsgi_cache_purge -syn keyword ngxDirective contained zone_sync -syn keyword ngxDirective contained zone_sync_buffers -syn keyword ngxDirective contained zone_sync_connect_retry_interval -syn keyword ngxDirective contained zone_sync_connect_timeout -syn keyword ngxDirective contained zone_sync_interval -syn keyword ngxDirective contained zone_sync_recv_buffer_size -syn keyword ngxDirective contained zone_sync_server -syn keyword ngxDirective contained zone_sync_ssl -syn keyword ngxDirective contained zone_sync_ssl_certificate -syn keyword ngxDirective contained zone_sync_ssl_certificate_key -syn keyword ngxDirective contained zone_sync_ssl_ciphers -syn keyword ngxDirective contained zone_sync_ssl_conf_command -syn keyword ngxDirective contained zone_sync_ssl_crl -syn keyword ngxDirective contained zone_sync_ssl_name -syn keyword ngxDirective contained zone_sync_ssl_password_file -syn keyword ngxDirective contained zone_sync_ssl_protocols -syn keyword ngxDirective contained zone_sync_ssl_server_name -syn keyword ngxDirective contained zone_sync_ssl_trusted_certificate -syn keyword ngxDirective contained zone_sync_ssl_verify -syn keyword ngxDirective contained zone_sync_ssl_verify_depth -syn keyword ngxDirective contained zone_sync_timeout - -" 3rd party modules list taken from -" https://github.com/freebsd/freebsd-ports/blob/main/www/nginx-devel/Makefile.extmod -" ---------------------------------------------------------------------------------- - -" https://github.com/msva/nginx_ajp_module -syn keyword ngxDirectiveThirdParty contained ajp_buffer_size -syn keyword ngxDirectiveThirdParty contained ajp_buffers -syn keyword ngxDirectiveThirdParty contained ajp_busy_buffers_size -syn keyword ngxDirectiveThirdParty contained ajp_cache -syn keyword ngxDirectiveThirdParty contained ajp_cache_key -syn keyword ngxDirectiveThirdParty contained ajp_cache_lock -syn keyword ngxDirectiveThirdParty contained ajp_cache_lock_timeout -syn keyword ngxDirectiveThirdParty contained ajp_cache_methods -syn keyword ngxDirectiveThirdParty contained ajp_cache_min_uses -syn keyword ngxDirectiveThirdParty contained ajp_cache_path -syn keyword ngxDirectiveThirdParty contained ajp_cache_use_stale -syn keyword ngxDirectiveThirdParty contained ajp_cache_valid -syn keyword ngxDirectiveThirdParty contained ajp_connect_timeout -syn keyword ngxDirectiveThirdParty contained ajp_header_packet_buffer_size -syn keyword ngxDirectiveThirdParty contained ajp_hide_header -syn keyword ngxDirectiveThirdParty contained ajp_ignore_client_abort -syn keyword ngxDirectiveThirdParty contained ajp_ignore_headers -syn keyword ngxDirectiveThirdParty contained ajp_intercept_errors -syn keyword ngxDirectiveThirdParty contained ajp_keep_conn -syn keyword ngxDirectiveThirdParty contained ajp_max_data_packet_size -syn keyword ngxDirectiveThirdParty contained ajp_max_temp_file_size -syn keyword ngxDirectiveThirdParty contained ajp_next_upstream -syn keyword ngxDirectiveThirdParty contained ajp_param -syn keyword ngxDirectiveThirdParty contained ajp_pass -syn keyword ngxDirectiveThirdParty contained ajp_pass_header -syn keyword ngxDirectiveThirdParty contained ajp_pass_request_body -syn keyword ngxDirectiveThirdParty contained ajp_pass_request_headers -syn keyword ngxDirectiveThirdParty contained ajp_read_timeout -syn keyword ngxDirectiveThirdParty contained ajp_script_url -syn keyword ngxDirectiveThirdParty contained ajp_secret -syn keyword ngxDirectiveThirdParty contained ajp_send_lowat -syn keyword ngxDirectiveThirdParty contained ajp_send_timeout -syn keyword ngxDirectiveThirdParty contained ajp_store -syn keyword ngxDirectiveThirdParty contained ajp_store_access -syn keyword ngxDirectiveThirdParty contained ajp_temp_file_write_size -syn keyword ngxDirectiveThirdParty contained ajp_temp_path -syn keyword ngxDirectiveThirdParty contained ajp_upstream_fail_timeout -syn keyword ngxDirectiveThirdParty contained ajp_upstream_max_fails - -" https://github.com/openresty/array-var-nginx-module -syn keyword ngxDirectiveThirdParty contained array_join -syn keyword ngxDirectiveThirdParty contained array_map -syn keyword ngxDirectiveThirdParty contained array_map_op -syn keyword ngxDirectiveThirdParty contained array_split - -" https://github.com/anomalizer/ngx_aws_auth -syn keyword ngxDirectiveThirdParty contained aws_access_key -syn keyword ngxDirectiveThirdParty contained aws_endpoint -syn keyword ngxDirectiveThirdParty contained aws_key_scope -syn keyword ngxDirectiveThirdParty contained aws_s3_bucket -syn keyword ngxDirectiveThirdParty contained aws_sign -syn keyword ngxDirectiveThirdParty contained aws_signing_key - -" https://github.com/google/ngx_brotli -syn keyword ngxDirectiveThirdParty contained brotli -syn keyword ngxDirectiveThirdParty contained brotli_buffers -syn keyword ngxDirectiveThirdParty contained brotli_comp_level -syn keyword ngxDirectiveThirdParty contained brotli_min_length -syn keyword ngxDirectiveThirdParty contained brotli_static -syn keyword ngxDirectiveThirdParty contained brotli_types -syn keyword ngxDirectiveThirdParty contained brotli_window - -" https://github.com/torden/ngx_cache_purge -syn keyword ngxDirectiveThirdParty contained cache_purge_response_type - -" https://github.com/AirisX/nginx_cookie_flag_module -syn keyword ngxDirectiveThirdParty contained set_cookie_flag - -" https://github.com/grahamedgecombe/nginx-ct -syn keyword ngxDirectiveThirdParty contained ssl_ct -syn keyword ngxDirectiveThirdParty contained ssl_ct_static_scts - -" https://github.com/openresty/echo-nginx-module -syn keyword ngxDirectiveThirdParty contained echo -syn keyword ngxDirectiveThirdParty contained echo_abort_parent -syn keyword ngxDirectiveThirdParty contained echo_after_body -syn keyword ngxDirectiveThirdParty contained echo_before_body -syn keyword ngxDirectiveThirdParty contained echo_blocking_sleep -syn keyword ngxDirectiveThirdParty contained echo_duplicate -syn keyword ngxDirectiveThirdParty contained echo_end -syn keyword ngxDirectiveThirdParty contained echo_exec -syn keyword ngxDirectiveThirdParty contained echo_flush -syn keyword ngxDirectiveThirdParty contained echo_foreach_split -syn keyword ngxDirectiveThirdParty contained echo_location -syn keyword ngxDirectiveThirdParty contained echo_location_async -syn keyword ngxDirectiveThirdParty contained echo_read_request_body -syn keyword ngxDirectiveThirdParty contained echo_request_body -syn keyword ngxDirectiveThirdParty contained echo_reset_timer -syn keyword ngxDirectiveThirdParty contained echo_sleep -syn keyword ngxDirectiveThirdParty contained echo_status -syn keyword ngxDirectiveThirdParty contained echo_subrequest -syn keyword ngxDirectiveThirdParty contained echo_subrequest_async - -" https://github.com/openresty/drizzle-nginx-module -syn keyword ngxDirectiveThirdParty contained drizzle_buffer_size -syn keyword ngxDirectiveThirdParty contained drizzle_connect_timeout -syn keyword ngxDirectiveThirdParty contained drizzle_dbname -syn keyword ngxDirectiveThirdParty contained drizzle_keepalive -syn keyword ngxDirectiveThirdParty contained drizzle_module_header -syn keyword ngxDirectiveThirdParty contained drizzle_pass -syn keyword ngxDirectiveThirdParty contained drizzle_query -syn keyword ngxDirectiveThirdParty contained drizzle_recv_cols_timeout -syn keyword ngxDirectiveThirdParty contained drizzle_recv_rows_timeout -syn keyword ngxDirectiveThirdParty contained drizzle_send_query_timeout -syn keyword ngxDirectiveThirdParty contained drizzle_server -syn keyword ngxDirectiveThirdParty contained drizzle_status - -" https://github.com/ZigzagAK/ngx_dynamic_upstream -syn keyword ngxDirectiveThirdParty contained dns_add_down -syn keyword ngxDirectiveThirdParty contained dns_ipv6 -syn keyword ngxDirectiveThirdParty contained dns_update -syn keyword ngxDirectiveThirdParty contained dynamic_state_file -syn keyword ngxDirectiveThirdParty contained dynamic_upstream - -" https://github.com/openresty/encrypted-session-nginx-module -syn keyword ngxDirectiveThirdParty contained encrypted_session_expires -syn keyword ngxDirectiveThirdParty contained encrypted_session_iv -syn keyword ngxDirectiveThirdParty contained encrypted_session_key -syn keyword ngxDirectiveThirdParty contained set_decrypt_session -syn keyword ngxDirectiveThirdParty contained set_encrypt_session - -" https://github.com/calio/form-input-nginx-module -syn keyword ngxDirectiveThirdParty contained set_form_input -syn keyword ngxDirectiveThirdParty contained set_form_input_multi - -" https://github.com/nieoding/nginx-gridfs -syn keyword ngxDirectiveThirdParty contained gridfs -syn keyword ngxDirectiveThirdParty contained mongo - -" https://github.com/openresty/headers-more-nginx-module -syn keyword ngxDirectiveThirdParty contained more_clear_headers -syn keyword ngxDirectiveThirdParty contained more_clear_input_headers -syn keyword ngxDirectiveThirdParty contained more_set_headers -syn keyword ngxDirectiveThirdParty contained more_set_input_headers - -" https://github.com/dvershinin/nginx_accept_language_module -syn keyword ngxDirectiveThirdParty contained set_from_accept_language - -" https://github.com/atomx/nginx-http-auth-digest -syn keyword ngxDirectiveThirdParty contained auth_digest -syn keyword ngxDirectiveThirdParty contained auth_digest_drop_time -syn keyword ngxDirectiveThirdParty contained auth_digest_evasion_time -syn keyword ngxDirectiveThirdParty contained auth_digest_expires -syn keyword ngxDirectiveThirdParty contained auth_digest_maxtries -syn keyword ngxDirectiveThirdParty contained auth_digest_replays -syn keyword ngxDirectiveThirdParty contained auth_digest_shm_size -syn keyword ngxDirectiveThirdParty contained auth_digest_timeout -syn keyword ngxDirectiveThirdParty contained auth_digest_user_file - -" https://github.com/stnoonan/spnego-http-auth-nginx-module -syn keyword ngxDirectiveThirdParty contained auth_gss -syn keyword ngxDirectiveThirdParty contained auth_gss_allow_basic_fallback -syn keyword ngxDirectiveThirdParty contained auth_gss_authorized_principal -syn keyword ngxDirectiveThirdParty contained auth_gss_authorized_principal_regex -syn keyword ngxDirectiveThirdParty contained auth_gss_constrained_delegation -syn keyword ngxDirectiveThirdParty contained auth_gss_delegate_credentials -syn keyword ngxDirectiveThirdParty contained auth_gss_force_realm -syn keyword ngxDirectiveThirdParty contained auth_gss_format_full -syn keyword ngxDirectiveThirdParty contained auth_gss_keytab -syn keyword ngxDirectiveThirdParty contained auth_gss_map_to_local -syn keyword ngxDirectiveThirdParty contained auth_gss_realm -syn keyword ngxDirectiveThirdParty contained auth_gss_service_ccache -syn keyword ngxDirectiveThirdParty contained auth_gss_service_name -syn keyword ngxDirectiveThirdParty contained auth_gss_zone_name - -" https://github.com/kvspb/nginx-auth-ldap -syn keyword ngxDirectiveThirdParty contained auth_ldap -syn keyword ngxDirectiveThirdParty contained auth_ldap_cache_enabled -syn keyword ngxDirectiveThirdParty contained auth_ldap_cache_expiration_time -syn keyword ngxDirectiveThirdParty contained auth_ldap_cache_size -syn keyword ngxDirectiveThirdParty contained auth_ldap_servers -syn keyword ngxDirectiveThirdParty contained auth_ldap_servers_size -syn keyword ngxDirectiveThirdParty contained ldap_server - -" https://github.com/sto/ngx_http_auth_pam_module -syn keyword ngxDirectiveThirdParty contained auth_pam -syn keyword ngxDirectiveThirdParty contained auth_pam_service_name -syn keyword ngxDirectiveThirdParty contained auth_pam_set_pam_env - -" https://github.com/arut/nginx-dav-ext-module -syn keyword ngxDirectiveThirdParty contained dav_ext_lock -syn keyword ngxDirectiveThirdParty contained dav_ext_lock_zone -syn keyword ngxDirectiveThirdParty contained dav_ext_methods - -" https://github.com/openresty/nginx-eval-module -syn keyword ngxDirectiveThirdParty contained eval -syn keyword ngxDirectiveThirdParty contained eval_buffer_size -syn keyword ngxDirectiveThirdParty contained eval_escalate -syn keyword ngxDirectiveThirdParty contained eval_override_content_type -syn keyword ngxDirectiveThirdParty contained eval_subrequest_in_memory - -" https://github.com/aperezdc/ngx-fancyindex -syn keyword ngxDirectiveThirdParty contained fancyindex -syn keyword ngxDirectiveThirdParty contained fancyindex_case_sensitive -syn keyword ngxDirectiveThirdParty contained fancyindex_css_href -syn keyword ngxDirectiveThirdParty contained fancyindex_default_sort -syn keyword ngxDirectiveThirdParty contained fancyindex_directories_first -syn keyword ngxDirectiveThirdParty contained fancyindex_exact_size -syn keyword ngxDirectiveThirdParty contained fancyindex_footer -syn keyword ngxDirectiveThirdParty contained fancyindex_header -syn keyword ngxDirectiveThirdParty contained fancyindex_hide_parent_dir -syn keyword ngxDirectiveThirdParty contained fancyindex_hide_symlinks -syn keyword ngxDirectiveThirdParty contained fancyindex_ignore -syn keyword ngxDirectiveThirdParty contained fancyindex_localtime -syn keyword ngxDirectiveThirdParty contained fancyindex_show_dotfiles -syn keyword ngxDirectiveThirdParty contained fancyindex_show_path -syn keyword ngxDirectiveThirdParty contained fancyindex_time_format - -" https://github.com/alibaba/nginx-http-footer-filter -syn keyword ngxDirectiveThirdParty contained footer -syn keyword ngxDirectiveThirdParty contained footer_types - -" https://github.com/leev/ngx_http_geoip2_module -syn keyword ngxDirectiveThirdParty contained geoip2 -syn keyword ngxDirectiveThirdParty contained geoip2_proxy -syn keyword ngxDirectiveThirdParty contained geoip2_proxy_recursive - -" https://github.com/ip2location/ip2location-nginx -syn keyword ngxDirectiveThirdParty contained ip2location_database -syn keyword ngxDirectiveThirdParty contained ip2location_proxy -syn keyword ngxDirectiveThirdParty contained ip2location_proxy_recursive - -" https://github.com/ip2location/ip2proxy-nginx -syn keyword ngxDirectiveThirdParty contained ip2proxy_database -syn keyword ngxDirectiveThirdParty contained ip2proxy_proxy -syn keyword ngxDirectiveThirdParty contained ip2proxy_proxy_recursive - -" https://github.com/kr/nginx-notice -syn keyword ngxDirectiveThirdParty contained notice -syn keyword ngxDirectiveThirdParty contained notice_type - -" https://github.com/slact/nchan -syn keyword ngxDirectiveThirdParty contained nchan_access_control_allow_credentials -syn keyword ngxDirectiveThirdParty contained nchan_access_control_allow_origin -syn keyword ngxDirectiveThirdParty contained nchan_authorize_request -syn keyword ngxDirectiveThirdParty contained nchan_benchmark -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_channels -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_message_padding_bytes -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_messages_per_channel_per_minute -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_publisher_distribution -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_subscriber_distribution -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_subscribers_per_channel -syn keyword ngxDirectiveThirdParty contained nchan_benchmark_time -syn keyword ngxDirectiveThirdParty contained nchan_channel_event_string -syn keyword ngxDirectiveThirdParty contained nchan_channel_events_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_channel_group -syn keyword ngxDirectiveThirdParty contained nchan_channel_group_accounting -syn keyword ngxDirectiveThirdParty contained nchan_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_channel_id_split_delimiter -syn keyword ngxDirectiveThirdParty contained nchan_channel_timeout -syn keyword ngxDirectiveThirdParty contained nchan_deflate_message_for_websocket -syn keyword ngxDirectiveThirdParty contained nchan_eventsource_event -syn keyword ngxDirectiveThirdParty contained nchan_eventsource_ping_comment -syn keyword ngxDirectiveThirdParty contained nchan_eventsource_ping_data -syn keyword ngxDirectiveThirdParty contained nchan_eventsource_ping_event -syn keyword ngxDirectiveThirdParty contained nchan_eventsource_ping_interval -syn keyword ngxDirectiveThirdParty contained nchan_group_location -syn keyword ngxDirectiveThirdParty contained nchan_group_max_channels -syn keyword ngxDirectiveThirdParty contained nchan_group_max_messages -syn keyword ngxDirectiveThirdParty contained nchan_group_max_messages_disk -syn keyword ngxDirectiveThirdParty contained nchan_group_max_messages_memory -syn keyword ngxDirectiveThirdParty contained nchan_group_max_subscribers -syn keyword ngxDirectiveThirdParty contained nchan_longpoll_multipart_response -syn keyword ngxDirectiveThirdParty contained nchan_max_channel_id_length -syn keyword ngxDirectiveThirdParty contained nchan_max_channel_subscribers -syn keyword ngxDirectiveThirdParty contained nchan_max_reserved_memory -syn keyword ngxDirectiveThirdParty contained nchan_message_buffer_length -syn keyword ngxDirectiveThirdParty contained nchan_message_max_buffer_length -syn keyword ngxDirectiveThirdParty contained nchan_message_temp_path -syn keyword ngxDirectiveThirdParty contained nchan_message_timeout -syn keyword ngxDirectiveThirdParty contained nchan_permessage_deflate_compression_level -syn keyword ngxDirectiveThirdParty contained nchan_permessage_deflate_compression_memlevel -syn keyword ngxDirectiveThirdParty contained nchan_permessage_deflate_compression_strategy -syn keyword ngxDirectiveThirdParty contained nchan_permessage_deflate_compression_window -syn keyword ngxDirectiveThirdParty contained nchan_pub_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_publisher -syn keyword ngxDirectiveThirdParty contained nchan_publisher_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_publisher_location -syn keyword ngxDirectiveThirdParty contained nchan_publisher_upstream_request -syn keyword ngxDirectiveThirdParty contained nchan_pubsub -syn keyword ngxDirectiveThirdParty contained nchan_pubsub_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_pubsub_location -syn keyword ngxDirectiveThirdParty contained nchan_redis_accurate_subscriber_count -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_check_interval -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_check_interval_backoff -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_check_interval_jitter -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_check_interval_max -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_check_interval_min -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_connect_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_max_failing_time -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_recovery_delay -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_recovery_delay_backoff -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_recovery_delay_jitter -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_recovery_delay_max -syn keyword ngxDirectiveThirdParty contained nchan_redis_cluster_recovery_delay_min -syn keyword ngxDirectiveThirdParty contained nchan_redis_command_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_connect_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_discovered_ip_range_blacklist -syn keyword ngxDirectiveThirdParty contained nchan_redis_fakesub_timer_interval -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_cache_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_keepalive_backoff -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_keepalive_jitter -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_keepalive_max -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_keepalive_min -syn keyword ngxDirectiveThirdParty contained nchan_redis_idle_channel_keepalive_safety_margin -syn keyword ngxDirectiveThirdParty contained nchan_redis_load_scripts_unconditionally -syn keyword ngxDirectiveThirdParty contained nchan_redis_namespace -syn keyword ngxDirectiveThirdParty contained nchan_redis_node_connect_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_nostore_fastpublish -syn keyword ngxDirectiveThirdParty contained nchan_redis_optimize_target -syn keyword ngxDirectiveThirdParty contained nchan_redis_pass -syn keyword ngxDirectiveThirdParty contained nchan_redis_pass_inheritable -syn keyword ngxDirectiveThirdParty contained nchan_redis_password -syn keyword ngxDirectiveThirdParty contained nchan_redis_ping_interval -syn keyword ngxDirectiveThirdParty contained nchan_redis_publish_msgpacked_max_size -syn keyword ngxDirectiveThirdParty contained nchan_redis_reconnect_delay -syn keyword ngxDirectiveThirdParty contained nchan_redis_reconnect_delay_backoff -syn keyword ngxDirectiveThirdParty contained nchan_redis_reconnect_delay_jitter -syn keyword ngxDirectiveThirdParty contained nchan_redis_reconnect_delay_max -syn keyword ngxDirectiveThirdParty contained nchan_redis_reconnect_delay_min -syn keyword ngxDirectiveThirdParty contained nchan_redis_retry_commands -syn keyword ngxDirectiveThirdParty contained nchan_redis_retry_commands_max_wait -syn keyword ngxDirectiveThirdParty contained nchan_redis_server -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_ciphers -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_client_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_client_certificate_key -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_server_name -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_trusted_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_trusted_certificate_path -syn keyword ngxDirectiveThirdParty contained nchan_redis_ssl_verify_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_storage_mode -syn keyword ngxDirectiveThirdParty contained nchan_redis_subscribe_weights -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_ciphers -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_client_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_server_name -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_trusted_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_trusted_certificate_path -syn keyword ngxDirectiveThirdParty contained nchan_redis_tls_verify_certificate -syn keyword ngxDirectiveThirdParty contained nchan_redis_upstream_stats -syn keyword ngxDirectiveThirdParty contained nchan_redis_upstream_stats_disconnected_timeout -syn keyword ngxDirectiveThirdParty contained nchan_redis_upstream_stats_enabled -syn keyword ngxDirectiveThirdParty contained nchan_redis_url -syn keyword ngxDirectiveThirdParty contained nchan_redis_username -syn keyword ngxDirectiveThirdParty contained nchan_redis_wait_after_connecting -syn keyword ngxDirectiveThirdParty contained nchan_shared_memory_size -syn keyword ngxDirectiveThirdParty contained nchan_storage_engine -syn keyword ngxDirectiveThirdParty contained nchan_store_messages -syn keyword ngxDirectiveThirdParty contained nchan_stub_status -syn keyword ngxDirectiveThirdParty contained nchan_sub_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_subscribe_existing_channels_only -syn keyword ngxDirectiveThirdParty contained nchan_subscribe_request -syn keyword ngxDirectiveThirdParty contained nchan_subscriber -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_channel_id -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_compound_etag_message_id -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_first_message -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_http_raw_stream_separator -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_info -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_info_string -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_last_message_id -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_location -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_message_id_custom_etag_header -syn keyword ngxDirectiveThirdParty contained nchan_subscriber_timeout -syn keyword ngxDirectiveThirdParty contained nchan_unsubscribe_request -syn keyword ngxDirectiveThirdParty contained nchan_use_redis -syn keyword ngxDirectiveThirdParty contained nchan_websocket_client_heartbeat -syn keyword ngxDirectiveThirdParty contained nchan_websocket_ping_interval -syn keyword ngxDirectiveThirdParty contained push_authorized_channels_only -syn keyword ngxDirectiveThirdParty contained push_channel_group -syn keyword ngxDirectiveThirdParty contained push_channel_timeout -syn keyword ngxDirectiveThirdParty contained push_max_channel_id_length -syn keyword ngxDirectiveThirdParty contained push_max_channel_subscribers -syn keyword ngxDirectiveThirdParty contained push_max_message_buffer_length -syn keyword ngxDirectiveThirdParty contained push_max_reserved_memory -syn keyword ngxDirectiveThirdParty contained push_message_buffer_length -syn keyword ngxDirectiveThirdParty contained push_message_timeout -syn keyword ngxDirectiveThirdParty contained push_min_message_buffer_length -syn keyword ngxDirectiveThirdParty contained push_publisher -syn keyword ngxDirectiveThirdParty contained push_store_messages -syn keyword ngxDirectiveThirdParty contained push_subscriber -syn keyword ngxDirectiveThirdParty contained push_subscriber_concurrency -syn keyword ngxDirectiveThirdParty contained push_subscriber_timeout - -" https://github.com/wandenberg/nginx-push-stream-module -syn keyword ngxDirectiveThirdParty contained push_stream_allow_connections_to_events_channel -syn keyword ngxDirectiveThirdParty contained push_stream_allowed_origins -syn keyword ngxDirectiveThirdParty contained push_stream_authorized_channels_only -syn keyword ngxDirectiveThirdParty contained push_stream_channel_deleted_message_text -syn keyword ngxDirectiveThirdParty contained push_stream_channel_inactivity_time -syn keyword ngxDirectiveThirdParty contained push_stream_channel_info_on_publish -syn keyword ngxDirectiveThirdParty contained push_stream_channels_path -syn keyword ngxDirectiveThirdParty contained push_stream_channels_statistics -syn keyword ngxDirectiveThirdParty contained push_stream_events_channel_id -syn keyword ngxDirectiveThirdParty contained push_stream_footer_template -syn keyword ngxDirectiveThirdParty contained push_stream_header_template -syn keyword ngxDirectiveThirdParty contained push_stream_header_template_file -syn keyword ngxDirectiveThirdParty contained push_stream_last_event_id -syn keyword ngxDirectiveThirdParty contained push_stream_last_received_message_tag -syn keyword ngxDirectiveThirdParty contained push_stream_last_received_message_time -syn keyword ngxDirectiveThirdParty contained push_stream_longpolling_connection_ttl -syn keyword ngxDirectiveThirdParty contained push_stream_max_channel_id_length -syn keyword ngxDirectiveThirdParty contained push_stream_max_messages_stored_per_channel -syn keyword ngxDirectiveThirdParty contained push_stream_max_number_of_channels -syn keyword ngxDirectiveThirdParty contained push_stream_max_number_of_wildcard_channels -syn keyword ngxDirectiveThirdParty contained push_stream_max_subscribers_per_channel -syn keyword ngxDirectiveThirdParty contained push_stream_message_template -syn keyword ngxDirectiveThirdParty contained push_stream_message_ttl -syn keyword ngxDirectiveThirdParty contained push_stream_padding_by_user_agent -syn keyword ngxDirectiveThirdParty contained push_stream_ping_message_interval -syn keyword ngxDirectiveThirdParty contained push_stream_ping_message_text -syn keyword ngxDirectiveThirdParty contained push_stream_publisher -syn keyword ngxDirectiveThirdParty contained push_stream_shared_memory_size -syn keyword ngxDirectiveThirdParty contained push_stream_store_messages -syn keyword ngxDirectiveThirdParty contained push_stream_subscriber -syn keyword ngxDirectiveThirdParty contained push_stream_subscriber_connection_ttl -syn keyword ngxDirectiveThirdParty contained push_stream_timeout_with_body -syn keyword ngxDirectiveThirdParty contained push_stream_user_agent -syn keyword ngxDirectiveThirdParty contained push_stream_websocket_allow_publish -syn keyword ngxDirectiveThirdParty contained push_stream_wildcard_channel_max_qtd -syn keyword ngxDirectiveThirdParty contained push_stream_wildcard_channel_prefix - -" https://github.com/yaoweibin/ngx_http_substitutions_filter_module -syn keyword ngxDirectiveThirdParty contained subs_buffers -syn keyword ngxDirectiveThirdParty contained subs_filter -syn keyword ngxDirectiveThirdParty contained subs_filter_bypass -syn keyword ngxDirectiveThirdParty contained subs_filter_types -syn keyword ngxDirectiveThirdParty contained subs_line_buffer_size - -" https://github.com/tarantool/nginx_upstream_module -syn keyword ngxDirectiveThirdParty contained tnt_allowed_indexes -syn keyword ngxDirectiveThirdParty contained tnt_allowed_spaces -syn keyword ngxDirectiveThirdParty contained tnt_buffer_size -syn keyword ngxDirectiveThirdParty contained tnt_connect_timeout -syn keyword ngxDirectiveThirdParty contained tnt_delete -syn keyword ngxDirectiveThirdParty contained tnt_http_methods -syn keyword ngxDirectiveThirdParty contained tnt_http_rest_methods -syn keyword ngxDirectiveThirdParty contained tnt_in_multiplier -syn keyword ngxDirectiveThirdParty contained tnt_insert -syn keyword ngxDirectiveThirdParty contained tnt_method -syn keyword ngxDirectiveThirdParty contained tnt_multireturn_skip_count -syn keyword ngxDirectiveThirdParty contained tnt_next_upstream -syn keyword ngxDirectiveThirdParty contained tnt_next_upstream_timeout -syn keyword ngxDirectiveThirdParty contained tnt_next_upstream_tries -syn keyword ngxDirectiveThirdParty contained tnt_out_multiplier -syn keyword ngxDirectiveThirdParty contained tnt_pass -syn keyword ngxDirectiveThirdParty contained tnt_pass_http_request -syn keyword ngxDirectiveThirdParty contained tnt_pass_http_request_buffer_size -syn keyword ngxDirectiveThirdParty contained tnt_pure_result -syn keyword ngxDirectiveThirdParty contained tnt_read_timeout -syn keyword ngxDirectiveThirdParty contained tnt_replace -syn keyword ngxDirectiveThirdParty contained tnt_select -syn keyword ngxDirectiveThirdParty contained tnt_select_limit_max -syn keyword ngxDirectiveThirdParty contained tnt_send_timeout -syn keyword ngxDirectiveThirdParty contained tnt_set_header -syn keyword ngxDirectiveThirdParty contained tnt_update -syn keyword ngxDirectiveThirdParty contained tnt_upsert - -" https://github.com/fdintino/nginx-upload-module -syn keyword ngxDirectiveThirdParty contained upload_add_header -syn keyword ngxDirectiveThirdParty contained upload_aggregate_form_field -syn keyword ngxDirectiveThirdParty contained upload_buffer_size -syn keyword ngxDirectiveThirdParty contained upload_cleanup -syn keyword ngxDirectiveThirdParty contained upload_empty_fiels_names -syn keyword ngxDirectiveThirdParty contained upload_limit_rate -syn keyword ngxDirectiveThirdParty contained upload_max_file_size -syn keyword ngxDirectiveThirdParty contained upload_max_output_body_len -syn keyword ngxDirectiveThirdParty contained upload_max_part_header_len -syn keyword ngxDirectiveThirdParty contained upload_merge_buffer_size -syn keyword ngxDirectiveThirdParty contained upload_pass -syn keyword ngxDirectiveThirdParty contained upload_pass_args -syn keyword ngxDirectiveThirdParty contained upload_pass_form_field -syn keyword ngxDirectiveThirdParty contained upload_range_header_buffer_size -syn keyword ngxDirectiveThirdParty contained upload_resumable -syn keyword ngxDirectiveThirdParty contained upload_set_form_field -syn keyword ngxDirectiveThirdParty contained upload_state_store -syn keyword ngxDirectiveThirdParty contained upload_store -syn keyword ngxDirectiveThirdParty contained upload_store_access -syn keyword ngxDirectiveThirdParty contained upload_tame_arrays - -" https://github.com/masterzen/nginx-upload-progress-module -syn keyword ngxDirectiveThirdParty contained report_uploads -syn keyword ngxDirectiveThirdParty contained track_uploads -syn keyword ngxDirectiveThirdParty contained upload_progress -syn keyword ngxDirectiveThirdParty contained upload_progress_content_type -syn keyword ngxDirectiveThirdParty contained upload_progress_header -syn keyword ngxDirectiveThirdParty contained upload_progress_java_output -syn keyword ngxDirectiveThirdParty contained upload_progress_json_output -syn keyword ngxDirectiveThirdParty contained upload_progress_jsonp_output -syn keyword ngxDirectiveThirdParty contained upload_progress_jsonp_parameter -syn keyword ngxDirectiveThirdParty contained upload_progress_template - -" https://github.com/yaoweibin/nginx_upstream_check_module -syn keyword ngxDirectiveThirdParty contained check -syn keyword ngxDirectiveThirdParty contained check_fastcgi_param -syn keyword ngxDirectiveThirdParty contained check_http_expect_alive -syn keyword ngxDirectiveThirdParty contained check_http_send -syn keyword ngxDirectiveThirdParty contained check_keepalive_requests -syn keyword ngxDirectiveThirdParty contained check_shm_size -syn keyword ngxDirectiveThirdParty contained check_status - -" https://github.com/jaygooby/nginx-upstream-fair -syn keyword ngxDirectiveThirdParty contained fair -syn keyword ngxDirectiveThirdParty contained upstream_fair_shm_size - -" https://github.com/ayty-adrianomartins/nginx-sticky-module-ng -syn keyword ngxDirectiveThirdParty contained sticky_hide_cookie -syn keyword ngxDirectiveThirdParty contained sticky_no_fallback - -" https://github.com/Novetta/nginx-video-thumbextractor-module -syn keyword ngxDirectiveThirdParty contained video_thumbextractor -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_image_height -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_image_width -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_baseline -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_dpi -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_optimize -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_progressive_mode -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_quality -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_jpeg_smooth -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_next_time -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_only_keyframe -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_processes_per_worker -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_threads -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_color -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_cols -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_margin -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_max_cols -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_max_rows -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_padding -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_rows -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_tile_sample_interval -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_video_filename -syn keyword ngxDirectiveThirdParty contained video_thumbextractor_video_second - -" https://github.com/calio/iconv-nginx-module -syn keyword ngxDirectiveThirdParty contained iconv_buffer_size -syn keyword ngxDirectiveThirdParty contained iconv_filter -syn keyword ngxDirectiveThirdParty contained set_iconv - -" https://github.com/baysao/nginx-let-module -syn keyword ngxDirectiveThirdParty contained let - -" https://github.com/openresty/lua-nginx-module -syn keyword ngxDirectiveThirdParty contained access_by_lua -syn keyword ngxDirectiveThirdParty contained access_by_lua_block -syn keyword ngxDirectiveThirdParty contained access_by_lua_file -syn keyword ngxDirectiveThirdParty contained access_by_lua_no_postpone -syn keyword ngxDirectiveThirdParty contained balancer_by_lua_block -syn keyword ngxDirectiveThirdParty contained balancer_by_lua_file -syn keyword ngxDirectiveThirdParty contained body_filter_by_lua -syn keyword ngxDirectiveThirdParty contained body_filter_by_lua_block -syn keyword ngxDirectiveThirdParty contained body_filter_by_lua_file -syn keyword ngxDirectiveThirdParty contained content_by_lua -syn keyword ngxDirectiveThirdParty contained content_by_lua_block -syn keyword ngxDirectiveThirdParty contained content_by_lua_file -syn keyword ngxDirectiveThirdParty contained exit_worker_by_lua_block -syn keyword ngxDirectiveThirdParty contained exit_worker_by_lua_file -syn keyword ngxDirectiveThirdParty contained header_filter_by_lua -syn keyword ngxDirectiveThirdParty contained header_filter_by_lua_block -syn keyword ngxDirectiveThirdParty contained header_filter_by_lua_file -syn keyword ngxDirectiveThirdParty contained init_by_lua -syn keyword ngxDirectiveThirdParty contained init_by_lua_block -syn keyword ngxDirectiveThirdParty contained init_by_lua_file -syn keyword ngxDirectiveThirdParty contained init_worker_by_lua -syn keyword ngxDirectiveThirdParty contained init_worker_by_lua_block -syn keyword ngxDirectiveThirdParty contained init_worker_by_lua_file -syn keyword ngxDirectiveThirdParty contained log_by_lua -syn keyword ngxDirectiveThirdParty contained log_by_lua_block -syn keyword ngxDirectiveThirdParty contained log_by_lua_file -syn keyword ngxDirectiveThirdParty contained lua_capture_error_log -syn keyword ngxDirectiveThirdParty contained lua_check_client_abort -syn keyword ngxDirectiveThirdParty contained lua_code_cache -syn keyword ngxDirectiveThirdParty contained lua_fake_shm -syn keyword ngxDirectiveThirdParty contained lua_http10_buffering -syn keyword ngxDirectiveThirdParty contained lua_load_resty_core -syn keyword ngxDirectiveThirdParty contained lua_malloc_trim -syn keyword ngxDirectiveThirdParty contained lua_max_pending_timers -syn keyword ngxDirectiveThirdParty contained lua_max_running_timers -syn keyword ngxDirectiveThirdParty contained lua_need_request_body -syn keyword ngxDirectiveThirdParty contained lua_package_cpath -syn keyword ngxDirectiveThirdParty contained lua_package_path -syn keyword ngxDirectiveThirdParty contained lua_regex_cache_max_entries -syn keyword ngxDirectiveThirdParty contained lua_regex_match_limit -syn keyword ngxDirectiveThirdParty contained lua_sa_restart -syn keyword ngxDirectiveThirdParty contained lua_shared_dict -syn keyword ngxDirectiveThirdParty contained lua_socket_buffer_size -syn keyword ngxDirectiveThirdParty contained lua_socket_connect_timeout -syn keyword ngxDirectiveThirdParty contained lua_socket_keepalive_timeout -syn keyword ngxDirectiveThirdParty contained lua_socket_log_errors -syn keyword ngxDirectiveThirdParty contained lua_socket_pool_size -syn keyword ngxDirectiveThirdParty contained lua_socket_read_timeout -syn keyword ngxDirectiveThirdParty contained lua_socket_send_lowat -syn keyword ngxDirectiveThirdParty contained lua_socket_send_timeout -syn keyword ngxDirectiveThirdParty contained lua_ssl_certificate -syn keyword ngxDirectiveThirdParty contained lua_ssl_certificate_key -syn keyword ngxDirectiveThirdParty contained lua_ssl_ciphers -syn keyword ngxDirectiveThirdParty contained lua_ssl_conf_command -syn keyword ngxDirectiveThirdParty contained lua_ssl_crl -syn keyword ngxDirectiveThirdParty contained lua_ssl_protocols -syn keyword ngxDirectiveThirdParty contained lua_ssl_trusted_certificate -syn keyword ngxDirectiveThirdParty contained lua_ssl_verify_depth -syn keyword ngxDirectiveThirdParty contained lua_thread_cache_max_entries -syn keyword ngxDirectiveThirdParty contained lua_transform_underscores_in_response_headers -syn keyword ngxDirectiveThirdParty contained lua_use_default_type -syn keyword ngxDirectiveThirdParty contained lua_worker_thread_vm_pool_size -syn keyword ngxDirectiveThirdParty contained rewrite_by_lua -syn keyword ngxDirectiveThirdParty contained rewrite_by_lua_block -syn keyword ngxDirectiveThirdParty contained rewrite_by_lua_file -syn keyword ngxDirectiveThirdParty contained rewrite_by_lua_no_postpone -syn keyword ngxDirectiveThirdParty contained server_rewrite_by_lua_block -syn keyword ngxDirectiveThirdParty contained server_rewrite_by_lua_file -syn keyword ngxDirectiveThirdParty contained set_by_lua -syn keyword ngxDirectiveThirdParty contained set_by_lua_block -syn keyword ngxDirectiveThirdParty contained set_by_lua_file -syn keyword ngxDirectiveThirdParty contained ssl_certificate_by_lua_block -syn keyword ngxDirectiveThirdParty contained ssl_certificate_by_lua_file -syn keyword ngxDirectiveThirdParty contained ssl_client_hello_by_lua_block -syn keyword ngxDirectiveThirdParty contained ssl_client_hello_by_lua_file -syn keyword ngxDirectiveThirdParty contained ssl_session_fetch_by_lua_block -syn keyword ngxDirectiveThirdParty contained ssl_session_fetch_by_lua_file -syn keyword ngxDirectiveThirdParty contained ssl_session_store_by_lua_block -syn keyword ngxDirectiveThirdParty contained ssl_session_store_by_lua_file - -" https://github.com/Taymindis/nginx-link-function -syn keyword ngxDirectiveThirdParty contained ngx_link_func_add_prop -syn keyword ngxDirectiveThirdParty contained ngx_link_func_add_req_header -syn keyword ngxDirectiveThirdParty contained ngx_link_func_ca_cert -syn keyword ngxDirectiveThirdParty contained ngx_link_func_call -syn keyword ngxDirectiveThirdParty contained ngx_link_func_download_link_lib -syn keyword ngxDirectiveThirdParty contained ngx_link_func_lib -syn keyword ngxDirectiveThirdParty contained ngx_link_func_shm_size -syn keyword ngxDirectiveThirdParty contained ngx_link_func_subrequest - -" https://github.com/openresty/memc-nginx-module -syn keyword ngxDirectiveThirdParty contained memc_buffer_size -syn keyword ngxDirectiveThirdParty contained memc_cmds_allowed -syn keyword ngxDirectiveThirdParty contained memc_connect_timeout -syn keyword ngxDirectiveThirdParty contained memc_flags_to_last_modified -syn keyword ngxDirectiveThirdParty contained memc_ignore_client_abort -syn keyword ngxDirectiveThirdParty contained memc_next_upstream -syn keyword ngxDirectiveThirdParty contained memc_pass -syn keyword ngxDirectiveThirdParty contained memc_read_timeout -syn keyword ngxDirectiveThirdParty contained memc_send_timeout -syn keyword ngxDirectiveThirdParty contained memc_upstream_fail_timeout -syn keyword ngxDirectiveThirdParty contained memc_upstream_max_fails - -" https://github.com/SpiderLabs/ModSecurity-nginx -syn keyword ngxDirectiveThirdParty contained modsecurity -syn keyword ngxDirectiveThirdParty contained modsecurity_rules -syn keyword ngxDirectiveThirdParty contained modsecurity_rules_file -syn keyword ngxDirectiveThirdParty contained modsecurity_rules_remote -syn keyword ngxDirectiveThirdParty contained modsecurity_transaction_id - -" https://github.com/nbs-system/naxsi -syn keyword ngxDirectiveThirdParty contained BasicRule -syn keyword ngxDirectiveThirdParty contained CheckRule -syn keyword ngxDirectiveThirdParty contained DeniedUrl -syn keyword ngxDirectiveThirdParty contained IgnoreCIDR -syn keyword ngxDirectiveThirdParty contained IgnoreIP -syn keyword ngxDirectiveThirdParty contained LearningMode -syn keyword ngxDirectiveThirdParty contained LibInjectionSql -syn keyword ngxDirectiveThirdParty contained LibInjectionXss -syn keyword ngxDirectiveThirdParty contained MainRule -syn keyword ngxDirectiveThirdParty contained NaxsiLogFile -syn keyword ngxDirectiveThirdParty contained SecRulesDisabled -syn keyword ngxDirectiveThirdParty contained SecRulesEnabled -syn keyword ngxDirectiveThirdParty contained basic_rule -syn keyword ngxDirectiveThirdParty contained check_rule -syn keyword ngxDirectiveThirdParty contained denied_url -syn keyword ngxDirectiveThirdParty contained learning_mode -syn keyword ngxDirectiveThirdParty contained libinjection_sql -syn keyword ngxDirectiveThirdParty contained libinjection_xss -syn keyword ngxDirectiveThirdParty contained main_rule -syn keyword ngxDirectiveThirdParty contained naxsi_log -syn keyword ngxDirectiveThirdParty contained rules_disabled -syn keyword ngxDirectiveThirdParty contained rules_enabled - -" https://github.com/opentracing-contrib/nginx-opentracing -syn keyword ngxDirectiveThirdParty contained opentracing -syn keyword ngxDirectiveThirdParty contained opentracing_fastcgi_propagate_context -syn keyword ngxDirectiveThirdParty contained opentracing_grpc_propagate_context -syn keyword ngxDirectiveThirdParty contained opentracing_load_tracer -syn keyword ngxDirectiveThirdParty contained opentracing_location_operation_name -syn keyword ngxDirectiveThirdParty contained opentracing_operation_name -syn keyword ngxDirectiveThirdParty contained opentracing_propagate_context -syn keyword ngxDirectiveThirdParty contained opentracing_tag -syn keyword ngxDirectiveThirdParty contained opentracing_trace_locations -syn keyword ngxDirectiveThirdParty contained opentracing_trust_incoming_span - -" https://github.com/phusion/passenger -syn keyword ngxDirectiveThirdParty contained passenger_abort_on_startup_error -syn keyword ngxDirectiveThirdParty contained passenger_abort_websockets_on_process_shutdown -syn keyword ngxDirectiveThirdParty contained passenger_admin_panel_auth_type -syn keyword ngxDirectiveThirdParty contained passenger_admin_panel_password -syn keyword ngxDirectiveThirdParty contained passenger_admin_panel_url -syn keyword ngxDirectiveThirdParty contained passenger_admin_panel_username -syn keyword ngxDirectiveThirdParty contained passenger_analytics_log_group -syn keyword ngxDirectiveThirdParty contained passenger_analytics_log_user -syn keyword ngxDirectiveThirdParty contained passenger_anonymous_telemetry_proxy -syn keyword ngxDirectiveThirdParty contained passenger_app_env -syn keyword ngxDirectiveThirdParty contained passenger_app_file_descriptor_ulimit -syn keyword ngxDirectiveThirdParty contained passenger_app_group_name -syn keyword ngxDirectiveThirdParty contained passenger_app_log_file -syn keyword ngxDirectiveThirdParty contained passenger_app_rights -syn keyword ngxDirectiveThirdParty contained passenger_app_root -syn keyword ngxDirectiveThirdParty contained passenger_app_start_command -syn keyword ngxDirectiveThirdParty contained passenger_app_type -syn keyword ngxDirectiveThirdParty contained passenger_base_uri -syn keyword ngxDirectiveThirdParty contained passenger_buffer_response -syn keyword ngxDirectiveThirdParty contained passenger_buffer_size -syn keyword ngxDirectiveThirdParty contained passenger_buffer_upload -syn keyword ngxDirectiveThirdParty contained passenger_buffers -syn keyword ngxDirectiveThirdParty contained passenger_busy_buffers_size -syn keyword ngxDirectiveThirdParty contained passenger_concurrency_model -syn keyword ngxDirectiveThirdParty contained passenger_core_file_descriptor_ulimit -syn keyword ngxDirectiveThirdParty contained passenger_ctl -syn keyword ngxDirectiveThirdParty contained passenger_data_buffer_dir -syn keyword ngxDirectiveThirdParty contained passenger_debug_log_file -syn keyword ngxDirectiveThirdParty contained passenger_debugger -syn keyword ngxDirectiveThirdParty contained passenger_default_group -syn keyword ngxDirectiveThirdParty contained passenger_default_user -syn keyword ngxDirectiveThirdParty contained passenger_direct_instance_request_address -syn keyword ngxDirectiveThirdParty contained passenger_disable_anonymous_telemetry -syn keyword ngxDirectiveThirdParty contained passenger_disable_log_prefix -syn keyword ngxDirectiveThirdParty contained passenger_disable_security_update_check -syn keyword ngxDirectiveThirdParty contained passenger_document_root -syn keyword ngxDirectiveThirdParty contained passenger_dump_config_manifest -syn keyword ngxDirectiveThirdParty contained passenger_enabled -syn keyword ngxDirectiveThirdParty contained passenger_env_var -syn keyword ngxDirectiveThirdParty contained passenger_file_descriptor_log_file -syn keyword ngxDirectiveThirdParty contained passenger_fly_with -syn keyword ngxDirectiveThirdParty contained passenger_force_max_concurrent_requests_per_process -syn keyword ngxDirectiveThirdParty contained passenger_friendly_error_pages -syn keyword ngxDirectiveThirdParty contained passenger_group -syn keyword ngxDirectiveThirdParty contained passenger_headers_hash_bucket_size -syn keyword ngxDirectiveThirdParty contained passenger_headers_hash_max_size -syn keyword ngxDirectiveThirdParty contained passenger_ignore_client_abort -syn keyword ngxDirectiveThirdParty contained passenger_ignore_headers -syn keyword ngxDirectiveThirdParty contained passenger_instance_registry_dir -syn keyword ngxDirectiveThirdParty contained passenger_intercept_errors -syn keyword ngxDirectiveThirdParty contained passenger_load_shell_envvars -syn keyword ngxDirectiveThirdParty contained passenger_log_file -syn keyword ngxDirectiveThirdParty contained passenger_log_level -syn keyword ngxDirectiveThirdParty contained passenger_max_instances -syn keyword ngxDirectiveThirdParty contained passenger_max_instances_per_app -syn keyword ngxDirectiveThirdParty contained passenger_max_pool_size -syn keyword ngxDirectiveThirdParty contained passenger_max_preloader_idle_time -syn keyword ngxDirectiveThirdParty contained passenger_max_request_queue_size -syn keyword ngxDirectiveThirdParty contained passenger_max_request_queue_time -syn keyword ngxDirectiveThirdParty contained passenger_max_request_time -syn keyword ngxDirectiveThirdParty contained passenger_max_requests -syn keyword ngxDirectiveThirdParty contained passenger_memory_limit -syn keyword ngxDirectiveThirdParty contained passenger_meteor_app_settings -syn keyword ngxDirectiveThirdParty contained passenger_min_instances -syn keyword ngxDirectiveThirdParty contained passenger_monitor_log_file -syn keyword ngxDirectiveThirdParty contained passenger_nodejs -syn keyword ngxDirectiveThirdParty contained passenger_pass_header -syn keyword ngxDirectiveThirdParty contained passenger_pool_idle_time -syn keyword ngxDirectiveThirdParty contained passenger_pre_start -syn keyword ngxDirectiveThirdParty contained passenger_preload_bundler -syn keyword ngxDirectiveThirdParty contained passenger_python -syn keyword ngxDirectiveThirdParty contained passenger_read_timeout -syn keyword ngxDirectiveThirdParty contained passenger_request_buffering -syn keyword ngxDirectiveThirdParty contained passenger_request_queue_overflow_status_code -syn keyword ngxDirectiveThirdParty contained passenger_resist_deployment_errors -syn keyword ngxDirectiveThirdParty contained passenger_response_buffer_high_watermark -syn keyword ngxDirectiveThirdParty contained passenger_restart_dir -syn keyword ngxDirectiveThirdParty contained passenger_rolling_restarts -syn keyword ngxDirectiveThirdParty contained passenger_root -syn keyword ngxDirectiveThirdParty contained passenger_ruby -syn keyword ngxDirectiveThirdParty contained passenger_security_update_check_proxy -syn keyword ngxDirectiveThirdParty contained passenger_set_header -syn keyword ngxDirectiveThirdParty contained passenger_show_version_in_header -syn keyword ngxDirectiveThirdParty contained passenger_socket_backlog -syn keyword ngxDirectiveThirdParty contained passenger_spawn_dir -syn keyword ngxDirectiveThirdParty contained passenger_spawn_exception_status_code -syn keyword ngxDirectiveThirdParty contained passenger_spawn_method -syn keyword ngxDirectiveThirdParty contained passenger_start_timeout -syn keyword ngxDirectiveThirdParty contained passenger_startup_file -syn keyword ngxDirectiveThirdParty contained passenger_stat_throttle_rate -syn keyword ngxDirectiveThirdParty contained passenger_sticky_sessions -syn keyword ngxDirectiveThirdParty contained passenger_sticky_sessions_cookie_attributes -syn keyword ngxDirectiveThirdParty contained passenger_sticky_sessions_cookie_name -syn keyword ngxDirectiveThirdParty contained passenger_temp_path -syn keyword ngxDirectiveThirdParty contained passenger_thread_count -syn keyword ngxDirectiveThirdParty contained passenger_turbocaching -syn keyword ngxDirectiveThirdParty contained passenger_use_global_queue -syn keyword ngxDirectiveThirdParty contained passenger_user -syn keyword ngxDirectiveThirdParty contained passenger_user_switching -syn keyword ngxDirectiveThirdParty contained passenger_vary_turbocache_by_cookie -syn keyword ngxDirectiveThirdParty contained rack_env -syn keyword ngxDirectiveThirdParty contained rails_app_spawner_idle_time -syn keyword ngxDirectiveThirdParty contained rails_env -syn keyword ngxDirectiveThirdParty contained rails_framework_spawner_idle_time -syn keyword ngxDirectiveThirdParty contained rails_spawn_method -syn keyword ngxDirectiveThirdParty contained union_station_filter -syn keyword ngxDirectiveThirdParty contained union_station_gateway_address -syn keyword ngxDirectiveThirdParty contained union_station_gateway_cert -syn keyword ngxDirectiveThirdParty contained union_station_gateway_port -syn keyword ngxDirectiveThirdParty contained union_station_key -syn keyword ngxDirectiveThirdParty contained union_station_proxy_address -syn keyword ngxDirectiveThirdParty contained union_station_support - -" https://github.com/konstruxi/ngx_postgres -syn keyword ngxDirectiveThirdParty contained postgres_connect_timeout -syn keyword ngxDirectiveThirdParty contained postgres_escape -syn keyword ngxDirectiveThirdParty contained postgres_keepalive -syn keyword ngxDirectiveThirdParty contained postgres_output -syn keyword ngxDirectiveThirdParty contained postgres_pass -syn keyword ngxDirectiveThirdParty contained postgres_query -syn keyword ngxDirectiveThirdParty contained postgres_result_timeout -syn keyword ngxDirectiveThirdParty contained postgres_rewrite -syn keyword ngxDirectiveThirdParty contained postgres_server -syn keyword ngxDirectiveThirdParty contained postgres_set - -" https://github.com/openresty/rds-csv-nginx-module -syn keyword ngxDirectiveThirdParty contained rds_csv -syn keyword ngxDirectiveThirdParty contained rds_csv_buffer_size -syn keyword ngxDirectiveThirdParty contained rds_csv_content_type -syn keyword ngxDirectiveThirdParty contained rds_csv_field_name_header -syn keyword ngxDirectiveThirdParty contained rds_csv_field_separator -syn keyword ngxDirectiveThirdParty contained rds_csv_row_terminator - -" https://github.com/openresty/rds-json-nginx-module -syn keyword ngxDirectiveThirdParty contained rds_json -syn keyword ngxDirectiveThirdParty contained rds_json_buffer_size -syn keyword ngxDirectiveThirdParty contained rds_json_content_type -syn keyword ngxDirectiveThirdParty contained rds_json_errcode_key -syn keyword ngxDirectiveThirdParty contained rds_json_errstr_key -syn keyword ngxDirectiveThirdParty contained rds_json_format -syn keyword ngxDirectiveThirdParty contained rds_json_ret -syn keyword ngxDirectiveThirdParty contained rds_json_root -syn keyword ngxDirectiveThirdParty contained rds_json_success_property -syn keyword ngxDirectiveThirdParty contained rds_json_user_property - -" https://github.com/openresty/redis2-nginx-module -syn keyword ngxDirectiveThirdParty contained redis2_bind -syn keyword ngxDirectiveThirdParty contained redis2_buffer_size -syn keyword ngxDirectiveThirdParty contained redis2_connect_timeout -syn keyword ngxDirectiveThirdParty contained redis2_literal_raw_query -syn keyword ngxDirectiveThirdParty contained redis2_next_upstream -syn keyword ngxDirectiveThirdParty contained redis2_pass -syn keyword ngxDirectiveThirdParty contained redis2_query -syn keyword ngxDirectiveThirdParty contained redis2_raw_queries -syn keyword ngxDirectiveThirdParty contained redis2_raw_query -syn keyword ngxDirectiveThirdParty contained redis2_read_timeout -syn keyword ngxDirectiveThirdParty contained redis2_send_timeout - -" https://github.com/arut/nginx-rtmp-module -syn keyword ngxDirectiveThirdParty contained ack_window -syn keyword ngxDirectiveThirdParty contained application -syn keyword ngxDirectiveThirdParty contained buffer -syn keyword ngxDirectiveThirdParty contained buflen -syn keyword ngxDirectiveThirdParty contained busy -syn keyword ngxDirectiveThirdParty contained chunk_size -syn keyword ngxDirectiveThirdParty contained dash -syn keyword ngxDirectiveThirdParty contained dash_cleanup -syn keyword ngxDirectiveThirdParty contained dash_fragment -syn keyword ngxDirectiveThirdParty contained dash_nested -syn keyword ngxDirectiveThirdParty contained dash_path -syn keyword ngxDirectiveThirdParty contained dash_playlist_length -syn keyword ngxDirectiveThirdParty contained drop_idle_publisher -syn keyword ngxDirectiveThirdParty contained exec -syn keyword ngxDirectiveThirdParty contained exec_block -syn keyword ngxDirectiveThirdParty contained exec_kill_signal -syn keyword ngxDirectiveThirdParty contained exec_options -syn keyword ngxDirectiveThirdParty contained exec_play -syn keyword ngxDirectiveThirdParty contained exec_play_done -syn keyword ngxDirectiveThirdParty contained exec_publish -syn keyword ngxDirectiveThirdParty contained exec_publish_done -syn keyword ngxDirectiveThirdParty contained exec_pull -syn keyword ngxDirectiveThirdParty contained exec_push -syn keyword ngxDirectiveThirdParty contained exec_record_done -syn keyword ngxDirectiveThirdParty contained exec_static -syn keyword ngxDirectiveThirdParty contained hls_audio_buffer_size -syn keyword ngxDirectiveThirdParty contained hls_base_url -syn keyword ngxDirectiveThirdParty contained hls_cleanup -syn keyword ngxDirectiveThirdParty contained hls_continuous -syn keyword ngxDirectiveThirdParty contained hls_fragment_naming -syn keyword ngxDirectiveThirdParty contained hls_fragment_naming_granularity -syn keyword ngxDirectiveThirdParty contained hls_fragment_slicing -syn keyword ngxDirectiveThirdParty contained hls_fragments_per_key -syn keyword ngxDirectiveThirdParty contained hls_key_path -syn keyword ngxDirectiveThirdParty contained hls_key_url -syn keyword ngxDirectiveThirdParty contained hls_keys -syn keyword ngxDirectiveThirdParty contained hls_max_audio_delay -syn keyword ngxDirectiveThirdParty contained hls_max_fragment -syn keyword ngxDirectiveThirdParty contained hls_muxdelay -syn keyword ngxDirectiveThirdParty contained hls_nested -syn keyword ngxDirectiveThirdParty contained hls_path -syn keyword ngxDirectiveThirdParty contained hls_playlist_length -syn keyword ngxDirectiveThirdParty contained hls_sync -syn keyword ngxDirectiveThirdParty contained hls_type -syn keyword ngxDirectiveThirdParty contained hls_variant -syn keyword ngxDirectiveThirdParty contained idle_streams -syn keyword ngxDirectiveThirdParty contained interleave -syn keyword ngxDirectiveThirdParty contained live -syn keyword ngxDirectiveThirdParty contained max_connections -syn keyword ngxDirectiveThirdParty contained max_message -syn keyword ngxDirectiveThirdParty contained max_streams -syn keyword ngxDirectiveThirdParty contained meta -syn keyword ngxDirectiveThirdParty contained netcall_buffer -syn keyword ngxDirectiveThirdParty contained netcall_timeout -syn keyword ngxDirectiveThirdParty contained notify_method -syn keyword ngxDirectiveThirdParty contained notify_relay_redirect -syn keyword ngxDirectiveThirdParty contained notify_update_strict -syn keyword ngxDirectiveThirdParty contained notify_update_timeout -syn keyword ngxDirectiveThirdParty contained on_connect -syn keyword ngxDirectiveThirdParty contained on_disconnect -syn keyword ngxDirectiveThirdParty contained on_done -syn keyword ngxDirectiveThirdParty contained on_play -syn keyword ngxDirectiveThirdParty contained on_play_done -syn keyword ngxDirectiveThirdParty contained on_publish -syn keyword ngxDirectiveThirdParty contained on_publish_done -syn keyword ngxDirectiveThirdParty contained on_record_done -syn keyword ngxDirectiveThirdParty contained on_update -syn keyword ngxDirectiveThirdParty contained out_cork -syn keyword ngxDirectiveThirdParty contained out_queue -syn keyword ngxDirectiveThirdParty contained ping -syn keyword ngxDirectiveThirdParty contained ping_timeout -syn keyword ngxDirectiveThirdParty contained play -syn keyword ngxDirectiveThirdParty contained play_local_path -syn keyword ngxDirectiveThirdParty contained play_restart -syn keyword ngxDirectiveThirdParty contained play_temp_path -syn keyword ngxDirectiveThirdParty contained play_time_fix -syn keyword ngxDirectiveThirdParty contained publish_notify -syn keyword ngxDirectiveThirdParty contained publish_time_fix -syn keyword ngxDirectiveThirdParty contained pull -syn keyword ngxDirectiveThirdParty contained pull_reconnect -syn keyword ngxDirectiveThirdParty contained push -syn keyword ngxDirectiveThirdParty contained push_reconnect -syn keyword ngxDirectiveThirdParty contained record -syn keyword ngxDirectiveThirdParty contained record_append -syn keyword ngxDirectiveThirdParty contained record_interval -syn keyword ngxDirectiveThirdParty contained record_lock -syn keyword ngxDirectiveThirdParty contained record_max_frames -syn keyword ngxDirectiveThirdParty contained record_max_size -syn keyword ngxDirectiveThirdParty contained record_notify -syn keyword ngxDirectiveThirdParty contained record_path -syn keyword ngxDirectiveThirdParty contained record_suffix -syn keyword ngxDirectiveThirdParty contained record_unique -syn keyword ngxDirectiveThirdParty contained recorder -syn keyword ngxDirectiveThirdParty contained relay_buffer -syn keyword ngxDirectiveThirdParty contained respawn -syn keyword ngxDirectiveThirdParty contained respawn_timeout -syn keyword ngxDirectiveThirdParty contained rtmp -syn keyword ngxDirectiveThirdParty contained rtmp_auto_push -syn keyword ngxDirectiveThirdParty contained rtmp_auto_push_reconnect -syn keyword ngxDirectiveThirdParty contained rtmp_control -syn keyword ngxDirectiveThirdParty contained rtmp_socket_dir -syn keyword ngxDirectiveThirdParty contained rtmp_stat -syn keyword ngxDirectiveThirdParty contained rtmp_stat_stylesheet -syn keyword ngxDirectiveThirdParty contained session_relay -syn keyword ngxDirectiveThirdParty contained so_keepalive -syn keyword ngxDirectiveThirdParty contained stream_buckets -syn keyword ngxDirectiveThirdParty contained sync -syn keyword ngxDirectiveThirdParty contained wait_key -syn keyword ngxDirectiveThirdParty contained wait_video - -" https://github.com/openresty/set-misc-nginx-module -syn keyword ngxDirectiveThirdParty contained set_base32_alphabet -syn keyword ngxDirectiveThirdParty contained set_base32_padding -syn keyword ngxDirectiveThirdParty contained set_decode_base32 -syn keyword ngxDirectiveThirdParty contained set_decode_base64 -syn keyword ngxDirectiveThirdParty contained set_decode_base64url -syn keyword ngxDirectiveThirdParty contained set_decode_hex -syn keyword ngxDirectiveThirdParty contained set_encode_base32 -syn keyword ngxDirectiveThirdParty contained set_encode_base64 -syn keyword ngxDirectiveThirdParty contained set_encode_base64url -syn keyword ngxDirectiveThirdParty contained set_encode_hex -syn keyword ngxDirectiveThirdParty contained set_escape_uri -syn keyword ngxDirectiveThirdParty contained set_formatted_gmt_time -syn keyword ngxDirectiveThirdParty contained set_formatted_local_time -syn keyword ngxDirectiveThirdParty contained set_hashed_upstream -syn keyword ngxDirectiveThirdParty contained set_hmac_sha1 -syn keyword ngxDirectiveThirdParty contained set_hmac_sha256 -syn keyword ngxDirectiveThirdParty contained set_if_empty -syn keyword ngxDirectiveThirdParty contained set_local_today -syn keyword ngxDirectiveThirdParty contained set_md5 -syn keyword ngxDirectiveThirdParty contained set_misc_base32_padding -syn keyword ngxDirectiveThirdParty contained set_quote_json_str -syn keyword ngxDirectiveThirdParty contained set_quote_pgsql_str -syn keyword ngxDirectiveThirdParty contained set_quote_sql_str -syn keyword ngxDirectiveThirdParty contained set_random -syn keyword ngxDirectiveThirdParty contained set_rotate -syn keyword ngxDirectiveThirdParty contained set_secure_random_alphanum -syn keyword ngxDirectiveThirdParty contained set_secure_random_lcalpha -syn keyword ngxDirectiveThirdParty contained set_sha1 -syn keyword ngxDirectiveThirdParty contained set_unescape_uri - -" https://github.com/sflow/nginx-sflow-module -syn keyword ngxDirectiveThirdParty contained sflow - -" https://github.com/nginx-shib/nginx-http-shibboleth -syn keyword ngxDirectiveThirdParty contained shib_request -syn keyword ngxDirectiveThirdParty contained shib_request_set -syn keyword ngxDirectiveThirdParty contained shib_request_use_headers - -" https://github.com/baysao/ngx_slowfs_cache -syn keyword ngxDirectiveThirdParty contained slowfs_big_file_size -syn keyword ngxDirectiveThirdParty contained slowfs_cache -syn keyword ngxDirectiveThirdParty contained slowfs_cache_key -syn keyword ngxDirectiveThirdParty contained slowfs_cache_min_uses -syn keyword ngxDirectiveThirdParty contained slowfs_cache_path -syn keyword ngxDirectiveThirdParty contained slowfs_cache_purge -syn keyword ngxDirectiveThirdParty contained slowfs_cache_valid -syn keyword ngxDirectiveThirdParty contained slowfs_temp_path - -" https://github.com/openresty/srcache-nginx-module -syn keyword ngxDirectiveThirdParty contained srcache_buffer -syn keyword ngxDirectiveThirdParty contained srcache_default_expire -syn keyword ngxDirectiveThirdParty contained srcache_fetch -syn keyword ngxDirectiveThirdParty contained srcache_fetch_skip -syn keyword ngxDirectiveThirdParty contained srcache_header_buffer_size -syn keyword ngxDirectiveThirdParty contained srcache_ignore_content_encoding -syn keyword ngxDirectiveThirdParty contained srcache_max_expire -syn keyword ngxDirectiveThirdParty contained srcache_methods -syn keyword ngxDirectiveThirdParty contained srcache_request_cache_control -syn keyword ngxDirectiveThirdParty contained srcache_response_cache_control -syn keyword ngxDirectiveThirdParty contained srcache_store -syn keyword ngxDirectiveThirdParty contained srcache_store_hide_header -syn keyword ngxDirectiveThirdParty contained srcache_store_max_size -syn keyword ngxDirectiveThirdParty contained srcache_store_no_cache -syn keyword ngxDirectiveThirdParty contained srcache_store_no_store -syn keyword ngxDirectiveThirdParty contained srcache_store_pass_header -syn keyword ngxDirectiveThirdParty contained srcache_store_private -syn keyword ngxDirectiveThirdParty contained srcache_store_ranges -syn keyword ngxDirectiveThirdParty contained srcache_store_skip -syn keyword ngxDirectiveThirdParty contained srcache_store_statuses - -" https://github.com/kaltura/nginx-vod-module -syn keyword ngxDirectiveThirdParty contained vod -syn keyword ngxDirectiveThirdParty contained vod_align_segments_to_key_frames -syn keyword ngxDirectiveThirdParty contained vod_apply_dynamic_mapping -syn keyword ngxDirectiveThirdParty contained vod_base_url -syn keyword ngxDirectiveThirdParty contained vod_bootstrap_segment_durations -syn keyword ngxDirectiveThirdParty contained vod_cache_buffer_size -syn keyword ngxDirectiveThirdParty contained vod_clip_from_param_name -syn keyword ngxDirectiveThirdParty contained vod_clip_to_param_name -syn keyword ngxDirectiveThirdParty contained vod_drm_clear_lead_segment_count -syn keyword ngxDirectiveThirdParty contained vod_drm_enabled -syn keyword ngxDirectiveThirdParty contained vod_drm_info_cache -syn keyword ngxDirectiveThirdParty contained vod_drm_max_info_length -syn keyword ngxDirectiveThirdParty contained vod_drm_request_uri -syn keyword ngxDirectiveThirdParty contained vod_drm_single_key -syn keyword ngxDirectiveThirdParty contained vod_drm_upstream_location -syn keyword ngxDirectiveThirdParty contained vod_dynamic_clip_map_uri -syn keyword ngxDirectiveThirdParty contained vod_dynamic_mapping_cache -syn keyword ngxDirectiveThirdParty contained vod_encryption_iv_seed -syn keyword ngxDirectiveThirdParty contained vod_expires -syn keyword ngxDirectiveThirdParty contained vod_expires_live -syn keyword ngxDirectiveThirdParty contained vod_expires_live_time_dependent -syn keyword ngxDirectiveThirdParty contained vod_fallback_upstream_location -syn keyword ngxDirectiveThirdParty contained vod_force_continuous_timestamps -syn keyword ngxDirectiveThirdParty contained vod_force_playlist_type_vod -syn keyword ngxDirectiveThirdParty contained vod_force_sequence_index -syn keyword ngxDirectiveThirdParty contained vod_gop_look_ahead -syn keyword ngxDirectiveThirdParty contained vod_gop_look_behind -syn keyword ngxDirectiveThirdParty contained vod_ignore_edit_list -syn keyword ngxDirectiveThirdParty contained vod_initial_read_size -syn keyword ngxDirectiveThirdParty contained vod_lang_param_name -syn keyword ngxDirectiveThirdParty contained vod_last_modified -syn keyword ngxDirectiveThirdParty contained vod_last_modified_types -syn keyword ngxDirectiveThirdParty contained vod_live_mapping_cache -syn keyword ngxDirectiveThirdParty contained vod_live_response_cache -syn keyword ngxDirectiveThirdParty contained vod_live_window_duration -syn keyword ngxDirectiveThirdParty contained vod_manifest_duration_policy -syn keyword ngxDirectiveThirdParty contained vod_manifest_segment_durations_mode -syn keyword ngxDirectiveThirdParty contained vod_mapping_cache -syn keyword ngxDirectiveThirdParty contained vod_max_frame_count -syn keyword ngxDirectiveThirdParty contained vod_max_frames_size -syn keyword ngxDirectiveThirdParty contained vod_max_mapping_response_size -syn keyword ngxDirectiveThirdParty contained vod_max_metadata_size -syn keyword ngxDirectiveThirdParty contained vod_max_upstream_headers_size -syn keyword ngxDirectiveThirdParty contained vod_media_set_map_uri -syn keyword ngxDirectiveThirdParty contained vod_media_set_override_json -syn keyword ngxDirectiveThirdParty contained vod_metadata_cache -syn keyword ngxDirectiveThirdParty contained vod_min_single_nalu_per_frame_segment -syn keyword ngxDirectiveThirdParty contained vod_mode -syn keyword ngxDirectiveThirdParty contained vod_multi_uri_suffix -syn keyword ngxDirectiveThirdParty contained vod_notification_uri -syn keyword ngxDirectiveThirdParty contained vod_open_file_thread_pool -syn keyword ngxDirectiveThirdParty contained vod_output_buffer_pool -syn keyword ngxDirectiveThirdParty contained vod_parse_hdlr_name -syn keyword ngxDirectiveThirdParty contained vod_parse_udta_name -syn keyword ngxDirectiveThirdParty contained vod_path_response_postfix -syn keyword ngxDirectiveThirdParty contained vod_path_response_prefix -syn keyword ngxDirectiveThirdParty contained vod_performance_counters -syn keyword ngxDirectiveThirdParty contained vod_proxy_header_name -syn keyword ngxDirectiveThirdParty contained vod_proxy_header_value -syn keyword ngxDirectiveThirdParty contained vod_redirect_segments_url -syn keyword ngxDirectiveThirdParty contained vod_remote_upstream_location -syn keyword ngxDirectiveThirdParty contained vod_response_cache -syn keyword ngxDirectiveThirdParty contained vod_secret_key -syn keyword ngxDirectiveThirdParty contained vod_segment_count_policy -syn keyword ngxDirectiveThirdParty contained vod_segment_duration -syn keyword ngxDirectiveThirdParty contained vod_segment_max_frame_count -syn keyword ngxDirectiveThirdParty contained vod_segments_base_url -syn keyword ngxDirectiveThirdParty contained vod_source_clip_map_uri -syn keyword ngxDirectiveThirdParty contained vod_speed_param_name -syn keyword ngxDirectiveThirdParty contained vod_status -syn keyword ngxDirectiveThirdParty contained vod_time_shift_param_name -syn keyword ngxDirectiveThirdParty contained vod_tracks_param_name -syn keyword ngxDirectiveThirdParty contained vod_upstream_extra_args -syn keyword ngxDirectiveThirdParty contained vod_upstream_location - -" https://github.com/vozlt/nginx-module-vts -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_average_method -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_bypass_limit -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_bypass_stats -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_display -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_display_format -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_display_jsonp -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_display_sum_key -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_dump -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_filter -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_filter_by_host -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_filter_by_set_key -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_filter_check_duplicate -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_filter_max_node -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_histogram_buckets -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_limit -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_limit_check_duplicate -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_limit_traffic -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_limit_traffic_by_set_key -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_set_by_filter -syn keyword ngxDirectiveThirdParty contained vhost_traffic_status_zone - -" https://github.com/openresty/xss-nginx-module -syn keyword ngxDirectiveThirdParty contained xss_callback_arg -syn keyword ngxDirectiveThirdParty contained xss_check_status -syn keyword ngxDirectiveThirdParty contained xss_get -syn keyword ngxDirectiveThirdParty contained xss_input_types -syn keyword ngxDirectiveThirdParty contained xss_output_type -syn keyword ngxDirectiveThirdParty contained xss_override_status - -" https://github.com/tg123/websockify-nginx-module -syn keyword ngxDirectiveThirdParty contained websockify_buffer_size -syn keyword ngxDirectiveThirdParty contained websockify_connect_timeout -syn keyword ngxDirectiveThirdParty contained websockify_pass -syn keyword ngxDirectiveThirdParty contained websockify_read_timeout -syn keyword ngxDirectiveThirdParty contained websockify_send_timeout - -" https://github.com/vozlt/nginx-module-sts -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status_average_method -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status_display -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status_display_format -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status_display_jsonp -syn keyword ngxDirectiveThirdParty contained stream_server_traffic_status_zone +syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline +syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString +syn match ngxComment ' *#.*$' + +syn keyword ngxBoolean on +syn keyword ngxBoolean off + +syn keyword ngxDirectiveBlock http contained +syn keyword ngxDirectiveBlock mail contained +syn keyword ngxDirectiveBlock events contained +syn keyword ngxDirectiveBlock server contained +syn keyword ngxDirectiveBlock types contained +syn keyword ngxDirectiveBlock location contained +syn keyword ngxDirectiveBlock upstream contained +syn keyword ngxDirectiveBlock charset_map contained +syn keyword ngxDirectiveBlock limit_except contained +syn keyword ngxDirectiveBlock if contained +syn keyword ngxDirectiveBlock geo contained +syn keyword ngxDirectiveBlock map contained + +syn keyword ngxDirectiveImportant include +syn keyword ngxDirectiveImportant root +syn keyword ngxDirectiveImportant server +syn keyword ngxDirectiveImportant server_name +syn keyword ngxDirectiveImportant listen +syn keyword ngxDirectiveImportant internal +syn keyword ngxDirectiveImportant proxy_pass +syn keyword ngxDirectiveImportant memcached_pass +syn keyword ngxDirectiveImportant fastcgi_pass +syn keyword ngxDirectiveImportant try_files + +syn keyword ngxDirectiveControl break +syn keyword ngxDirectiveControl return +syn keyword ngxDirectiveControl rewrite +syn keyword ngxDirectiveControl set + +syn keyword ngxDirectiveError error_page +syn keyword ngxDirectiveError post_action + +syn keyword ngxDirectiveDeprecated connections +syn keyword ngxDirectiveDeprecated imap +syn keyword ngxDirectiveDeprecated open_file_cache_retest +syn keyword ngxDirectiveDeprecated optimize_server_names +syn keyword ngxDirectiveDeprecated satisfy_any + +syn keyword ngxDirective accept_mutex +syn keyword ngxDirective accept_mutex_delay +syn keyword ngxDirective access_log +syn keyword ngxDirective add_after_body +syn keyword ngxDirective add_before_body +syn keyword ngxDirective add_header +syn keyword ngxDirective addition_types +syn keyword ngxDirective aio +syn keyword ngxDirective alias +syn keyword ngxDirective allow +syn keyword ngxDirective ancient_browser +syn keyword ngxDirective ancient_browser_value +syn keyword ngxDirective auth_basic +syn keyword ngxDirective auth_basic_user_file +syn keyword ngxDirective auth_http +syn keyword ngxDirective auth_http_header +syn keyword ngxDirective auth_http_timeout +syn keyword ngxDirective autoindex +syn keyword ngxDirective autoindex_exact_size +syn keyword ngxDirective autoindex_localtime +syn keyword ngxDirective charset +syn keyword ngxDirective charset_types +syn keyword ngxDirective client_body_buffer_size +syn keyword ngxDirective client_body_in_file_only +syn keyword ngxDirective client_body_in_single_buffer +syn keyword ngxDirective client_body_temp_path +syn keyword ngxDirective client_body_timeout +syn keyword ngxDirective client_header_buffer_size +syn keyword ngxDirective client_header_timeout +syn keyword ngxDirective client_max_body_size +syn keyword ngxDirective connection_pool_size +syn keyword ngxDirective create_full_put_path +syn keyword ngxDirective daemon +syn keyword ngxDirective dav_access +syn keyword ngxDirective dav_methods +syn keyword ngxDirective debug_connection +syn keyword ngxDirective debug_points +syn keyword ngxDirective default_type +syn keyword ngxDirective degradation +syn keyword ngxDirective degrade +syn keyword ngxDirective deny +syn keyword ngxDirective devpoll_changes +syn keyword ngxDirective devpoll_events +syn keyword ngxDirective directio +syn keyword ngxDirective directio_alignment +syn keyword ngxDirective empty_gif +syn keyword ngxDirective env +syn keyword ngxDirective epoll_events +syn keyword ngxDirective error_log +syn keyword ngxDirective eventport_events +syn keyword ngxDirective expires +syn keyword ngxDirective fastcgi_bind +syn keyword ngxDirective fastcgi_buffer_size +syn keyword ngxDirective fastcgi_buffers +syn keyword ngxDirective fastcgi_busy_buffers_size +syn keyword ngxDirective fastcgi_cache +syn keyword ngxDirective fastcgi_cache_key +syn keyword ngxDirective fastcgi_cache_methods +syn keyword ngxDirective fastcgi_cache_min_uses +syn keyword ngxDirective fastcgi_cache_path +syn keyword ngxDirective fastcgi_cache_use_stale +syn keyword ngxDirective fastcgi_cache_valid +syn keyword ngxDirective fastcgi_catch_stderr +syn keyword ngxDirective fastcgi_connect_timeout +syn keyword ngxDirective fastcgi_hide_header +syn keyword ngxDirective fastcgi_ignore_client_abort +syn keyword ngxDirective fastcgi_ignore_headers +syn keyword ngxDirective fastcgi_index +syn keyword ngxDirective fastcgi_intercept_errors +syn keyword ngxDirective fastcgi_max_temp_file_size +syn keyword ngxDirective fastcgi_next_upstream +syn keyword ngxDirective fastcgi_param +syn keyword ngxDirective fastcgi_pass_header +syn keyword ngxDirective fastcgi_pass_request_body +syn keyword ngxDirective fastcgi_pass_request_headers +syn keyword ngxDirective fastcgi_read_timeout +syn keyword ngxDirective fastcgi_send_lowat +syn keyword ngxDirective fastcgi_send_timeout +syn keyword ngxDirective fastcgi_split_path_info +syn keyword ngxDirective fastcgi_store +syn keyword ngxDirective fastcgi_store_access +syn keyword ngxDirective fastcgi_temp_file_write_size +syn keyword ngxDirective fastcgi_temp_path +syn keyword ngxDirective fastcgi_upstream_fail_timeout +syn keyword ngxDirective fastcgi_upstream_max_fails +syn keyword ngxDirective flv +syn keyword ngxDirective geoip_city +syn keyword ngxDirective geoip_country +syn keyword ngxDirective google_perftools_profiles +syn keyword ngxDirective gzip +syn keyword ngxDirective gzip_buffers +syn keyword ngxDirective gzip_comp_level +syn keyword ngxDirective gzip_disable +syn keyword ngxDirective gzip_hash +syn keyword ngxDirective gzip_http_version +syn keyword ngxDirective gzip_min_length +syn keyword ngxDirective gzip_no_buffer +syn keyword ngxDirective gzip_proxied +syn keyword ngxDirective gzip_static +syn keyword ngxDirective gzip_types +syn keyword ngxDirective gzip_vary +syn keyword ngxDirective gzip_window +syn keyword ngxDirective if_modified_since +syn keyword ngxDirective ignore_invalid_headers +syn keyword ngxDirective image_filter +syn keyword ngxDirective image_filter_buffer +syn keyword ngxDirective image_filter_jpeg_quality +syn keyword ngxDirective image_filter_transparency +syn keyword ngxDirective imap_auth +syn keyword ngxDirective imap_capabilities +syn keyword ngxDirective imap_client_buffer +syn keyword ngxDirective index +syn keyword ngxDirective ip_hash +syn keyword ngxDirective keepalive_requests +syn keyword ngxDirective keepalive_timeout +syn keyword ngxDirective kqueue_changes +syn keyword ngxDirective kqueue_events +syn keyword ngxDirective large_client_header_buffers +syn keyword ngxDirective limit_conn +syn keyword ngxDirective limit_conn_log_level +syn keyword ngxDirective limit_rate +syn keyword ngxDirective limit_rate_after +syn keyword ngxDirective limit_req +syn keyword ngxDirective limit_req_log_level +syn keyword ngxDirective limit_req_zone +syn keyword ngxDirective limit_zone +syn keyword ngxDirective lingering_time +syn keyword ngxDirective lingering_timeout +syn keyword ngxDirective lock_file +syn keyword ngxDirective log_format +syn keyword ngxDirective log_not_found +syn keyword ngxDirective log_subrequest +syn keyword ngxDirective map_hash_bucket_size +syn keyword ngxDirective map_hash_max_size +syn keyword ngxDirective master_process +syn keyword ngxDirective memcached_bind +syn keyword ngxDirective memcached_buffer_size +syn keyword ngxDirective memcached_connect_timeout +syn keyword ngxDirective memcached_next_upstream +syn keyword ngxDirective memcached_read_timeout +syn keyword ngxDirective memcached_send_timeout +syn keyword ngxDirective memcached_upstream_fail_timeout +syn keyword ngxDirective memcached_upstream_max_fails +syn keyword ngxDirective merge_slashes +syn keyword ngxDirective min_delete_depth +syn keyword ngxDirective modern_browser +syn keyword ngxDirective modern_browser_value +syn keyword ngxDirective msie_padding +syn keyword ngxDirective msie_refresh +syn keyword ngxDirective multi_accept +syn keyword ngxDirective open_file_cache +syn keyword ngxDirective open_file_cache_errors +syn keyword ngxDirective open_file_cache_events +syn keyword ngxDirective open_file_cache_min_uses +syn keyword ngxDirective open_file_cache_valid +syn keyword ngxDirective open_log_file_cache +syn keyword ngxDirective output_buffers +syn keyword ngxDirective override_charset +syn keyword ngxDirective perl +syn keyword ngxDirective perl_modules +syn keyword ngxDirective perl_require +syn keyword ngxDirective perl_set +syn keyword ngxDirective pid +syn keyword ngxDirective pop3_auth +syn keyword ngxDirective pop3_capabilities +syn keyword ngxDirective port_in_redirect +syn keyword ngxDirective postpone_gzipping +syn keyword ngxDirective postpone_output +syn keyword ngxDirective protocol +syn keyword ngxDirective proxy +syn keyword ngxDirective proxy_bind +syn keyword ngxDirective proxy_buffer +syn keyword ngxDirective proxy_buffer_size +syn keyword ngxDirective proxy_buffering +syn keyword ngxDirective proxy_buffers +syn keyword ngxDirective proxy_busy_buffers_size +syn keyword ngxDirective proxy_cache +syn keyword ngxDirective proxy_cache_key +syn keyword ngxDirective proxy_cache_methods +syn keyword ngxDirective proxy_cache_min_uses +syn keyword ngxDirective proxy_cache_path +syn keyword ngxDirective proxy_cache_use_stale +syn keyword ngxDirective proxy_cache_valid +syn keyword ngxDirective proxy_connect_timeout +syn keyword ngxDirective proxy_headers_hash_bucket_size +syn keyword ngxDirective proxy_headers_hash_max_size +syn keyword ngxDirective proxy_hide_header +syn keyword ngxDirective proxy_ignore_client_abort +syn keyword ngxDirective proxy_ignore_headers +syn keyword ngxDirective proxy_intercept_errors +syn keyword ngxDirective proxy_max_temp_file_size +syn keyword ngxDirective proxy_method +syn keyword ngxDirective proxy_next_upstream +syn keyword ngxDirective proxy_pass_error_message +syn keyword ngxDirective proxy_pass_header +syn keyword ngxDirective proxy_pass_request_body +syn keyword ngxDirective proxy_pass_request_headers +syn keyword ngxDirective proxy_read_timeout +syn keyword ngxDirective proxy_redirect +syn keyword ngxDirective proxy_send_lowat +syn keyword ngxDirective proxy_send_timeout +syn keyword ngxDirective proxy_set_body +syn keyword ngxDirective proxy_set_header +syn keyword ngxDirective proxy_ssl_session_reuse +syn keyword ngxDirective proxy_store +syn keyword ngxDirective proxy_store_access +syn keyword ngxDirective proxy_temp_file_write_size +syn keyword ngxDirective proxy_temp_path +syn keyword ngxDirective proxy_timeout +syn keyword ngxDirective proxy_upstream_fail_timeout +syn keyword ngxDirective proxy_upstream_max_fails +syn keyword ngxDirective random_index +syn keyword ngxDirective read_ahead +syn keyword ngxDirective real_ip_header +syn keyword ngxDirective recursive_error_pages +syn keyword ngxDirective request_pool_size +syn keyword ngxDirective reset_timedout_connection +syn keyword ngxDirective resolver +syn keyword ngxDirective resolver_timeout +syn keyword ngxDirective rewrite_log +syn keyword ngxDirective rtsig_overflow_events +syn keyword ngxDirective rtsig_overflow_test +syn keyword ngxDirective rtsig_overflow_threshold +syn keyword ngxDirective rtsig_signo +syn keyword ngxDirective satisfy +syn keyword ngxDirective secure_link_secret +syn keyword ngxDirective send_lowat +syn keyword ngxDirective send_timeout +syn keyword ngxDirective sendfile +syn keyword ngxDirective sendfile_max_chunk +syn keyword ngxDirective server_name_in_redirect +syn keyword ngxDirective server_names_hash_bucket_size +syn keyword ngxDirective server_names_hash_max_size +syn keyword ngxDirective server_tokens +syn keyword ngxDirective set_real_ip_from +syn keyword ngxDirective smtp_auth +syn keyword ngxDirective smtp_capabilities +syn keyword ngxDirective smtp_client_buffer +syn keyword ngxDirective smtp_greeting_delay +syn keyword ngxDirective so_keepalive +syn keyword ngxDirective source_charset +syn keyword ngxDirective ssi +syn keyword ngxDirective ssi_ignore_recycled_buffers +syn keyword ngxDirective ssi_min_file_chunk +syn keyword ngxDirective ssi_silent_errors +syn keyword ngxDirective ssi_types +syn keyword ngxDirective ssi_value_length +syn keyword ngxDirective ssl +syn keyword ngxDirective ssl_certificate +syn keyword ngxDirective ssl_certificate_key +syn keyword ngxDirective ssl_ciphers +syn keyword ngxDirective ssl_client_certificate +syn keyword ngxDirective ssl_crl +syn keyword ngxDirective ssl_dhparam +syn keyword ngxDirective ssl_engine +syn keyword ngxDirective ssl_prefer_server_ciphers +syn keyword ngxDirective ssl_protocols +syn keyword ngxDirective ssl_session_cache +syn keyword ngxDirective ssl_session_timeout +syn keyword ngxDirective ssl_verify_client +syn keyword ngxDirective ssl_verify_depth +syn keyword ngxDirective starttls +syn keyword ngxDirective stub_status +syn keyword ngxDirective sub_filter +syn keyword ngxDirective sub_filter_once +syn keyword ngxDirective sub_filter_types +syn keyword ngxDirective tcp_nodelay +syn keyword ngxDirective tcp_nopush +syn keyword ngxDirective thread_stack_size +syn keyword ngxDirective timeout +syn keyword ngxDirective timer_resolution +syn keyword ngxDirective types_hash_bucket_size +syn keyword ngxDirective types_hash_max_size +syn keyword ngxDirective underscores_in_headers +syn keyword ngxDirective uninitialized_variable_warn +syn keyword ngxDirective use +syn keyword ngxDirective user +syn keyword ngxDirective userid +syn keyword ngxDirective userid_domain +syn keyword ngxDirective userid_expires +syn keyword ngxDirective userid_mark +syn keyword ngxDirective userid_name +syn keyword ngxDirective userid_p3p +syn keyword ngxDirective userid_path +syn keyword ngxDirective userid_service +syn keyword ngxDirective valid_referers +syn keyword ngxDirective variables_hash_bucket_size +syn keyword ngxDirective variables_hash_max_size +syn keyword ngxDirective worker_connections +syn keyword ngxDirective worker_cpu_affinity +syn keyword ngxDirective worker_priority +syn keyword ngxDirective worker_processes +syn keyword ngxDirective worker_rlimit_core +syn keyword ngxDirective worker_rlimit_nofile +syn keyword ngxDirective worker_rlimit_sigpending +syn keyword ngxDirective worker_threads +syn keyword ngxDirective working_directory +syn keyword ngxDirective xclient +syn keyword ngxDirective xml_entities +syn keyword ngxDirective xslt_stylesheet +syn keyword ngxDirective xslt_types + +" 3rd party module list: +" http://wiki.nginx.org/Nginx3rdPartyModules + +" Accept Language Module +" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales. +syn keyword ngxDirectiveThirdParty set_from_accept_language + +" Access Key Module +" Denies access unless the request URL contains an access key. +syn keyword ngxDirectiveThirdParty accesskey +syn keyword ngxDirectiveThirdParty accesskey_arg +syn keyword ngxDirectiveThirdParty accesskey_hashmethod +syn keyword ngxDirectiveThirdParty accesskey_signature + +" Auth PAM Module +" HTTP Basic Authentication using PAM. +syn keyword ngxDirectiveThirdParty auth_pam +syn keyword ngxDirectiveThirdParty auth_pam_service_name + +" Cache Purge Module +" Module adding ability to purge content from FastCGI and proxy caches. +syn keyword ngxDirectiveThirdParty fastcgi_cache_purge +syn keyword ngxDirectiveThirdParty proxy_cache_purge + +" Chunkin Module +" HTTP 1.1 chunked-encoding request body support for Nginx. +syn keyword ngxDirectiveThirdParty chunkin +syn keyword ngxDirectiveThirdParty chunkin_keepalive +syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf +syn keyword ngxDirectiveThirdParty chunkin_resume + +" Circle GIF Module +" Generates simple circle images with the colors and size specified in the URL. +syn keyword ngxDirectiveThirdParty circle_gif +syn keyword ngxDirectiveThirdParty circle_gif_max_radius +syn keyword ngxDirectiveThirdParty circle_gif_min_radius +syn keyword ngxDirectiveThirdParty circle_gif_step_radius + +" Drizzle Module +" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle. +syn keyword ngxDirectiveThirdParty drizzle_connect_timeout +syn keyword ngxDirectiveThirdParty drizzle_dbname +syn keyword ngxDirectiveThirdParty drizzle_keepalive +syn keyword ngxDirectiveThirdParty drizzle_module_header +syn keyword ngxDirectiveThirdParty drizzle_pass +syn keyword ngxDirectiveThirdParty drizzle_query +syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout +syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout +syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout +syn keyword ngxDirectiveThirdParty drizzle_server + +" Echo Module +" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file. +syn keyword ngxDirectiveThirdParty echo +syn keyword ngxDirectiveThirdParty echo_after_body +syn keyword ngxDirectiveThirdParty echo_before_body +syn keyword ngxDirectiveThirdParty echo_blocking_sleep +syn keyword ngxDirectiveThirdParty echo_duplicate +syn keyword ngxDirectiveThirdParty echo_end +syn keyword ngxDirectiveThirdParty echo_exec +syn keyword ngxDirectiveThirdParty echo_flush +syn keyword ngxDirectiveThirdParty echo_foreach_split +syn keyword ngxDirectiveThirdParty echo_location +syn keyword ngxDirectiveThirdParty echo_location_async +syn keyword ngxDirectiveThirdParty echo_read_request_body +syn keyword ngxDirectiveThirdParty echo_request_body +syn keyword ngxDirectiveThirdParty echo_reset_timer +syn keyword ngxDirectiveThirdParty echo_sleep +syn keyword ngxDirectiveThirdParty echo_subrequest +syn keyword ngxDirectiveThirdParty echo_subrequest_async + +" Events Module +" Privides options for start/stop events. +syn keyword ngxDirectiveThirdParty on_start +syn keyword ngxDirectiveThirdParty on_stop + +" EY Balancer Module +" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream. +syn keyword ngxDirectiveThirdParty max_connections +syn keyword ngxDirectiveThirdParty max_connections_max_queue_length +syn keyword ngxDirectiveThirdParty max_connections_queue_timeout + +" Fancy Indexes Module +" Like the built-in autoindex module, but fancier. +syn keyword ngxDirectiveThirdParty fancyindex +syn keyword ngxDirectiveThirdParty fancyindex_exact_size +syn keyword ngxDirectiveThirdParty fancyindex_footer +syn keyword ngxDirectiveThirdParty fancyindex_header +syn keyword ngxDirectiveThirdParty fancyindex_localtime +syn keyword ngxDirectiveThirdParty fancyindex_readme +syn keyword ngxDirectiveThirdParty fancyindex_readme_mode + +" GeoIP Module (DEPRECATED) +" Country code lookups via the MaxMind GeoIP API. +syn keyword ngxDirectiveThirdParty geoip_country_file + +" Headers More Module +" Set and clear input and output headers...more than "add"! +syn keyword ngxDirectiveThirdParty more_clear_headers +syn keyword ngxDirectiveThirdParty more_clear_input_headers +syn keyword ngxDirectiveThirdParty more_set_headers +syn keyword ngxDirectiveThirdParty more_set_input_headers + +" HTTP Push Module +" Turn Nginx into an adept long-polling HTTP Push (Comet) server. +syn keyword ngxDirectiveThirdParty push_buffer_size +syn keyword ngxDirectiveThirdParty push_listener +syn keyword ngxDirectiveThirdParty push_message_timeout +syn keyword ngxDirectiveThirdParty push_queue_messages +syn keyword ngxDirectiveThirdParty push_sender + +" HTTP Redis Module > +" Redis support.> +syn keyword ngxDirectiveThirdParty redis_bind +syn keyword ngxDirectiveThirdParty redis_buffer_size +syn keyword ngxDirectiveThirdParty redis_connect_timeout +syn keyword ngxDirectiveThirdParty redis_next_upstream +syn keyword ngxDirectiveThirdParty redis_pass +syn keyword ngxDirectiveThirdParty redis_read_timeout +syn keyword ngxDirectiveThirdParty redis_send_timeout + +" HTTP JavaScript Module +" Embedding SpiderMonkey. Nearly full port on Perl module. +syn keyword ngxDirectiveThirdParty js +syn keyword ngxDirectiveThirdParty js_filter +syn keyword ngxDirectiveThirdParty js_filter_types +syn keyword ngxDirectiveThirdParty js_load +syn keyword ngxDirectiveThirdParty js_maxmem +syn keyword ngxDirectiveThirdParty js_require +syn keyword ngxDirectiveThirdParty js_set +syn keyword ngxDirectiveThirdParty js_utf8 + +" Log Request Speed +" Log the time it took to process each request. +syn keyword ngxDirectiveThirdParty log_request_speed_filter +syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout + +" Memc Module +" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands. +syn keyword ngxDirectiveThirdParty memc_buffer_size +syn keyword ngxDirectiveThirdParty memc_cmds_allowed +syn keyword ngxDirectiveThirdParty memc_connect_timeout +syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified +syn keyword ngxDirectiveThirdParty memc_next_upstream +syn keyword ngxDirectiveThirdParty memc_pass +syn keyword ngxDirectiveThirdParty memc_read_timeout +syn keyword ngxDirectiveThirdParty memc_send_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout +syn keyword ngxDirectiveThirdParty memc_upstream_max_fails + +" Mogilefs Module +" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS. +syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout +syn keyword ngxDirectiveThirdParty mogilefs_domain +syn keyword ngxDirectiveThirdParty mogilefs_methods +syn keyword ngxDirectiveThirdParty mogilefs_noverify +syn keyword ngxDirectiveThirdParty mogilefs_pass +syn keyword ngxDirectiveThirdParty mogilefs_read_timeout +syn keyword ngxDirectiveThirdParty mogilefs_send_timeout +syn keyword ngxDirectiveThirdParty mogilefs_tracker + +" MP4 Streaming Lite Module +" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL. +syn keyword ngxDirectiveThirdParty mp4 + +" Nginx Notice Module +" Serve static file to POST requests. +syn keyword ngxDirectiveThirdParty notice +syn keyword ngxDirectiveThirdParty notice_type + +" Phusion Passenger +" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers. +syn keyword ngxDirectiveThirdParty passenger_base_uri +syn keyword ngxDirectiveThirdParty passenger_default_user +syn keyword ngxDirectiveThirdParty passenger_enabled +syn keyword ngxDirectiveThirdParty passenger_log_level +syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app +syn keyword ngxDirectiveThirdParty passenger_max_pool_size +syn keyword ngxDirectiveThirdParty passenger_pool_idle_time +syn keyword ngxDirectiveThirdParty passenger_root +syn keyword ngxDirectiveThirdParty passenger_ruby +syn keyword ngxDirectiveThirdParty passenger_use_global_queue +syn keyword ngxDirectiveThirdParty passenger_user_switching +syn keyword ngxDirectiveThirdParty rack_env +syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_env +syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time +syn keyword ngxDirectiveThirdParty rails_spawn_method + +" RDS JSON Module +" Help ngx_drizzle and other DBD modules emit JSON data. +syn keyword ngxDirectiveThirdParty rds_json +syn keyword ngxDirectiveThirdParty rds_json_content_type +syn keyword ngxDirectiveThirdParty rds_json_format +syn keyword ngxDirectiveThirdParty rds_json_ret + +" RRD Graph Module +" This module provides an HTTP interface to RRDtool's graphing facilities. +syn keyword ngxDirectiveThirdParty rrd_graph +syn keyword ngxDirectiveThirdParty rrd_graph_root + +" Secure Download +" Create expiring links. +syn keyword ngxDirectiveThirdParty secure_download +syn keyword ngxDirectiveThirdParty secure_download_fail_location +syn keyword ngxDirectiveThirdParty secure_download_path_mode +syn keyword ngxDirectiveThirdParty secure_download_secret + +" SlowFS Cache Module +" Module adding ability to cache static files. +syn keyword ngxDirectiveThirdParty slowfs_big_file_size +syn keyword ngxDirectiveThirdParty slowfs_cache +syn keyword ngxDirectiveThirdParty slowfs_cache_key +syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses +syn keyword ngxDirectiveThirdParty slowfs_cache_path +syn keyword ngxDirectiveThirdParty slowfs_cache_purge +syn keyword ngxDirectiveThirdParty slowfs_cache_valid +syn keyword ngxDirectiveThirdParty slowfs_temp_path + +" Strip Module +" Whitespace remover. +syn keyword ngxDirectiveThirdParty strip + +" Substitutions Module +" A filter module which can do both regular expression and fixed string substitutions on response bodies. +syn keyword ngxDirectiveThirdParty subs_filter +syn keyword ngxDirectiveThirdParty subs_filter_types + +" Supervisord Module +" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand. +syn keyword ngxDirectiveThirdParty supervisord +syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status +syn keyword ngxDirectiveThirdParty supervisord_name +syn keyword ngxDirectiveThirdParty supervisord_start +syn keyword ngxDirectiveThirdParty supervisord_stop + +" Upload Module +" Parses multipart/form-data allowing arbitrary handling of uploaded files. +syn keyword ngxDirectiveThirdParty upload_aggregate_form_field +syn keyword ngxDirectiveThirdParty upload_buffer_size +syn keyword ngxDirectiveThirdParty upload_cleanup +syn keyword ngxDirectiveThirdParty upload_limit_rate +syn keyword ngxDirectiveThirdParty upload_max_file_size +syn keyword ngxDirectiveThirdParty upload_max_output_body_len +syn keyword ngxDirectiveThirdParty upload_max_part_header_len +syn keyword ngxDirectiveThirdParty upload_pass +syn keyword ngxDirectiveThirdParty upload_pass_args +syn keyword ngxDirectiveThirdParty upload_pass_form_field +syn keyword ngxDirectiveThirdParty upload_set_form_field +syn keyword ngxDirectiveThirdParty upload_store +syn keyword ngxDirectiveThirdParty upload_store_access + +" Upload Progress Module +" Tracks and reports upload progress. +syn keyword ngxDirectiveThirdParty report_uploads +syn keyword ngxDirectiveThirdParty track_uploads +syn keyword ngxDirectiveThirdParty upload_progress +syn keyword ngxDirectiveThirdParty upload_progress_content_type +syn keyword ngxDirectiveThirdParty upload_progress_header +syn keyword ngxDirectiveThirdParty upload_progress_json_output +syn keyword ngxDirectiveThirdParty upload_progress_template + +" Upstream Fair Balancer +" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin. +syn keyword ngxDirectiveThirdParty fair +syn keyword ngxDirectiveThirdParty upstream_fair_shm_size + +" Upstream Consistent Hash +" Select backend based on Consistent hash ring. +syn keyword ngxDirectiveThirdParty consistent_hash + +" Upstream Hash Module +" Provides simple upstream load distribution by hashing a configurable variable. +syn keyword ngxDirectiveThirdParty hash +syn keyword ngxDirectiveThirdParty hash_again + +" XSS Module +" Native support for cross-site scripting (XSS) in an nginx. +syn keyword ngxDirectiveThirdParty xss_callback_arg +syn keyword ngxDirectiveThirdParty xss_get +syn keyword ngxDirectiveThirdParty xss_input_types +syn keyword ngxDirectiveThirdParty xss_output_type + +" uWSGI Module +" Allows Nginx to interact with uWSGI processes and control what parameters are passed to the process. +syn keyword ngxDirectiveThirdParty uwsgi_bind +syn keyword ngxDirectiveThirdParty uwsgi_buffer_size +syn keyword ngxDirectiveThirdParty uwsgi_buffering +syn keyword ngxDirectiveThirdParty uwsgi_buffers +syn keyword ngxDirectiveThirdParty uwsgi_busy_buffers_size +syn keyword ngxDirectiveThirdParty uwsgi_cache +syn keyword ngxDirectiveThirdParty uwsgi_cache_bypass +syn keyword ngxDirectiveThirdParty uwsgi_cache_key +syn keyword ngxDirectiveThirdParty uwsgi_cache_lock +syn keyword ngxDirectiveThirdParty uwsgi_cache_lock_timeout +syn keyword ngxDirectiveThirdParty uwsgi_cache_methods +syn keyword ngxDirectiveThirdParty uwsgi_cache_min_uses +syn keyword ngxDirectiveThirdParty uwsgi_cache_path +syn keyword ngxDirectiveThirdParty uwsgi_cache_use_stale +syn keyword ngxDirectiveThirdParty uwsgi_cache_valid +syn keyword ngxDirectiveThirdParty uwsgi_connect_timeout +syn keyword ngxDirectiveThirdParty uwsgi_hide_header +syn keyword ngxDirectiveThirdParty uwsgi_ignore_client_abort +syn keyword ngxDirectiveThirdParty uwsgi_ignore_headers +syn keyword ngxDirectiveThirdParty uwsgi_intercept_errors +syn keyword ngxDirectiveThirdParty uwsgi_max_temp_file_size +syn keyword ngxDirectiveThirdParty uwsgi_modifier1 +syn keyword ngxDirectiveThirdParty uwsgi_modifier2 +syn keyword ngxDirectiveThirdParty uwsgi_next_upstream +syn keyword ngxDirectiveThirdParty uwsgi_no_cache +syn keyword ngxDirectiveThirdParty uwsgi_param +syn keyword ngxDirectiveThirdParty uwsgi_pass +syn keyword ngxDirectiveThirdParty uwsgi_pass_header +syn keyword ngxDirectiveThirdParty uwsgi_pass_request_body +syn keyword ngxDirectiveThirdParty uwsgi_pass_request_headers +syn keyword ngxDirectiveThirdParty uwsgi_read_timeout +syn keyword ngxDirectiveThirdParty uwsgi_send_timeout +syn keyword ngxDirectiveThirdParty uwsgi_store +syn keyword ngxDirectiveThirdParty uwsgi_store_access +syn keyword ngxDirectiveThirdParty uwsgi_string +syn keyword ngxDirectiveThirdParty uwsgi_temp_file_write_size +syn keyword ngxDirectiveThirdParty uwsgi_temp_path " highlight -hi def link ngxComment Comment -hi def link ngxParamComment Comment -hi def link ngxListenComment Comment -hi def link ngxVariable Identifier -hi def link ngxVariableString PreProc -hi def link ngxString String -hi def link ngxListenString String +hi link ngxComment Comment +hi link ngxVariable Identifier +hi link ngxVariableBlock Identifier +hi link ngxVariableString PreProc +hi link ngxBlock Normal +hi link ngxString String -hi def link ngxBoolean Boolean -hi def link ngxDirectiveBlock Statement -hi def link ngxDirectiveImportant Type -hi def link ngxDirectiveListen Type -hi def link ngxDirectiveControl Keyword -hi def link ngxDirectiveError Constant -hi def link ngxDirectiveDeprecated Error -hi def link ngxDirective Identifier -hi def link ngxDirectiveThirdParty Special -hi def link ngxDirectiveThirdPartyDeprecated Error - -hi def link ngxListenOptions Keyword -hi def link ngxListenOptionsDeprecated Error - -let &cpo = s:save_cpo -unlet s:save_cpo +hi link ngxBoolean Boolean +hi link ngxDirectiveBlock Statement +hi link ngxDirectiveImportant Type +hi link ngxDirectiveControl Keyword +hi link ngxDirectiveError Constant +hi link ngxDirectiveDeprecated Error +hi link ngxDirective Identifier +hi link ngxDirectiveThirdParty Special let b:current_syntax = "nginx" diff --git a/debian/README.Packaging b/debian/README.Packaging new file mode 100644 index 0000000..66a88c1 --- /dev/null +++ b/debian/README.Packaging @@ -0,0 +1,66 @@ +Debian Packaging +================ + +We use git-buildpackage for packaging. Our repository can be found at +git.debian.org:/git/collab-maint/nginx.git. + +Workflow for Unstable +===================== + +We use the standard git-buildpackage workflow. + +Workflow for Experimental (not-active) +====================================== + +Now that nginx 1.6.0 is released there is no plan to package mainline 1.7 +releases to experimental. The following guide is been kept as a reference. + +-------- + +Nginx mainline releases (1.5.x series) are been packaged for experimental, +as they lack security support. + +The workflow we use is based on the assumption that packaging work happens on +origin/master and experimental builds are a trivial patch away from that. + +The direct consequense of treating experimental as a patchset for origin/master +is that the relevant branches are forced-pushed whenever we release a new +1.5.x version. In other words, **it is not safe to base your work on the +experimental branch**. + +This is a brief description of our experimental branches and how we are using +them. + +* experimental-base + Force-pushed when origin/master changes. + + experimental-base tracks the changes needed for building the 1.5.x branch, + such as new configure parameters, etc. On new 1.5.x releases, it is rebased + on origin/master so it is always up-to-date with our latest packaging work. + +* experimental + Force-pushed on every 1.5.x release. + + This branch points to the latest 1.5.x release. + Before release this branch is reset to experimental-base, and then merged + with the new upstream-1.5 branch. Finally all the release specific changes + are commited (changelog entry etc) and the build is made. + +* upstream-1.5 + Force-pushed on every 1.5.x release. + + Before a new 1.5.x release the branch is reset to origin/upstream. + This is a technicallity so we can avoid resolving conflicts when a new 1.4.x + release happens between two experimental releases. + +Older 1.5.x releases are not referenced by any branch, but they can be found by +the relevant debian/* tag. + +3rd party experimental workflow +=============================== + +As we described, it is better not base you work on our forced-pushed +experimental branch. A better approach would be to maintain a custom-build +branch that is rebased to our latest experimental branch (basically git rebase +--onto the relevant commits should work). + diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index dc71efa..0000000 --- a/debian/README.source +++ /dev/null @@ -1,63 +0,0 @@ -Debian Packaging -================ - -We use git-buildpackage for packaging. - -Workflow for Unstable -===================== - -We use the standard git-buildpackage workflow. - -Dynamic Modules -=============== - -Since v1.9.11 Nginx added dynamic module support. This will sanitize the -nginx packaging flow in the long term, but there is a lot work to be done -in order to get there. We gradually convert all modules to dynamic -as they add support for it. - -[0] https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/ - -Workflow for Experimental -========================= - -Nginx mainline releases (1.11.x series) are been packaged for experimental, -as they lack security support. - -The workflow we use is based on the assumption that packaging work happens on -origin/master and experimental builds are a trivial patch away from that. - -The direct consequence of treating experimental as a patchset for origin/master -is that the relevant branches are forced-pushed whenever we release a new -1.11.x version. In other words, **it is not safe to base your work on the -experimental branch**. - -This is a brief description of our experimental branches and how we are using -them. - -* experimental-base - Force-pushed when origin/master changes. - - experimental-base tracks the changes needed for building the 1.11.x branch, - such as new configure parameters, etc. On new 1.11.x releases, it is rebased - on origin/master so it is always up-to-date with our latest packaging work. - -* experimental - Force-pushed on every 1.11.x release. - - This branch points to the latest 1.11.x release. - Before release this branch is reset to experimental-base, and then merged - with the new upstream-1.11 branch. Finally all the release specific changes - are commited (changelog entry etc) and the build is made. - -* upstream-1.11 - Pushed on every 1.11.x release. - - Before a new 1.11.x release origin/upstream is dummy merged (-s ours) into - ustream-1.11. This is a technicallity so we can avoid resolving conflicts - when a new 1.10.x release happens between two experimental releases. - -Older 1.11.x releases are not referenced by any branch, but they can be found -by the relevant debian/* tag. - - diff --git a/debian/apport/source_nginx.py b/debian/apport/source_nginx.py deleted file mode 100644 index aec6e8e..0000000 --- a/debian/apport/source_nginx.py +++ /dev/null @@ -1,19 +0,0 @@ -''' -apport package hook for nginx packages - -Copyright (c) 2015, Thomas Ward -''' - -import apport.hookutils -import os -import subprocess - -def add_info(report, ui): - if (report['Package'].split()[0] != 'nginx-common' - and report['ProblemType'] == 'Package' - and os.path.isdir('/run/systemd/system')): - report['Journalctl_Nginx.txt'] = apport.hookutils.command_output( - ['journalctl', '-xe', '--unit=nginx.service']) - report['SystemctlStatusFull_Nginx.txt'] = subprocess.Popen( - ['systemctl', '-l', 'status', 'nginx.service'], - stdout=subprocess.PIPE).communicate()[0] diff --git a/debian/autoscripts/postinst-nginx b/debian/autoscripts/postinst-nginx deleted file mode 100644 index aa376d5..0000000 --- a/debian/autoscripts/postinst-nginx +++ /dev/null @@ -1,26 +0,0 @@ -for confpair in #NAMES# ; do - from=$(echo $confpair | cut -d: -f1) - to=$(echo $confpair | cut -d: -f2) - - if [ -L /etc/nginx/modules-enabled/$to.removed ]; then - rm /etc/nginx/modules-enabled/$to.removed - removed_link=true - else - removed_link=false - fi - - # Symlink on - # 1) Fresh installations - # 2) Reinstalls after automatic removes (preserve admin actions) - if [ -z "$2" -o "$removed_link" = "true" ]; then - ln -sf /usr/share/nginx/modules-available/$from \ - /etc/nginx/modules-enabled/$to - fi -done - -if [ "$1" = "configure" ] ; then - if which dpkg-trigger >/dev/null 2>&1 ; then - dpkg-trigger --no-await nginx-reload - fi - -fi diff --git a/debian/autoscripts/postrm-nginx b/debian/autoscripts/postrm-nginx deleted file mode 100644 index 8769983..0000000 --- a/debian/autoscripts/postrm-nginx +++ /dev/null @@ -1,28 +0,0 @@ -if [ "$1" = "purge" ] ; then - for confpair in #NAMES# ; do - from=$(echo $confpair | cut -d: -f1) - to=$(echo $confpair | cut -d: -f2) - - if [ -L /etc/nginx/modules-enabled/$to ]; then - rm /etc/nginx/modules-enabled/$to - fi - if [ -L /etc/nginx/modules-enabled/$to.removed ]; then - rm /etc/nginx/modules-enabled/$to.removed - fi - done -fi - -if [ "$1" = "remove" ] ; then - for confpair in #NAMES# ; do - from=$(echo $confpair | cut -d: -f1) - to=$(echo $confpair | cut -d: -f2) - - if [ -L /etc/nginx/modules-enabled/$to ]; then - mv /etc/nginx/modules-enabled/$to /etc/nginx/modules-enabled/$to.removed - fi - done - - if which dpkg-trigger >/dev/null 2>&1 ; then - dpkg-trigger --no-await nginx-reload - fi -fi diff --git a/debian/autoscripts/prerm-nginx b/debian/autoscripts/prerm-nginx deleted file mode 100644 index c36a883..0000000 --- a/debian/autoscripts/prerm-nginx +++ /dev/null @@ -1,10 +0,0 @@ -if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ] ; then - for confpair in #NAMES# ; do - from=$(echo $confpair | cut -d: -f1) - to=$(echo $confpair | cut -d: -f2) - - if [ -L /etc/nginx/modules-enabled/$to ]; then - mv /etc/nginx/modules-enabled/$to /etc/nginx/modules-enabled/$to.removed - fi - done -fi diff --git a/debian/changelog b/debian/changelog index 8ec0edd..d94cd14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,867 +1,31 @@ -nginx (1.26.3-3) unstable; urgency=medium +nginx (1.6.2-5+deb8u6) jessie-security; urgency=high - [ Jan Mojžíš ] - * d/changelog: fix whitespace in 1.26.3-2 record - * d/control: add libnginx-mod-http-lua dependency for nginx-extras package - for riscv64 platform + * CVE-2018-16845: Prevent a denial of service vulnerability due to an integer + underflow whilst calculating an MP4 header sizes. Previously, there was no + validation for the size of a 64-bit atom in an MP4 file. This could lead to + a CPU hog when the size is 0 or various other problems due to integer + underflow when the calculating atom data size, including segmentation + faults or even worker-process memory disclosure. (Closes: #913090) - [ Thomas Ward ] - * d/nginx-common.nginx.service: Add ConditionFileIsExecutable to - SystemD service file, prevents starting of service if nginx is - not installed (which can happen if nginx-common is installed - independently from `nginx` itself (Closes: #1098477) + -- Chris Lamb Thu, 08 Nov 2018 18:32:42 +0100 - -- Jan Mojžíš Thu, 15 May 2025 15:31:38 +0200 +nginx (1.6.2-5+deb8u5) jessie-security; urgency=high -nginx (1.26.3-2) unstable; urgency=medium + * Handle CVE-2017-7529 Integer overflow in the range filter (Closes: #868109) - * Team upload - * Upload to unstable + -- Christos Trochalakis Wed, 12 Jul 2017 10:29:22 +0300 - -- Jérémy Lal Fri, 07 Feb 2025 12:53:11 +0100 +nginx (1.6.2-5+deb8u4) jessie-security; urgency=high -nginx (1.26.3-1) experimental; urgency=medium + * Non-maintainer upload by the Security Team. + * debian/nginx-common.config: fix return code so script doesn't exit. + Thanks to Marc Deslauriers and Thomas Ward (Closes: #842276) - * Team upload - * New upstream version 1.26.3 + -- Salvatore Bonaccorso Thu, 27 Oct 2016 20:22:42 +0200 - -- Jérémy Lal Wed, 05 Feb 2025 19:08:02 +0100 - -nginx (1.26.2-1) experimental; urgency=medium - - * Team upload - * New upstream version 1.26.2 - * Add Sergey Kandaurov pgp public key - * Drop upstream patches - - [ Jan Mojžíš ] - * d/gbp.conf: add upstream-signatures = on - * d/{control,copyright}: update my email to "janmojzis@debian.org" - * d/copyright: bump my copyright year - - -- Jérémy Lal Sun, 02 Feb 2025 21:08:45 +0100 - -nginx (1.26.0-3) unstable; urgency=medium - - * d/control: Resolve dependency loop between nginx and nginx-common. - (Fixes: #1082373) - - -- Thomas Ward Fri, 20 Sep 2024 21:35:42 -0400 - -nginx (1.26.0-2) unstable; urgency=medium - - [ Jan Mojžíš ] - * d/rules: enable QUIC and HTTP/3 module (Closes: 1070488) - * d/control: bump Standards-Version: 4.7.0, no changes - * d/p/nginx-1.26.1.patch add, backport changes from the nginx 1.26.1 and fix - CVE-2024-32760, CVE-2024-31079, CVE-2024-35200, CVE-2024-34161 - * d/p/CVE-2024-7347.patch add, backport CVE-2024-7347 fix (Closes: 1078971) - * d/libnginx-mod.abisubstvars updated comment when ABI needs to be changed - - [ Thomas Ward ] - * d/conf/nginx.conf: Update default options for current security - practices and standards. SSL protos, disable prefer server - ciphers, hide server tokens/versions in responses. - - -- Jan Mojžíš Mon, 19 Aug 2024 18:46:30 +0200 - -nginx (1.26.0-1) unstable; urgency=medium - - * New upstream version 1.26.0 - * nginx ABI release: nginx-abi-1.26.0-1 (Closes: 1069997) - * d/libnginx-mod.abisubstvars: remove third-party modules version constraints - * d/u/signing-key.asc add Roman Arutyunyan’s PGP public key, - the key is used to sign the 1.26.0 release - * d/p/CVE-2023-44487.patch remove, fixed in upstream - * d/ufw/nginx update, add QUICK, thanks Marcus Bointon - * d/conf/mime.types add application/xslt+xml, thanks K. Widholm - * d/copyright: updated copyright related to new upstream version - * d/copyright: bump my copyright year - * d/conf/nginx.conf: add worker_cpu_affinity auto (Closes: 1063659) - * d/gbp.conf: add sign-tags = True, [pull] track-missing = True, - [import-orig] merge-mode = replace - - -- Jan Mojžíš Sun, 05 May 2024 18:48:05 +0200 - -nginx (1.24.0-2) unstable; urgency=medium - - * d/control added dependency nginx-common to nginx (Closes: 1039905) - After nginx installation, the nginx-common package is installed - automatically due to its dependencies. The nginx-common package includes - the systemd unit, which becomes enabled and activated upon installation. - When the nginx is removed, nginx-common package and the systemd unit will - remain in the system. Adding a dependency nginx-common to nginx solves - this problem. - * d/control fixed binNMU safe dependency declaration nginx to nginx-common, - nginx is 'any', nginx-common is 'all' -> dependency '= ${source:Version}' - * d/rules removed override_dh_strip, migration to automatic debug symbols is - already done, fixes debug-symbol-migration-possibly-complete lint. warning - * d/po/ro.po added Romanian debconf translation. (Closes: 1033084), - Thanks to Remus-Gabriel Chelu - * d/po/sv.po added Swedish debconf translation. (Closes: 1050443), - Thanks to Peter Kvillegård - * d/conf/mime.types added video/ogg, video/x-matroska (Closes: 1028144) - * d/p/CVE-2023-44487.patch adds additional mitigations for CVE-2023-44487 - that according to NGINX developers on nginx-devel are already suitably - mitigated with the default config options for keepalive. (Closes: 1053770) - * d/control added nginx-dev dependency on ${nginx:abi} - * d/debhelper/nginx_mod.pm automatic libnginx-mod-stream dependencies - - -- Jan Mojžíš Wed, 11 Oct 2023 01:17:51 +0200 - -nginx (1.24.0-1) unstable; urgency=medium - - * New upstream version 1.24.0 - * nginx ABI release: nginx-abi-1.24.0-1 - * d/libnginx-mod.abisubstvars update version constraints of the 3rd party - modules - * d/p/bug-{1024605,973861}.patch removed, fixed in upstream - * d/copyright: updated copyright for files src/event/ngx_event_udp.h, - src/os/win32/ngx_dlopen - - -- Jan Mojžíš Tue, 27 Jun 2023 23:19:31 +0200 - -nginx (1.22.1-9) unstable; urgency=medium - - * d/control: nginx-common Breaks+Replaces: nginx (<< 1.22.1-8) - (Closes: 1032929) - - -- Jan Mojžíš Tue, 14 Mar 2023 16:19:32 +0100 - -nginx (1.22.1-8) unstable; urgency=medium - - * Main change: - Configuration files returned to nginx-common package. This fixes - the serious problem of losing configuration files during upgrade. - This is a rollback of a change made in 1.22.1-6 (Closes: 1032517) - * d/control: fix nginx-full dependencies - * d/libnginx-mod.abisubstvars: update libnginx-mod-http-lua version - - -- Jan Mojžíš Tue, 14 Mar 2023 06:53:32 +0100 - -nginx (1.22.1-7) unstable; urgency=medium - - * nginx ABI release: nginx-abi-1.22.1-7 - * nginx ABI: Nginx now provides nginx-abi- to better manage - dependencies between nginx and 3rd party modules. Credit to Jérémy Lal. - * switched to libpcre2 (Closes: 1000013) - * d/p/bug-973861: added, lingering close for connections with pipelined - requests. The patch is backported from the upstream. (Closes: 973861) - * d/gbb.conf: switched to debian branch main (debian-branch = main) - * d/copyright: updated to be compatible with 'cme update dpkg-copyright' - - -- Jan Mojžíš Mon, 13 Feb 2023 13:04:16 +0100 - -nginx (1.22.1-6) unstable; urgency=medium - - * Main change: - Nginx binary moved to package nginx, also moved basic - configuration files from nginx-common to package nginx. - The packages nginx-{light,core,extras,common} are replaced - by a metapackage. (Closes: 1025763) - Users should simply install 'nginx' and 'libnginx-mod-...' - instead of these packages. - * Additional changes: - * d/nginx-{light,core,extras,full,common}.NEWS: added warning that - nginx-{light,core,extras,full,common} are deprecated - * d/control: fixed dependencies for safe binNMU - * d/copyright: updated debian/* copyright - * d/copyright: added missing copyright for d/apport/* - * d/copyright: added missing GPL-2+ copyright for d/debhelper/dh_nginx - * d/copyright: added missing copyright for d/help/examples/nginx_modsite - * d/po/it.po: added Italian debconf translation. (Closes: 1019160) - * d/control: removed dependency on obsolete package lsb-base - * d/control: bump Standards-Version: 4.6.2, no changes - - -- Jan Mojžíš Wed, 08 Feb 2023 17:20:27 +0100 - -nginx (1.22.1-5) unstable; urgency=medium - - [ Jan Mojžíš ] - * Since version 1.22.1-5 all third party modules are removed from Debian NGINX - package and all these modules are maintained in separate external packages. - Removed namely these remaining modules: - - libnginx-mod-http-geoip2 - - libnginx-mod-stream-geoip2 - - libnginx-mod-http-auth-pam - - libnginx-mod-http-echo - - libnginx-mod-http-upstream-fair - - libnginx-mod-http-headers-more-filter - - libnginx-mod-http-cache-purge - - libnginx-mod-http-fancyindex - - libnginx-mod-http-uploadprogress - - libnginx-mod-http-subs-filter - - libnginx-mod-http-dav-ext - * d/tests: all *-simple and *-deps tests updated to check if nginx works - after installation/reload/restart for all flavours - * d/control: updated nginx-common dependency, fixes lintian warning - maybe-not-arch-all-binnmuable - - [ Jérémy Lal ] - * d/rules: default error-log-path is stderr (--error-log-path=stderr) - instead of hardcoded /var/log/nginx/error.log (Closes: 1025858) - * dh nginx: auto-detect build-dependency on ndk-dev - * dh nginx: absolute /usr/sbin/nginx path for nginx tests - * d/p/nginx-ssl_cert_cb_yield.patch SSL_CTX_set_cert_cb() callback yielding - patch update - * d/conf/nginx.conf: Set global error_log to /var/log/error.log - Now that error_log default value is stderr, it is possible - to override that config using nginx -g 'error_log stderr;' - - [ Miao Wang ] - * d/control: removed unnecessary dependencies after removing 3rd party modules - * d/rules: enabled stream_realip_module (--with-stream_realip_module) - * d/rules: explicitly disabled pcre2 (--without-pcre2) - - -- Jan Mojžíš Tue, 20 Dec 2022 10:36:19 +0100 - -nginx (1.22.1-4) unstable; urgency=medium - - * d/t/*-module-deps: updated, added curl timeout 300 seconds and - added nginx restart before calling curl - * d/t/*-module-deps: update: - - added tests for new ext. module libnginx-mod-http-set-misc - - added tests for new ext. module libnginx-mod-http-brotli-filter - - added tests for new ext. module libnginx-mod-http-brotli-static - - added tests for new ext. module libnginx-mod-http-memc - - added tests for new ext. module libnginx-mod-http-srcache-filter - * removed 3th party modules and moved to separate packages: - - libnginx-mod-nchan module - - libnginx-mod-rtmp module - - libnginx-mod-http-ndk module - - -- Jan Mojžíš Thu, 08 Dec 2022 14:15:15 +0100 - -nginx (1.22.1-3) unstable; urgency=medium - - * d/control: added Multi-Arch: foreign for package nginx-dev - * d/rules: enabled NDK upstream list module NDK_UPSTREAM_LIST - * d/p/bug-1024605.patch: added header Forwarded: not-needed - - -- Jan Mojžíš Mon, 05 Dec 2022 18:25:16 +0100 - -nginx (1.22.1-2) unstable; urgency=medium - - [ Jan Mojžíš ] - * d/control: fixed spelling-error-in-description - * d/nginx-*.postinst: fixed postinst script, used invoke-rc.d instead of - pidof and ad-hoc tests, tnx Gioele Barabucci - * d/tests/ssi-module-test added, simple ngx_http_ssi_filter_module test - * d/p/bug-1024605.patch added: fixes problem when a subrequest has SSI - enabled but its main request does not, the SSI module may crash the worker - due to NULL-pointer dereference. The patch is backported from the upstream - (Closes: 1024605) - * d/control: updated implicit dependencies of third-party modules - for easier transition to third-party modules in separate packages. - - [ Jérémy Lal ] - * d/debhelper: set nginx_mod buildsystem by default - * d/control: nginx-dev provides dh-sequence-nginx (Closes: #1024879) - * d/control: remove Uploaders that are part of nginx-team, - keep only the most recent active one, per policy 5.6.3. - - [ Debian Janitor ] - * Remove constraints unnecessary since buster (oldstable): - + nginx-dev: Drop versioned constraint on dpkg-dev in Depends. - - -- Jan Mojžíš Wed, 30 Nov 2022 17:39:42 +0100 - -nginx (1.22.1-1) unstable; urgency=medium - - [ Jan Mojžíš ] - * New upstream version 1.22.1 - * d/control: added implicit version of dependency libnginx-mod-http-lua - (>=1:0.10.22-3~), it is a rebuilt version with nginx 1.22.1. - * Added libnginx-mod-http-lua powerpc architecture - - [ Debian Janitor ] - * Fix day-of-week for changelog entry 0.5.11-1. - - -- Jan Mojžíš Thu, 10 Nov 2022 18:21:43 +0100 - -nginx (1.22.0-3.1) unstable; urgency=medium - - * Non-maintainer upload. - * No source change upload to rebuild with debhelper 13.10. - - -- Michael Biebl Sat, 15 Oct 2022 12:28:07 +0200 - -nginx (1.22.0-3) unstable; urgency=medium - - * d/changelog: fixed typo in bug number 61261 -> 861261 (Closes: 861261) - * d/p/nginx-ssl_cert_cb_yield.patch added (Closes: 884434) - * http-lua: removed the http-lua module and moved it to a separate package - - -- Jan Mojžíš Wed, 17 Aug 2022 18:38:15 +0200 - -nginx (1.22.0-2) unstable; urgency=medium - - [ Miao Wang ] - * adding a new libnginx-mod-http-ndk-dev package including necessary - headers to build a 3rd party module depending on ndk. - - [ Jan Mojžíš ] - * d/nginx-common.nginx.service: added Systemd dependency - Wants=network-online.target and updated Systemd "After" dependency to - recommended NGINX values, namely: - - network-online.target (Closes: 861261) (Closes: 1000406) - - remote-fs.target (Closes: 898896) - - nss-lookup.target - * d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch: forwarded - to upstream (Closes: 859082) - * d/t/reboot: added, tests if nginx works after reboot - * d/m/p/http-subs-filter/pcre2.patch: added PCRE2 support - * d/p/nginx-fix-pidfile.patch: Fix NGINX PIDfile handling to avoid - SystemD race condition, this fix is backported from Ubuntu (Closes: 876365) - * d/apport/source_nginx.py: Add apport hooks for additional bug - information gathering, the script is backported from Ubuntu (Closes: 963668) - * d/nginx-common.install: Add install rule for apport hooks. - - [ Debian Janitor ] - * Remove constraints unnecessary since buster: - + Build-Depends: Drop versioned constraint on dpkg-dev. - + nginx-common: Drop versioned constraint on lsb-base in Depends. - + nginx-core: Drop versioned constraint on nginx in Breaks. - + nginx-full: Drop versioned constraint on nginx in Breaks. - + nginx-light: Drop versioned constraint on nginx in Breaks. - + nginx-extras: Drop versioned constraint on nginx in Breaks. - + libnginx-mod-http-perl: Drop versioned constraint on nginx-extras in - Replaces. - + Remove 5 maintscript entries from 1 files. - - -- Jan Mojžíš Sun, 07 Aug 2022 16:14:59 +0200 - -nginx (1.22.0-1) unstable; urgency=medium - - [ Thomas Ward ] - * New upstream release (1.22.0) - * Additional changes: - * d/conf/mime.types: Fix a typo in font/woff2 extension in - mime.types. (Closes: #1010798) - * d/upstream/signing-key.asc: Additional signing keys observed - in upstream (Konstantin Pavlov ) during - upstream merge/import by Thomas Ward, additional signing key - was added to the keyring while keeping Maxim's key in signing - keys as well. - * d/copyright: Updated copyright for src/core/ngx_murmurhash.c - and debian/modules/http-ndk/src/hash/murmurhash2.c to be - public-domain (Closes: #1011936) - * d/control: Use libluajit-5.1-dev for s390x. - Due to src:luajit2 landing in Unstable, superseding src:luajit, - and due to luajit2 having s390x support, we can use s390x now - with luajit instead of standard Lua. - Thanks to Paul Gevers for the heads up on luajit2 supporting s390x. - * d/control: Use liblua for ppc64el - src:luajit2 is still not ppc64el - stable and there seems to be nobody willing to support it. (Closes: 1013807) - - [ Jan Mojžíš ] - * d/patches/CVE-2021-3618.patch removed, fix is included in new upstream - release - * d/copyright: bump nginx copyright years - * d/copyright: added copyright for src/stream/ngx_stream_set_module.c - * d/copyright: removed copyright for src/http/v2/ngx_http_v2_huff_encode.c - * d/control: bump Standards-Version to 4.6.1, no changes - - [ Bastian Germann ] - * d/copyright: Update copyright for d/debhelper/* - - [ Miao Wang ] - * dh_nginx: support auto generating module config files - * adding a new nginx-dev package including necessary headers and debhelper - scripts to build and package a 3rd party module. (Closes: 985133) - * d/p/0002-Make-sure-signature-stays-the-same-in-all-nginx-buil.patch - removed, because feature already implemented with --with-compat configure - option since 1.11.5 - - -- Thomas Ward Tue, 10 May 2022 12:08:02 -0400 - -nginx (1.20.2-2) unstable; urgency=medium - - [ Thomas Ward ] - * d/patches/CVE-2021-3618.patch: Include upstream changeset from NGINX - that adds mitigations into the Mail module for CVE-2021-3618.patch. - (Closes: #991328) - - [ Jan Mojžíš ] - * d/p/0003-define_gnu_source-on-other-glibc-based-platforms.patch update, - fixes build on hurd-i386 platform - - -- Thomas Ward Wed, 04 May 2022 16:04:59 -0400 - -nginx (1.20.2-1) unstable; urgency=medium - - [ Ondřej Nový ] - * d/control: Update Uploaders for new maintainers. - - [ Thomas Ward ] - * Update to latest upstream Stable version (1.20.2) (Closes: #1008855) - * d/patches/Resolver-fixed-off-by-one-write-in-ngx_resolver - _copy.patch: Drop CVE-2021-23017 patch, as this is fixed in 1.20.1 - and we are now using 1.20.2 which already contains the patch. - * Refreshed d/patches/0002-Make-sure-signature-stays-the-same- - in-all-nginx-buil.patch (fuzz thanks to 1.20.2) - * d/conf/mime.types: Update mime.types to more match upstream mime.types - and include upstream changes with mime.types from 1.21.x via nginx.org - mercurial repository versions. - * d/control: Remove self from Uploaders per other Debian devs, who want - that commit to be done by someone on the current uploaders/maintainers - group instead. - - -- Thomas Ward Tue, 19 Apr 2022 09:50:42 -0400 - -nginx (1.18.0-9) unstable; urgency=medium - - [ Jan Mojžíš ] - * http-lua: Downgrade to 0.10.13 (Closes: #1008787). - * http-lua: Backport upstream bugfix for segfault in nginx core >= 1.15.0 - when libnginx-mod-http-lua is loaded and init_worker_by_lua* is used. - * d/control: Add mips64el,ppc64,kfreebsd-amd64 to list of luajit platforms. - * d/control: fix Homepage nginx.net -> nginx.org (Closes: #976158) - - [ Thomas Ward ] - * d/watch: Update watch syntax to match all even versions of NGINX releases - rather than use a watch syntax that is static to one specific version. - This will fix the untracked "New upstream stable versions" problem. - * d/control: Update 'uploaders' as Thomas Ward is now a maintainer in - the Salsa repository. - - -- Jan Mojžíš Tue, 05 Apr 2022 19:11:47 +0200 - -nginx (1.18.0-8) unstable; urgency=medium - - * Restore patch: - d/p/Resolver-fixed-off-by-one-write-in-ngx_resolver_copy.patch - - -- Ondřej Nový Tue, 15 Mar 2022 13:23:06 +0100 - -nginx (1.18.0-7) unstable; urgency=medium - - [ Ondřej Nový ] - * d/p/CVE-2019-20372.patch: Drop, applied upstream. - * http-auth-pam: Upgrade to 1.5.3. - * http-echo: Upgrade to 0.62. - * nchan: Upgrade to 1.2.15. - * http-fancyindex: Upgrade to 0.5.2. - * rtmp: Upgrade to 1.2.2. - * http-lua: Upgrade to 0.10.15 (Closes: #994178). - * http-lua: Rebase patch. - * nchan: Drop GCC 10 patch, applied upstream. - * d/watch: Bump version to 4. - * Bump standards version to 4.6.1 (no changes). - * d/copyright: Bump my copyright year. - - [ Ondřej Surý ] - * Add arm64 and ppc64el to list of luajit platforms. - - [ Athos Ribeiro ] - * d/nginx-common.nginx.service: Fix service shutdown description to mention - SIGQUIT instead of SIGSTOP (LP: #1919965). - - -- Ondřej Nový Tue, 15 Mar 2022 11:50:18 +0100 - -nginx (1.18.0-6.1) unstable; urgency=high - - * Non-maintainer upload. - * Resolver: fixed off-by-one write in ngx_resolver_copy() (CVE-2021-23017) - (Closes: #989095) - - -- Salvatore Bonaccorso Sat, 29 May 2021 16:21:37 +0200 - -nginx (1.18.0-6) unstable; urgency=medium - - * Fix GCC-10 compatibility (Closes: #957605). - - -- Ondřej Nový Wed, 19 Aug 2020 15:27:02 +0200 - -nginx (1.18.0-5) unstable; urgency=medium - - * Prevented request smuggling in LUA - CVE-2020-11724 - Closes: #964950 - - -- Ondřej Nový Tue, 14 Jul 2020 10:08:15 +0200 - -nginx (1.18.0-4) unstable; urgency=medium - - * Revert: libnginx-mod-* now depends on nginx- (Closes: #963860). - * Update ngx_http_auth_pam_module upstream URL. - * libnginx-mod-* recommends nginx now. - * http-auth-pam: Upgrade to 1.5.2 (Closes: #963567). - * d/copyright: Bump year of http-auth-pam. - - -- Ondřej Nový Fri, 03 Jul 2020 09:34:49 +0200 - -nginx (1.18.0-3) unstable; urgency=medium - - * Source-only upload to allow migration. - - -- Ondřej Nový Thu, 11 Jun 2020 15:14:59 +0200 - -nginx (1.18.0-2) unstable; urgency=medium - - [ Ondřej Nový ] - * d/copyright: - - Update for upstream release - - Add Thomas Ward from Ubuntu for debian/* - * d/conf/sites-available/default: Update PHP path for PHP 7.4 - * d/conf/nginx.conf: - - Enable TLSv1.3 - - Remove tcp_nodelay on, which is same as default - - Remove keepalive_timeout 65 and use default value 75s. - - Remove trailing whitespaces - * Introduce nginx-core and make it new default for "nginx" - * Add stream-geoip and stream-geoip2 modules - * d/ngx-conf: Convert to Python 3 - * d/control: Add GeoIP2 into description - * Build dynamic modules only in extras flavour - * libnginx-mod-* now depends on nginx- - * Check if port 80 is free before starting during install - - [ Ondřej Surý ] - * http-geoip2: Add ngx_http_geoip2_module 3.3 - - -- Ondřej Nový Fri, 05 Jun 2020 18:28:40 +0200 - -nginx (1.18.0-1) unstable; urgency=medium - - [ Ondřej Nový ] - * New upstream version 1.18.0 - * Add REMOTE_USER fastcgi param - * Use debhelper-compat instead of debian/compat - * Replace dh_systemd_enable with dh_installsystemd - * Set Rules-Requires-Root: no - * d/rules/dh_installinit: Replace --no-restart-on-upgrade with - --no-stop-on-upgrade - * Bump debhelper compat level to 13 - * Use package.maintscript instead of dpkg-maintscript-helper - * Bump standards version to 4.5.0 - * d/watch: Change to 1.18.x - * d/patches/CVE-2019-20372.patch: Rebase - * Convert d/ngxmod to Python 3 (Closes: #953025) - * nchan: Upgrade to 1.2.7 - * http-fancyindex: Upgrade to 0.4.4 - * d/copyright: Add myself for Debian part - * Add myself as uploader - - [ Mohamed Akram ] - * Enable --with-compat configure option (Closes: #897926) - - -- Ondřej Nový Fri, 29 May 2020 19:03:30 +0200 - -nginx (1.16.1-3) unstable; urgency=high - - * Handle CVE-2019-20372, error page request smuggling - (Closes: #948579) - - -- Christos Trochalakis Sat, 11 Jan 2020 09:36:00 +0200 - -nginx (1.16.1-2) unstable; urgency=medium - - * http-lua: Downgrade to 0.10.13 (Closes: #941917) - Temporary fix FTBFS on architectures where Luajit is not available. - - -- Christos Trochalakis Sat, 12 Oct 2019 17:59:23 +0300 - -nginx (1.16.1-1) unstable; urgency=medium - - * New upstream version (Closes: #929200) - * Follow stable 1.16 releases (Closes: #929199) - * Drop already included debian patches - * http-ndk: Upgrade to 0.3.1 - * http-lua: Upgrade to 0.10.15 - - -- Christos Trochalakis Mon, 09 Sep 2019 18:24:43 +0300 - -nginx (1.14.2-3) unstable; urgency=high - - * Backport upstream fixes for 3 CVEs (Closes: #935037) - Those fixes affect Nginx HTTP/2 implementation, which might cause - excessive memory consumption and CPU usage. - (CVE-2019-9511, CVE-2019-9513, CVE-2019-9516). - - -- Christos Trochalakis Mon, 19 Aug 2019 11:30:08 +0300 - -nginx (1.14.2-2) unstable; urgency=medium - - [ Kartik Mistry ] - * po/tr.po: - + Added Turkish translation. Thanks Atila KOÇ - (Closes: #915728) +nginx (1.6.2-5+deb8u3) jessie-security; urgency=high [ Christos Trochalakis ] - * http-dav-ext: Upgrade to 3.0.0 (Closes: #851651) - * Use a minimal export of the upstream signing key - * Bump Standards-Version, no changes needed - - -- Christos Trochalakis Thu, 27 Dec 2018 12:49:34 +0200 - -nginx (1.14.2-1) unstable; urgency=medium - - [ Olaf van der Spek ] - * Reference PHP 7.3 (Closes: 913250) - - [ Christos Trochalakis ] - * Adjust fastcgi_split_path_info snippet to handle the `/example.php/` case - (Closes: #911398) - - -- Christos Trochalakis Thu, 13 Dec 2018 10:05:37 +0200 - -nginx (1.14.1-1) unstable; urgency=medium - - [ Kartik Mistry ] - * Removed unused lintian override. - * Fixed trailing whitespaces in changelog. - - [ Christos Trochalakis ] - * New upstream version. (Closes: #913090) - + CVE-2018-16843 Excessive memory usage in HTTP/2 - + CVE-2018-16844 Excessive CPU usage in HTTP/2 - + CVE-2018-16845 Memory disclosure in the ngx_http_mp4_module - - -- Christos Trochalakis Wed, 07 Nov 2018 07:16:00 +0200 - -nginx (1.14.0-1) unstable; urgency=medium - - [ Kartik Mistry ] - * debian/control: - + Removed duplicate Build-Depends. - + Use https in Homepage. - - [ Christos Trochalakis ] - * http-lua: Upgrade to 0.10.13 - * http-lua: Drop our OpenSSL patch, OpenSSL 1.1 is now supported upstream - * http-fancyindex: Upgrade to 0.4.3 - * Order nginx after nss-lookup.target to synchronize host/network name lookups - (Closes: #900790) - * Merge ru translations. - Thanks to Lev Lamberov (Closes: #883104) - - -- Christos Trochalakis Fri, 31 Aug 2018 15:28:04 +0300 - -nginx (1.13.12-1) unstable; urgency=medium - - * New upstream version - - -- Christos Trochalakis Wed, 11 Apr 2018 08:19:23 +0300 - -nginx (1.13.11-1) unstable; urgency=medium - - * New upstream version - - -- Christos Trochalakis Tue, 10 Apr 2018 14:55:11 +0300 - -nginx (1.13.10-1) unstable; urgency=medium - - * New upstream version - - -- Christos Trochalakis Wed, 21 Mar 2018 16:16:22 +0200 - -nginx (1.13.9-1) unstable; urgency=medium - - [ Michael Lustfield ] - * Remove non-uploading users - - [ Christos Trochalakis ] - * New upstream version 1.13.9 - * Move packaging repository to salsa.debian.org - * Bump Standards-Version to 4.1.3, no changes needed - - -- Christos Trochalakis Wed, 21 Feb 2018 11:24:53 +0200 - -nginx (1.13.8-1) unstable; urgency=medium - - * New upstream release. - - -- Christos Trochalakis Wed, 27 Dec 2017 09:24:36 +0200 - -nginx (1.13.7-1) unstable; urgency=medium - - [ Christos Trochalakis ] - * New upstream version 1.13.7 - * Bump Standards-Version, no changes needed - * debian/watch: switch to HTTPS for the upstream check - - [ Mpampis Kostas ] - * Automate modules watch & upgrade process (Closes: #869499) - - [ Christos Trochalakis ] - * Bits & pieces for ngxmod - * http-headers-more-filter: Upgrade to 0.33 - * http-echo: Upgrade to 0.61 - * http-lua: Upgrade to 0.10.11 - * http-dav-ext: Upgrade to 0.1.0 (Closes: #878611) - * http-fancyindex: Upgrade to 0.4.2 - * rtmp: Upgrade to 1.2.1 (Closes: #880718) - - -- Christos Trochalakis Thu, 14 Dec 2017 11:04:36 +0200 - -nginx (1.13.6-2) unstable; urgency=medium - - * rtmp: Ship docs & examples (Closes: #878368) - - -- Christos Trochalakis Fri, 13 Oct 2017 12:59:28 +0300 - -nginx (1.13.6-1) unstable; urgency=medium - - * New upstream version - * Normalize module paths in packaging repository - * Bump Standards-Version, no changes needed - * Drop dh-systemd dependency since we depend on debhelper >= 10 - - -- Christos Trochalakis Thu, 12 Oct 2017 10:37:29 +0300 - -nginx (1.13.5-1) unstable; urgency=medium - - * New upstream version 1.13.5 - * doc: Improve example WordPress configuration - Thanks to Larry Holish (Closes: #863343) - * Remove upstart conffile (Closes: #874319) - - -- Christos Trochalakis Wed, 06 Sep 2017 10:10:24 +0300 - -nginx (1.13.4-1) unstable; urgency=medium - - * New upstream version 1.13.4 - * nginx-lua: - + Add a simple lua autopkgtest - + Discover LuaJIT 2.1 (FTBFS) (Closes: #873319) - + Update to v0.10.10 - + Update OpenSSL 1.1 patch - + Drop patch to build against Nginx 1.11.11, now included upstream - * tests: Fix race between reload and curl's http request - * Explicitly disable autoreconf (debhelper 10) - * Drop Upstart configuration - * Bump Standards to 4.1.0 - + Switch all packages to Priority optional, extra is considered deprecated - - -- Christos Trochalakis Tue, 29 Aug 2017 10:49:03 +0300 - -nginx (1.13.3-1) unstable; urgency=high - - * New upstream version 1.13.3. - Fixes CVE-2017-7529 (Closes: #868109) - * Drop gzip_disable "msie6" directive. (Closes: #867024) - - -- Christos Trochalakis Wed, 12 Jul 2017 11:20:27 +0300 - -nginx (1.13.2-1) unstable; urgency=medium - - [ Christos Trochalakis ] - * New upstream version 1.13.2. - * Fix nginx-cache-purge segfaults (Closes: #866750) - * Merge ca translations. - Thanks to Alytidae (Closes: #865996) - * Merge es translations. - Thanks to Jonathan Bustillos (Closes: #855610) - * Merge pt translations. - Thanks to Rui Branco (Closes: #858741) - * Bump Standards to 4.0.0. - - Switch the copyright-format URL to https. - - [ Nicolas Dandrimont ] - * Introduce libnginx-mod-rtmp (Closes: #843777) - - -- Christos Trochalakis Mon, 03 Jul 2017 13:44:59 +0300 - -nginx (1.13.1-2) unstable; urgency=medium - - * Upload to unstable. - - -- Christos Trochalakis Tue, 20 Jun 2017 14:16:52 +0300 - -nginx (1.13.1-1) experimental; urgency=medium - - * New upstream version 1.13.1. - - -- Christos Trochalakis Wed, 31 May 2017 11:41:59 +0300 - -nginx (1.13.0-1) experimental; urgency=medium - - * New upstream release. - We now target nginx mainline (1.13.x). - - -- Christos Trochalakis Wed, 10 May 2017 11:40:38 +0300 - -nginx (1.12.0-1) experimental; urgency=medium - - [ Michael Lustfield ] - * debian/rules: - - Configure build flags to work with other arches and downstreams. - Thanks to Thomas Ward. - - [ Christos Trochalakis ] - * New upstream release. - * Patch nginx-upstream-fair to build against nginx 1.11.6. - * Patch nginx-lua to build against nginx 1.11.11. - * Patch nginx-echo to build against nginx 1.11.11. - * Drop curve list patch, it's included upstream. - * Drop perl build flags patch, it is now handled upstream. - * Enable SSL Preread builtin module on nginx-full & nginx-extras. - (Closes: #854214) - * Switch to debhelper 10, no changes needed. - - -- Christos Trochalakis Fri, 05 May 2017 11:16:30 +0300 - -nginx (1.10.3-1) unstable; urgency=medium - - * New upstream release. (Closes: #855113) - * Update Vcs fields to the new location. - The repo is now moved under the pkg-nginx namespace. - - -- Christos Trochalakis Wed, 15 Feb 2017 09:58:13 +0200 - -nginx (1.10.2-4) unstable; urgency=medium - - * Switch module reloading logic to dpkg triggers. - * Enable modules after a remove -> install cycle. - * Move module patches to debian/modules/patches. - * Backport curve list support from 1.11.x. (Closes: #846085) - * Add a NEWS entry regarding dynamic modules. - * Merge de,fr,nl,pt_BR,da translations. - Thanks to Chris Leick. (Closes: #843770) - Thanks to Julien Patriarca. (Closes: #844712) - Thanks to Frans Spiesschaert. (Closes: #845693) - Thanks to Adriano Rafael Gomes. (Closes: #846522) - Thanks to Joe Dalton. (Closes: #850857) - - -- Christos Trochalakis Sun, 22 Jan 2017 12:19:30 +0200 - -nginx (1.10.2-3) unstable; urgency=medium - - [ Michael Lustfield ] - * debian/conf/sites-enabled/default: - + Correcting location of default php-fpm socket. (Closes: #846145) - - [ Christos Trochalakis ] - * debian/rules: Correctly clean patched modules. - Thanks to Sven-Haegar Koch for the initial patch. (Closes: #844506) - * mod: Upgrade nchan to 1.0.8. (Closes: #844473) - * mod: Upgrade nginx-lua to 0.10.7. - * Update nginx-lua OpenSSL 1.1.0 patch. - * Reactivate PIE. - Thanks to Markus Waldeck for the suggestion. - * mod: Check if nginx binary exists before reloading. - * mod: Upgrade headers-mode to 0.32. - * mod: Upgrade development kit to 0.3.0. - - -- Christos Trochalakis Sat, 24 Dec 2016 12:11:21 +0200 - -nginx (1.10.2-2) unstable; urgency=medium - - * Build against OpenSSL 1.1.0. (Closes: #828453) - + Patch for nginx-lua by Alessandro Ghedini. - + Patch for nginx-upstream-fair by Kurt Roeckx. - * debian/modules: - + Rethink module patching logic. - + Convert dav-ext to a dynamic module package: - o libnginx-mod-http-dav-ext - - -- Christos Trochalakis Sat, 12 Nov 2016 09:18:12 +0200 - -nginx (1.10.2-1) unstable; urgency=high - - [ Christos Trochalakis ] - * New upstream release. * debian/nginx-common.postinst: + CVE-2016-1247: Secure log file handling (owner & permissions) against privilege escalation attacks. /var/log/nginx is now owned @@ -869,260 +33,29 @@ nginx (1.10.2-1) unstable; urgency=high Changing /var/log/nginx permissions effectively reopens #701112, since log files can be world-readable. This is a trade-off until a better log opening solution is implemented upstream (trac:376). - (Closes: #842295) * debian/control: - + Version depend on lsb-base (>= 3.0-6). - Fixes lintian init.d-script-needs-depends-on-lsb-base. - * debian/nginx-*.lintian-overrides: - + Drop unused spelling-error-in-binary override. + Don't allow building against liblua5.1-0-dev on architectures + that libluajit is available. (Closes: #826167) - [ Michael Lustfield ] - * debian/conf/sites-available/default: - + Updated PHP sample configuration block. (Closes: #841230) + -- Christos Trochalakis Tue, 04 Oct 2016 15:20:33 +0300 - -- Christos Trochalakis Sat, 29 Oct 2016 08:45:09 +0300 - -nginx (1.10.1-3) unstable; urgency=medium - - * debian/control: - + Drop nginx-*-dbg packages in favor of autogenerated -dbgsym packages. - + Remove relic Breaks/Replaces from nginx-common. - + Fix lsb-base dependencies. - + Switch Maintainer to the Nginx Packaging Team and keep active maintainers - as uploaders. Jose, Fabio, Dmitry & Cyril, thanks a lot for all your - contributions! - - -- Christos Trochalakis Thu, 15 Sep 2016 15:20:58 +0300 - -nginx (1.10.1-2) unstable; urgency=medium +nginx (1.6.2-5+deb8u2) jessie-security; urgency=high [ Christos Trochalakis ] - * debian/control: - + Don't allow building against liblua5.1-0-dev on architectures - that libluajit is available. - + Enable slice module on all flavors. (Closes: #815080) - + Enable SCGI & uWSGI module for nginx-light. - + Convert to dynamic module packages: - o libnginx-mod-nchan - o libnginx-mod-http-echo - o libnginx-mod-http-upstream-fair - o libnginx-mod-http-headers-more-filter - o libnginx-mod-http-cache-purge - o libnginx-mod-http-fancyindex - o libnginx-mod-http-uploadprogress - o libnginx-mod-http-subs-filter - * debian/modules: - + Replace http-push with nchan v1.0.2 (Closes: #836134) - + Upgrade nginx-lua to v0.10.6 - + Upgrade nginx-echo to v0.60 - + Upgrade headers-more to v0.31 - + Upgrade fancyindex to v0.4.1 - + Upgrade upload-progress to v0.9.2 - - [ Michael Lustfield ] - * debian/patches/0003-*.patch: - + Use _GNU_SOURCE on GNU/kFreeBSD. (Closes: #826061) - Thanks Steven Chamberlain for the patch. - * debian/nginx-*.postinst: - + Make nginx-*.postinst use invoke-rc.d. (Closes: #823435) - Thanks Simon Deziel for the patch. - - -- Christos Trochalakis Tue, 06 Sep 2016 11:06:26 +0300 - -nginx (1.10.1-1) unstable; urgency=medium - - [ Christos Trochalakis ] - * New upstream release (1.10.1) - Fixes CVE-2016-4450 + * Fixes CVE-2016-4450 NULL pointer dereference while writing client request body. (Closes: #825960) - * debian/control: - + Generate dbgsym packages only if dh_strip supports it. - Thanks Faidon Liambotis for the hint. + -- Christos Trochalakis Tue, 31 May 2016 22:55:34 +0300 - -- Christos Trochalakis Tue, 31 May 2016 22:01:25 +0300 - -nginx (1.10.0-1) unstable; urgency=medium +nginx (1.6.2-5+deb8u1) jessie-security; urgency=high [ Christos Trochalakis ] - * New upstream release (1.10.0) + * Fixes multiple resolver CVEs, + CVE-2016-0742, CVE-2016-0746, CVE-2016-0747 + Closes: #812806 - -- Christos Trochalakis Fri, 29 Apr 2016 10:31:46 +0300 - -nginx (1.9.14-2) unstable; urgency=medium - - [ Christos Trochalakis ] - * debian/control: - + Fix upgrading nginx-extras from testing. (Closes: #822553) - + Bump Standards to 3.9.8, no changes needed. - * debian/libnginx-mod-http-perl.lintian-overrides: - + Override wrong-section-according-to-package-name warning. - - -- Christos Trochalakis Wed, 27 Apr 2016 16:43:02 +0300 - -nginx (1.9.14-1) unstable; urgency=medium - - [ Christos Trochalakis ] - * New upstream release (1.9.14) (Closes: #812806) - * debian: - + Setup dynamic module flow, and implement a simple dh_nginx helper for - internal use. - + Split modules in libnginx-mod-* packages. - Not all modules are ready for dynamic building. - * debian/control: - + Enable http/2, thread pool & WebDAV on nginx-light. - In order for dynamic modules to be loadable in all nginx flavors we need - to ensure they share the same build signature. (Closes: #816095) - + nginx-common & nginx-doc are now 'Multi-Arch: foreign'. (Closes: #812484) - Thanks Elrond for the report and the initial patch. - + Use secure VCS uri (lintian). - + Bump Standards to 3.9.7. - * debian/rules: - + Disable PIE for now so we can build dynamic modules. - * debian/tests/control: - + Test if modules are loadable in nginx-light. - * debian/nginx-common.nginx.service: - + Documentation points to nginx man page. - * debian/modules/nginx-lua: - + Update nginx-lua to v0.12 and convert it to a dyn module. - Fixes buiding failures with nginx 1.9.11. - * debian/modules/nginx-auth-pam: - + Update http-auth-pam module to 1.5 and convert it to a dyn module. - (Closes: #819062) - - -- Christos Trochalakis Tue, 19 Apr 2016 11:05:35 +0300 - -nginx (1.9.10-1) unstable; urgency=medium - - [ Christos Trochalakis ] - * New upstream release (1.9.10) (Closes: #812806) - * debian/control: - + Drop python dependency from nginx-common. (Closes: #808699) - - -- Christos Trochalakis Tue, 26 Jan 2016 20:12:06 +0200 - -nginx (1.9.9-1) unstable; urgency=medium - - [ Michael Lustfield ] - * debian/nginx-common.nginx.logrotate: - + Switching logrotate to 14 days. (Closes: #805322) - - [ Christos Trochalakis ] - * New upstream release (1.9.9). - * debian/modules/nginx-lua: - + Update nginx-lua to v0.10.0. - - -- Christos Trochalakis Thu, 14 Jan 2016 10:40:35 +0200 - -nginx (1.9.6-2) unstable; urgency=medium - - [ Christos Trochalakis] - * debian/modules/nginx-lua: - + Update nginx-lua to v0.9.19 fixing HTTP/2 compatibility. - - -- Christos Trochalakis Fri, 13 Nov 2015 16:08:01 +0200 - -nginx (1.9.6-1) unstable; urgency=medium - - [ Christos Trochalakis] - * New upstream release. - * Enable http2 module in nginx-full & nginx-extras - - -- Christos Trochalakis Tue, 03 Nov 2015 08:59:21 +0200 - -nginx (1.9.4-1) unstable; urgency=medium - - [ Christos Trochalakis] - * New upstream release. - * debian/copyright: - + Fix licence order. - - -- Christos Trochalakis Mon, 24 Aug 2015 16:23:20 +0300 - -nginx (1.9.3-1) unstable; urgency=medium - - [ Christos Trochalakis] - * New upstream Release. (Closes: #789924) - * debian/control: - + Remove XS-Testsuite header, it is now automatically added when - `debian/tests/control` is present. - * debian/modules/nginx-lua: - + Update nginx-lua to v0.9.16 and drop our backported patches. - * debian/conf/*: - + Add REQUEST_SCHEME to fcgi, wsgi and scgi configs (sync with upstream). - - -- Christos Trochalakis Tue, 14 Jul 2015 20:24:52 +0300 - -nginx (1.9.2-1) unstable; urgency=medium - - [ Michael Lustfield ] - * debian/nginx-common.nginx.init: - + Init script now returns the proper exit status. (Closes: #788573) - + Cleaned up the init script to have consistent naming/structure. - - [ Christos Trochalakis ] - * New upstream Release. - * debian/rules: - + Add stream module to nginx-full & nginx-extras. - + Add thread pool support to nginx-full & nginx-extras. - * debian/modules/nginx-lua: - + Backport upstream's 9531e5e7 fixing build failure when thread pool - support is enabled. - - -- Christos Trochalakis Mon, 22 Jun 2015 10:16:19 +0300 - -nginx (1.9.1-1) unstable; urgency=medium - - [ Michael Lustfield ] - * debian/conf/nginx.conf: - + Switch worker_processes to auto. (Closes: #781711) - * debian/conf/sites-available/default: - + Add comment about disabling gzip in HTTPS. (Closes: #773332) - + Add comment about checking ssl_ciphers. (Closes: #765782) - * debian/modules/*: - + Updated nginx-auth-pam 1.3 -> 1.4. (Closes: #777120) - + Updated nginx-echo v0.56 -> v0.57. - + Updated nginx-lua v0.9.13 -> v0.9.15. - + Updated nginx-cache-purge 2.1 -> 2.3. - + Updated ngx-fancyindex v0.3.4 -> v0.3.5. - * debian/nginx-common.NEWS: - + Document potential issues with newer versions on i386. - * debian/nginx-common.{dirs,install}, debian/vim/*: - + Installing vim syntax highlighting from package. (Closes: #771609) - Thanks Emmanuel Bouthenot for building this patch. - * debian/nginx-common.nginx.upstart: - + Created file to support upstart jobs. (Closes: #745483) - Thanks Cameron Norman for building this file. - * debian/rules: - + Add hardening flags with dpkg-buildflags. (Closes: #747025, #781703) - Thanks Thomas Ward. - + Supply custom DEB_BUILD_MAINT_OPTIONS for debian_ldflags generation. - Thanks Thomas Ward. - + Added back missing module gunzip. (Closes: #782065) - Thanks Peter Wu for the initial patch. - * debian/modules/nginx-lua/*: - + Updated module version. (Closes: #762494) - * debian/ngx-conf/* - + Added configuration utility, not shipped yet. (Closes: #652108) - * debian/nginx-common.manpages: - + Replaced man page with upstream maintained version. (Closes: #781345) - * debian/nginx-common.install: - + Changed debian/index.html -> html/index.html. This installs the package - maintained version of this file as opposed to our out of date version. - - [ Christos Trochalakis ] - * New upstream release. Switching to mainline version. (Closes: #777677) - * debian/nginx-common.manpages: - + Build & ship manpages with binary packages. - * debian/rules: - + Adjust configure flags for limit_zone module (renamed to limit_conn). - * debian/modules/nginx-lua: - + Backport upstream's f4e1311 fixing build failure with mainline nginx. - * debian/control: - + Depend on libgd-dev now that jessie is released. - - -- Christos Trochalakis Fri, 12 Jun 2015 15:42:49 +0300 + -- Christos Trochalakis Wed, 27 Jan 2016 12:22:00 +0200 nginx (1.6.2-5) unstable; urgency=medium @@ -2656,14 +1589,14 @@ nginx (0.7.61-2) unstable; urgency=low nginx (0.7.61-1) unstable; urgency=low * New upstream version: - *) Bugfix: nginx could not be built --without-http-cache; the bug had + *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.7.60. - *) Bugfix: a segmentation fault occurred in worker process, if a - backend 401 error was intercepted and the backend did not set the + *) Bugfix: a segmentation fault occurred in worker process, if a + backend 401 error was intercepted and the backend did not set the "WWW-Authenticate" response header line. Thanks to Eugene Mychlo. *) Feature: the "keepalive_requests" directive. - *) Bugfix: in open_file_cache and proxy/fastcgi cache interaction on + *) Bugfix: in open_file_cache and proxy/fastcgi cache interaction on start up. *) Bugfix: open_file_cache might cache open file descriptors too long. *) Bugfix: XLST filter did not work in subrequests. @@ -2794,14 +1727,14 @@ nginx (0.5.33-1) unstable; urgency=low * New stable upstream release (Closes: #451173) * nginx now provides httpd, httpd-cgi virtual packages (Closes: #439468, #452025) - * sites-enabled/default link is now provided only on fresh + * sites-enabled/default link is now provided only on fresh installations (Closes: #432961) * Updated code for online upgrading of nginx (Closes: #445246) * Reviewed maintainer scripts for correct behaviour on updates (Closes: #452787, #435965) * Removed debian/nginx.links and debian/preinst. * Changing Maintainer address to bureado@debian.org. - * Welcoming Fabio Tranchitella as an nginx + * Welcoming Fabio Tranchitella as an nginx uploader for Debian. Thanks for your patches. -- Jose Parrella Sat, 08 Dec 2007 11:27:54 -0400 @@ -2809,7 +1742,7 @@ nginx (0.5.33-1) unstable; urgency=low nginx (0.5.30-1) unstable; urgency=low * New stable upstream release. - * Adding mime.types (and other upstream conffiles) to the package + * Adding mime.types (and other upstream conffiles) to the package since it was lost on 0.5.26 (Closes: #435964) -- Jose Parrella Sat, 04 Aug 2007 10:39:40 -0400 @@ -2839,7 +1772,7 @@ nginx (0.5.13-1) unstable; urgency=low nginx (0.5.12-2) unstable; urgency=low - * Patching src/core/ngx_shmtx.h in order to solve FTBFS problems in + * Patching src/core/ngx_shmtx.h in order to solve FTBFS problems in non-x86 archs (Thanks to Igor Sysoev) (Closes: #410884) -- Jose Parrella Wed, 14 Feb 2007 13:32:01 -0400 @@ -2855,7 +1788,7 @@ nginx (0.5.11-1) unstable; urgency=low * New upstream version. (Closes: #405983) - -- Jose Parrella Mon, 05 Feb 2007 19:35:56 -0400 + -- Jose Parrella Sun, 5 Feb 2007 19:35:56 -0400 nginx (0.4.13-2) unstable; urgency=low @@ -2895,3 +1828,4 @@ nginx (0.4.2-1) unstable; urgency=low * Tweaked the configuration file and the path handling for Debian. -- Jose Parrella Thu, 14 Sep 2006 11:40:20 -0400 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/conf/fastcgi.conf b/debian/conf/fastcgi.conf index d53a628..ac9ff92 100644 --- a/debian/conf/fastcgi.conf +++ b/debian/conf/fastcgi.conf @@ -10,7 +10,6 @@ fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; -fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; @@ -18,7 +17,6 @@ fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; -fastcgi_param REMOTE_USER $remote_user; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; diff --git a/debian/conf/fastcgi_params b/debian/conf/fastcgi_params index 69c4387..71e2c2e 100644 --- a/debian/conf/fastcgi_params +++ b/debian/conf/fastcgi_params @@ -9,7 +9,6 @@ fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; -fastcgi_param REQUEST_SCHEME $scheme; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; @@ -17,7 +16,6 @@ fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; -fastcgi_param REMOTE_USER $remote_user; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; diff --git a/debian/conf/mime.types b/debian/conf/mime.types index cf968c0..89be9a4 100644 --- a/debian/conf/mime.types +++ b/debian/conf/mime.types @@ -1,101 +1,89 @@ + types { - text/html html htm shtml; - text/css css; - text/xml xml; - image/gif gif; - image/jpeg jpeg jpg; - application/javascript js; - application/atom+xml atom; - application/rss+xml rss; + text/html html htm shtml; + text/css css; + text/xml xml; + image/gif gif; + image/jpeg jpeg jpg; + application/javascript js; + application/atom+xml atom; + application/rss+xml rss; - text/mathml mml; - text/plain txt; - text/vnd.sun.j2me.app-descriptor jad; - text/vnd.wap.wml wml; - text/x-component htc; + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; - image/avif avif; - image/png png; - image/svg+xml svg svgz; - image/tiff tif tiff; - image/vnd.wap.wbmp wbmp; - image/webp webp; - image/x-icon ico; - image/x-jng jng; - image/x-ms-bmp bmp; + image/png png; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + image/svg+xml svg svgz; + image/webp webp; - font/woff woff; - font/woff2 woff2; + application/font-woff woff; + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.apple.mpegurl m3u8; + application/vnd.ms-excel xls; + application/vnd.ms-fontobject eot; + application/vnd.ms-powerpoint ppt; + application/vnd.wap.wmlc wmlc; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/xspf+xml xspf; + application/zip zip; - application/java-archive jar war ear; - application/json json; - application/mac-binhex40 hqx; - application/msword doc; - application/pdf pdf; - application/postscript ps eps ai; - application/rtf rtf; - application/vnd.apple.mpegurl m3u8; - application/vnd.google-earth.kml+xml kml; - application/vnd.google-earth.kmz kmz; - application/vnd.ms-excel xls; - application/vnd.ms-fontobject eot; - application/vnd.ms-powerpoint ppt; - application/vnd.oasis.opendocument.graphics odg; - application/vnd.oasis.opendocument.presentation odp; - application/vnd.oasis.opendocument.spreadsheet ods; - application/vnd.oasis.opendocument.text odt; - application/vnd.openxmlformats-officedocument.presentationml.presentation - pptx; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - xlsx; - application/vnd.openxmlformats-officedocument.wordprocessingml.document - docx; - application/vnd.wap.wmlc wmlc; - application/wasm wasm; - application/x-7z-compressed 7z; - application/x-cocoa cco; - application/x-java-archive-diff jardiff; - application/x-java-jnlp-file jnlp; - application/x-makeself run; - application/x-perl pl pm; - application/x-pilot prc pdb; - application/x-rar-compressed rar; - application/x-redhat-package-manager rpm; - application/x-sea sea; - application/x-shockwave-flash swf; - application/x-stuffit sit; - application/x-tcl tcl tk; - application/x-x509-ca-cert der pem crt; - application/x-xpinstall xpi; - application/xhtml+xml xhtml; - application/xslt+xml xsl xslt; - application/xspf+xml xspf; - application/zip zip; + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + application/octet-stream iso img; + application/octet-stream msi msp msm; - application/octet-stream bin exe dll; - application/octet-stream deb; - application/octet-stream dmg; - application/octet-stream iso img; - application/octet-stream msi msp msm; + application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; + application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; - audio/midi mid midi kar; - audio/mpeg mp3; - audio/ogg ogg; - audio/x-m4a m4a; - audio/x-realaudio ra; + audio/midi mid midi kar; + audio/mpeg mp3; + audio/ogg ogg; + audio/x-m4a m4a; + audio/x-realaudio ra; - video/3gpp 3gpp 3gp; - video/mp2t ts; - video/mp4 mp4; - video/mpeg mpeg mpg; - video/ogg ogv; - video/quicktime mov; - video/webm webm; - video/x-flv flv; - video/x-m4v m4v; - video/x-matroska mkv; - video/x-mng mng; - video/x-ms-asf asx asf; - video/x-ms-wmv wmv; - video/x-msvideo avi; + video/3gpp 3gpp 3gp; + video/mp2t ts; + video/mp4 mp4; + video/mpeg mpeg mpg; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-m4v m4v; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; } diff --git a/debian/conf/nginx.conf b/debian/conf/nginx.conf index 68a8fd4..785360a 100644 --- a/debian/conf/nginx.conf +++ b/debian/conf/nginx.conf @@ -1,9 +1,6 @@ user www-data; -worker_processes auto; -worker_cpu_affinity auto; +worker_processes 4; pid /run/nginx.pid; -error_log /var/log/nginx/error.log; -include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; @@ -18,8 +15,10 @@ http { sendfile on; tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; types_hash_max_size 2048; - server_tokens off; # Recommended practice is to turn this off + # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; @@ -31,20 +30,22 @@ http { # SSL Settings ## - ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3 (POODLE), TLS 1.0, 1.1 - ssl_prefer_server_ciphers off; # Don't force server cipher order. + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; + gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; @@ -65,17 +66,17 @@ http { #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript -# +# # # auth_http localhost/auth.php; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; -# +# # server { # listen localhost:110; # protocol pop3; # proxy on; # } -# +# # server { # listen localhost:143; # protocol imap; diff --git a/debian/conf/scgi_params b/debian/conf/scgi_params index 6d4ce4f..47348ca 100644 --- a/debian/conf/scgi_params +++ b/debian/conf/scgi_params @@ -8,7 +8,6 @@ scgi_param DOCUMENT_URI $document_uri; scgi_param DOCUMENT_ROOT $document_root; scgi_param SCGI 1; scgi_param SERVER_PROTOCOL $server_protocol; -scgi_param REQUEST_SCHEME $scheme; scgi_param HTTPS $https if_not_empty; scgi_param REMOTE_ADDR $remote_addr; diff --git a/debian/conf/sites-available/default b/debian/conf/sites-available/default index c5af914..b4c49af 100644 --- a/debian/conf/sites-available/default +++ b/debian/conf/sites-available/default @@ -1,17 +1,12 @@ ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. -# https://www.nginx.com/resources/wiki/start/ -# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ -# https://wiki.debian.org/Nginx/DirectoryStructure +# http://wiki.nginx.org/Pitfalls +# http://wiki.nginx.org/QuickStart +# http://wiki.nginx.org/Configuration # -# In most cases, administrators will remove this file from sites-enabled/ and -# leave it as reference inside of sites-available where it will continue to be -# updated by the nginx packaging team. -# -# This file will automatically load configuration files provided by other -# applications, such as Drupal or Wordpress. These applications will be made -# available underneath a path with that package name, such as /drupal8. +# Generally, you will want to move this file somewhere, and start with a clean +# file but keep this around for reference. Or just disable in sites-enabled. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## @@ -27,12 +22,6 @@ server { # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # - # Note: You should disable gzip for SSL traffic. - # See: https://bugs.debian.org/773332 - # - # Read up on ssl_ciphers to ensure a secure configuration. - # See: https://bugs.debian.org/765782 - # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # @@ -51,15 +40,15 @@ server { try_files $uri $uri/ =404; } - # pass PHP scripts to FastCGI server + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # - # # With php-fpm (or other unix sockets): - # fastcgi_pass unix:/run/php/php7.4-fpm.sock; - # # With php-cgi (or other tcp sockets): + # # With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; + # # With php5-fpm: + # fastcgi_pass unix:/var/run/php5-fpm.sock; #} # deny access to .htaccess files, if Apache's document root diff --git a/debian/conf/snippets/fastcgi-php.conf b/debian/conf/snippets/fastcgi-php.conf index 467a9e7..8f8e4a2 100644 --- a/debian/conf/snippets/fastcgi-php.conf +++ b/debian/conf/snippets/fastcgi-php.conf @@ -1,5 +1,5 @@ # regex to split $uri to $fastcgi_script_name and $fastcgi_path -fastcgi_split_path_info ^(.+?\.php)(/.*)$; +fastcgi_split_path_info ^(.+\.php)(/.+)$; # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; diff --git a/debian/conf/uwsgi_params b/debian/conf/uwsgi_params index 09c732c..f539451 100644 --- a/debian/conf/uwsgi_params +++ b/debian/conf/uwsgi_params @@ -8,7 +8,6 @@ uwsgi_param REQUEST_URI $request_uri; uwsgi_param PATH_INFO $document_uri; uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param SERVER_PROTOCOL $server_protocol; -uwsgi_param REQUEST_SCHEME $scheme; uwsgi_param HTTPS $https if_not_empty; uwsgi_param REMOTE_ADDR $remote_addr; diff --git a/debian/control b/debian/control index 47749f4..13b7d9f 100644 --- a/debian/control +++ b/debian/control @@ -1,43 +1,58 @@ Source: nginx Section: httpd Priority: optional -Maintainer: Debian Nginx Maintainers -Uploaders: Jan Mojžíš -Build-Depends: debhelper-compat (= 13), +Maintainer: Kartik Mistry +Uploaders: Jose Parrella , + Fabio Tranchitella , + Michael Lustfield , + Dmitry E. Oboukhov , + Cyril Lavier , + Christos Trochalakis +Build-Depends: autotools-dev, + debhelper (>= 9), + po-debconf, + dh-systemd (>= 1.5), + dpkg-dev (>= 1.15.5), libexpat-dev, - libgd-dev, + libgd2-dev | libgd2-noxpm-dev, libgeoip-dev, - libpcre2-dev, + libluajit-5.1-dev [i386 amd64 kfreebsd-i386 armel armhf powerpc powerpcspe mips mipsel], + liblua5.1-0-dev [!i386 !amd64 !kfreebsd-i386 !armel !armhf !powerpc !powerpcspe !mips !mipsel], + libmhash-dev, + libpam0g-dev, + libpcre3-dev, libperl-dev, libssl-dev, libxslt1-dev, po-debconf, zlib1g-dev -Standards-Version: 4.7.0 -Homepage: https://nginx.org -Vcs-Git: https://salsa.debian.org/nginx-team/nginx.git -Vcs-Browser: https://salsa.debian.org/nginx-team/nginx -Rules-Requires-Root: no +Standards-Version: 3.9.6.0 +Homepage: http://nginx.net +Vcs-Git: git://anonscm.debian.org/collab-maint/nginx.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nginx.git;a=summary +XS-Testsuite: autopkgtest Package: nginx -Architecture: any -Depends: ${misc:Depends}, - ${shlibs:Depends}, - iproute2, - nginx-common (= ${source:Version}), -Breaks: nginx-light (<< 1.22.1-6~), nginx-extras (<< 1.22.1-6~), nginx-core (<< 1.22.1-6~), -Replaces: nginx-light (<< 1.22.1-6~), nginx-extras (<< 1.22.1-6~), nginx-core (<< 1.22.1-6~), -Provides: httpd, httpd-cgi, ${nginx:abi} +Architecture: all +Depends: nginx-full (>= ${source:Version}) | + nginx-light (>= ${source:Version}) | + nginx-extras (>= ${source:Version}) , + nginx-full (<< ${source:Version}.1~) | + nginx-light (<< ${source:Version}.1~) | + nginx-extras (<< ${source:Version}.1~) , + ${misc:Depends} Description: small, powerful, scalable web/proxy server Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. + . + This is a dependency package to install either nginx-full (by default) or + nginx-light. Package: nginx-doc Architecture: all -Multi-Arch: foreign Section: doc -Depends: ${misc:Depends} +Depends: lsb-base (>= 3.2-14), ${misc:Depends} Description: small, powerful, scalable web/proxy server - documentation Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server @@ -46,11 +61,16 @@ Description: small, powerful, scalable web/proxy server - documentation This package provides extra documentation to help unleash the power of Nginx. Package: nginx-common -Breaks: nginx (<< 1.22.1-8) -Replaces: nginx (<< 1.22.1-8) Architecture: all -Multi-Arch: foreign -Depends: ${misc:Depends} +Depends: lsb-base (>= 3.2-14), ${misc:Depends} +Replaces: nginx (<< 0.8.54-4), + nginx-extras (<< 0.8.54-4), + nginx-full (<< 0.8.54-4), + nginx-light (<< 0.8.54-4) +Breaks: nginx (<< 0.8.54-4), + nginx-extras (<< 0.8.54-4), + nginx-full (<< 0.8.54-4), + nginx-light (<< 0.8.54-4) Suggests: fcgiwrap, nginx-doc, ssl-cert Description: small, powerful, scalable web/proxy server - common files Nginx ("engine X") is a high-performance web and reverse proxy server @@ -60,252 +80,135 @@ Description: small, powerful, scalable web/proxy server - common files This package contains base configuration files used by all versions of nginx. -Package: nginx-dev -Architecture: all -Multi-Arch: foreign -Depends: ${misc:Depends}, ${S:Build-Depends}, - ${nginx:abi}, - nginx (<< ${source:Version}.1~), - nginx (>= ${source:Version}), -Provides: dh-sequence-nginx -Description: nginx web/proxy server - development headers - Nginx ("engine X") is a high-performance web and reverse proxy server - created by Igor Sysoev. It can be used both as a standalone web server - and as a proxy to reduce the load on back-end HTTP or mail servers. - . - This package provides development headers and necessary config scripts - for the nginx web/proxy server, useful to develop and link third party - additions to the Debian nginx web/proxy server packages. - -Package: nginx-core -Architecture: all -Depends: libnginx-mod-http-geoip (>= ${source:Version}), - libnginx-mod-http-geoip (<< ${source:Version}.1~), - libnginx-mod-http-image-filter (>= ${source:Version}), - libnginx-mod-http-image-filter (<< ${source:Version}.1~), - libnginx-mod-http-xslt-filter (>= ${source:Version}), - libnginx-mod-http-xslt-filter (<< ${source:Version}.1~), - libnginx-mod-mail (>= ${source:Version}), - libnginx-mod-mail (<< ${source:Version}.1~), - libnginx-mod-stream (>= ${source:Version}), - libnginx-mod-stream (<< ${source:Version}.1~), - libnginx-mod-stream-geoip (>= ${source:Version}), - libnginx-mod-stream-geoip (<< ${source:Version}.1~), - nginx (>= ${source:Version}), - nginx (<< ${source:Version}.1~), - ${misc:Depends}, - ${shlibs:Depends} -Breaks: nginx-full (<< 1.18.0-1), -Replaces: nginx-full (<< 1.18.0-1), +Package: nginx-full +Architecture: any +Depends: nginx-common (= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} +Breaks: nginx (<< 1.4.5-1) +Provides: httpd, httpd-cgi, nginx +Conflicts: nginx-extras, nginx-light +Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (standard version) Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. . - This metapackage provides a version of nginx identical to that of nginx-full, - but without any third-party modules, and only modules in the original - nginx code base. + This package provides a version of nginx with the complete set of + standard modules included (but omitting some of those included in + nginx-extra). . - STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, Empty - GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, - Referer, Rewrite, SCGI, Split Clients, UWSGI. + STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, + Charset, Empty GIF, FastCGI, Geo, Gzip, Headers, Index, Limit Requests, + Limit Zone, Log, Map, Memcached, Proxy, Referer, Rewrite, SCGI, + Split Clients, SSI, Upstream, User ID, UWSGI. . - OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip, - Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP, - Slice, SSI, SSL, SSL Preread, Stub Status, Substitution, Thread Pool, - Upstream, User ID, XSLT. + OPTIONAL HTTP MODULES: Addition, Auth Request, Debug, GeoIP, Gzip + Precompression, HTTP Sub, Image Filter, IPv6, Real IP, Spdy, SSL, Stub Status, + Substitution, WebDAV, XSLT. . - OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP. + MAIL MODULES: Mail Core, IMAP, POP3, SMTP, SSL. . - OPTIONAL STREAM MODULES: Stream Core, GeoIP + THIRD PARTY MODULES: Auth PAM, DAV Ext, Echo, HTTP Substitution Filter, + Upstream Fair Queue. -Package: nginx-full -Architecture: all -Depends: libnginx-mod-http-auth-pam, - libnginx-mod-http-dav-ext, - libnginx-mod-http-echo, - libnginx-mod-http-geoip2, - libnginx-mod-http-subs-filter, - libnginx-mod-http-upstream-fair, - libnginx-mod-stream-geoip2, - nginx (>= ${source:Version}), - nginx (<< ${source:Version}.1~), - ${misc:Depends}, - ${shlibs:Depends} -Description: nginx web/proxy server (standard version with 3rd parties) +Package: nginx-full-dbg +Architecture: any +Section: debug +Priority: extra +Depends: nginx-full (= ${binary:Version}), ${misc:Depends} +Conflicts: nginx-extras-dbg, nginx-light-dbg +Description: nginx web/proxy server (standard version) - debugging symbols Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. . - This metapackage provides a version of nginx with the complete set of - standard modules included (but omitting some of those included in - nginx-extras). - . - STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, Empty - GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, - Referer, Rewrite, SCGI, Split Clients, UWSGI. - . - OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, GeoIP, Gunzip, - Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, Real IP, - Slice, SSI, SSL, Stream, SSL Preread, Stub Status, Substitution, Thread Pool, - Upstream, User ID, XSLT. - . - OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP. - . - OPTIONAL STREAM MODULES: Stream Core, GeoIP, GeoIP2 - . - THIRD PARTY MODULES: Auth PAM, DAV Ext, Echo, GeoIP2, HTTP Substitutions - Upstream Fair Queue. + This package provides debugging symbols for nginx-full, to assist in debugging + issues that you may find. It should not be required for normal operation. Package: nginx-light -Architecture: all -Depends: libnginx-mod-http-echo, - nginx (>= ${source:Version}), - nginx (<< ${source:Version}.1~), - ${misc:Depends}, - ${shlibs:Depends} +Architecture: any +Priority: extra +Depends: nginx-common (= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} +Breaks: nginx (<< 1.4.5-1) +Provides: httpd, httpd-cgi, nginx +Conflicts: nginx-extras, nginx-full +Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (basic version) Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. . - This metapackage provides a very light version of nginx with only the + This package provides a very light version of nginx with only the minimal set of features and modules. . - STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Empty GIF, - FastCGI, Map, Proxy, Rewrite, SCGI, uWSGI. + STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Charset, + Empty GIF, FastCGI, Gzip, Headers, Index, Log, Map, Proxy, Rewrite, Upstream. . - OPTIONAL HTTP MODULES: Auth Request, Charset, Gzip, Gzip Precompression, - Headers, HTTP/2, Index, Log, Real IP, Slice, SSI, SSL, Stub Status, Thread - Pool, WebDAV, Upstream. + OPTIONAL HTTP MODULES: Auth Request, Debug, Gzip Precompression, IPv6, Real + Ip, SSL, Stub Status. . THIRD PARTY MODULES: Echo. +Package: nginx-light-dbg +Architecture: any +Section: debug +Priority: extra +Depends: nginx-light (= ${binary:Version}), ${misc:Depends} +Conflicts: nginx-extras-dbg, nginx-full-dbg +Description: nginx web/proxy server (basic version) - debugging symbols + Nginx ("engine X") is a high-performance web and reverse proxy server + created by Igor Sysoev. It can be used both as a standalone web server + and as a proxy to reduce the load on back-end HTTP or mail servers. + . + This package provides debugging symbols for nginx-light, to assist in + debugging issues that you may find. It should not be required for normal + operation. + Package: nginx-extras Architecture: any -Depends: nginx (= ${binary:Version}), - libnginx-mod-http-geoip (= ${binary:Version}), - libnginx-mod-http-image-filter (= ${binary:Version}), - libnginx-mod-http-perl (= ${binary:Version}), - libnginx-mod-http-xslt-filter (= ${binary:Version}), - libnginx-mod-mail (= ${binary:Version}), - libnginx-mod-stream (= ${binary:Version}), - libnginx-mod-stream-geoip (= ${binary:Version}), - libnginx-mod-http-auth-pam, - libnginx-mod-http-cache-purge, - libnginx-mod-http-dav-ext, - libnginx-mod-http-echo, - libnginx-mod-http-fancyindex, - libnginx-mod-http-geoip2, - libnginx-mod-http-headers-more-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], - libnginx-mod-http-subs-filter, - libnginx-mod-http-uploadprogress, - libnginx-mod-http-upstream-fair, - libnginx-mod-nchan, - libnginx-mod-stream-geoip2, +Priority: extra +Depends: nginx-common (= ${source:Version}), ${misc:Depends}, + ${perl:Depends}, ${shlibs:Depends} +Breaks: nginx (<< 1.4.5-1) +Provides: httpd, httpd-cgi, nginx +Conflicts: nginx-full, nginx-light +Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (extended version) Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. . - This metapackage provides a version of nginx with the standard modules, plus + This package provides a version of nginx with the standard modules, plus extra features and modules such as the Perl module, which allows the addition of Perl in configuration files. . - STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, Empty - GIF, FastCGI, Geo, Limit Connections, Limit Requests, Map, Memcached, Proxy, - Referer, Rewrite, SCGI, Split Clients, UWSGI. + STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index, Browser, + Charset, Empty GIF, FastCGI, Geo, Gzip, Headers, Index, Limit Requests, + Limit Zone, Log, Map, Memcached, Proxy, Referer, Rewrite, SCGI, + Split Clients, SSI, Upstream, User ID, UWSGI. . - OPTIONAL HTTP MODULES: Addition, Auth Request, Charset, WebDAV, FLV, GeoIP, - Gunzip, Gzip, Gzip Precompression, Headers, HTTP/2, Image Filter, Index, Log, - MP4, Embedded Perl, Random Index, Real IP, Slice, Secure Link, SSI, SSL, - SSL Preread, Stub Status, Substitution, Thread Pool, Upstream, User ID, XSLT. + OPTIONAL HTTP MODULES: Addition, Auth Request, Debug, Embedded Perl, FLV, + GeoIP, Gzip Precompression, Image Filter, IPv6, MP4, Random Index, Real IP, + Secure Link, Spdy, SSL, Stub Status, Substitution, WebDAV, XSLT. . - OPTIONAL MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3, SMTP. + MAIL MODULES: Mail Core, IMAP, POP3, SMTP, SSL. . - OPTIONAL STREAM MODULES: Stream, GeoIP, GeoIP2 - . - THIRD PARTY MODULES: Auth PAM, Cache Purge, DAV Ext, Echo, Fancy Index, - GeoIP2, Headers More, Embedded Lua, HTTP Substitutions, Nchan, Upload Progress, - Upstream Fair Queue. + THIRD PARTY MODULES: Auth PAM, Chunkin, DAV Ext, Echo, Embedded Lua, + Fancy Index, HttpHeadersMore, HTTP Substitution Filter, http push, + Nginx Development Kit, Upload Progress, Upstream Fair Queue. -Package: libnginx-mod-http-geoip +Package: nginx-extras-dbg Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: GeoIP HTTP module for Nginx - The ngx_http_geoip module creates variables with values depending on the - client IP address, using the precompiled MaxMind databases. +Section: debug +Priority: extra +Depends: nginx-extras (= ${binary:Version}), ${misc:Depends} +Conflicts: nginx-full-dbg, nginx-light-dbg +Description: nginx web/proxy server (extended version) - debugging symbols + Nginx ("engine X") is a high-performance web and reverse proxy server + created by Igor Sysoev. It can be used both as a standalone web server + and as a proxy to reduce the load on back-end HTTP or mail servers. . - Those variables include country, region, city, latitude, longitude, postal - code, etc. - -Package: libnginx-mod-http-image-filter -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: HTTP image filter module for Nginx - The ngx_http_image_filter module is a filter that transforms images in JPEG, - GIF, and PNG formats. - . - The module supports filters such as rotate, resize, crop, quality, sharpening, - interlacing and more. - -Package: libnginx-mod-http-xslt-filter -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: XSLT Transformation module for Nginx - The ngx_http_xslt_filter module is a filter that transforms XML responses - using one or more XSLT stylesheets. - . - The transformation can be adjusted by setting the relevant configuration - parameters. - -Package: libnginx-mod-mail -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: Mail module for Nginx - The nginx_mail module adds mail proxy support to nginx. - . - The module supports proxying all the standard mail protocols such as IMAP, - POP3 & SMTP. - -Package: libnginx-mod-stream -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: Stream module for Nginx - The nginx_stream module adds stream proxy support to nginx. - . - Stream module supports loadbalancing & proxying to TCP servers. The module - also supports ACLs/connection limiting and configuring multiple operational - parameters. - -Package: libnginx-mod-stream-geoip -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends}, - libnginx-mod-stream (= ${binary:Version}), -Recommends: nginx, -Description: GeoIP Stream module for Nginx - The ngx_stream_geoip module creates variables with values depending on the - client IP address, using the precompiled MaxMind databases. - . - Those variables include country, region, city, latitude, longitude, postal - code, etc. - -Package: libnginx-mod-http-perl -Architecture: any -Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}, -Recommends: nginx, -Description: Perl module for Nginx - Embed Perl runtime into nginx. - . - The ngx_http_perl module is used to implement location and variable handlers - in Perl and insert Perl calls into SSI. - . - Note that this module is marked experimental. + This package provides debugging symbols for nginx-extras, to assist in + debugging issues that you may find. It should not be required for normal + operation. diff --git a/debian/copyright b/debian/copyright index 0536a8c..9b123d1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,82 +1,102 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: nginx -Source: https://nginx.org/en/download.html +Source: http://nginx.org/en/download.html Files: * -Copyright: Valentin V. Bartenev - Ruslan Ermilov - Roman Arutyunyan - Maxim Dounin - 2011-2024, Nginx, Inc. - 2002-2021, Igor Sysoev +Copyright: 2002-2014 Igor Sysoev + 2011-2014 Nginx, Inc. + Maxim Dounin + Valentin V. Bartenev +License: BSD-2-clause + +Files: src/core/ngx_murmurhash.c +Copyright: Copyright (C) Austin Appleby +License: BSD-2-clause + +Files: src/core/ngx_proxy_protocol.h + src/core/ngx_proxy_protocol.c +Copyright: Copyright (C) Roman Arutyunyan + Copyright (C) Nginx, Inc. +License: BSD-2-clause + +Files: src/http/modules/ngx_http_scgi_module.c + src/http/modules/ngx_http_uwsgi_module.c +Copyright: Copyright (C) Igor Sysoev + Copyright (C) Nginx, Inc. + Copyright (C) Manlio Perillo (manlio.perillo@gmail.com) License: BSD-2-clause Files: contrib/geo2nginx.pl Copyright: 2005, Andrei Nigmatulin License: BSD-2-clause +Files: debian/modules/headers-more-nginx-module/* +Copyright: Copyright (c) 2009-2014, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. + Copyright (c) 2010-2013, Bernd Dorn + Copyright (c) Igor Sysoev +License: BSD-2-clause + +Files: debian/modules/nginx-development-kit/* +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: debian/modules/nginx-development-kit/src/hash/md5.h + debian/modules/nginx-development-kit/src/hash/sha.h +Copyright: Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) +License: BSD-4-clause + +Files: debian/modules/nginx-auth-pam/* +Copyright: 2008-2013, Sergio Talens Oliag +License: BSD-2-clause + +Files: debian/modules/nginx-echo/* +Copyright: Copyright (c) 2009-2014, Yichun "agentzh" Zhang +License: BSD-2-clause + +Files: debian/modules/nginx-lua/* +Copyright: Copyright (C) 2009-2014, by Xiaozhe Wang (chaoslawful) . + Copyright (C) 2009-2014, by Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. +License: BSD-2-clause + +Files: debian/modules/nginx-upstream-fair/* +Copyright: Copyright (c) 2007 Grzegorz Nosek + Igor Sysoev +License: BSD-2-clause + +Files: debian/modules/nginx-http-push/* +Copyright: Copyright (c) 2009 Leo Ponomarev +License: Expat + +Files: debian/modules/nginx-upload-progress/* +Copyright: Brice Figureau + 2002-2007, Igor Sysoev +License: BSD-2-clause + +Files: debian/modules/nginx-cache-purge/* +Copyright: 2009-2012, FRiCKLE , + 2009-2012, Piotr Sikora +License: BSD-2-clause + +Files: debian/modules/nginx-dav-ext-module/* +Copyright: Arutyunyan Roman +License: BSD-2-clause + +Files: debian/modules/ngx-fancyindex/* +Copyright: Copyright (c) Adrian Perez +License: BSD-2-clause + +Files: debian/modules/ngx_http_substitutions_filter_module/* +Copyright: Copyright (C) 2014 by Weibin Yao +License: BSD-2-clause + Files: debian/* -Copyright: 2022-2025, Jan Mojžíš - 2020-2022, Ondřej Nový - 2019-2022, Thomas Ward - 2013-2016, Christos Trochalakis - 2011-2013, Cyril Lavier - 2011, Dmitry E. Oboukhov - 2010-2014, Michael Lustfield - 2009-2014, Kartik Mistry - 2008, Jose Parrella - 2007-2009, Fabio Tranchitella -License: BSD-2-clause - -Files: debian/apport/* -Copyright: 2015, Thomas Ward -License: BSD-2-clause - -Files: debian/debhelper/* -Copyright: 2022, Miao Wang -License: Expat - -Files: debian/debhelper/dh_nginx -Copyright: 2016, Christos Trochalakis -License: GPL-2+ - -Files: debian/ngx-conf/ngx-conf -Copyright: 2015, Michael Lustfield -License: Expat - -Files: man/* -Copyright: Nginx, Inc. - 2010, 2019, Sergey A. Osokin -License: BSD-2-clause - -Files: src/core/ngx_murmurhash.c -Copyright: Austin Appleby -License: public-domain - All MurmurHash versions are public domain software, and the author - disclaims all copyright to their code. - -Files: src/http/modules/ngx_http_scgi_module.c -Copyright: Nginx, Inc. - Manlio Perillo (manlio.perillo@gmail.com) - Igor Sysoev -License: BSD-2-clause - -Files: src/http/modules/ngx_http_uwsgi_module.c -Copyright: Nginx, Inc. - Igor Sysoev - 2009, 2010, Unbit S.a.s. - 2008, Manlio Perillo (manlio.perillo@gmail.com) -License: BSD-2-clause - -Files: src/http/ngx_http_huff_encode.c -Copyright: Valentin V. Bartenev - Nginx, Inc. - 2015, Vlad Krasnov -License: BSD-2-clause - -Files: src/stream/ngx_stream_set_module.c -Copyright: Pavel Pautov - Nginx, Inc. +Copyright: 2007-2009, Fabio Tranchitella + 2008, Jose Parrella + 2009-2014, Kartik Mistry + 2010-2014, Michael Lustfield + 2011 Dmitry E. Oboukhov + 2011-2013, Cyril Lavier + 2013-2014, Christos Trochalakis License: BSD-2-clause License: BSD-2-clause @@ -104,6 +124,58 @@ License: BSD-2-clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +License: BSD-3-clause + All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD-4-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -122,15 +194,3 @@ License: Expat LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -License: GPL-2+ - This is free software, licensed under: - . - The GNU General Public License, Version 2, June 1991 - . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 dated June, 1991, or (at - your option) any later version. - On Debian systems, the complete text of version 2 of the GNU General - Public License can be found in '/usr/share/common-licenses/GPL-2'. diff --git a/debian/debhelper/dh_nginx b/debian/debhelper/dh_nginx deleted file mode 100755 index 9100220..0000000 --- a/debian/debhelper/dh_nginx +++ /dev/null @@ -1,334 +0,0 @@ -#! /usr/bin/perl - -# dh_nginx - Nginx configuration helper -# Copyright (C) 2016 Christos Trochalakis -# -# This program is licensed under the terms of the GNU General -# Public License veserion 2+ -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -use strict; -use File::Find; -use Debian::Debhelper::Dh_Lib; -use Dpkg::Substvars; - -=head1 NAME - -dh_nginx - register configuration snippets to the nginx web server - -=cut -my $nginx_in_tree; -my $abi; -sub nginx_depends -{ - if (!$abi) { - my $sv = Dpkg::Substvars->new(); - if ($nginx_in_tree) { - $sv->load("debian/libnginx-mod.abisubstvars"); - } - else { - $sv->load("/usr/share/nginx/src/debian/libnginx-mod.abisubstvars"); - } - $abi = $sv->get("nginx:abi"); - } - return "$abi"; -} - -sub nginx_api_installdir -{ - return "/usr/lib/nginx/modules/"; -} - -sub nginx_modules_conf_installdir -{ - return "usr/share/nginx/modules-available/" -} - -=head1 SYNOPSIS - -B [S>] [B<-n>|B<--noscripts>] [B<--in-nginx-tree>] - -=head1 DESCRIPTION - -B is a debhelper program that is responsible for correctly installing -Nginx configuration snippets and setting postinst, prerm and dependencies in -Nginx web server modules and web applications. - -It supports the following configuration types - -=over 4 - -=item * -Nginx modules - -=back - -=head1 INVOCATION - - %: - dh $@ --with nginx - -=head1 FILES - -=over 4 - -=item debian/I.nginx - -=item debian/nginx - -=back - -Lists files to be registered with the Nginx HTTP server. The file is -interpreted as line separated list of installation stanzas, where each entry -consists of whitespace separated values conforming to the file semantics below. - -When this file is missing but the name of the package looks like a nginx module, -the module load file and its loading priority is automatically generated inferring -from the package name. In this case, IB<.install> or other mechanisms -should be used for copying the B<.so> library into the correct place. - -=head2 FILE SEMANTICS - -Each line consists of a triple - -I I [I] - -where the values are interpreted as follows: - - -=head3 I - -Denotes the type of file to be installed. Recognized values are B for -Nginx modules. - -=head3 I - -Is interpreted as existing file name within the source package. No path -expansion is effectuated. Just like L, B can not -rename files. - -=head3 I - -Is inrerpreted as optional arguments if any, currently not used. - -=head2 MODULES - -Modules are handled specially and are determined by the B type. Modules must -have a I<.conf> suffix. In that case the file is interpreted as module load -file and is installed to I. If the file is ending -with a I<.so> suffix it is interpreted as actual module shared object and is -installed to the Nginx module directory, an optional numeric priority can be -set as the last argument to handle module dependencies. - -=head1 OPTIONS - -=over 4 - -=item B<-e>, B<--noenable> - -Install maintainer scripts accordingly, but do not enable the scripts or -configuration by default. - -=item B<-n>, B<--noscripts> - -Do not modify F/F/F maintainer scripts. - -=item B<--in-nginx-tree> - -Specify this option when building in-tree modules along with nginx. When -specified, nginx abi version is not required in package name. - -=back - -=head1 NOTES - -Note that this command is not idempotent. L should be called -between invocations of this command. Otherwise, it may cause multiple -instances of the same text to be added to maintainer scripts. - -=head1 AUTHOR - -This manual and L was written by Christos Trochalakis. -dh_nginx is heavily influnced by dh_apache2 written by Arno Toell -. - -=cut - - -## -## main code starts here -## - -init(options => { - "e|noenable" => \$dh{NOENABLE}, - "in-nginx-tree" => \$nginx_in_tree, -}); - -foreach my $package ((@{$dh{DOPACKAGES}})) -{ - my %PACKAGE_TYPE = ( - has_a_module => [], - ); - - my $file = pkgfile($package, "nginx"); - my $tmp = tmpdir($package); - my $installdir = $tmp . "/" . nginx_modules_conf_installdir(); - my $modinstalldir = $tmp . "/" . nginx_api_installdir(); - - if ($file){ - my @files_to_register = filedoublearray($file, ".") if $file; - foreach my $line (@files_to_register) - { - my $type = lc(shift @{$line}) if $line->[0]; - my $source = shift @{$line} if $line->[0]; - my @arguments = @{$line}; - my $destination; - - $type = "modules" if $type eq "mod"; - - verbose_print("$type -- $source -- @arguments\n\n"); - - if ($type eq "modules") - { - my $basesource = basename($source); - - if ($type eq "modules") - { - if ($basesource =~ m/\.conf$/) - { - my $enablename = $basesource; - my $prio = $#arguments >= 0 ? $arguments[0] : 50; - $destination = "$prio-$basesource"; - push @{$PACKAGE_TYPE{'has_a_module'}}, "$enablename:$destination"; - verbose_print("Installing module configuration $enablename into $installdir prio:$prio\n"); - } - elsif ($basesource =~ m/\.so$/) - { - verbose_print("Installing module binary $source into $modinstalldir\n"); - if (! -d $modinstalldir) - { - complex_doit("mkdir","-p", $modinstalldir); - complex_doit("chmod","755","$modinstalldir"); - } - complex_doit("cp", $source, $modinstalldir); - next; - } - - # TODO - error("module: \"$basesource\" needs .conf, .so or suffix") if $basesource !~ m/\.(conf|so)/; - } - - if (! -d $installdir) - { - complex_doit("mkdir","-p",$installdir); - complex_doit("chmod","755","$installdir"); - } - complex_doit("cp",$source,$installdir); - complex_doit("chmod","644","$installdir/$basesource"); - - } - else - { - error("Unknown parameter: $type\n"); - } - - } - } elsif ($package =~ /^libnginx-mod-/){ - verbose_print("$package might be a nginx module\n"); - - my $module = $package; - $module =~ s/^libnginx-mod-//; - verbose_print("Guessed module name: $module\n"); - - my $modulepath = $module; - $modulepath =~ s/-/_/g; - - if (-e "$modinstalldir/ngx_${modulepath}_module.so"){ - my $prio = 50; - if ($module =~ /^\w+-/ && !($module =~ /^http-/) ){ - $prio = 70; - } - verbose_print("Guessed load priority: $prio\n"); - - my $conf_name = "mod-$module.conf"; - install_dir($installdir); - verbose_print("Installing module configuration $conf_name into $installdir prio:$prio\n"); - open(MOD_CONF, $dh{NO_ACT} ? ">&STDERR" : ">$installdir/$conf_name") or error("open($installdir/$conf_name): $!"); - print(MOD_CONF "load_module modules/ngx_${modulepath}_module.so;\n"); - close(MOD_CONF); - chmod(0644, "$installdir/$conf_name") or error("chmod(0644, $installdir/$conf_name): $!"); - push @{$PACKAGE_TYPE{'has_a_module'}}, "$conf_name:$prio-$conf_name"; - } else { - verbose_print("$package is not a nginx module because $modinstalldir/ngx_${modulepath}_module.so not found"); - verbose_print("If it is not correct, check if the module is installed before invoking this script"); - } - } - - my @postinst_autoscripts; - - if ($#{$PACKAGE_TYPE{'has_a_module'}} >= 0) - { - if ($package !~ m/libnginx-mod-\w+?/) - { - warning("Package $package appears to be an Nginx module. It should comply to the package naming scheme libnginx-mod-\n"); - } - addsubstvar($package, "misc:Depends", nginx_depends()); - - my $modules = ""; - foreach my $module (@{$PACKAGE_TYPE{'has_a_module'}}) - { - $modules .= "$module "; - } - - push @postinst_autoscripts, ["module", $modules]; - } - - if (! $dh{NOSCRIPTS}) - { - foreach my $ref (@postinst_autoscripts) - { - for my $script_type (qw/postinst prerm postrm/) - { - if ($script_type eq "postinst" && $dh{NOENABLE}) - { - next - } - - my %replacements = ( - NAMES => $ref->[1], - ); - - my $sed_command = ""; - foreach my $key (sort keys %replacements) - { - my $val = $replacements{$key}; - # Use a control char as separator for sed, to - # reduce escaping issues. Everything else is - # passed verbatim, i.e. it must not contain any - # shell or sed special characters. - my $sep = "\x17"; - $sed_command .= "s" . $sep . "#$key#" . - $sep . $val . - $sep . "g; "; - } - - autoscript($package, "$script_type", "$script_type-nginx", $sed_command); - } - } - } -} - -# vim: syntax=perl sw=8 sts=8 sr noet diff --git a/debian/debhelper/nginx.pm b/debian/debhelper/nginx.pm deleted file mode 100644 index 0e41120..0000000 --- a/debian/debhelper/nginx.pm +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Debian::Debhelper::Dh_Lib; - -add_command_options( "dh_auto_test", "--buildsystem=nginx_mod" ); -add_command_options( "dh_auto_configure", "--buildsystem=nginx_mod" ); -add_command_options( "dh_auto_build", "--buildsystem=nginx_mod" ); -add_command_options( "dh_auto_install", "--buildsystem=nginx_mod" ); -add_command_options( "dh_auto_clean", "--buildsystem=nginx_mod" ); - -insert_after("dh_install", "dh_nginx"); - -1; diff --git a/debian/debhelper/nginx_mod.pm b/debian/debhelper/nginx_mod.pm deleted file mode 100644 index 1b1ecaf..0000000 --- a/debian/debhelper/nginx_mod.pm +++ /dev/null @@ -1,138 +0,0 @@ -# A build system class for handling nginx modules. -# -# Copyright: © 2022 Miao Wang -# License: MIT - -package Debian::Debhelper::Buildsystem::nginx_mod; - -use strict; -use warnings; -use Dpkg::Deps qw(deps_parse); -use Dpkg::Control::Info; -use Debian::Debhelper::Dh_Lib qw(error doit getpackages addsubstvar); -use File::Spec; -use parent qw(Debian::Debhelper::Buildsystem::makefile); -use Config; - -sub DESCRIPTION { - "Nginx Module (config)" -} - -sub check_auto_buildable { - my ($this, $step) = @_; - - return 1 if -e $this->get_sourcepath("config"); -} - -sub _NGINX_SRC_DIR { - "/usr/share/nginx/src" -} - -sub _NDK_SRC_DIR { - "/usr/share/nginx-ndk/src" -} - -sub new { - my $class=shift; - my $this= $class->SUPER::new(@_); - my $ngx_ver = `grep 'define NGINX_VERSION' /usr/share/nginx/src/src/core/nginx.h | sed -e 's/^.*"\\(.*\\)".*/\\1/'`; - chomp($ngx_ver); - $this->prefer_out_of_source_building(@_); - $this->{has_ndk} = $this->has_build_dep("libnginx-mod-http-ndk-dev"); - $this->{has_stream} = $this->has_build_dep("libnginx-mod-stream"); - foreach my $cur (getpackages('arch')) { - if ($this->{has_ndk} == 1) { - addsubstvar($cur, "misc:Depends", "libnginx-mod-http-ndk"); - } - if ($this->{has_stream} == 1) { - addsubstvar($cur, "misc:Depends", "libnginx-mod-stream (>= $ngx_ver), libnginx-mod-stream (<< $ngx_ver.1~)"); - } - } - return $this; -} - -sub configure { - my $this=shift; - - doit({ - "chdir" => $this->_NGINX_SRC_DIR, - "update_env" => { - "src_dir" => $this->get_sourcedir, - "bld_dir" => $this->get_builddir, - "pwd_dir" => $this->{cwd}, - }, - }, "bash", "-c", '. ./conf_flags - ./configure \\ - --with-cc-opt="$(cd "$pwd_dir/$src_dir"; dpkg-buildflags --get CFLAGS) -fPIC $(cd "$pwd_dir/$src_dir"; dpkg-buildflags --get CPPFLAGS)" \\ - --with-ld-opt="$(cd "$pwd_dir/$src_dir"; dpkg-buildflags --get LDFLAGS) -fPIC" \\ - "${NGX_CONF_FLAGS[@]}" \\ - --add-dynamic-module="$pwd_dir/$src_dir" \\ - --builddir="$pwd_dir/$bld_dir" \\ - ' . ($this->{has_ndk} ? '--add-module=' . $this->_NDK_SRC_DIR : '') . ' \\ - ' . ($this->{has_stream} ? '--with-stream' : '') . ' \\ - "$@"', "dummy", @_); -} - -sub build { - my $this=shift; - - $this->do_make("-f", File::Spec->catfile($this->{cwd}, $this->get_buildpath("Makefile")), "-C", $this->_NGINX_SRC_DIR, "modules"); -} - -sub test { - my $this=shift; - - if ( $this->{has_ndk} and !grep( /^ndk_http_module.so$/, @_ ) ) { - unshift @_, "ndk_http_module.so"; - } - - if ( $this->{has_stream} and !grep( /^ngx_stream_module.so$/, @_ ) ) { - unshift @_, "ngx_stream_module.so"; - } - - $this->doit_in_builddir("bash", "-e", "-o", "pipefail", "-c", ' - tmp_conf=$(mktemp -p .) - for pre_dep in "$@"; do - echo "load_module modules/$pre_dep;" >> "$tmp_conf" - done - for i in *.so; do - echo "load_module $PWD/$i;" >> "$tmp_conf" - done - echo "events{}" >> "$tmp_conf" - /usr/sbin/nginx -g "error_log /dev/null; pid /dev/null;" -t -q -c "$PWD/$tmp_conf" - rm -f "$tmp_conf" - ', "dummy", @_); -} - -sub install { - my $this=shift; - my $destdir=shift; - - $this->doit_in_builddir("bash", "-e", "-o", "pipefail", "-c", ' - destdir=$1 - mkdir -p "$destdir/usr/lib/nginx/modules" - for i in *.so; do - cp "$i" "$destdir/usr/lib/nginx/modules/" - done - ', "dummy", $destdir); -} - -sub clean { - my $this=shift; - $this->rmdir_builddir(); -} - -sub has_build_dep { - my $this=shift; - my $bd=shift; - my $control = Dpkg::Control::Info->new()->get_source(); - my $depends = deps_parse($control->{'Build-Depends'}); - foreach (split /,\s+/,$depends) { - if ($_ =~ /$bd/) { - return 1; - } - } - return 0; -} - -1 diff --git a/debian/gbp.conf b/debian/gbp.conf index 44bfd7d..af46c8f 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -1,13 +1,3 @@ [DEFAULT] -debian-branch = main -upstream-branch = upstream -upstream-tag = upstream/%(version)s pristine-tar = True -sign-tags = True -upstream-signatures = on -[import-orig] -merge-mode = replace - -[pull] -track-missing = True diff --git a/debian/help/examples/http b/debian/help/examples/http index bac9f90..89b2dde 100644 --- a/debian/help/examples/http +++ b/debian/help/examples/http @@ -38,6 +38,7 @@ http { ## gzip on; + gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; diff --git a/debian/help/examples/wordpress b/debian/help/examples/wordpress index 2d4c0ab..6faf918 100644 --- a/debian/help/examples/wordpress +++ b/debian/help/examples/wordpress @@ -34,8 +34,8 @@ server { } # This location block protects against a known attack. It happens if - # the attacker uploads a non-PHP file and attempts to run it as a - # PHP file on the server. + # the attacker uploads a non-php file and attempts to run it as a + # php file on the server. location ~ \..*/.*\.php$ { return 403; } @@ -43,7 +43,7 @@ server { # This is our primary location block. The try_files directive will # attempt to serve the data in the order listed. First try the exact # request (such as an image or text file). If it doesn't exist, see if - # the directory exists. If not, then we move to the last option which + # the directory exists. If not, then we move to the last options which # passes the request to /index.php with the requested query. location / { try_files $uri $uri/ /index.php?q=$uri&$args; @@ -51,7 +51,7 @@ server { # If a PHP file is served, this block will handle the request. This block # works on the assumption you are using php-cgi listening on /tmp/phpcgi.socket. - # Please see the PHP example (/usr/share/doc/nginx-doc/php) for more + # Please see the php example (usr/share/doc/nginx/exmaples/php) for more # information about setting up PHP. # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini location ~ \.php$ { @@ -61,11 +61,12 @@ server { fastcgi_intercept_errors on; fastcgi_pass unix:/tmp/phpcgi.socket; } - - # If we're serving a static file that ends with one of the following - # extensions, it is best to set a very high expires time. This will - # generate fewer requests for the file. These requests will be logged if - # found, but not if they don't exist. + + # As mentioned above, Nignx is king of static. If we're serving a static + # file that ends with one of the following extensions, it is best to set + # a very high expires time. This will generate fewer requests for the + # file. These requests will be logged if found, but not if they don't + # exist. location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; diff --git a/debian/index.html b/debian/index.html new file mode 100644 index 0000000..118c9d6 --- /dev/null +++ b/debian/index.html @@ -0,0 +1,32 @@ + + + +Welcome to nginx on Debian! + + + +

Welcome to nginx on Debian!

+

If you see this page, the nginx web server is successfully installed and +working on Debian. Further configuration is required.

+ +

For online documentation and support please refer to +nginx.org

+ +

+ Please use the reportbug tool to report bugs in the + nginx package with Debian. However, check existing + bug reports before reporting a new bug. +

+ +

Thank you for using debian and nginx.

+ + + + diff --git a/debian/libnginx-mod-http-geoip.nginx b/debian/libnginx-mod-http-geoip.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-http-geoip.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod-http-image-filter.nginx b/debian/libnginx-mod-http-image-filter.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-http-image-filter.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod-http-perl.install b/debian/libnginx-mod-http-perl.install deleted file mode 100755 index 7382eca..0000000 --- a/debian/libnginx-mod-http-perl.install +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/perl -w - -use Config; - -my $vendorarch = substr($Config{vendorarch}, 1); -print "debian/build-bin/objs/src/http/modules/perl/blib/arch/auto/nginx/* $vendorarch/auto/nginx\n"; -print "debian/build-bin/objs/src/http/modules/perl/blib/lib/nginx.pm $vendorarch\n"; diff --git a/debian/libnginx-mod-http-perl.nginx b/debian/libnginx-mod-http-perl.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-http-perl.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod-http-xslt-filter.nginx b/debian/libnginx-mod-http-xslt-filter.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-http-xslt-filter.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod-mail.nginx b/debian/libnginx-mod-mail.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-mail.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod-stream-geoip.nginx b/debian/libnginx-mod-stream-geoip.nginx deleted file mode 100755 index 438ee46..0000000 --- a/debian/libnginx-mod-stream-geoip.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf 70\n"; diff --git a/debian/libnginx-mod-stream.nginx b/debian/libnginx-mod-stream.nginx deleted file mode 100755 index 0ca730a..0000000 --- a/debian/libnginx-mod-stream.nginx +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-bin/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/libnginx-mod.abisubstvars b/debian/libnginx-mod.abisubstvars deleted file mode 100644 index 57261d4..0000000 --- a/debian/libnginx-mod.abisubstvars +++ /dev/null @@ -1,11 +0,0 @@ -# ABI must be changed: -# - when upstream nginx version is changed -# - when module signature is changed (e.g. time_t change from 32bit integer to 64bit integer https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069997) -# - when symbols/structures/... (exported from header files) are changed -# -# ABI format: nginx-abi-{UPSTREAM_VERSION}-{SUFFIX} -# the {SUFFIX} provides a mechanism on rare cases when there have to be ABI -# changes without upgrading the upstream nginx version, e.g. security updates -# in oldstable - -nginx:abi=nginx-abi-1.26.3-1 diff --git a/debian/libnginx-mod.conf/mod-http-geoip.conf b/debian/libnginx-mod.conf/mod-http-geoip.conf deleted file mode 100644 index 9721986..0000000 --- a/debian/libnginx-mod.conf/mod-http-geoip.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_http_geoip_module.so; diff --git a/debian/libnginx-mod.conf/mod-http-image-filter.conf b/debian/libnginx-mod.conf/mod-http-image-filter.conf deleted file mode 100644 index dfa2939..0000000 --- a/debian/libnginx-mod.conf/mod-http-image-filter.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_http_image_filter_module.so; diff --git a/debian/libnginx-mod.conf/mod-http-perl.conf b/debian/libnginx-mod.conf/mod-http-perl.conf deleted file mode 100644 index ab3d02a..0000000 --- a/debian/libnginx-mod.conf/mod-http-perl.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_http_perl_module.so; diff --git a/debian/libnginx-mod.conf/mod-http-xslt-filter.conf b/debian/libnginx-mod.conf/mod-http-xslt-filter.conf deleted file mode 100644 index a4f87ac..0000000 --- a/debian/libnginx-mod.conf/mod-http-xslt-filter.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_http_xslt_filter_module.so; diff --git a/debian/libnginx-mod.conf/mod-mail.conf b/debian/libnginx-mod.conf/mod-mail.conf deleted file mode 100644 index cfd4a4d..0000000 --- a/debian/libnginx-mod.conf/mod-mail.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_mail_module.so; diff --git a/debian/libnginx-mod.conf/mod-stream-geoip.conf b/debian/libnginx-mod.conf/mod-stream-geoip.conf deleted file mode 100644 index 7195856..0000000 --- a/debian/libnginx-mod.conf/mod-stream-geoip.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_stream_geoip_module.so; diff --git a/debian/libnginx-mod.conf/mod-stream.conf b/debian/libnginx-mod.conf/mod-stream.conf deleted file mode 100644 index f2b2657..0000000 --- a/debian/libnginx-mod.conf/mod-stream.conf +++ /dev/null @@ -1 +0,0 @@ -load_module modules/ngx_stream_module.so; diff --git a/debian/libnginx-mod.nginx.skeleton b/debian/libnginx-mod.nginx.skeleton deleted file mode 100755 index 78c206f..0000000 --- a/debian/libnginx-mod.nginx.skeleton +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -w - -use File::Basename; - -# Guess module name -$module = basename($0, '.nginx'); -$module =~ s/^libnginx-mod-//; - -$modulepath = $module; -$modulepath =~ s/-/_/g; - -print "mod debian/build-extras/objs/ngx_${modulepath}_module.so\n"; -print "mod debian/libnginx-mod.conf/mod-${module}.conf\n"; diff --git a/debian/modules/README.Modules-versions b/debian/modules/README.Modules-versions new file mode 100644 index 0000000..542ecee --- /dev/null +++ b/debian/modules/README.Modules-versions @@ -0,0 +1,57 @@ +README for Modules versions +--------------------------- + + This file lists third party modules built with nginx in Debian, homepage and + version. + + headers-more-nginx-module + https://github.com/agentzh/headers-more-nginx-module + Version: v0.25 + + nginx-development-kit + https://github.com/simpl/ngx_devel_kit/ + Version: v0.2.19 + + nginx-auth-pam + http://web.iti.upv.es/~sto/nginx/ + Version: 1.3 + + nginx-echo + https://github.com/agentzh/echo-nginx-module + Version: v0.56 + + nginx-lua + Homepage: https://github.com/chaoslawful/lua-nginx-module + https://github.com/chaoslawful/lua-nginx-module.git + Version: v0.9.12 + + nginx-upstream-fair + Homepage: https://github.com/gnosek/nginx-upstream-fair + Version: a18b409 + + nginx-push + Homepage: http://pushmodule.slact.net/#download + https://github.com/slact/nginx_http_push_module/archive/v0.711.tar.gz + Version: 0.73 + + nginx-upload-progress + Homepage: https://github.com/masterzen/nginx-upload-progress-module + https://nodeload.github.com/masterzen/nginx-upload-progress-module/tarball/master + rm -r debian/nginx-upload-progress/test + Version: v0.9.1 + + nginx-cache-purge + Homepage: http://labs.frickle.com/nginx_ngx_cache_purge/ + Version: 2.1 + + nginx-dav-ext-module + Homepage: https://github.com/arut/nginx-dav-ext-module + Version: v0.0.3 + + ngx-fancyindex + Homepage: https://github.com/aperezdc/ngx-fancyindex + Version: v0.3.4 + + ngx_http_substitutions_filter_module + Homepage: https://github.com/yaoweibin/ngx_http_substitutions_filter_module + Version: v0.6.4 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore b/debian/modules/headers-more-nginx-module/.gitignore similarity index 100% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore rename to debian/modules/headers-more-nginx-module/.gitignore diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown b/debian/modules/headers-more-nginx-module/README.markdown similarity index 61% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown rename to debian/modules/headers-more-nginx-module/README.markdown index 6baea91..9693504 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown +++ b/debian/modules/headers-more-nginx-module/README.markdown @@ -1,3 +1,8 @@ + + Name ==== @@ -8,7 +13,6 @@ Name Table of Contents ================= -* [Name](#name) * [Version](#version) * [Synopsis](#synopsis) * [Description](#description) @@ -36,44 +40,44 @@ Table of Contents Version ======= -This document describes headers-more-nginx-module [v0.34](https://github.com/openresty/headers-more-nginx-module/tags) released on 17 July 2022. +This document describes headers-more-nginx-module [v0.25](http://github.com/agentzh/headers-more-nginx-module/tags) released on 10 January 2014. Synopsis ======== ```nginx - # set the Server output header - more_set_headers 'Server: my-server'; +# set the Server output header +more_set_headers 'Server: my-server'; - # set and clear output headers - location /bar { - more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo'; - more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo'; - more_set_headers -s '400 404 500 503' -s 413 'Foo: Bar'; - more_clear_headers 'Content-Type'; +# set and clear output headers +location /bar { + more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo'; + more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo'; + more_set_headers -s '400 404 500 503' -s 413 'Foo: Bar'; + more_clear_headers 'Content-Type'; + + # your proxy_pass/memcached_pass/or any other config goes here... +} - # your proxy_pass/memcached_pass/or any other config goes here... - } +# set output headers +location /type { + more_set_headers 'Content-Type: text/plain'; + # ... +} - # set output headers - location /type { - more_set_headers 'Content-Type: text/plain'; - # ... - } +# set input headers +location /foo { + set $my_host 'my dog'; + more_set_input_headers 'Host: $my_host'; + more_set_input_headers -t 'text/plain' 'X-Foo: bah'; + + # now $host and $http_host have their new values... + # ... +} - # set input headers - location /foo { - set $my_host 'my dog'; - more_set_input_headers 'Host: $my_host'; - more_set_input_headers -t 'text/plain' 'X-Foo: bah'; - - # now $host and $http_host have their new values... - # ... - } - - # replace input header X-Foo *only* if it already exists - more_set_input_headers -r 'X-Foo: howdy'; +# replace input header X-Foo *only* if it already exists +more_set_input_headers -r 'X-Foo: howdy'; ``` Description @@ -94,27 +98,19 @@ output headers with the [more_set_headers](#more_set_headers) and [more_clear_headers](#more_clear_headers) directives. For example, ```nginx - more_set_headers -s 404 -t 'text/html' 'X-Foo: Bar'; + +more_set_headers -s 404 -t 'text/html' 'X-Foo: Bar'; ``` -You can also specify multiple MIME types to filter out in a single `-t` option. -For example, - -```nginx -more_set_headers -t 'text/html text/plain' 'X-Foo: Bar'; -``` - -Never use other parameters like `charset=utf-8` in the `-t` option values; they will not -work as you would expect. - Input headers can be modified as well. For example ```nginx - location /foo { - more_set_input_headers 'Host: foo' 'User-Agent: faked'; - # now $host, $http_host, $user_agent, and - # $http_user_agent all have their new values. - } + +location /foo { + more_set_input_headers 'Host: foo' 'User-Agent: faked'; + # now $host, $http_host, $user_agent, and + # $http_user_agent all have their new values. +} ``` The option `-t` is also available in the @@ -134,7 +130,7 @@ Directives more_set_headers ---------------- -**syntax:** *more_set_headers [-t <content-type list>]... [-s <status-code list>]... [-a] <new-header>...* +**syntax:** *more_set_headers [-t <content-type list>]... [-s <status-code list>]... <new-header>...* **default:** *no* @@ -142,38 +138,34 @@ more_set_headers **phase:** *output-header-filter* -Replaces (if any) or adds (if not any) the specified output headers when the response status code matches the codes specified by the `-s` option *AND* the response content type matches the types specified by the `-t` option. - -If the "-a" option is specified, the specified output headers can be appended directly without clearing the old fields. The behavior of builtin headers such as "Content-Type", "Content-Length", "Server", etc. cannot be changed. +Adds or replaces the specified output headers when the response status code matches the codes specified by the `-s` option *AND* the response content type matches the types specified by the `-t` option. If either `-s` or `-t` is not specified or has an empty list value, then no match is required. Therefore, the following directive set the `Server` output header to the custom value for *any* status code and *any* content type: ```nginx - more_set_headers "Server: my_server"; + more_set_headers "Server: my_server"; ``` -Existing response headers with the same name are always overridden. If you want to add headers incrementally, use the standard [add_header](http://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header) directive instead. - A single directive can set/add multiple output headers. For example ```nginx - more_set_headers 'Foo: bar' 'Baz: bah'; + more_set_headers 'Foo: bar' 'Baz: bah'; ``` Multiple occurrences of the options are allowed in a single directive. Their values will be merged together. For instance ```nginx - more_set_headers -s 404 -s '500 503' 'Foo: bar'; + more_set_headers -s 404 -s '500 503' 'Foo: bar'; ``` is equivalent to ```nginx - more_set_headers -s '404 500 503' 'Foo: bar'; + more_set_headers -s '404 500 503' 'Foo: bar'; ``` The new header should be the one of the forms: @@ -188,8 +180,8 @@ Nginx variables are allowed in header values. For example: ```nginx - set $my_var "dog"; - more_set_headers "Server: $my_var"; + set $my_var "dog"; + more_set_headers "Server: $my_var"; ``` But variables won't work in header keys due to performance considerations. @@ -202,13 +194,13 @@ Note that although `more_set_headers` is allowed in *location* if blocks, it is ```nginx - ? # This is NOT allowed! - ? server { - ? if ($args ~ 'download') { - ? more_set_headers 'Foo: Bar'; - ? } - ? ... - ? } + ? # This is NOT allowed! + ? server { + ? if ($args ~ 'download') { + ? more_set_headers 'Foo: Bar'; + ? } + ? ... + ? } ``` Behind the scene, use of this directive and its friend [more_clear_headers](#more_clear_headers) will (lazily) register an ouput header filter that modifies `r->headers_out` the way you specify. @@ -231,31 +223,30 @@ In fact, ```nginx - more_clear_headers -s 404 -t 'text/plain' Foo Baz; + more_clear_headers -s 404 -t 'text/plain' Foo Baz; ``` is exactly equivalent to ```nginx - more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; + more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; ``` or ```nginx - more_set_headers -s 404 -t 'text/plain' Foo Baz + more_set_headers -s 404 -t 'text/plain' Foo Baz ``` See [more_set_headers](#more_set_headers) for more details. -The wildcard character, `*`, can also be used at the end of the header name to specify a pattern. For example, the following directive -effectively clears *any* output headers starting by "`X-Hidden-`": +Wildcard `*` can also be used to specify a header name pattern. For example, the following directive effectively clears *any* output headers starting by "`X-Hidden-`": ```nginx - more_clear_headers 'X-Hidden-*'; +more_clear_headers 'X-Hidden-*'; ``` The `*` wildcard support was first introduced in [v0.09](#v009). @@ -276,10 +267,7 @@ Very much like [more_set_headers](#more_set_headers) except that it operates on Note that using the `-t` option in this directive means filtering by the `Content-Type` *request* header, rather than the response header. -Behind the scene, use of this directive and its friend [more_clear_input_headers](#more_clear_input_headers) will (lazily) -register a `rewrite phase` handler that modifies `r->headers_in` the way you specify. Note that it always run at the *end* of -the `rewrite` phase so that it runs *after* the standard [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) -and works in subrequests as well. +Behind the scene, use of this directive and its friend [more_clear_input_headers](#more_clear_input_headers) will (lazily) register a `rewrite phase` handler that modifies `r->headers_in` the way you specify. Note that it always run at the *end* of the `rewrite` so that it runs *after* the standard [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) and works in subrequests as well. If the `-r` option is specified, then the headers will be replaced to the new values *only if* they already exist. @@ -301,40 +289,25 @@ In fact, ```nginx - more_clear_input_headers -t 'text/plain' Foo Baz; + more_clear_input_headers -s 404 -t 'text/plain' Foo Baz; ``` is exactly equivalent to ```nginx - more_set_input_headers -t 'text/plain' "Foo: " "Baz: "; + more_set_input_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; ``` or ```nginx - more_set_input_headers -t 'text/plain' Foo Baz -``` - -To remove request headers "Foo" and "Baz" for all incoming requests regardless of the content type, we can write - -```nginx - - more_clear_input_headers "Foo" "Baz"; + more_set_input_headers -s 404 -t 'text/plain' Foo Baz ``` See [more_set_input_headers](#more_set_input_headers) for more details. -The wildcard character, `*`, can also be used at the end of the header name to specify a pattern. For example, the following directive -effectively clears *any* input headers starting by "`X-Hidden-`": - -```nginx - - more_clear_input_headers 'X-Hidden-*'; -``` - [Back to TOC](#table-of-contents) Limitations @@ -349,33 +322,25 @@ Installation ============ Grab the nginx source code from [nginx.org](http://nginx.org/), for example, -the version 1.17.8 (see [nginx compatibility](#compatibility)), and then build the source with this module: +the version 1.5.8 (see [nginx compatibility](#compatibility)), and then build the source with this module: ```bash - wget 'http://nginx.org/download/nginx-1.17.8.tar.gz' - tar -xzvf nginx-1.17.8.tar.gz - cd nginx-1.17.8/ +wget 'http://nginx.org/download/nginx-1.5.8.tar.gz' +tar -xzvf nginx-1.5.8.tar.gz +cd nginx-1.5.8/ - # Here we assume you would install you nginx under /opt/nginx/. - ./configure --prefix=/opt/nginx \ - --add-module=/path/to/headers-more-nginx-module - - make - make install +# Here we assume you would install you nginx under /opt/nginx/. +./configure --prefix=/opt/nginx \ + --add-module=/path/to/headers-more-nginx-module + +make +make install ``` -Download the latest version of the release tarball of this module from [headers-more-nginx-module file list](https://github.com/openresty/headers-more-nginx-module/tags). +Download the latest version of the release tarball of this module from [headers-more-nginx-module file list](http://github.com/agentzh/headers-more-nginx-module/tags). -Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the -`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) -directive, for example, - -```nginx -load_module /path/to/modules/ngx_http_headers_more_filter_module.so; -``` - -Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org). +Also, this module is included and enabled by default in the [ngx_openresty bundle](http://openresty.org). [Back to TOC](#table-of-contents) @@ -384,20 +349,6 @@ Compatibility The following versions of Nginx should work with this module: -* **1.21.x** (last tested: 1.21.4) -* **1.19.x** (last tested: 1.19.9) -* **1.17.x** (last tested: 1.17.8) -* **1.16.x** -* **1.15.x** (last tested: 1.15.8) -* **1.14.x** -* **1.13.x** (last tested: 1.13.6) -* **1.12.x** -* **1.11.x** (last tested: 1.11.2) -* **1.10.x** -* **1.9.x** (last tested: 1.9.15) -* **1.8.x** -* **1.7.x** (last tested: 1.7.10) -* **1.6.x** (last tested: 1.6.2) * **1.5.x** (last tested: 1.5.8) * **1.4.x** (last tested: 1.4.4) * **1.3.x** (last tested: 1.3.7) @@ -438,7 +389,7 @@ Bugs and Patches Please submit bug reports, wishlists, or patches by -1. creating a ticket on the [GitHub Issue Tracker](https://github.com/chaoslawful/lua-nginx-module/issues), +1. creating a ticket on the [GitHub Issue Tracker](http://github.com/chaoslawful/lua-nginx-module/issues), 1. or posting to the [OpenResty community](#community). [Back to TOC](#table-of-contents) @@ -446,14 +397,14 @@ Please submit bug reports, wishlists, or patches by Source Repository ================= -Available on github at [openresty/headers-more-nginx-module](https://github.com/openresty/headers-more-nginx-module). +Available on github at [agentzh/headers-more-nginx-module](http://github.com/agentzh/headers-more-nginx-module). [Back to TOC](#table-of-contents) Changes ======= -The changes of every release of this module can be obtained from the OpenResty bundle's change logs: +The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: @@ -462,29 +413,29 @@ The changes of every release of this module can be obtained from the OpenResty b Test Suite ========== -This module comes with a Perl-driven test suite. The [test cases](https://github.com/openresty/headers-more-nginx-module/tree/master/t/) are -[declarative](https://github.com/openresty/headers-more-nginx-module/blob/master/t/sanity.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. +This module comes with a Perl-driven test suite. The [test cases](http://github.com/agentzh/headers-more-nginx-module/tree/master/t/) are +[declarative](http://github.com/agentzh/headers-more-nginx-module/blob/master/t/sanity.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. To run it on your side: ```bash - $ PATH=/path/to/your/nginx-with-headers-more-module:$PATH prove -r t +$ PATH=/path/to/your/nginx-with-headers-more-module:$PATH prove -r t ``` To run the test suite with valgrind's memcheck, use the following commands: ```bash - $ export PATH=/path/to/your/nginx-with-headers-more-module:$PATH - $ TEST_NGINX_USE_VALGRIND=1 prove -r t +$ export PATH=/path/to/your/nginx-with-headers-more-module:$PATH +$ TEST_NGINX_USE_VALGRIND=1 prove -r t ``` You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. Because a single nginx server (by default, `localhost:1984`) is used across all the test scripts (`.t` files), it's meaningless to run the test suite in parallel by specifying `-jN` when invoking the `prove` utility. -Some parts of the test suite requires modules [proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), and [echo](https://github.com/openresty/echo-nginx-module) to be enabled as well when building Nginx. +Some parts of the test suite requires modules [proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), and [echo](http://github.com/agentzh/echo-nginx-module) to be enabled as well when building Nginx. [Back to TOC](#table-of-contents) @@ -505,7 +456,7 @@ You'll be very welcomed to submit patches to the [author](#author) or just ask f Authors ======= -* Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, OpenResty Inc. +* Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, CloudFlare Inc. * Bernd Dorn ( ) This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. @@ -517,11 +468,30 @@ Copyright & License The code base is borrowed directly from the standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module in Nginx 0.8.24. This part of code is copyrighted by Igor Sysoev. -Copyright (c) 2009-2017, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. +Copyright (c) 2009-2014, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. Copyright (c) 2010-2013, Bernd Dorn. -The license text is available in the [LICENSE](LICENSE) file located in the root directory of the project. +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [Back to TOC](#table-of-contents) @@ -531,8 +501,5 @@ See Also * The original thread on the Nginx mailing list that inspires this module's development: ["A question about add_header replication"](http://forum.nginx.org/read.php?2,11206,11738). * The orginal announcement thread on the Nginx mailing list: ["The "headers_more" module: Set and clear output headers...more than 'add'!"](http://forum.nginx.org/read.php?2,23460). * The original [blog post](http://agentzh.blogspot.com/2009/11/headers-more-module-scripting-input-and.html) about this module's initial development. -* The [echo module](https://github.com/openresty/echo-nginx-module) for Nginx module's automated testing. +* The [echo module](http://github.com/agentzh/echo-nginx-module) for Nginx module's automated testing. * The standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module. - -[Back to TOC](#table-of-contents) - diff --git a/debian/modules/headers-more-nginx-module/config b/debian/modules/headers-more-nginx-module/config new file mode 100644 index 0000000..d92baea --- /dev/null +++ b/debian/modules/headers-more-nginx-module/config @@ -0,0 +1,5 @@ +ngx_addon_name=ngx_http_headers_more_filter_module +HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_headers_more_filter_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_headers_more_filter_module.c $ngx_addon_dir/src/ngx_http_headers_more_headers_out.c $ngx_addon_dir/src/ngx_http_headers_more_headers_in.c $ngx_addon_dir/src/ngx_http_headers_more_util.c" +NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_headers_more_filter_module.h $ngx_addon_dir/src/ngx_http_headers_more_headers_in.h $ngx_addon_dir/src/ngx_http_headers_more_headers_out.h $ngx_addon_dir/src/ngx_http_headers_more_headers_in.h $ngx_addon_dir/src/ngx_http_headers_more_util.h" + diff --git a/debian/modules/headers-more-nginx-module/doc/HttpHeadersMoreModule.wiki b/debian/modules/headers-more-nginx-module/doc/HttpHeadersMoreModule.wiki new file mode 100644 index 0000000..c57a1f5 --- /dev/null +++ b/debian/modules/headers-more-nginx-module/doc/HttpHeadersMoreModule.wiki @@ -0,0 +1,390 @@ += Name = + +'''ngx_headers_more''' - Set and clear input and output headers...more than "add"! + +''This module is not distributed with the Nginx source.'' See [[#Installation|the installation instructions]]. + += Version = + +This document describes headers-more-nginx-module [http://github.com/agentzh/headers-more-nginx-module/tags v0.25] released on 10 January 2014. + += Synopsis = + + + # set the Server output header + more_set_headers 'Server: my-server'; + + # set and clear output headers + location /bar { + more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo'; + more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo'; + more_set_headers -s '400 404 500 503' -s 413 'Foo: Bar'; + more_clear_headers 'Content-Type'; + + # your proxy_pass/memcached_pass/or any other config goes here... + } + + # set output headers + location /type { + more_set_headers 'Content-Type: text/plain'; + # ... + } + + # set input headers + location /foo { + set $my_host 'my dog'; + more_set_input_headers 'Host: $my_host'; + more_set_input_headers -t 'text/plain' 'X-Foo: bah'; + + # now $host and $http_host have their new values... + # ... + } + + # replace input header X-Foo *only* if it already exists + more_set_input_headers -r 'X-Foo: howdy'; + + += Description = + +This module allows you to add, set, or clear any output +or input header that you specify. + +This is an enhanced version of the standard +[[HttpHeadersModule|headers]] module because it provides more utilities like +resetting or clearing "builtin headers" like Content-Type, +Content-Length, and Server. + +It also allows you to specify an optional HTTP status code +criteria using the -s option and an optional content +type criteria using the -t option while modifying the +output headers with the [[#more_set_headers|more_set_headers]] and +[[#more_clear_headers|more_clear_headers]] directives. For example, + + + more_set_headers -s 404 -t 'text/html' 'X-Foo: Bar'; + + +Input headers can be modified as well. For example + + + location /foo { + more_set_input_headers 'Host: foo' 'User-Agent: faked'; + # now $host, $http_host, $user_agent, and + # $http_user_agent all have their new values. + } + + +The option -t is also available in the +[[#more_set_input_headers|more_set_input_headers]] and +[[#more_clear_input_headers|more_clear_input_headers]] directives (for request header filtering) while the -s option +is not allowed. + +Unlike the standard [[HttpHeadersModule|headers]] module, this module's directives will by +default apply to all the status codes, including 4xx and 5xx. + += Directives = + +== more_set_headers == +'''syntax:''' ''more_set_headers [-t ]... [-s ]... ...'' + +'''default:''' ''no'' + +'''context:''' ''http, server, location, location if'' + +'''phase:''' ''output-header-filter'' + +Adds or replaces the specified output headers when the response status code matches the codes specified by the -s option ''AND'' the response content type matches the types specified by the -t option. + +If either -s or -t is not specified or has an empty list value, then no match is required. Therefore, the following directive set the Server output header to the custom value for ''any'' status code and ''any'' content type: + + + more_set_headers "Server: my_server"; + + +A single directive can set/add multiple output headers. For example + + + more_set_headers 'Foo: bar' 'Baz: bah'; + + +Multiple occurrences of the options are allowed in a single directive. Their values will be merged together. For instance + + + more_set_headers -s 404 -s '500 503' 'Foo: bar'; + + +is equivalent to + + + more_set_headers -s '404 500 503' 'Foo: bar'; + + +The new header should be the one of the forms: + +# Name: Value +# Name: +# Name + +The last two effectively clear the value of the header Name. + +Nginx variables are allowed in header values. For example: + + + set $my_var "dog"; + more_set_headers "Server: $my_var"; + + +But variables won't work in header keys due to performance considerations. + +Multiple set/clear header directives are allowed in a single location, and they're executed sequentially. + +Directives inherited from an upper level scope (say, http block or server blocks) are executed before the directives in the location block. + +Note that although more_set_headers is allowed in ''location'' if blocks, it is ''not'' allowed in the ''server'' if blocks, as in + + + ? # This is NOT allowed! + ? server { + ? if ($args ~ 'download') { + ? more_set_headers 'Foo: Bar'; + ? } + ? ... + ? } + + +Behind the scene, use of this directive and its friend [[#more_clear_headers|more_clear_headers]] will (lazily) register an ouput header filter that modifies r->headers_out the way you specify. + +== more_clear_headers == +'''syntax:''' ''more_clear_headers [-t ]... [-s ]... ...'' + +'''default:''' ''no'' + +'''context:''' ''http, server, location, location if'' + +'''phase:''' ''output-header-filter'' + +Clears the specified output headers. + +In fact, + + + more_clear_headers -s 404 -t 'text/plain' Foo Baz; + + +is exactly equivalent to + + + more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; + + +or + + + more_set_headers -s 404 -t 'text/plain' Foo Baz + + +See [[#more_set_headers|more_set_headers]] for more details. + +Wildcard * can also be used to specify a header name pattern. For example, the following directive effectively clears ''any'' output headers starting by "X-Hidden-": + + + more_clear_headers 'X-Hidden-*'; + + +The * wildcard support was first introduced in [[#v0.09|v0.09]]. + +== more_set_input_headers == +'''syntax:''' ''more_set_input_headers [-r] [-t ]... ...'' + +'''default:''' ''no'' + +'''context:''' ''http, server, location, location if'' + +'''phase:''' ''rewrite tail'' + +Very much like [[#more_set_headers|more_set_headers]] except that it operates on input headers (or request headers) and it only supports the -t option. + +Note that using the -t option in this directive means filtering by the Content-Type ''request'' header, rather than the response header. + +Behind the scene, use of this directive and its friend [[#more_clear_input_headers|more_clear_input_headers]] will (lazily) register a rewrite phase handler that modifies r->headers_in the way you specify. Note that it always run at the ''end'' of the rewrite so that it runs ''after'' the standard [[HttpRewriteModule|rewrite module]] and works in subrequests as well. + +If the -r option is specified, then the headers will be replaced to the new values ''only if'' they already exist. + +== more_clear_input_headers == +'''syntax:''' ''more_clear_input_headers [-t ]... ...'' + +'''default:''' ''no'' + +'''context:''' ''http, server, location, location if'' + +'''phase:''' ''rewrite tail'' + +Clears the specified input headers. + +In fact, + + + more_clear_input_headers -s 404 -t 'text/plain' Foo Baz; + + +is exactly equivalent to + + + more_set_input_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; + + +or + + + more_set_input_headers -s 404 -t 'text/plain' Foo Baz + + +See [[#more_set_input_headers|more_set_input_headers]] for more details. + += Limitations = + +* Unlike the standard [[HttpHeadersModule|headers]] module, this module does not automatically take care of the constraint among the Expires, Cache-Control, and Last-Modified headers. You have to get them right yourself or use the [[HttpHeadersModule|headers]] module together with this module. +* You cannot remove the Connection response header using this module because the Connection response header is generated by the standard ngx_http_header_filter_module in the Nginx core, whose output header filter runs always ''after'' the filter of this module. The only way to actually remove the Connection header is to patch the Nginx core, that is, editing the C function ngx_http_header_filter in the src/http/ngx_http_header_filter_module.c file. + += Installation = + +Grab the nginx source code from [http://nginx.org/ nginx.org], for example, +the version 1.5.8 (see [[#Compatibility|nginx compatibility]]), and then build the source with this module: + + + wget 'http://nginx.org/download/nginx-1.5.8.tar.gz' + tar -xzvf nginx-1.5.8.tar.gz + cd nginx-1.5.8/ + + # Here we assume you would install you nginx under /opt/nginx/. + ./configure --prefix=/opt/nginx \ + --add-module=/path/to/headers-more-nginx-module + + make + make install + + +Download the latest version of the release tarball of this module from [http://github.com/agentzh/headers-more-nginx-module/tags headers-more-nginx-module file list]. + +Also, this module is included and enabled by default in the [http://openresty.org ngx_openresty bundle]. + += Compatibility = + +The following versions of Nginx should work with this module: + +* '''1.5.x''' (last tested: 1.5.8) +* '''1.4.x''' (last tested: 1.4.4) +* '''1.3.x''' (last tested: 1.3.7) +* '''1.2.x''' (last tested: 1.2.9) +* '''1.1.x''' (last tested: 1.1.5) +* '''1.0.x''' (last tested: 1.0.11) +* '''0.9.x''' (last tested: 0.9.4) +* '''0.8.x''' (last tested: 0.8.54) +* '''0.7.x >= 0.7.44''' (last tested: 0.7.68) + +Earlier versions of Nginx like 0.6.x and 0.5.x will ''not'' work. + +If you find that any particular version of Nginx above 0.7.44 does not work with this module, please consider [[#Report Bugs|reporting a bug]]. + += Community = + +== English Mailing List == + +The [https://groups.google.com/group/openresty-en openresty-en] mailing list is for English speakers. + +== Chinese Mailing List == + +The [https://groups.google.com/group/openresty openresty] mailing list is for Chinese speakers. + += Bugs and Patches = + +Please submit bug reports, wishlists, or patches by + +# creating a ticket on the [http://github.com/chaoslawful/lua-nginx-module/issues GitHub Issue Tracker], +# or posting to the [[#Community|OpenResty community]]. + += Source Repository = + +Available on github at [http://github.com/agentzh/headers-more-nginx-module agentzh/headers-more-nginx-module]. + += Changes = + +The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: + +http://openresty.org/#Changes + += Test Suite = + +This module comes with a Perl-driven test suite. The [http://github.com/agentzh/headers-more-nginx-module/tree/master/t/ test cases] are +[http://github.com/agentzh/headers-more-nginx-module/blob/master/t/sanity.t declarative] too. Thanks to the [http://search.cpan.org/perldoc?Test::Nginx Test::Nginx] module in the Perl world. + +To run it on your side: + + + $ PATH=/path/to/your/nginx-with-headers-more-module:$PATH prove -r t + + +To run the test suite with valgrind's memcheck, use the following commands: + + + $ export PATH=/path/to/your/nginx-with-headers-more-module:$PATH + $ TEST_NGINX_USE_VALGRIND=1 prove -r t + + +You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. + +Because a single nginx server (by default, localhost:1984) is used across all the test scripts (.t files), it's meaningless to run the test suite in parallel by specifying -jN when invoking the prove utility. + +Some parts of the test suite requires modules [[HttpProxyModule|proxy]], [[HttpRewriteModule|rewrite]], and [[HttpEchoModule|echo]] to be enabled as well when building Nginx. + += TODO = + +* Support variables in new headers' keys. + += Getting involved = + +You'll be very welcomed to submit patches to the [[#Author|author]] or just ask for a commit bit to the [[#Source Repository|source repository]] on GitHub. + += Authors = + +* Yichun "agentzh" Zhang (章亦春) '''', CloudFlare Inc. +* Bernd Dorn ( http://www.lovelysystems.com/ ) + +This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. + += Copyright & License = + +The code base is borrowed directly from the standard [[HttpHeadersModule|headers]] module in Nginx 0.8.24. This part of code is copyrighted by Igor Sysoev. + +Copyright (c) 2009-2014, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. + +Copyright (c) 2010-2013, Bernd Dorn. + +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += See Also = + +* The original thread on the Nginx mailing list that inspires this module's development: [http://forum.nginx.org/read.php?2,11206,11738 "A question about add_header replication"]. +* The orginal announcement thread on the Nginx mailing list: [http://forum.nginx.org/read.php?2,23460 "The "headers_more" module: Set and clear output headers...more than 'add'!"]. +* The original [http://agentzh.blogspot.com/2009/11/headers-more-module-scripting-input-and.html blog post] about this module's initial development. +* The [[HttpEchoModule|echo module]] for Nginx module's automated testing. +* The standard [[HttpHeadersModule|headers]] module. diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h b/debian/modules/headers-more-nginx-module/src/ddebug.h similarity index 93% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h rename to debian/modules/headers-more-nginx-module/src/ddebug.h index 13879af..c86764d 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h +++ b/debian/modules/headers-more-nginx-module/src/ddebug.h @@ -1,13 +1,10 @@ #ifndef DDEBUG_H #define DDEBUG_H - -#include #include #include #include - #if defined(DDEBUG) && (DDEBUG) # if (NGX_HAVE_VARIADIC_MACROS) @@ -23,8 +20,7 @@ #include -static ngx_inline void -dd(const char * fmt, ...) { +static void dd(const char * fmt, ...) { } # endif @@ -39,7 +35,7 @@ dd(const char * fmt, ...) { # define dd_main_req_count 0 # endif -static ngx_inline void +static void dd_enter_helper(ngx_http_request_t *r, const char *func) { ngx_http_posted_request_t *pr; @@ -81,12 +77,10 @@ dd_enter_helper(ngx_http_request_t *r, const char *func) #include -static ngx_inline void -dd(const char * fmt, ...) { +static void dd(const char * fmt, ...) { } -static ngx_inline void -dd_enter() { +static void dd_enter() { } # endif diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.c similarity index 97% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.c index 0bb6fec..5fe6088 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.c @@ -19,10 +19,10 @@ /* config handlers */ -static void *ngx_http_headers_more_create_loc_conf(ngx_conf_t *cf); -static char *ngx_http_headers_more_merge_loc_conf(ngx_conf_t *cf, +static void * ngx_http_headers_more_create_loc_conf(ngx_conf_t *cf); +static char * ngx_http_headers_more_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child); -static void *ngx_http_headers_more_create_main_conf(ngx_conf_t *cf); +static void * ngx_http_headers_more_create_main_conf(ngx_conf_t *cf); static ngx_int_t ngx_http_headers_more_post_config(ngx_conf_t *cf); /* post-read-phase handler */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.h similarity index 92% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.h index 5f31ab4..72a5317 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.h @@ -60,9 +60,8 @@ struct ngx_http_headers_more_header_val_s { ngx_str_t key; ngx_http_headers_more_set_header_pt handler; ngx_uint_t offset; - unsigned replace:1; - unsigned wildcard:1; - unsigned append:1; + ngx_flag_t replace; + ngx_flag_t wildcard; }; diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.c similarity index 77% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.c index 983be5b..7cadb56 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.c @@ -15,7 +15,7 @@ #include -static char *ngx_http_headers_more_parse_directive(ngx_conf_t *cf, +static char * ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, void *conf, ngx_http_headers_more_opcode_t opcode); static int ngx_http_headers_more_check_type(ngx_http_request_t *r, @@ -39,7 +39,7 @@ static ngx_int_t ngx_http_set_host_header(ngx_http_request_t *r, ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); static ngx_int_t ngx_http_set_connection_header(ngx_http_request_t *r, ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); -static ngx_int_t ngx_http_set_builtin_multi_header(ngx_http_request_t *r, +static ngx_int_t ngx_http_set_cookie_header(ngx_http_request_t *r, ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); static ngx_int_t ngx_http_headers_more_validate_host(ngx_str_t *host, ngx_pool_t *pool, ngx_uint_t alloc); @@ -48,6 +48,16 @@ static ngx_int_t ngx_http_headers_more_validate_host(ngx_str_t *host, static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] = { +#if (NGX_HTTP_GZIP) + { ngx_string("Accept-Encoding"), + offsetof(ngx_http_headers_in_t, accept_encoding), + ngx_http_set_builtin_header }, + + { ngx_string("Via"), + offsetof(ngx_http_headers_in_t, via), + ngx_http_set_builtin_header }, +#endif + { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host), ngx_http_set_host_header }, @@ -60,22 +70,6 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] offsetof(ngx_http_headers_in_t, if_modified_since), ngx_http_set_builtin_header }, -#if defined(nginx_version) && nginx_version >= 9002 - { ngx_string("If-Unmodified-Since"), - offsetof(ngx_http_headers_in_t, if_unmodified_since), - ngx_http_set_builtin_header }, -#endif - -#if defined(nginx_version) && nginx_version >= 1003003 - { ngx_string("If-Match"), - offsetof(ngx_http_headers_in_t, if_match), - ngx_http_set_builtin_header }, - - { ngx_string("If-None-Match"), - offsetof(ngx_http_headers_in_t, if_none_match), - ngx_http_set_builtin_header }, -#endif - { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent), ngx_http_set_user_agent_header }, @@ -84,10 +78,6 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] offsetof(ngx_http_headers_in_t, referer), ngx_http_set_builtin_header }, - { ngx_string("Content-Length"), - offsetof(ngx_http_headers_in_t, content_length), - ngx_http_set_content_length_header }, - { ngx_string("Content-Type"), offsetof(ngx_http_headers_in_t, content_type), ngx_http_set_builtin_header }, @@ -108,21 +98,6 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] offsetof(ngx_http_headers_in_t, expect), ngx_http_set_builtin_header }, -#if defined(nginx_version) && nginx_version >= 1003013 - { ngx_string("Upgrade"), - offsetof(ngx_http_headers_in_t, upgrade), - ngx_http_set_builtin_header }, -#endif - -#if (NGX_HTTP_GZIP) - { ngx_string("Accept-Encoding"), - offsetof(ngx_http_headers_in_t, accept_encoding), - ngx_http_set_builtin_header }, - - { ngx_string("Via"), offsetof(ngx_http_headers_in_t, via), - ngx_http_set_builtin_header }, -#endif - { ngx_string("Authorization"), offsetof(ngx_http_headers_in_t, authorization), ngx_http_set_builtin_header }, @@ -131,12 +106,13 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] offsetof(ngx_http_headers_in_t, keep_alive), ngx_http_set_builtin_header }, -#if (NGX_HTTP_X_FORWARDED_FOR) - { ngx_string("X-Forwarded-For"), - offsetof(ngx_http_headers_in_t, x_forwarded_for), - ngx_http_set_builtin_multi_header }, + { ngx_string("Content-Length"), + offsetof(ngx_http_headers_in_t, content_length), + ngx_http_set_content_length_header }, -#endif + { ngx_string("Cookie"), + 0, + ngx_http_set_cookie_header }, #if (NGX_HTTP_REALIP) { ngx_string("X-Real-IP"), @@ -144,30 +120,6 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] ngx_http_set_builtin_header }, #endif -#if (NGX_HTTP_DAV) - { ngx_string("Depth"), offsetof(ngx_http_headers_in_t, depth), - ngx_http_set_builtin_header }, - - { ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination), - ngx_http_set_builtin_header }, - - { ngx_string("Overwrite"), offsetof(ngx_http_headers_in_t, overwrite), - ngx_http_set_builtin_header }, - - { ngx_string("Date"), offsetof(ngx_http_headers_in_t, date), - ngx_http_set_builtin_header }, -#endif - -#if defined(nginx_version) && nginx_version >= 1023000 - { ngx_string("Cookie"), - offsetof(ngx_http_headers_in_t, cookie), - ngx_http_set_builtin_multi_header }, -#else - { ngx_string("Cookie"), - offsetof(ngx_http_headers_in_t, cookies), - ngx_http_set_builtin_multi_header }, -#endif - { ngx_null_string, 0, ngx_http_set_header } }; @@ -232,7 +184,6 @@ ngx_http_set_header_helper(ngx_http_request_t *r, matched = NULL; retry: - part = &r->headers_in.headers.part; h = part->elts; @@ -249,59 +200,42 @@ retry: i = 0; } - if (!hv->wildcard - && h[i].key.len == hv->key.len + if (h[i].key.len == hv->key.len && ngx_strncasecmp(h[i].key.data, hv->key.data, h[i].key.len) == 0) { - goto matched; - } + if (value->len == 0 || (matched && matched != &h[i])) { + h[i].hash = 0; - if (hv->wildcard - && value->len == 0 - && h[i].key.len >= hv->key.len - 1 - && ngx_strncasecmp(h[i].key.data, hv->key.data, - hv->key.len - 1) == 0) - { - goto matched; - } + rc = ngx_http_headers_more_rm_header_helper( + &r->headers_in.headers, part, i); - /* not matched */ - continue; + ngx_http_headers_more_assert( + !(r->headers_in.headers.part.next == NULL + && r->headers_in.headers.last + != &r->headers_in.headers.part)); -matched: + if (rc == NGX_OK) { + if (output_header) { + *output_header = NULL; + } - if (value->len == 0 || (matched && matched != &h[i])) { - h[i].hash = 0; - - rc = ngx_http_headers_more_rm_header_helper( - &r->headers_in.headers, part, i); - - ngx_http_headers_more_assert( - !(r->headers_in.headers.part.next == NULL - && r->headers_in.headers.last - != &r->headers_in.headers.part)); - - if (rc == NGX_OK) { - if (output_header) { - *output_header = NULL; + goto retry; } - goto retry; + return NGX_ERROR; } - return NGX_ERROR; - } + h[i].value = *value; - h[i].value = *value; + if (output_header) { + *output_header = &h[i]; + dd("setting existing builtin input header"); + } - if (output_header) { - *output_header = &h[i]; - dd("setting existing builtin input header"); - } - - if (matched == NULL) { - matched = &h[i]; + if (matched == NULL) { + matched = &h[i]; + } } } @@ -313,11 +247,6 @@ matched: return NGX_OK; } - if (r->headers_in.headers.last == NULL) { - /* must be 400 bad request */ - return NGX_OK; - } - h = ngx_list_push(&r->headers_in.headers); if (h == NULL) { @@ -335,9 +264,6 @@ matched: h->key = hv->key; h->value = *value; -#if defined(nginx_version) && nginx_version >= 1023000 - h->next = NULL; -#endif h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); if (h->lowcase_key == NULL) { @@ -438,7 +364,7 @@ ngx_http_set_content_length_header(ngx_http_request_t *r, return NGX_ERROR; } - dd("reset headers_in.content_length_n to %d", (int) len); + dd("reset headers_in.content_length_n to %d", (int)len); r->headers_in.content_length_n = len; @@ -486,9 +412,9 @@ ngx_http_headers_more_clear_input_headers(ngx_conf_t *cf, static int ngx_http_headers_more_check_type(ngx_http_request_t *r, ngx_array_t *types) { - ngx_uint_t i; + ngx_uint_t i; ngx_str_t *t; - ngx_str_t actual_type; + ngx_str_t actual_type; if (r->headers_in.content_type == NULL) { return 0; @@ -537,7 +463,7 @@ ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, if (hlcf->cmds == NULL) { hlcf->cmds = ngx_array_create(cf->pool, 1, - sizeof(ngx_http_headers_more_cmd_t)); + sizeof(ngx_http_headers_more_cmd_t)); if (hlcf->cmds == NULL) { return NGX_CONF_ERROR; @@ -551,7 +477,7 @@ ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, } cmd->headers = ngx_array_create(cf->pool, 1, - sizeof(ngx_http_headers_more_header_val_t)); + sizeof(ngx_http_headers_more_header_val_t)); if (cmd->headers == NULL) { return NGX_CONF_ERROR; @@ -614,12 +540,11 @@ ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, ignore_next_arg = 1; continue; - } - if (arg[i].data[1] == 'r') { - dd("Found replace flag"); - replace = 1; - continue; + } else if (arg[i].data[1] == 'r') { + dd("Found replace flag"); + replace = 1; + continue; } } @@ -748,7 +673,6 @@ ngx_http_set_connection_header(ngx_http_request_t *r, if (ngx_strcasestrn(value->data, "close", 5 - 1)) { r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; r->headers_in.keep_alive_n = -1; - r->keepalive = 0; } else if (ngx_strcasestrn(value->data, "keep-alive", 10 - 1)) { r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; @@ -759,83 +683,27 @@ ngx_http_set_connection_header(ngx_http_request_t *r, static ngx_int_t -ngx_http_set_builtin_multi_header(ngx_http_request_t *r, +ngx_http_set_cookie_header(ngx_http_request_t *r, ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) { -#if defined(nginx_version) && nginx_version >= 1023000 - ngx_table_elt_t **headers, **ph, *h; -#if (DDEBUG) - int nelts; -#endif + ngx_table_elt_t **cookie, *h; - if (r->headers_out.status == 400 || r->headers_in.headers.last == NULL) { - /* must be a 400 Bad Request */ - return NGX_OK; - } + if (r->headers_in.cookies.nelts > 0) { + ngx_array_destroy(&r->headers_in.cookies); - headers = (ngx_table_elt_t **) ((char *) &r->headers_in + hv->offset); - - if (*headers) { -#if (DDEBUG) - nelts = 0; - for (h = *headers; h; h = h->next) { - nelts++; - } - - dd("clear multi-value headers: %d", nelts); -#endif - - *headers = NULL; - } - - if (ngx_http_set_header_helper(r, hv, value, &h) == NGX_ERROR) { - return NGX_ERROR; - } - - if (value->len == 0) { - return NGX_OK; - } - - dd("new multi-value header: %p", h); - - if (*headers) { - for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } - *ph = h; - - } else { - *headers = h; - } - - h->next = NULL; - - return NGX_OK; -#else - ngx_array_t *headers; - ngx_table_elt_t **v, *h; - - if (r->headers_out.status == 400 || r->headers_in.headers.last == NULL) { - /* must be a 400 Bad Request */ - return NGX_OK; - } - - headers = (ngx_array_t *) ((char *) &r->headers_in + hv->offset); - - if (headers->nelts > 0) { - ngx_array_destroy(headers); - - if (ngx_array_init(headers, r->pool, 2, + if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, sizeof(ngx_table_elt_t *)) != NGX_OK) { return NGX_ERROR; } - dd("clear multi-value headers: %d", (int) headers->nelts); + dd("clear headers in cookies: %d", (int) r->headers_in.cookies.nelts); } #if 1 - if (headers->nalloc == 0) { - if (ngx_array_init(headers, r->pool, 2, + if (r->headers_in.cookies.nalloc == 0) { + if (ngx_array_init(&r->headers_in.cookies, r->pool, 2, sizeof(ngx_table_elt_t *)) != NGX_OK) { @@ -855,14 +723,13 @@ ngx_http_set_builtin_multi_header(ngx_http_request_t *r, dd("new cookie header: %p", h); - v = ngx_array_push(headers); - if (v == NULL) { + cookie = ngx_array_push(&r->headers_in.cookies); + if (cookie == NULL) { return NGX_ERROR; } - *v = h; + *cookie = h; return NGX_OK; -#endif } @@ -895,7 +762,6 @@ ngx_http_headers_more_validate_host(ngx_str_t *host, ngx_pool_t *pool, if (dot_pos == i - 1) { return NGX_DECLINED; } - dot_pos = i; break; diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.h similarity index 78% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.h index d2251da..ae21501 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.h @@ -16,10 +16,10 @@ ngx_int_t ngx_http_headers_more_exec_input_cmd(ngx_http_request_t *r, ngx_http_headers_more_cmd_t *cmd); -char *ngx_http_headers_more_set_input_headers(ngx_conf_t *cf, +char * ngx_http_headers_more_set_input_headers(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -char *ngx_http_headers_more_clear_input_headers(ngx_conf_t *cf, +char * ngx_http_headers_more_clear_input_headers(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.c similarity index 84% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.c index 2a95b5f..0685cf9 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.c @@ -184,10 +184,6 @@ ngx_http_set_header_helper(ngx_http_request_t *r, } #endif - if (hv->append) { - goto append; - } - part = &r->headers_out.headers.part; h = part->elts; @@ -227,7 +223,6 @@ ngx_http_set_header_helper(ngx_http_request_t *r, continue; matched: - if (value->len == 0 || matched) { dd("clearing normal header for %.*s", (int) hv->key.len, hv->key.data); @@ -248,7 +243,7 @@ matched: } if (matched){ - return NGX_OK; + return NGX_OK; } if ((hv->wildcard || no_create) && value->len == 0) { @@ -259,8 +254,6 @@ matched: * is empty because some builtin headers like Last-Modified * relies on this to get cleared */ -append: - h = ngx_list_push(&r->headers_out.headers); if (h == NULL) { return NGX_ERROR; @@ -333,46 +326,6 @@ static ngx_int_t ngx_http_set_builtin_multi_header(ngx_http_request_t *r, ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) { -#if defined(nginx_version) && nginx_version >= 1023000 - ngx_table_elt_t **headers, *h, *ho, **ph; - - headers = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset); - - if (*headers) { - for (h = (*headers)->next; h; h = h->next) { - h->hash = 0; - h->value.len = 0; - } - - h = *headers; - - h->value = *value; - - if (value->len == 0) { - h->hash = 0; - - } else { - h->hash = hv->hash; - } - - return NGX_OK; - } - - for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } - - ho = ngx_list_push(&r->headers_out.headers); - if (ho == NULL) { - return NGX_ERROR; - } - - ho->value = *value; - ho->hash = hv->hash; - ngx_str_set(&ho->key, "Cache-Control"); - ho->next = NULL; - *ph = ho; - - return NGX_OK; -#else ngx_array_t *pa; ngx_table_elt_t *ho, **ph; ngx_uint_t i; @@ -424,7 +377,6 @@ ngx_http_set_builtin_multi_header(ngx_http_request_t *r, *ph = ho; return NGX_OK; -#endif } @@ -563,7 +515,7 @@ static ngx_flag_t ngx_http_headers_more_check_type(ngx_http_request_t *r, ngx_array_t *types) { ngx_uint_t i; - ngx_str_t *t; + ngx_str_t *t; dd("headers_out->content_type: %.*s (len %d)", (int) r->headers_out.content_type.len, @@ -575,7 +527,7 @@ ngx_http_headers_more_check_type(ngx_http_request_t *r, ngx_array_t *types) for (i = 0; i < types->nelts; i++) { dd("...comparing with type [%.*s]", (int) t[i].len, t[i].data); - if (r->headers_out.content_type_len == t[i].len + if (r->headers_out.content_type.len == t[i].len && ngx_strncmp(r->headers_out.content_type.data, t[i].data, t[i].len) == 0) { @@ -591,7 +543,7 @@ static ngx_flag_t ngx_http_headers_more_check_status(ngx_http_request_t *r, ngx_array_t *statuses) { ngx_uint_t i; - ngx_uint_t *status; + ngx_uint_t *status; dd("headers_out.status = %d", (int) r->headers_out.status); @@ -612,24 +564,20 @@ static char * ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, void *conf, ngx_http_headers_more_opcode_t opcode) { - ngx_http_headers_more_loc_conf_t *hlcf = conf; + ngx_http_headers_more_loc_conf_t *hlcf = conf; - ngx_uint_t i, j; - ngx_http_headers_more_cmd_t *cmd; - ngx_str_t *arg; - ngx_flag_t ignore_next_arg; - ngx_str_t *cmd_name; - ngx_int_t rc; - ngx_flag_t append = 0; - ngx_flag_t is_builtin_header = 0; - ngx_http_headers_more_header_val_t *h; - ngx_http_headers_more_set_header_t *handlers; + ngx_uint_t i; + ngx_http_headers_more_cmd_t *cmd; + ngx_str_t *arg; + ngx_flag_t ignore_next_arg; + ngx_str_t *cmd_name; + ngx_int_t rc; ngx_http_headers_more_main_conf_t *hmcf; if (hlcf->cmds == NULL) { hlcf->cmds = ngx_array_create(cf->pool, 1, - sizeof(ngx_http_headers_more_cmd_t)); + sizeof(ngx_http_headers_more_cmd_t)); if (hlcf->cmds == NULL) { return NGX_CONF_ERROR; @@ -731,22 +679,6 @@ ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, ignore_next_arg = 1; continue; - - } else if (arg[i].data[1] == 'a') { - - if (ngx_strncasecmp((u_char *) "more_set_headers", - cmd_name->data, cmd_name->len) != 0) - { - ngx_log_error(NGX_LOG_ERR, cf->log, 0, - "%V: invalid option name: \"%V\"", - cmd_name, &arg[i]); - - return NGX_CONF_ERROR; - } - - dd("Found append flag"); - append = 1; - continue; } } @@ -762,37 +694,6 @@ ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, if (cmd->headers->nelts == 0) { cmd->headers = NULL; - - } else { - - h = cmd->headers->elts; - for (i = 0; i < cmd->headers->nelts; i++) { - h[i].append = 0; - - handlers = ngx_http_headers_more_set_handlers; - - for (j = 0; handlers[j].name.len; j++) { - if (h[i].key.len == handlers[j].name.len - && ngx_strncasecmp(h[i].key.data, handlers[j].name.data, - h[i].key.len) == 0) - { - is_builtin_header = 1; - break; - } - } - - if (is_builtin_header && append) { - ngx_log_error(NGX_LOG_ERR, cf->log, 0, - "%V: can not append builtin headers \"%V\"", - cmd_name, &h[i].key); - - return NGX_CONF_ERROR; - } - - if (!is_builtin_header) { - h[i].append = append; - } - } } if (cmd->types->nelts == 0) { diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.h similarity index 80% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.h index c939507..ad21bb5 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.h @@ -16,10 +16,10 @@ ngx_int_t ngx_http_headers_more_exec_cmd(ngx_http_request_t *r, ngx_http_headers_more_cmd_t *cmd); -char *ngx_http_headers_more_set_headers(ngx_conf_t *cf, +char * ngx_http_headers_more_set_headers(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -char *ngx_http_headers_more_clear_headers(ngx_conf_t *cf, +char * ngx_http_headers_more_clear_headers(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.c similarity index 87% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.c index e1f3636..caba38f 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.c @@ -84,12 +84,12 @@ ngx_http_headers_more_parse_header(ngx_conf_t *cf, ngx_str_t *cmd_name, return NGX_ERROR; } - hv->wildcard = (key.data[key.len - 1] == '*'); + hv->wildcard = (key.data[key.len-1] == '*'); if (hv->wildcard && key.len<2){ - ngx_log_error(NGX_LOG_ERR, cf->log, 0, - "%V: wildcard key too short: %V", - cmd_name, raw_header); - return NGX_ERROR; + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: wildcard key to short: %V", + cmd_name, raw_header); + return NGX_ERROR; } hv->hash = ngx_hash_key_lc(key.data, key.len); @@ -103,7 +103,7 @@ ngx_http_headers_more_parse_header(ngx_conf_t *cf, ngx_str_t *cmd_name, handlers[i].name.len) != 0) { dd("hv key comparison: %s <> %s", handlers[i].name.data, - hv->key.data); + hv->key.data); continue; } @@ -235,7 +235,7 @@ ngx_http_headers_more_parse_types(ngx_log_t *log, ngx_str_t *cmd_name, for (; p != last; p++) { if (t == NULL) { - if (isspace(*p) || *p == ';') { + if (isspace(*p)) { continue; } @@ -250,7 +250,7 @@ ngx_http_headers_more_parse_types(ngx_log_t *log, ngx_str_t *cmd_name, continue; } - if (isspace(*p) || *p == ';') { + if (isspace(*p)) { t = NULL; continue; } @@ -262,6 +262,46 @@ ngx_http_headers_more_parse_types(ngx_log_t *log, ngx_str_t *cmd_name, } +ngx_int_t +ngx_http_headers_more_rm_header(ngx_list_t *l, ngx_table_elt_t *h) +{ + ngx_uint_t i; + ngx_list_part_t *part; + ngx_table_elt_t *data; + + part = &l->part; + data = part->elts; + + for (i = 0; /* void */; i++) { + dd("i: %d, part: %p", (int) i, part); + + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + + dd("switching to the next part %p", part->next); + + part = part->next; +#if 1 + data = part->elts; +#endif + + h = part->elts; + i = 0; + } + + if (&data[i] == h) { + dd("found header at %d", (int) i); + + return ngx_http_headers_more_rm_header_helper(l, part, i); + } + } + + return NGX_ERROR; +} + + ngx_int_t ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, ngx_uint_t i) @@ -270,12 +310,12 @@ ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, ngx_list_part_t *new, *part; dd("list rm item: part %p, i %d, nalloc %d", cur, (int) i, - (int) l->nalloc); + (int) l->nalloc); data = cur->elts; dd("cur: nelts %d, nalloc %d", (int) cur->nelts, - (int) l->nalloc); + (int) l->nalloc); if (i == 0) { cur->elts = (char *) cur->elts + l->size; @@ -295,7 +335,6 @@ ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, if (part->next == NULL) { return NGX_ERROR; } - part = part->next; } @@ -339,7 +378,6 @@ ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, if (part->next == NULL) { return NGX_ERROR; } - part = part->next; } diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.h similarity index 93% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h rename to debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.h index 6c4614b..11dee8c 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h +++ b/debian/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.h @@ -48,5 +48,8 @@ ngx_int_t ngx_http_headers_more_parse_types(ngx_log_t *log, ngx_int_t ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, ngx_uint_t i); +ngx_int_t ngx_http_headers_more_rm_header(ngx_list_t *l, + ngx_table_elt_t *h); + #endif /* NGX_HTTP_HEADERS_MORE_UTIL_H */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t b/debian/modules/headers-more-nginx-module/t/bug.t similarity index 75% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t rename to debian/modules/headers-more-nginx-module/t/bug.t index 2339401..656b8a5 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t +++ b/debian/modules/headers-more-nginx-module/t/bug.t @@ -4,7 +4,7 @@ use Test::Nginx::Socket; # 'no_plan'; repeat_each(2); -plan tests => 56 * repeat_each(); +plan tests => 43 * repeat_each(); no_diff; @@ -318,99 +318,3 @@ Bah: baz --- no_error_log [error] - - -=== TEST 17: Content-Type response headers with a charset param (correct -t values) ---- config - location = /t { - more_set_headers -t 'text/html' 'X-Foo: Bar'; - proxy_pass http://127.0.0.1:$server_port/fake; - } - - location = /fake { - default_type text/html; - charset utf-8; - echo ok; - } ---- request -GET /t ---- response_headers -X-Foo: Bar ---- response_body -ok - - - -=== TEST 18: Content-Type response headers with a charset param (WRONG -t values) ---- config - location = /t { - more_set_headers -t 'text/html; charset=utf-8' 'X-Foo: Bar'; - proxy_pass http://127.0.0.1:$server_port/fake; - } - - location = /fake { - default_type text/html; - charset utf-8; - echo ok; - } ---- request -GET /t ---- response_headers -X-Foo: Bar ---- response_body -ok - - - -=== TEST 19: for bad requests (bad request method letter case) ---- config - error_page 400 = /err; - - location = /err { - more_set_input_headers "Foo: bar"; - echo ok; - } ---- raw_request -GeT / HTTP/1.1 ---- response_body -ok ---- no_check_leak - - - -=== TEST 20: for bad requests (bad request method names) ---- config - error_page 400 = /err; - - location = /err { - more_set_input_headers "Foo: bar"; - echo ok; - } ---- raw_request -GET x HTTP/1.1 ---- response_body -ok ---- no_check_leak - - - -=== TEST 21: override Cache-Control header sent by proxy module ---- config - location = /back { - content_by_lua_block { - ngx.header['Cache-Control'] = 'max-age=0, no-cache' - ngx.send_headers() - ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control) - } - } - - location = /t { - more_set_headers "Cache-Control: max-age=1800"; - proxy_pass http://127.0.0.1:$server_port/back; - } ---- request - GET /t ---- response_headers -Cache-Control: max-age=1800 ---- response_body -Cache-Control: max-age=0, no-cache diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t b/debian/modules/headers-more-nginx-module/t/builtin.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t rename to debian/modules/headers-more-nginx-module/t/builtin.t index 27b20af..f2b5c34 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t +++ b/debian/modules/headers-more-nginx-module/t/builtin.t @@ -336,3 +336,4 @@ hello Vary: hello --- response_body hello + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t b/debian/modules/headers-more-nginx-module/t/eval.t similarity index 96% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t rename to debian/modules/headers-more-nginx-module/t/eval.t index febd306..e28a787 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t +++ b/debian/modules/headers-more-nginx-module/t/eval.t @@ -1,4 +1,4 @@ -# vi:filetype= +# vi:filetype=perl use lib 'lib'; use Test::Nginx::Socket; # 'no_plan'; @@ -34,3 +34,4 @@ __DATA__ GET /foo --- response_body OK + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t b/debian/modules/headers-more-nginx-module/t/input-conn.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t rename to debian/modules/headers-more-nginx-module/t/input-conn.t index f53e80f..a32d4e1 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t +++ b/debian/modules/headers-more-nginx-module/t/input-conn.t @@ -135,3 +135,4 @@ content: conn type: 0 connection: bad --- no_error_log [error] + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t b/debian/modules/headers-more-nginx-module/t/input-cookie.t similarity index 89% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t rename to debian/modules/headers-more-nginx-module/t/input-cookie.t index 3e5257b..8929be7 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t +++ b/debian/modules/headers-more-nginx-module/t/input-cookie.t @@ -162,22 +162,3 @@ Cookie: boo=123 --- no_error_log [error] - - -=== TEST 5: for bad requests causing segfaults when setting & getting multi-value headers ---- config - error_page 400 = /err; - - location = /err { - more_set_input_headers "Cookie: foo=bar"; - echo -n $cookie_foo; - echo ok; - } ---- raw_request -GeT / HTTP/1.1 ---- response_body -ok ---- no_error_log -[warn] -[error] ---- no_check_leak diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t b/debian/modules/headers-more-nginx-module/t/input-ua.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t rename to debian/modules/headers-more-nginx-module/t/input-ua.t index da9a60d..56d2222 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t +++ b/debian/modules/headers-more-nginx-module/t/input-ua.t @@ -626,3 +626,4 @@ content: konqueror: 1 User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) (Kubuntu) --- no_error_log [error] + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t b/debian/modules/headers-more-nginx-module/t/input.t similarity index 86% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t rename to debian/modules/headers-more-nginx-module/t/input.t index 01ae73f..9c5da23 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t +++ b/debian/modules/headers-more-nginx-module/t/input.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; # 'no_plan'; repeat_each(2); -plan tests => repeat_each() * 128; +plan tests => repeat_each() * 105; no_long_string(); #no_diff; @@ -1166,166 +1166,3 @@ AAA: 678 --- no_error_log [error] - - -=== TEST 44: clear If-Unmodified-Since req header ---- config - location = /t { - more_clear_input_headers 'If-Unmodified-Since'; - content_by_lua ' - ngx.header["Last-Modified"] = "Tue, 30 Jun 2011 12:16:36 GMT" - ngx.say("If-Unmodified-Since: ", ngx.var.http_if_unmodified_since) - '; - } ---- request -GET /t ---- more_headers -If-Unmodified-Since: Tue, 28 Jun 2011 12:16:36 GMT ---- response_body -If-Unmodified-Since: nil ---- no_error_log -[error] - - - -=== TEST 45: clear If-Match req header ---- config - location = /t { - more_clear_input_headers 'If-Match'; - echo "If-Match: $http_if_match"; - } ---- request -GET /t ---- more_headers -If-Match: abc ---- response_body -If-Match: ---- no_error_log -[error] - - - -=== TEST 46: clear If-None-Match req header ---- config - location = /t { - more_clear_input_headers 'If-None-Match'; - echo "If-None-Match: $http_if_none_match"; - } ---- request -GET /t ---- more_headers -If-None-Match: * ---- response_body -If-None-Match: ---- no_error_log -[error] - - - -=== TEST 47: set the Destination request header for WebDav ---- config - location = /a.txt { - more_set_input_headers "Destination: /b.txt"; - dav_methods MOVE; - dav_access all:rw; - root html; - } - ---- user_files ->>> a.txt -hello, world! - ---- request -MOVE /a.txt - ---- response_body ---- no_error_log -client sent no "Destination" header -[error] ---- error_code: 204 - - - -=== TEST 48: more_set_input_headers + X-Forwarded-For ---- config - location = /t { - more_set_input_headers "X-Forwarded-For: 8.8.8.8"; - proxy_pass http://127.0.0.1:$server_port/back; - proxy_set_header Foo $proxy_add_x_forwarded_for; - } - - location = /back { - echo "Foo: $http_foo"; - } - ---- request -GET /t - ---- response_body -Foo: 8.8.8.8, 127.0.0.1 ---- no_error_log -[error] - - - -=== TEST 49: more_clear_input_headers + X-Forwarded-For ---- config - location = /t { - more_clear_input_headers "X-Forwarded-For"; - proxy_pass http://127.0.0.1:$server_port/back; - proxy_set_header Foo $proxy_add_x_forwarded_for; - } - - location = /back { - echo "Foo: $http_foo"; - } - ---- request -GET /t - ---- more_headers -X-Forwarded-For: 8.8.8.8 ---- response_body -Foo: 127.0.0.1 ---- no_error_log -[error] - - - -=== TEST 50: clear input headers with wildcard ---- config - location /hello { - more_clear_input_headers 'X-Hidden-*'; - content_by_lua ' - ngx.say("X-Hidden-One: ", ngx.var.http_x_hidden_one) - ngx.say("X-Hidden-Two: ", ngx.var.http_x_hidden_two) - '; - } ---- request - GET /hello ---- more_headers -X-Hidden-One: i am hidden -X-Hidden-Two: me 2 ---- response_body -X-Hidden-One: nil -X-Hidden-Two: nil - - - -=== TEST 51: make sure wildcard doesn't affect more_set_input_headers ---- config - location /hello { - more_set_input_headers 'X-Hidden-*: lol'; - content_by_lua ' - ngx.say("X-Hidden-One: ", ngx.var.http_x_hidden_one) - ngx.say("X-Hidden-Two: ", ngx.var.http_x_hidden_two) - '; - } ---- request - GET /hello ---- more_headers -X-Hidden-One: i am hidden -X-Hidden-Two: me 2 ---- response_body -X-Hidden-One: i am hidden -X-Hidden-Two: me 2 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t b/debian/modules/headers-more-nginx-module/t/phase.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t rename to debian/modules/headers-more-nginx-module/t/phase.t index 11183db..343d2e5 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t +++ b/debian/modules/headers-more-nginx-module/t/phase.t @@ -23,3 +23,4 @@ __DATA__ X-Foo: Blah --- response_body_like: 403 Forbidden --- error_code: 403 + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t b/debian/modules/headers-more-nginx-module/t/sanity.t similarity index 89% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t rename to debian/modules/headers-more-nginx-module/t/sanity.t index 47d65e3..e316cac 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t +++ b/debian/modules/headers-more-nginx-module/t/sanity.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(2); -plan tests => repeat_each() * 123; +plan tests => repeat_each() * 113; #master_on(); #workers(2); @@ -566,63 +566,3 @@ hi ok --- http09 - - -=== TEST 34: use the -a option to append the cookie field ---- config - location /cookie { - more_set_headers -a 'Set-Cookie: name=lynch'; - echo ok; - } ---- request - GET /cookie ---- response_headers -Set-Cookie: name=lynch ---- response_body -ok - - - -=== TEST 35: the original Set-Cookie fields will not be overwritten, when using the -a option ---- config - location /cookie { - more_set_headers 'Set-Cookie: name=lynch'; - more_set_headers -a 'Set-Cookie: born=1981'; - echo ok; - } ---- request - GET /cookie ---- raw_response_headers_like eval -"Set-Cookie: name=lynch\r\nSet-Cookie: born=1981\r\n" ---- response_body -ok - - - -=== TEST 36: The behavior of builtin headers can not be changed ---- config - location /foo { - more_set_headers -a "Server: myServer"; - echo ok; - } ---- request - GET /foo ---- must_die ---- error_log chomp -can not append builtin headers ---- suppress_stderr - - - -=== TEST 37: can not use -a option with more_clear_headers ---- config - location /foo { - more_clear_headers -a 'Content-Type'; - echo ok; - } ---- request - GET /foo ---- must_die ---- error_log chomp -invalid option name: "-a" ---- suppress_stderr diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t b/debian/modules/headers-more-nginx-module/t/subrequest.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t rename to debian/modules/headers-more-nginx-module/t/subrequest.t index 9443eca..34e84c9 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t +++ b/debian/modules/headers-more-nginx-module/t/subrequest.t @@ -66,3 +66,4 @@ main: dog --- response_headers ! Host --- skip_nginx: 3: < 0.7.46 + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t b/debian/modules/headers-more-nginx-module/t/unused.t similarity index 89% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t rename to debian/modules/headers-more-nginx-module/t/unused.t index c51f91c..c3c869f 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t +++ b/debian/modules/headers-more-nginx-module/t/unused.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(2); -plan tests => repeat_each() * (blocks() * 4 + 2); +plan tests => repeat_each() * (blocks() * 4 + 3); #master_on(); #workers(2); @@ -125,9 +125,6 @@ headers more rewrite handler === TEST 7: multiple http {} blocks (filter) -This test case won't run with nginx 1.9.3+ since duplicate http {} blocks -have been prohibited since then. ---- SKIP --- config location /foo { echo hi; @@ -152,9 +149,6 @@ headers more header filter === TEST 8: multiple http {} blocks (handler) -This test case won't run with nginx 1.9.3+ since duplicate http {} blocks -have been prohibited since then. ---- SKIP --- config location /foo { more_set_input_headers 'Foo: bar'; @@ -172,3 +166,4 @@ bar headers more header handler [error] --- log_level: debug + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t b/debian/modules/headers-more-nginx-module/t/vars.t similarity index 99% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t rename to debian/modules/headers-more-nginx-module/t/vars.t index 04c75c3..426c68c 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t +++ b/debian/modules/headers-more-nginx-module/t/vars.t @@ -56,3 +56,4 @@ hi dog --- response_headers Host: + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh b/debian/modules/headers-more-nginx-module/util/build.sh similarity index 87% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh rename to debian/modules/headers-more-nginx-module/util/build.sh index 00a191f..1e91f56 100755 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh +++ b/debian/modules/headers-more-nginx-module/util/build.sh @@ -6,15 +6,11 @@ root=`pwd` version=$1 home=~ force=$2 -pcre2_opt="" -if [ "$WITHOUT_PCRE2" = "1" ]; then - pcre2_opt="--without-pcre2" -fi #--with-cc=gcc46 \ ngx-build $force $version \ - --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB" \ + --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB:$LUAJIT_LIB:/usr/local/lib" \ --without-mail_pop3_module \ --without-mail_imap_module \ --without-mail_smtp_module \ @@ -25,9 +21,7 @@ ngx-build $force $version \ --without-http_autoindex_module \ --without-http_auth_basic_module \ --without-http_userid_module \ - $pcre2_opt \ --with-http_realip_module \ - --with-http_dav_module \ --add-module=$root/../eval-nginx-module \ --add-module=$root/../lua-nginx-module \ --add-module=$root/../echo-nginx-module \ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress b/debian/modules/headers-more-nginx-module/valgrind.suppress similarity index 61% rename from modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress rename to debian/modules/headers-more-nginx-module/valgrind.suppress index d51de70..87ce6af 100644 --- a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress +++ b/debian/modules/headers-more-nginx-module/valgrind.suppress @@ -1,9 +1,40 @@ +{ + +Memcheck:Cond +fun:lj_str_new +} { - Memcheck:Leak - fun:malloc - fun:ngx_alloc - obj:* + Memcheck:Cond + fun:lj_str_new + fun:lua_pushlstring +} +{ + + Memcheck:Addr4 + fun:lj_str_new + fun:lua_pushlstring +} +{ + +Memcheck:Leak +fun:malloc +fun:ngx_alloc +obj:* +} +{ + +Memcheck:Leak +fun:malloc +fun:ngx_alloc +} +{ + +Memcheck:Leak +fun:malloc +fun:ngx_alloc +fun:ngx_palloc_large +fun:ngx_palloc } { @@ -13,6 +44,27 @@ fun:ngx_calloc fun:ngx_event_process_init } +{ + +Memcheck:Addr4 +fun:lj_str_new +fun:lua_pushlstring +fun:ngx_http_lua_get_output_header +} +{ + + Memcheck:Addr4 + fun:lj_str_new + fun:lua_getfield + fun:ngx_http_lua_cache_load_code +} +{ + + Memcheck:Addr4 + fun:lj_str_new + fun:lua_setfield + fun:ngx_http_lua_cache_store_code +} { Memcheck:Leak @@ -20,12 +72,34 @@ fun:ngx_alloc fun:ngx_event_process_init } +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:(below main) +} { Memcheck:Param epoll_ctl(event) fun:epoll_ctl } +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_create_pool +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_malloc + fun:ngx_palloc_large +} { Memcheck:Cond @@ -34,6 +108,22 @@ fun:ngx_log_error_core fun:ngx_http_charset_header_filter } +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_malloc + fun:ngx_pnalloc +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_malloc + fun:ngx_palloc +} { nginx-core-process-init Memcheck:Leak @@ -95,6 +185,15 @@ fun:ngx_epoll_process_events fun:ngx_process_events_and_timers } +{ + + Memcheck:Leak + fun:memalign + fun:posix_memalign + fun:ngx_memalign + fun:ngx_palloc_block + fun:ngx_palloc +} { Memcheck:Addr8 @@ -103,33 +202,4 @@ fun:exit fun:ngx_master_process_exit } -{ - - Memcheck:Cond - fun:index - fun:expand_dynamic_string_token - fun:_dl_map_object - fun:map_doit - fun:_dl_catch_error - fun:do_preload - fun:dl_main -} -{ - - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:ngx_alloc - fun:ngx_set_environment - fun:ngx_single_process_cycle -} -{ - - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:ngx_alloc - fun:ngx_set_environment - fun:ngx_worker_process_init - fun:ngx_worker_process_cycle -} + diff --git a/debian/modules/nginx-auth-pam/ChangeLog b/debian/modules/nginx-auth-pam/ChangeLog new file mode 100644 index 0000000..5c49312 --- /dev/null +++ b/debian/modules/nginx-auth-pam/ChangeLog @@ -0,0 +1,29 @@ +2013-09-17 sto@iti.es + + * Version 1.3. + * Added support to export HOST and REQUEST variables to the PAM ENVIRONMENT. + Thanks to Ruben Jenster for the initial patch, his version is available + from https://github.com/r10r/ngx_http_auth_pam_module; my version uses his + implementation but only if the user sets the ``pam_auth_set_pam_env`` + flag. + * Fixed bug from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=+721702 + (ngx_module_t commands array should end with a ngx_null_command); the bug + was already fixed on the PAM_ENV patch, but I forgot about it until I went + back to my svn repository to add the debian patch... better latter than + never... ;) + +2010-11-15 sto@iti.upv.es + + * Version 1.2. + * Fixed possible memory leak when authentication fails, pam_end has to + be called to free memory (thanks to Neil Chintomby). + +2009-01-26 sto@iti.upv.es + + * Version 1.1. + * Fixed ngx_log_debugX calls, no we use the correct X value on each + call. + +2008-09-17 sto@iti.upv.es + + * Initial version (1.0). diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE b/debian/modules/nginx-auth-pam/LICENSE similarity index 79% rename from modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE rename to debian/modules/nginx-auth-pam/LICENSE index db3aca7..fd15a67 100644 --- a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE +++ b/debian/modules/nginx-auth-pam/LICENSE @@ -1,8 +1,5 @@ -/* - * Copyright (C) 2002-2015 Igor Sysoev - * Copyright (C) 2011-2015 Nginx, Inc. - * Copyright (C) 2015-2019 Google Inc. - * All rights reserved. +/* + * Copyright (C) 2008-2013 Sergio Talens Oliag * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -24,4 +21,5 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * */ diff --git a/debian/modules/nginx-auth-pam/README b/debian/modules/nginx-auth-pam/README new file mode 100644 index 0000000..b47f167 --- /dev/null +++ b/debian/modules/nginx-auth-pam/README @@ -0,0 +1,102 @@ +Nginx module to use PAM for simple http authentication +====================================================== + +:Date: $Date: 2013-09-17 12:00:49 +0200 (dt 17 de set de 2013) $ +:Revision: $Rev: 7626 $ + +Compilation +----------- + +When compiling from source build as usual adding the -add-module option:: + + ./configure --add-module=$PATH_TO_MODULE + +If you are using a Debian GNU/Linux distribution install the nginx-full package; +the module has been included in the nginx debian package since version 1.1.6-1 +and there are newer packages on the stable distribution (wheezy) and the wheezy +version is also available from the oldstable backports repository +(squeeze-backports). + +Configuration +------------- + +The module only has two directives: + +- ``auth_pam``: This is the http authentication realm. If given the value + ``off`` the module is disabled (needed when we want to override the value + set on a lower-level directive). + +- ``auth_pam_service_name``: this is the PAM service name and by default it is + set to ``nginx``. + +Examples +-------- + +To protect everything under ``/secure`` you will add the following to the +``nginx.conf`` file:: + + location /secure { + auth_pam "Secure Zone"; + auth_pam_service_name "nginx"; + } + +Note that the module runs as the web server user, so the PAM modules used must +be able to authenticate the users without being root; that means that if you +want to use the ``pam_unix.so`` module to autenticate users you need to let the +web server user to read the ``/etc/shadow`` file if that does not scare you (on +Debian like systems you can add the ``www-data`` user to the ``shadow`` group). + +As an example, to authenticate users against an LDAP server (using the +``pam_ldap.so`` module) you will use an ``/etc/pam.d/nginx`` like the following:: + + auth required /lib/security/pam_ldap.so + account required /lib/security/pam_ldap.so + +If you also want to limit the users from LDAP that can authenticate you can +use the ``pam_listfile.so`` module; to limit who can access resources under +``/restricted`` add the following to the ``nginx.conf`` file:: + + location /restricted { + auth_pam "Restricted Zone"; + auth_pam_service_name "nginx_restricted"; + } + +Use the following ``/etc/pam.d/nginx_restricted`` file:: + + auth required /lib/security/pam_listfile.so onerr=fail item=user \ + sense=allow file=/etc/nginx/restricted_users + auth required /lib/security/pam_ldap.so + account required /lib/security/pam_ldap.so + +And add the users allowed to authenticate to the ``/etc/nginx/restricted_users`` +(remember that the web server user has to be able to read this file). + + +PAM Environment +--------------- + +If you want use the ``pam_exec.so`` plugin for request based authentication the +module can add to the PAM environment the ``HOST`` and ``REQUEST`` variables if +you set the ``auth_pam_set_pam_env`` flag:: + + location /pam_exec_protected { + auth_pam "Exec Zone"; + auth_pam_service_name "nginx_exec"; + auth_pam_set_pam_env on; + } + +With this configuration if you access an URL like: + + http://localhost:8000/pam_exec_protected/page?foo=yes&bar=too + +the PAM environment will include the following variables:: + + HOST=localhost:8000 + REQUEST=GET /pam_exec_protected/page?foo=yes&bar=too HTTP/1.1 + +You may use this information for request based authentication. +You need a recent pam release (>= version 1.0.90) to expose environment +variables to pam_exec. + +.. ...... +.. SVN Id: $Id: README 7626 2013-09-17 10:00:49Z sto $ diff --git a/debian/modules/nginx-auth-pam/config b/debian/modules/nginx-auth-pam/config new file mode 100644 index 0000000..ef0815e --- /dev/null +++ b/debian/modules/nginx-auth-pam/config @@ -0,0 +1,4 @@ +ngx_addon_name=ngx_http_auth_pam_module +HTTP_MODULES="$HTTP_MODULES ngx_http_auth_pam_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_auth_pam_module.c" +CORE_LIBS="$CORE_LIBS -lpam" diff --git a/debian/modules/nginx-auth-pam/ngx_http_auth_pam_module.c b/debian/modules/nginx-auth-pam/ngx_http_auth_pam_module.c new file mode 100644 index 0000000..08fe1f6 --- /dev/null +++ b/debian/modules/nginx-auth-pam/ngx_http_auth_pam_module.c @@ -0,0 +1,443 @@ +/* + * Copyright (C) 2008-2013 Sergio Talens-Oliag + * + * Based on nginx's 'ngx_http_auth_basic_module.c' by Igor Sysoev and apache's + * 'mod_auth_pam.c' by Ingo Luetkebolhe. + * + * SVN Id: $Id: ngx_http_auth_pam_module.c 7626 2013-09-17 10:00:49Z sto $ + */ + +#include +#include +#include +#include + +#define NGX_PAM_SERVICE_NAME "nginx" + +/* Module context data */ +typedef struct { + ngx_str_t passwd; +} ngx_http_auth_pam_ctx_t; + +/* PAM userinfo */ +typedef struct { + ngx_str_t username; + ngx_str_t password; +} ngx_pam_userinfo; + +/* Module configuration struct */ +typedef struct { + ngx_str_t realm; /* http basic auth realm */ + ngx_str_t service_name; /* pam service name */ + ngx_flag_t set_pam_env; /* flag that indicates if we should export + variables to PAM or NOT */ +} ngx_http_auth_pam_loc_conf_t; + +/* Module handler */ +static ngx_int_t ngx_http_auth_pam_handler(ngx_http_request_t *r); + +/* Function that authenticates the user -- is the only function that uses PAM */ +static ngx_int_t ngx_http_auth_pam_authenticate(ngx_http_request_t *r, + ngx_http_auth_pam_ctx_t *ctx, + ngx_str_t *passwd, void *conf); + +static ngx_int_t ngx_http_auth_pam_set_realm(ngx_http_request_t *r, + ngx_str_t *realm); + +static void *ngx_http_auth_pam_create_loc_conf(ngx_conf_t *cf); + +static char *ngx_http_auth_pam_merge_loc_conf(ngx_conf_t *cf, + void *parent, void *child); + +static ngx_int_t ngx_http_auth_pam_init(ngx_conf_t *cf); + +static char *ngx_http_auth_pam(ngx_conf_t *cf, void *post, void *data); + +static ngx_conf_post_handler_pt ngx_http_auth_pam_p = ngx_http_auth_pam; + +static int ngx_auth_pam_talker(int num_msg, const struct pam_message ** msg, + struct pam_response ** resp, void *appdata_ptr); + +static ngx_command_t ngx_http_auth_pam_commands[] = { + + { ngx_string("auth_pam"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF + |NGX_CONF_TAKE1, + ngx_conf_set_str_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_auth_pam_loc_conf_t, realm), + &ngx_http_auth_pam_p }, + + { ngx_string("auth_pam_service_name"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF + |NGX_CONF_TAKE1, + ngx_conf_set_str_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_auth_pam_loc_conf_t, service_name), + NULL }, + + { ngx_string("auth_pam_set_pam_env"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF + |NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_auth_pam_loc_conf_t, set_pam_env), + NULL }, + + ngx_null_command +}; + + +static ngx_http_module_t ngx_http_auth_pam_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_auth_pam_init, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_auth_pam_create_loc_conf, /* create location configuration */ + ngx_http_auth_pam_merge_loc_conf /* merge location configuration */ +}; + + +ngx_module_t ngx_http_auth_pam_module = { + NGX_MODULE_V1, + &ngx_http_auth_pam_module_ctx, /* module context */ + ngx_http_auth_pam_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +/* + * ngx_auth_pam_talker: supply authentication information to PAM when asked + * + * Assumptions: + * A password is asked for by requesting input without echoing + * A username is asked for by requesting input _with_ echoing + */ +static int +ngx_auth_pam_talker(int num_msg, const struct pam_message ** msg, + struct pam_response ** resp, void *appdata_ptr) +{ + int i; + ngx_pam_userinfo *uinfo; + struct pam_response *response; + + uinfo = (ngx_pam_userinfo *) appdata_ptr; + response = NULL; + + /* parameter sanity checking */ + if (!resp || !msg || !uinfo) + return PAM_CONV_ERR; + + /* allocate memory to store response */ + response = malloc(num_msg * sizeof(struct pam_response)); + if (!response) + return PAM_CONV_ERR; + + /* copy values */ + for (i = 0; i < num_msg; i++) { + /* initialize to safe values */ + response[i].resp_retcode = 0; + response[i].resp = 0; + + /* select response based on requested output style */ + switch (msg[i]->msg_style) { + case PAM_PROMPT_ECHO_ON: + /* on memory allocation failure, auth fails */ + response[i].resp = strdup((const char *)uinfo->username.data); + break; + case PAM_PROMPT_ECHO_OFF: + response[i].resp = strdup((const char *)uinfo->password.data); + break; + default: + if (response) { + free(response); + } + return PAM_CONV_ERR; + } + } + /* everything okay, set PAM response values */ + *resp = response; + return PAM_SUCCESS; +} + +static ngx_int_t +ngx_http_auth_pam_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_http_auth_pam_ctx_t *ctx; + ngx_http_auth_pam_loc_conf_t *alcf; + + alcf = ngx_http_get_module_loc_conf(r, ngx_http_auth_pam_module); + + if (alcf->realm.len == 0) { + return NGX_DECLINED; + } + + ctx = ngx_http_get_module_ctx(r, ngx_http_auth_pam_module); + + if (ctx) { + return ngx_http_auth_pam_authenticate(r, ctx, &ctx->passwd, alcf); + } + + /* Decode http auth user and passwd, leaving values on the request */ + rc = ngx_http_auth_basic_user(r); + + if (rc == NGX_DECLINED) { + return ngx_http_auth_pam_set_realm(r, &alcf->realm); + } + + if (rc == NGX_ERROR) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* Check user & password using PAM */ + return ngx_http_auth_pam_authenticate(r, ctx, &ctx->passwd, alcf); +} + +/** + * create a key value pair from the given key and value string + */ +static void set_to_pam_env(pam_handle_t *pamh, ngx_http_request_t *r, + char *key, char *value) +{ + if (key != NULL && value != NULL) { + size_t size = strlen(key) + strlen(value) + 1 * sizeof(char); + char *key_value_pair = ngx_palloc(r->pool, size); + sprintf(key_value_pair, "%s=%s", key, value); + + pam_putenv(pamh, key_value_pair); + } +} + +/** + * creates a '\0' terminated string from the given ngx_str_t + * + * @param source nginx string structure with data and length + * @param pool pool of the request used for memory allocation + */ +static char* ngx_strncpy_s(ngx_str_t source, ngx_pool_t *pool) +{ + // allocate memory in pool + char* destination = ngx_palloc(pool, source.len + 1); + strncpy(destination, (char *) source.data, source.len); + // add null terminator + destination[source.len] = '\0'; + return destination; +} + +/** + * enrich pam environment with request parameters + */ +static void add_request_info_to_pam_env(pam_handle_t *pamh, + ngx_http_request_t *r) +{ + char *request_info = ngx_strncpy_s(r->request_line, r->pool); + char *host_info = ngx_strncpy_s(r->headers_in.host->value, r->pool); + + set_to_pam_env(pamh, r, "REQUEST", request_info); + set_to_pam_env(pamh, r, "HOST", host_info); +} + +static ngx_int_t +ngx_http_auth_pam_authenticate(ngx_http_request_t *r, + ngx_http_auth_pam_ctx_t *ctx, ngx_str_t *passwd, + void *conf) +{ + ngx_int_t rc; + ngx_http_auth_pam_loc_conf_t *alcf; + + ngx_pam_userinfo uinfo; + struct pam_conv conv_info; /* PAM struct */ + pam_handle_t *pamh; + u_char *service_name; + + alcf = conf; + + size_t len; + u_char *uname_buf, *p; + + /** + * Get username and password, note that r->headers_in.user contains the + * string 'user:pass', so we need to copy the username + **/ + for (len = 0; len < r->headers_in.user.len; len++) { + if (r->headers_in.user.data[len] == ':') { + break; + } + } + uname_buf = ngx_palloc(r->pool, len+1); + if (uname_buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + p = ngx_cpymem(uname_buf, r->headers_in.user.data , len); + *p ='\0'; + + uinfo.username.data = uname_buf; + uinfo.username.len = len; + + uinfo.password.data = r->headers_in.passwd.data; + uinfo.password.len = r->headers_in.passwd.len; + + conv_info.conv = &ngx_auth_pam_talker; + conv_info.appdata_ptr = (void *) &uinfo; + + pamh = NULL; + + /* Initialize PAM */ + if (alcf->service_name.data == NULL) { + service_name = (u_char *) NGX_PAM_SERVICE_NAME; + } else { + service_name = alcf->service_name.data; + } + if ((rc = pam_start((const char *) service_name, + (const char *) uinfo.username.data, + &conv_info, + &pamh)) != PAM_SUCCESS) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "PAM: Could not start pam service: %s", + pam_strerror(pamh, rc)); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (alcf->set_pam_env) { + add_request_info_to_pam_env(pamh, r); + } + + /* try to authenticate user, log error on failure */ + if ((rc = pam_authenticate(pamh, + PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) { + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "PAM: user '%s' - not authenticated: %s", + uinfo.username.data, pam_strerror(pamh, rc)); + pam_end(pamh, PAM_SUCCESS); + return ngx_http_auth_pam_set_realm(r, &alcf->realm); + } /* endif authenticate */ + + /* check that the account is healthy */ + if ((rc = pam_acct_mgmt(pamh, PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) { + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "PAM: user '%s' - invalid account: %s", + uinfo.username.data, pam_strerror(pamh, rc)); + pam_end(pamh, PAM_SUCCESS); + return ngx_http_auth_pam_set_realm(r, &alcf->realm); + } + + pam_end(pamh, PAM_SUCCESS); + return NGX_OK; +} + +static ngx_int_t +ngx_http_auth_pam_set_realm(ngx_http_request_t *r, ngx_str_t *realm) +{ + r->headers_out.www_authenticate = ngx_list_push(&r->headers_out.headers); + if (r->headers_out.www_authenticate == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + r->headers_out.www_authenticate->hash = 1; + r->headers_out.www_authenticate->key.len = sizeof("WWW-Authenticate") - 1; + r->headers_out.www_authenticate->key.data = (u_char *) "WWW-Authenticate"; + r->headers_out.www_authenticate->value = *realm; + + return NGX_HTTP_UNAUTHORIZED; +} + +static void * +ngx_http_auth_pam_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_auth_pam_loc_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_auth_pam_loc_conf_t)); + if (conf == NULL) { + return NGX_CONF_ERROR; + } + + /* Strings are already NULL, but the flags have to be marked as unset */ + conf->set_pam_env = NGX_CONF_UNSET; + + return conf; +} + +static char * +ngx_http_auth_pam_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_http_auth_pam_loc_conf_t *prev = parent; + ngx_http_auth_pam_loc_conf_t *conf = child; + + if (conf->realm.data == NULL) { + conf->realm = prev->realm; + } + + if (conf->service_name.data == NULL) { + conf->service_name = prev->service_name; + } + + /* By default set_pam_env is off */ + ngx_conf_merge_value(conf->set_pam_env, prev->set_pam_env, 0); + + return NGX_CONF_OK; +} + +static ngx_int_t +ngx_http_auth_pam_init(ngx_conf_t *cf) +{ + ngx_http_handler_pt *h; + ngx_http_core_main_conf_t *cmcf; + + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); + + h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers); + if (h == NULL) { + return NGX_ERROR; + } + + *h = ngx_http_auth_pam_handler; + + return NGX_OK; +} + +static char * +ngx_http_auth_pam(ngx_conf_t *cf, void *post, void *data) +{ + ngx_str_t *realm = data; + + size_t len; + u_char *basic, *p; + + if (ngx_strcmp(realm->data, "off") == 0) { + realm->len = 0; + realm->data = (u_char *) ""; + + return NGX_CONF_OK; + } + + len = sizeof("Basic realm=\"") - 1 + realm->len + 1; + + basic = ngx_palloc(cf->pool, len); + if (basic == NULL) { + return NGX_CONF_ERROR; + } + + p = ngx_cpymem(basic, "Basic realm=\"", sizeof("Basic realm=\"") - 1); + p = ngx_cpymem(p, realm->data, realm->len); + *p = '"'; + + realm->len = len; + realm->data = basic; + + return NGX_CONF_OK; +} + +/* SVN Id: $Id: ngx_http_auth_pam_module.c 7626 2013-09-17 10:00:49Z sto $ */ diff --git a/debian/modules/nginx-cache-purge/CHANGES b/debian/modules/nginx-cache-purge/CHANGES new file mode 100644 index 0000000..4dea592 --- /dev/null +++ b/debian/modules/nginx-cache-purge/CHANGES @@ -0,0 +1,56 @@ +2013-03-19 VERSION 2.1 + * When enabled, cache purge will now catch all requests with + PURGE (or specified) method, even if cache isn't configured. + Previously, it would pass such requests to the upstream. + +2012-12-07 VERSION 2.0 + * Add alternative "same location" syntax. + From CloudFlare. + +2012-07-02 VERSION 1.6 + * Fix compatibility with nginx-1.3.2+. + Reported by MagicBear, patch from Ruslan Ermilov. + +2011-12-20 VERSION 1.5 + * Fix on-disk cache size calculation. + Since the initial release, recorded on-disk cache size was + decreased twice for purged content (once during cache purge + and once during subsequent cache update). + This resulted in recorded on-disk cache size being much + smaller than in reality, which could lead to on-disk cache + outgrowing defined "max_size" parameter. + Patch from Pyry Hakulinen. + +2011-10-05 VERSION 1.4 + * Add AIO support. + Requested by Emin Hasanov. + +2011-05-03 VERSION 1.3 + * Fix compatibility with nginx-1.0.1. + Reported by Sergey A. Osokin and Markus Linnala. + +2010-08-29 + * Fix compatibility with nginx-0.8.0 and versions older than + nginx-0.7.60. + +2010-08-11 VERSION 1.2 + * Fix various build scenarios with disabled upstream modules. + Reported by Johan Bergstroem. + + * Add ability to purge content from SCGI's cache. + Requested by Johan Bergstroem. + +2010-06-08 VERSION 1.1 + * Fix compatibility with nginx-0.8.40+. + + * Add ability to purge content from uWSGI's cache. + +2010-01-10 VERSION 1.0 + * Initial module release. + +2009-11-17 + * Fix patch compatibility with nginx-0.8.11+. + Reported by Bing Ran. + +2009-08-11 + * Initial patch release. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE b/debian/modules/nginx-cache-purge/LICENSE similarity index 91% rename from modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE rename to debian/modules/nginx-cache-purge/LICENSE index 0047538..a9bd6ee 100644 --- a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE +++ b/debian/modules/nginx-cache-purge/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2009-2014, FRiCKLE -Copyright (c) 2009-2014, Piotr Sikora +Copyright (c) 2009-2012, FRiCKLE +Copyright (c) 2009-2012, Piotr Sikora All rights reserved. This project was fully funded by yo.se. diff --git a/debian/modules/nginx-cache-purge/README.md b/debian/modules/nginx-cache-purge/README.md new file mode 100644 index 0000000..89d84e0 --- /dev/null +++ b/debian/modules/nginx-cache-purge/README.md @@ -0,0 +1,180 @@ +About +===== +`ngx_cache_purge` is `nginx` module which adds ability to purge content from +`FastCGI`, `proxy`, `SCGI` and `uWSGI` caches. + + +Sponsors +======== +Work on the original patch was fully funded by [yo.se](http://yo.se). + + +Status +====== +This module is production-ready and it's compatible with following nginx +releases: + +- 0.7.x (tested with 0.7.60 to 0.7.69), +- 0.8.x (tested with 0.8.0 to 0.8.55), +- 0.9.x (tested with 0.9.0 to 0.9.7), +- 1.0.x (tested with 1.0.0 to 1.0.15), +- 1.1.x (tested with 1.1.0 to 1.1.19), +- 1.2.x (tested with 1.2.0 to 1.2.7), +- 1.3.x (tested with 1.3.0 to 1.3.14). + + +Configuration directives (same location syntax) +=============================================== +fastcgi_cache_purge +------------------- +* **syntax**: `fastcgi_cache_purge on|off| [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `FastCGI`'s cache. + + +proxy_cache_purge +----------------- +* **syntax**: `proxy_cache_purge on|off| [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `proxy`'s cache. + + +scgi_cache_purge +---------------- +* **syntax**: `scgi_cache_purge on|off| [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `SCGI`'s cache. + + +uwsgi_cache_purge +----------------- +* **syntax**: `uwsgi_cache_purge on|off| [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `uWSGI`'s cache. + + +Configuration directives (separate location syntax) +=================================================== +fastcgi_cache_purge +------------------- +* **syntax**: `fastcgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `FastCGI`'s cache. + + +proxy_cache_purge +----------------- +* **syntax**: `proxy_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `proxy`'s cache. + + +scgi_cache_purge +---------------- +* **syntax**: `scgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `SCGI`'s cache. + + +uwsgi_cache_purge +----------------- +* **syntax**: `uwsgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `uWSGI`'s cache. + + +Sample configuration (same location syntax) +=========================================== + http { + proxy_cache_path /tmp/cache keys_zone=tmpcache:10m; + + server { + location / { + proxy_pass http://127.0.0.1:8000; + proxy_cache tmpcache; + proxy_cache_key $uri$is_args$args; + proxy_cache_purge PURGE from 127.0.0.1; + } + } + } + + +Sample configuration (separate location syntax) +=============================================== + http { + proxy_cache_path /tmp/cache keys_zone=tmpcache:10m; + + server { + location / { + proxy_pass http://127.0.0.1:8000; + proxy_cache tmpcache; + proxy_cache_key $uri$is_args$args; + } + + location ~ /purge(/.*) { + allow 127.0.0.1; + deny all; + proxy_cache_purge tmpcache $1$is_args$args; + } + } + } + + +Testing +======= +`ngx_cache_purge` comes with complete test suite based on [Test::Nginx](http://github.com/agentzh/test-nginx). + +You can test it by running: + +`$ prove` + + +License +======= + Copyright (c) 2009-2012, FRiCKLE + Copyright (c) 2009-2012, Piotr Sikora + All rights reserved. + + This project was fully funded by yo.se. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +See also +======== +- [ngx_slowfs_cache](http://github.com/FRiCKLE/ngx_slowfs_cache). diff --git a/debian/modules/nginx-cache-purge/TODO.md b/debian/modules/nginx-cache-purge/TODO.md new file mode 100644 index 0000000..e279043 --- /dev/null +++ b/debian/modules/nginx-cache-purge/TODO.md @@ -0,0 +1,7 @@ +Features that __will not__ be added to `ngx_cache_purge`: + +* Support for prefixed purges (`/purge/images/*`). + Reason: Impossible with current cache implementation. + +* Support for wildcard/regex purges (`/purge/*.jpg`). + Reason: Impossible with current cache implementation. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/config b/debian/modules/nginx-cache-purge/config similarity index 53% rename from modules_deb/libnginx-mod-http-cache-purge-2.5.3/config rename to debian/modules/nginx-cache-purge/config index b900680..34f42ec 100644 --- a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/config +++ b/debian/modules/nginx-cache-purge/config @@ -15,17 +15,7 @@ if [ "$HTTP_UWSGI" = "YES" ]; then fi ngx_addon_name=ngx_http_cache_purge_module -CACHE_PURGE_SRCS="$ngx_addon_dir/ngx_cache_purge_module.c" - -if [ -n "$ngx_module_link" ]; then - ngx_module_type=HTTP - ngx_module_name="$ngx_addon_name" - ngx_module_srcs="$CACHE_PURGE_SRCS" - - . auto/module -else - HTTP_MODULES="$HTTP_MODULES $ngx_addon_name" - NGX_ADDON_SRCS="$NGX_ADDON_SRCS $CACHE_PURGE_SRCS" -fi +HTTP_MODULES="$HTTP_MODULES ngx_http_cache_purge_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_cache_purge_module.c" have=NGX_CACHE_PURGE_MODULE . auto/have diff --git a/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c b/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c new file mode 100644 index 0000000..be51a7d --- /dev/null +++ b/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c @@ -0,0 +1,1299 @@ +/* + * Copyright (c) 2009-2012, FRiCKLE + * Copyright (c) 2009-2012, Piotr Sikora + * All rights reserved. + * + * This project was fully funded by yo.se. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + + +#if (NGX_HTTP_CACHE) + +typedef struct { + ngx_flag_t enable; + ngx_str_t method; + ngx_array_t *access; /* array of ngx_in_cidr_t */ + ngx_array_t *access6; /* array of ngx_in6_cidr_t */ +} ngx_http_cache_purge_conf_t; + +typedef struct { +# if (NGX_HTTP_FASTCGI) + ngx_http_cache_purge_conf_t fastcgi; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + ngx_http_cache_purge_conf_t proxy; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + ngx_http_cache_purge_conf_t scgi; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + ngx_http_cache_purge_conf_t uwsgi; +# endif /* NGX_HTTP_UWSGI */ + + ngx_http_cache_purge_conf_t *conf; + ngx_http_handler_pt handler; + ngx_http_handler_pt original_handler; +} ngx_http_cache_purge_loc_conf_t; + +# if (NGX_HTTP_FASTCGI) +char *ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) +char *ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) +char *ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_scgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) +char *ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_UWSGI */ + +ngx_int_t ngx_http_cache_purge_access_handler(ngx_http_request_t *r); +ngx_int_t ngx_http_cache_purge_access(ngx_array_t *a, ngx_array_t *a6, + struct sockaddr *s); + +ngx_int_t ngx_http_cache_purge_send_response(ngx_http_request_t *r); +ngx_int_t ngx_http_cache_purge_init(ngx_http_request_t *r, + ngx_http_file_cache_t *cache, ngx_http_complex_value_t *cache_key); +void ngx_http_cache_purge_handler(ngx_http_request_t *r); + +ngx_int_t ngx_http_file_cache_purge(ngx_http_request_t *r); + +char *ngx_http_cache_purge_conf(ngx_conf_t *cf, + ngx_http_cache_purge_conf_t *cpcf); + +void *ngx_http_cache_purge_create_loc_conf(ngx_conf_t *cf); +char *ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, + void *parent, void *child); + +static ngx_command_t ngx_http_cache_purge_module_commands[] = { + +# if (NGX_HTTP_FASTCGI) + { ngx_string("fastcgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_fastcgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) + { ngx_string("proxy_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_proxy_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) + { ngx_string("scgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_scgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) + { ngx_string("uwsgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_uwsgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, +# endif /* NGX_HTTP_UWSGI */ + + ngx_null_command +}; + +static ngx_http_module_t ngx_http_cache_purge_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_cache_purge_create_loc_conf, /* create location configuration */ + ngx_http_cache_purge_merge_loc_conf /* merge location configuration */ +}; + +ngx_module_t ngx_http_cache_purge_module = { + NGX_MODULE_V1, + &ngx_http_cache_purge_module_ctx, /* module context */ + ngx_http_cache_purge_module_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +static char ngx_http_cache_purge_success_page_top[] = +"" CRLF +"Successful purge" CRLF +"" CRLF +"

Successful purge

" CRLF +; + +static char ngx_http_cache_purge_success_page_tail[] = +CRLF "
" CRLF +"
" NGINX_VER "
" CRLF +"" CRLF +"" CRLF +; + +# if (NGX_HTTP_FASTCGI) +extern ngx_module_t ngx_http_fastcgi_module; + +typedef struct { + ngx_http_upstream_conf_t upstream; + + ngx_str_t index; + + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; + ngx_array_t *params_source; + ngx_array_t *catch_stderr; + + ngx_array_t *fastcgi_lengths; + ngx_array_t *fastcgi_values; + +# if defined(nginx_version) && (nginx_version >= 8040) + ngx_hash_t headers_hash; + ngx_uint_t header_params; +# endif /* nginx_version >= 8040 */ + +# if defined(nginx_version) && (nginx_version >= 1001004) + ngx_flag_t keep_conn; +# endif /* nginx_version >= 1001004 */ + + ngx_http_complex_value_t cache_key; + +# if (NGX_PCRE) + ngx_regex_t *split_regex; + ngx_str_t split_name; +# endif /* NGX_PCRE */ +} ngx_http_fastcgi_loc_conf_t; + +char * +ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_http_compile_complex_value_t ccv; + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_fastcgi_loc_conf_t *flcf; + ngx_str_t *value; + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->fastcgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->fastcgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + flcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_fastcgi_module); + + if (flcf->upstream.cache != NGX_CONF_UNSET_PTR + && flcf->upstream.cache != NULL) + { + return "is incompatible with \"fastcgi_cache\""; + } + + if (flcf->upstream.upstream || flcf->fastcgi_lengths) { + return "is incompatible with \"fastcgi_pass\""; + } + + if (flcf->upstream.store > 0 || flcf->upstream.store_lengths) { + return "is incompatible with \"fastcgi_store\""; + } + + value = cf->args->elts; + + /* set fastcgi_cache part */ + flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_fastcgi_module); + if (flcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + + /* set fastcgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &flcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->fastcgi.enable = 0; + clcf->handler = ngx_http_fastcgi_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r) +{ + ngx_http_fastcgi_loc_conf_t *flcf; + + flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); + + if (ngx_http_cache_purge_init(r, flcf->upstream.cache->data, + &flcf->cache_key) + != NGX_OK) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + +# if defined(nginx_version) && (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) +extern ngx_module_t ngx_http_proxy_module; + +typedef struct { + ngx_str_t key_start; + ngx_str_t schema; + ngx_str_t host_header; + ngx_str_t port; + ngx_str_t uri; +} ngx_http_proxy_vars_t; + +typedef struct { + ngx_http_upstream_conf_t upstream; + + ngx_array_t *flushes; + ngx_array_t *body_set_len; + ngx_array_t *body_set; + ngx_array_t *headers_set_len; + ngx_array_t *headers_set; + ngx_hash_t headers_set_hash; + + ngx_array_t *headers_source; +# if defined(nginx_version) && (nginx_version < 8040) + ngx_array_t *headers_names; +# endif /* nginx_version < 8040 */ + + ngx_array_t *proxy_lengths; + ngx_array_t *proxy_values; + + ngx_array_t *redirects; +# if defined(nginx_version) && (nginx_version >= 1001015) + ngx_array_t *cookie_domains; + ngx_array_t *cookie_paths; +# endif /* nginx_version >= 1001015 */ + + ngx_str_t body_source; + + ngx_str_t method; + ngx_str_t location; + ngx_str_t url; + + ngx_http_complex_value_t cache_key; + + ngx_http_proxy_vars_t vars; + + ngx_flag_t redirect; + +# if defined(nginx_version) && (nginx_version >= 1001004) + ngx_uint_t http_version; +# endif /* nginx_version >= 1001004 */ + + ngx_uint_t headers_hash_max_size; + ngx_uint_t headers_hash_bucket_size; +} ngx_http_proxy_loc_conf_t; + +char * +ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_compile_complex_value_t ccv; + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_proxy_loc_conf_t *plcf; + ngx_str_t *value; + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->proxy.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->proxy); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + plcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_proxy_module); + + if (plcf->upstream.cache != NGX_CONF_UNSET_PTR + && plcf->upstream.cache != NULL) + { + return "is incompatible with \"proxy_cache\""; + } + + if (plcf->upstream.upstream || plcf->proxy_lengths) { + return "is incompatible with \"proxy_pass\""; + } + + if (plcf->upstream.store > 0 || plcf->upstream.store_lengths) { + return "is incompatible with \"proxy_store\""; + } + + value = cf->args->elts; + + /* set proxy_cache part */ + plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_proxy_module); + if (plcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + + /* set proxy_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &plcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->proxy.enable = 0; + clcf->handler = ngx_http_proxy_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r) +{ + ngx_http_proxy_loc_conf_t *plcf; + + plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); + + if (ngx_http_cache_purge_init(r, plcf->upstream.cache->data, + &plcf->cache_key) + != NGX_OK) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + +# if defined(nginx_version) && (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) +extern ngx_module_t ngx_http_scgi_module; + +typedef struct { + ngx_http_upstream_conf_t upstream; + + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; + ngx_array_t *params_source; + + ngx_hash_t headers_hash; + ngx_uint_t header_params; + + ngx_array_t *scgi_lengths; + ngx_array_t *scgi_values; + + ngx_http_complex_value_t cache_key; +} ngx_http_scgi_loc_conf_t; + +char * +ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_compile_complex_value_t ccv; + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_scgi_loc_conf_t *slcf; + ngx_str_t *value; + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->scgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->scgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + slcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_scgi_module); + + if (slcf->upstream.cache != NGX_CONF_UNSET_PTR + && slcf->upstream.cache != NULL) + { + return "is incompatible with \"scgi_cache\""; + } + + if (slcf->upstream.upstream || slcf->scgi_lengths) { + return "is incompatible with \"scgi_pass\""; + } + + if (slcf->upstream.store > 0 || slcf->upstream.store_lengths) { + return "is incompatible with \"scgi_store\""; + } + + value = cf->args->elts; + + /* set scgi_cache part */ + slcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_scgi_module); + if (slcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + + /* set scgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &slcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->scgi.enable = 0; + clcf->handler = ngx_http_scgi_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_scgi_cache_purge_handler(ngx_http_request_t *r) +{ + ngx_http_scgi_loc_conf_t *slcf; + + slcf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); + + if (ngx_http_cache_purge_init(r, slcf->upstream.cache->data, + &slcf->cache_key) + != NGX_OK) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + +# if defined(nginx_version) && (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) +extern ngx_module_t ngx_http_uwsgi_module; + +typedef struct { + ngx_http_upstream_conf_t upstream; + + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; + ngx_array_t *params_source; + + ngx_hash_t headers_hash; + ngx_uint_t header_params; + + ngx_array_t *uwsgi_lengths; + ngx_array_t *uwsgi_values; + + ngx_http_complex_value_t cache_key; + + ngx_str_t uwsgi_string; + + ngx_uint_t modifier1; + ngx_uint_t modifier2; +} ngx_http_uwsgi_loc_conf_t; + +char * +ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_compile_complex_value_t ccv; + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_uwsgi_loc_conf_t *ulcf; + ngx_str_t *value; + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->uwsgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->uwsgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + ulcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_uwsgi_module); + + if (ulcf->upstream.cache != NGX_CONF_UNSET_PTR + && ulcf->upstream.cache != NULL) + { + return "is incompatible with \"uwsgi_cache\""; + } + + if (ulcf->upstream.upstream || ulcf->uwsgi_lengths) { + return "is incompatible with \"uwsgi_pass\""; + } + + if (ulcf->upstream.store > 0 || ulcf->upstream.store_lengths) { + return "is incompatible with \"uwsgi_store\""; + } + + value = cf->args->elts; + + /* set uwsgi_cache part */ + ulcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_uwsgi_module); + if (ulcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + + /* set uwsgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &ulcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->uwsgi.enable = 0; + clcf->handler = ngx_http_uwsgi_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r) +{ + ngx_http_uwsgi_loc_conf_t *ulcf; + + ulcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); + + if (ngx_http_cache_purge_init(r, ulcf->upstream.cache->data, + &ulcf->cache_key) + != NGX_OK) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + +# if defined(nginx_version) && (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_UWSGI */ + +ngx_int_t +ngx_http_cache_purge_access_handler(ngx_http_request_t *r) +{ + ngx_http_cache_purge_loc_conf_t *cplcf; + + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + + if (r->method_name.len != cplcf->conf->method.len + || (ngx_strncmp(r->method_name.data, cplcf->conf->method.data, + r->method_name.len))) + { + return cplcf->original_handler(r); + } + + if ((cplcf->conf->access || cplcf->conf->access6) + && ngx_http_cache_purge_access(cplcf->conf->access, + cplcf->conf->access6, + r->connection->sockaddr) != NGX_OK) + { + return NGX_HTTP_FORBIDDEN; + } + + if (cplcf->handler == NULL) { + return NGX_HTTP_NOT_FOUND; + } + + return cplcf->handler(r); +} + +ngx_int_t +ngx_http_cache_purge_access(ngx_array_t *access, ngx_array_t *access6, + struct sockaddr *s) +{ + in_addr_t inaddr; + ngx_in_cidr_t *a; + ngx_uint_t i; +# if (NGX_HAVE_INET6) + struct in6_addr *inaddr6; + ngx_in6_cidr_t *a6; + u_char *p; + ngx_uint_t n; +# endif /* NGX_HAVE_INET6 */ + + switch (s->sa_family) { + case AF_INET: + if (access == NULL) { + return NGX_DECLINED; + } + + inaddr = ((struct sockaddr_in *) s)->sin_addr.s_addr; + +# if (NGX_HAVE_INET6) + ipv4: +# endif /* NGX_HAVE_INET6 */ + + a = access->elts; + for (i = 0; i < access->nelts; i++) { + if ((inaddr & a[i].mask) == a[i].addr) { + return NGX_OK; + } + } + + return NGX_DECLINED; + +# if (NGX_HAVE_INET6) + case AF_INET6: + inaddr6 = &((struct sockaddr_in6 *) s)->sin6_addr; + p = inaddr6->s6_addr; + + if (access && IN6_IS_ADDR_V4MAPPED(inaddr6)) { + inaddr = p[12] << 24; + inaddr += p[13] << 16; + inaddr += p[14] << 8; + inaddr += p[15]; + inaddr = htonl(inaddr); + + goto ipv4; + } + + if (access6 == NULL) { + return NGX_DECLINED; + } + + a6 = access6->elts; + for (i = 0; i < access6->nelts; i++) { + for (n = 0; n < 16; n++) { + if ((p[n] & a6[i].mask.s6_addr[n]) != a6[i].addr.s6_addr[n]) { + goto next; + } + } + + return NGX_OK; + + next: + continue; + } + + return NGX_DECLINED; +# endif /* NGX_HAVE_INET6 */ + } + + return NGX_DECLINED; +} + +ngx_int_t +ngx_http_cache_purge_send_response(ngx_http_request_t *r) +{ + ngx_chain_t out; + ngx_buf_t *b; + ngx_str_t *key; + ngx_int_t rc; + size_t len; + + key = r->cache->keys.elts; + + len = sizeof(ngx_http_cache_purge_success_page_top) - 1 + + sizeof(ngx_http_cache_purge_success_page_tail) - 1 + + sizeof("
Key : ") - 1 + sizeof(CRLF "
Path: ") - 1 + + key[0].len + r->cache->file.name.len; + + r->headers_out.content_type.len = sizeof("text/html") - 1; + r->headers_out.content_type.data = (u_char *) "text/html"; + r->headers_out.status = NGX_HTTP_OK; + r->headers_out.content_length_n = len; + + if (r->method == NGX_HTTP_HEAD) { + rc = ngx_http_send_header(r); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + } + + b = ngx_create_temp_buf(r->pool, len); + if (b == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + out.buf = b; + out.next = NULL; + + b->last = ngx_cpymem(b->last, ngx_http_cache_purge_success_page_top, + sizeof(ngx_http_cache_purge_success_page_top) - 1); + b->last = ngx_cpymem(b->last, "
Key : ", sizeof("
Key : ") - 1); + b->last = ngx_cpymem(b->last, key[0].data, key[0].len); + b->last = ngx_cpymem(b->last, CRLF "
Path: ", + sizeof(CRLF "
Path: ") - 1); + b->last = ngx_cpymem(b->last, r->cache->file.name.data, + r->cache->file.name.len); + b->last = ngx_cpymem(b->last, ngx_http_cache_purge_success_page_tail, + sizeof(ngx_http_cache_purge_success_page_tail) - 1); + b->last_buf = 1; + + rc = ngx_http_send_header(r); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + return ngx_http_output_filter(r, &out); +} + +ngx_int_t +ngx_http_cache_purge_init(ngx_http_request_t *r, ngx_http_file_cache_t *cache, + ngx_http_complex_value_t *cache_key) +{ + ngx_http_cache_t *c; + ngx_str_t *key; + ngx_int_t rc; + + rc = ngx_http_discard_request_body(r); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t)); + if (c == NULL) { + return NGX_ERROR; + } + + rc = ngx_array_init(&c->keys, r->pool, 1, sizeof(ngx_str_t)); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + key = ngx_array_push(&c->keys); + if (key == NULL) { + return NGX_ERROR; + } + + rc = ngx_http_complex_value(r, cache_key, key); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + r->cache = c; + c->body_start = ngx_pagesize; + c->file_cache = cache; + c->file.log = r->connection->log; + + ngx_http_file_cache_create_key(r); + + return NGX_OK; +} + +void +ngx_http_cache_purge_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + +# if (NGX_HAVE_FILE_AIO) + if (r->aio) { + return; + } +# endif + + rc = ngx_http_file_cache_purge(r); + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge: %i, \"%s\"", + rc, r->cache->file.name.data); + + switch (rc) { + case NGX_OK: + r->write_event_handler = ngx_http_request_empty_handler; + ngx_http_finalize_request(r, ngx_http_cache_purge_send_response(r)); + return; + case NGX_DECLINED: + ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); + return; +# if (NGX_HAVE_FILE_AIO) + case NGX_AGAIN: + r->write_event_handler = ngx_http_cache_purge_handler; + return; +# endif + default: + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + } +} + +ngx_int_t +ngx_http_file_cache_purge(ngx_http_request_t *r) +{ + ngx_http_file_cache_t *cache; + ngx_http_cache_t *c; + + switch (ngx_http_file_cache_open(r)) { + case NGX_OK: + case NGX_HTTP_CACHE_STALE: +# if defined(nginx_version) \ + && ((nginx_version >= 8001) \ + || ((nginx_version < 8000) && (nginx_version >= 7060))) + case NGX_HTTP_CACHE_UPDATING: +# endif + break; + case NGX_DECLINED: + return NGX_DECLINED; +# if (NGX_HAVE_FILE_AIO) + case NGX_AGAIN: + return NGX_AGAIN; +# endif + default: + return NGX_ERROR; + } + + c = r->cache; + cache = c->file_cache; + + /* + * delete file from disk but *keep* in-memory node, + * because other requests might still point to it. + */ + + ngx_shmtx_lock(&cache->shpool->mutex); + + if (!c->node->exists) { + /* race between concurrent purges, backoff */ + ngx_shmtx_unlock(&cache->shpool->mutex); + return NGX_DECLINED; + } + +# if defined(nginx_version) && (nginx_version >= 1000001) + cache->sh->size -= c->node->fs_size; + c->node->fs_size = 0; +# else + cache->sh->size -= (c->node->length + cache->bsize - 1) / cache->bsize; + c->node->length = 0; +# endif + + c->node->exists = 0; +# if defined(nginx_version) \ + && ((nginx_version >= 8001) \ + || ((nginx_version < 8000) && (nginx_version >= 7060))) + c->node->updating = 0; +# endif + + ngx_shmtx_unlock(&cache->shpool->mutex); + + if (ngx_delete_file(c->file.name.data) == NGX_FILE_ERROR) { + /* entry in error log is enough, don't notice client */ + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", c->file.name.data); + } + + /* file deleted from cache */ + return NGX_OK; +} + +char * +ngx_http_cache_purge_conf(ngx_conf_t *cf, ngx_http_cache_purge_conf_t *cpcf) +{ + ngx_cidr_t cidr; + ngx_in_cidr_t *access; +# if (NGX_HAVE_INET6) + ngx_in6_cidr_t *access6; +# endif /* NGX_HAVE_INET6 */ + ngx_str_t *value; + ngx_int_t rc; + ngx_uint_t i; + + value = cf->args->elts; + + if (ngx_strcmp(value[1].data, (u_char *) "off") == 0) { + cpcf->enable = 0; + return NGX_CONF_OK; + + } else if (ngx_strcmp(value[1].data, (u_char *) "on") == 0) { + ngx_str_set(&cpcf->method, "PURGE"); + + } else { + cpcf->method = value[1]; + } + + if (cf->args->nelts < 4) { + cpcf->enable = 1; + return NGX_CONF_OK; + } + + /* sanity check */ + if (ngx_strcmp(value[2].data, (u_char *) "from") != 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\", expected" + " \"from\" keyword", &value[2]); + return NGX_CONF_ERROR; + } + + if (ngx_strcmp(value[3].data, (u_char *) "all") == 0) { + cpcf->enable = 1; + return NGX_CONF_OK; + } + + for (i = 3; i < cf->args->nelts; i++) { + rc = ngx_ptocidr(&value[i], &cidr); + + if (rc == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\"", &value[i]); + return NGX_CONF_ERROR; + } + + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", + &value[i]); + } + + switch (cidr.family) { + case AF_INET: + if (cpcf->access == NULL) { + cpcf->access = ngx_array_create(cf->pool, cf->args->nelts - 3, + sizeof(ngx_in_cidr_t)); + if (cpcf->access == NULL) { + return NGX_CONF_ERROR; + } + } + + access = ngx_array_push(cpcf->access); + if (access == NULL) { + return NGX_CONF_ERROR; + } + + access->mask = cidr.u.in.mask; + access->addr = cidr.u.in.addr; + + break; + +# if (NGX_HAVE_INET6) + case AF_INET6: + if (cpcf->access6 == NULL) { + cpcf->access6 = ngx_array_create(cf->pool, cf->args->nelts - 3, + sizeof(ngx_in6_cidr_t)); + if (cpcf->access6 == NULL) { + return NGX_CONF_ERROR; + } + } + + access6 = ngx_array_push(cpcf->access6); + if (access6 == NULL) { + return NGX_CONF_ERROR; + } + + access6->mask = cidr.u.in6.mask; + access6->addr = cidr.u.in6.addr; + + break; +# endif /* NGX_HAVE_INET6 */ + } + } + + cpcf->enable = 1; + + return NGX_CONF_OK; +} + +void +ngx_http_cache_purge_merge_conf(ngx_http_cache_purge_conf_t *conf, + ngx_http_cache_purge_conf_t *prev) +{ + if (conf->enable == NGX_CONF_UNSET) { + if (prev->enable == 1) { + conf->enable = prev->enable; + conf->method = prev->method; + conf->access = prev->access; + conf->access6 = prev->access6; + + } else { + conf->enable = 0; + } + } +} + +void * +ngx_http_cache_purge_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_cache_purge_loc_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_cache_purge_loc_conf_t)); + if (conf == NULL) { + return NULL; + } + + /* + * set by ngx_pcalloc(): + * + * conf->*.method = { 0, NULL } + * conf->*.access = NULL + * conf->*.access6 = NULL + */ + +# if (NGX_HTTP_FASTCGI) + conf->fastcgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + conf->proxy.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + conf->scgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + conf->uwsgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_UWSGI */ + + conf->conf = NGX_CONF_UNSET_PTR; + conf->handler = NGX_CONF_UNSET_PTR; + conf->original_handler = NGX_CONF_UNSET_PTR; + + return conf; +} + +char * +ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_http_cache_purge_loc_conf_t *prev = parent; + ngx_http_cache_purge_loc_conf_t *conf = child; + ngx_http_core_loc_conf_t *clcf; +# if (NGX_HTTP_FASTCGI) + ngx_http_fastcgi_loc_conf_t *flcf; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + ngx_http_proxy_loc_conf_t *plcf; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + ngx_http_scgi_loc_conf_t *slcf; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + ngx_http_uwsgi_loc_conf_t *ulcf; +# endif /* NGX_HTTP_UWSGI */ + + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + +# if (NGX_HTTP_FASTCGI) + ngx_http_cache_purge_merge_conf(&conf->fastcgi, &prev->fastcgi); + + if (conf->fastcgi.enable && clcf->handler != NULL) { + flcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_fastcgi_module); + + if (flcf->upstream.upstream || flcf->fastcgi_lengths) { + conf->conf = &conf->fastcgi; + conf->handler = flcf->upstream.cache + ? ngx_http_fastcgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) + ngx_http_cache_purge_merge_conf(&conf->proxy, &prev->proxy); + + if (conf->proxy.enable && clcf->handler != NULL) { + plcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_proxy_module); + + if (plcf->upstream.upstream || plcf->proxy_lengths) { + conf->conf = &conf->proxy; + conf->handler = plcf->upstream.cache + ? ngx_http_proxy_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) + ngx_http_cache_purge_merge_conf(&conf->scgi, &prev->scgi); + + if (conf->scgi.enable && clcf->handler != NULL) { + slcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_scgi_module); + + if (slcf->upstream.upstream || slcf->scgi_lengths) { + conf->conf = &conf->scgi; + conf->handler = slcf->upstream.cache + ? ngx_http_scgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) + ngx_http_cache_purge_merge_conf(&conf->uwsgi, &prev->uwsgi); + + if (conf->uwsgi.enable && clcf->handler != NULL) { + ulcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_uwsgi_module); + + if (ulcf->upstream.upstream || ulcf->uwsgi_lengths) { + conf->conf = &conf->uwsgi; + conf->handler = ulcf->upstream.cache + ? ngx_http_uwsgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_UWSGI */ + + ngx_conf_merge_ptr_value(conf->conf, prev->conf, NULL); + ngx_conf_merge_ptr_value(conf->handler, prev->handler, NULL); + ngx_conf_merge_ptr_value(conf->original_handler, prev->original_handler, + NULL); + + return NGX_CONF_OK; +} + +#else /* !NGX_HTTP_CACHE */ + +static ngx_http_module_t ngx_http_cache_purge_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + NULL, /* create location configuration */ + NULL, /* merge location configuration */ +}; + +ngx_module_t ngx_http_cache_purge_module = { + NGX_MODULE_V1, + &ngx_http_cache_purge_module_ctx, /* module context */ + NULL, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +#endif /* NGX_HTTP_CACHE */ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t b/debian/modules/nginx-cache-purge/t/proxy.t similarity index 79% rename from modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t rename to debian/modules/nginx-cache-purge/t/proxy.t index fefe9b8..d2d3b8a 100644 --- a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t +++ b/debian/modules/nginx-cache-purge/t/proxy.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(1); -plan tests => repeat_each() * (blocks() * 4 + 3 * 1); +plan tests => repeat_each() * (blocks() * 3 + 3 * 1); our $http_config = <<'_EOC_'; proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; @@ -48,9 +48,7 @@ GET /proxy/passwd Content-Type: text/plain --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -65,9 +63,7 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -81,9 +77,7 @@ PURGE /purge/proxy/passwd Content-Type: text/html --- response_body_like: Successful purge --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -92,14 +86,12 @@ qr/\[(warn|error|crit|alert|emerg)\]/ --- config eval: $::config --- request PURGE /purge/proxy/passwd ---- error_code: 412 +--- error_code: 404 --- response_headers Content-Type: text/html ---- response_body_like: 412 Precondition Failed +--- response_body_like: 404 Not Found --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -114,9 +106,7 @@ Content-Type: text/plain X-Cache-Status: MISS --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -131,6 +121,4 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t b/debian/modules/nginx-cache-purge/t/proxy2.t similarity index 83% rename from modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t rename to debian/modules/nginx-cache-purge/t/proxy2.t index 4c7e19f..ad78d62 100644 --- a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t +++ b/debian/modules/nginx-cache-purge/t/proxy2.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(1); -plan tests => repeat_each() * (blocks() * 4 + 6 * 1); +plan tests => repeat_each() * (blocks() * 3 + 6 * 1); our $http_config = <<'_EOC_'; proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; @@ -80,9 +80,7 @@ GET /proxy/passwd Content-Type: text/plain --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -97,9 +95,7 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -113,9 +109,7 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: Successful purge --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -124,14 +118,12 @@ qr/\[(warn|error|crit|alert|emerg)\]/ --- config eval: $::config --- request PURGE /proxy/passwd ---- error_code: 412 +--- error_code: 404 --- response_headers Content-Type: text/html ---- response_body_like: 412 Precondition Failed +--- response_body_like: 404 Not Found --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -146,9 +138,7 @@ Content-Type: text/plain X-Cache-Status: MISS --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -163,9 +153,7 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -179,9 +167,7 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: Successful purge --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -190,14 +176,12 @@ qr/\[(warn|error|crit|alert|emerg)\]/ --- config eval: $::config_allowed --- request PURGE /proxy/passwd ---- error_code: 412 +--- error_code: 404 --- response_headers Content-Type: text/html ---- response_body_like: 412 Precondition Failed +--- response_body_like: 404 Not Found --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -212,9 +196,7 @@ Content-Type: text/plain X-Cache-Status: MISS --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -229,9 +211,7 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -245,9 +225,7 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: 403 Forbidden --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 4: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62 @@ -262,9 +240,7 @@ Content-Type: text/plain X-Cache-Status: HIT --- response_body_like: root --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ ---- skip_nginx2: 5: < 0.8.3 or < 0.7.62 +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -287,8 +263,6 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: 404 Not Found --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ --- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -312,8 +286,6 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: 403 Forbidden --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ --- skip_nginx2: 4: < 0.8.3 or < 0.7.62 @@ -344,6 +316,4 @@ PURGE /proxy/passwd Content-Type: text/html --- response_body_like: Successful purge --- timeout: 10 ---- no_error_log eval -qr/\[(warn|error|crit|alert|emerg)\]/ --- skip_nginx2: 4: < 0.8.3 or < 0.7.62 diff --git a/debian/modules/nginx-dav-ext-module/README b/debian/modules/nginx-dav-ext-module/README new file mode 100644 index 0000000..bc727ff --- /dev/null +++ b/debian/modules/nginx-dav-ext-module/README @@ -0,0 +1,29 @@ +== nginx-dav-ext-module == + +NGINX WebDAV missing commands support (PROPFIND & OPTIONS) + +(c) 2012 Arutyunyan Roman (arut@qip.ru) + + +For full WebDAV support in NGINX you need to turn on standard NGINX +WebDAV module (providing partial WebDAV implementation) as well as +this module for missing methods + +./configure --with-http_dav_module --add-module= + + + +Requirements: + + libexpat-dev + + +Example config: + + location / { + + dav_methods PUT DELETE MKCOL COPY MOVE; + dav_ext_methods PROPFIND OPTIONS; + + root /var/root/; + } diff --git a/debian/modules/nginx-dav-ext-module/config b/debian/modules/nginx-dav-ext-module/config new file mode 100644 index 0000000..98b2b7a --- /dev/null +++ b/debian/modules/nginx-dav-ext-module/config @@ -0,0 +1,9 @@ +ngx_addon_name="ngx_http_dav_ext_module" + +HTTP_MODULES="$HTTP_MODULES \ + ngx_http_dav_ext_module" + +NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ + $ngx_addon_dir/ngx_http_dav_ext_module.c" + +CORE_LIBS="$CORE_LIBS -lexpat" diff --git a/debian/modules/nginx-dav-ext-module/ngx_http_dav_ext_module.c b/debian/modules/nginx-dav-ext-module/ngx_http_dav_ext_module.c new file mode 100644 index 0000000..73d86de --- /dev/null +++ b/debian/modules/nginx-dav-ext-module/ngx_http_dav_ext_module.c @@ -0,0 +1,824 @@ +/****************************************************************************** + Copyright (c) 2012, Roman Arutyunyan (arut@qip.ru) + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + OF SUCH DAMAGE. + *******************************************************************************/ + +/* + + NGINX missing WebDAV commands support + + *PROPFIND & OPTIONS* + + */ + +#include +#include +#include + +#include +#include +#include + +#include + +#define NGX_HTTP_DAV_EXT_OFF 2 + +typedef struct { + + ngx_uint_t methods; + +} ngx_http_dav_ext_loc_conf_t; + +static ngx_int_t ngx_http_dav_ext_init(ngx_conf_t *cf); +static void * ngx_http_dav_ext_create_loc_conf(ngx_conf_t *cf); +static char * ngx_http_dav_ext_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child); + +static ngx_conf_bitmask_t ngx_http_dav_ext_methods_mask[] = { + + { ngx_string("off"), NGX_HTTP_DAV_EXT_OFF }, + { ngx_string("propfind"), NGX_HTTP_PROPFIND }, + { ngx_string("options"), NGX_HTTP_OPTIONS }, + { ngx_null_string, 0 } + +}; + +static ngx_command_t ngx_http_dav_ext_commands[] = { + + { ngx_string("dav_ext_methods"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_conf_set_bitmask_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_dav_ext_loc_conf_t, methods), + &ngx_http_dav_ext_methods_mask }, + + ngx_null_command +}; + +static ngx_http_module_t ngx_http_dav_ext_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_dav_ext_init, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_dav_ext_create_loc_conf, /* create location configuration */ + ngx_http_dav_ext_merge_loc_conf, /* merge location configuration */ +}; + + +ngx_module_t ngx_http_dav_ext_module = { + NGX_MODULE_V1, + &ngx_http_dav_ext_module_ctx, /* module context */ + ngx_http_dav_ext_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +#define NGX_HTTP_DAV_EXT_NODE_propfind 0x001 +#define NGX_HTTP_DAV_EXT_NODE_prop 0x002 +#define NGX_HTTP_DAV_EXT_NODE_propname 0x004 +#define NGX_HTTP_DAV_EXT_NODE_allprop 0x008 + +#define NGX_HTTP_DAV_EXT_PROP_creationdate 0x001 +#define NGX_HTTP_DAV_EXT_PROP_displayname 0x002 +#define NGX_HTTP_DAV_EXT_PROP_getcontentlanguage 0x004 +#define NGX_HTTP_DAV_EXT_PROP_getcontentlength 0x008 +#define NGX_HTTP_DAV_EXT_PROP_getcontenttype 0x010 +#define NGX_HTTP_DAV_EXT_PROP_getetag 0x020 +#define NGX_HTTP_DAV_EXT_PROP_getlastmodified 0x040 +#define NGX_HTTP_DAV_EXT_PROP_lockdiscovery 0x080 +#define NGX_HTTP_DAV_EXT_PROP_resourcetype 0x100 +#define NGX_HTTP_DAV_EXT_PROP_source 0x200 +#define NGX_HTTP_DAV_EXT_PROP_supportedlock 0x400 + +#define NGX_HTTP_DAV_EXT_PROPFIND_SELECTED 1 +#define NGX_HTTP_DAV_EXT_PROPFIND_NAMES 2 +#define NGX_HTTP_DAV_EXT_PROPFIND_ALL 3 + +typedef struct { + + ngx_uint_t nodes; + + ngx_uint_t props; + + ngx_uint_t propfind; + +} ngx_http_dav_ext_ctx_t; + +static int ngx_http_dav_ext_xmlcmp(const char *xname, const char *sname) { + + const char *c; + + c = strrchr(xname, ':'); + + return strcmp(c ? c + 1 : xname, sname); +} + +static void ngx_http_dav_ext_start_xml_elt(void *user_data, + const XML_Char *name, const XML_Char **atts) +{ + ngx_http_dav_ext_ctx_t *ctx = user_data; + +#define NGX_HTTP_DAV_EXT_SET_NODE(nm) \ + if (!ngx_http_dav_ext_xmlcmp(name, #nm)) \ + ctx->nodes ^= NGX_HTTP_DAV_EXT_NODE_##nm + + NGX_HTTP_DAV_EXT_SET_NODE(propfind); + NGX_HTTP_DAV_EXT_SET_NODE(prop); + NGX_HTTP_DAV_EXT_SET_NODE(propname); + NGX_HTTP_DAV_EXT_SET_NODE(allprop); + +} + +static void ngx_http_dav_ext_end_xml_elt(void *user_data, const XML_Char *name) +{ + ngx_http_dav_ext_ctx_t *ctx = user_data; + + if (ctx->nodes & NGX_HTTP_DAV_EXT_NODE_propfind) { + + if (ctx->nodes & NGX_HTTP_DAV_EXT_NODE_prop) { + + ctx->propfind = NGX_HTTP_DAV_EXT_PROPFIND_SELECTED; + +#define NGX_HTTP_DAV_EXT_SET_PROP(nm) \ + if (!ngx_http_dav_ext_xmlcmp(name, #nm)) \ + ctx->props |= NGX_HTTP_DAV_EXT_PROP_##nm + + NGX_HTTP_DAV_EXT_SET_PROP(creationdate); + NGX_HTTP_DAV_EXT_SET_PROP(displayname); + NGX_HTTP_DAV_EXT_SET_PROP(getcontentlanguage); + NGX_HTTP_DAV_EXT_SET_PROP(getcontentlength); + NGX_HTTP_DAV_EXT_SET_PROP(getcontenttype); + NGX_HTTP_DAV_EXT_SET_PROP(getetag); + NGX_HTTP_DAV_EXT_SET_PROP(getlastmodified); + NGX_HTTP_DAV_EXT_SET_PROP(lockdiscovery); + NGX_HTTP_DAV_EXT_SET_PROP(resourcetype); + NGX_HTTP_DAV_EXT_SET_PROP(source); + NGX_HTTP_DAV_EXT_SET_PROP(supportedlock); + + } + + if (ctx->nodes & NGX_HTTP_DAV_EXT_NODE_propname) { + + ctx->propfind = NGX_HTTP_DAV_EXT_PROPFIND_NAMES; + + } + + if (ctx->nodes & NGX_HTTP_DAV_EXT_NODE_allprop) { + + ctx->propfind = NGX_HTTP_DAV_EXT_PROPFIND_ALL; + + } + + } + + ngx_http_dav_ext_start_xml_elt(user_data, name, NULL); +} + +#define NGX_HTTP_DAV_EXT_COPY 0x01 +#define NGX_HTTP_DAV_EXT_ESCAPE 0x02 + +static void +ngx_http_dav_ext_output(ngx_http_request_t *r, ngx_chain_t **ll, + ngx_int_t flags, u_char *data, ngx_uint_t len) +{ + ngx_chain_t *cl; + ngx_buf_t *b; + + if (!len) { + return; + } + + if (flags & NGX_HTTP_DAV_EXT_ESCAPE) { + + b = ngx_create_temp_buf(r->pool, len + ngx_escape_html(NULL, data, len)); + b->last = (u_char*)ngx_escape_html(b->pos, data, len); + + } else if (flags & NGX_HTTP_DAV_EXT_COPY) { + + b = ngx_create_temp_buf(r->pool, len); + b->last = ngx_cpymem(b->pos, data, len); + + } else { + + b = ngx_calloc_buf(r->pool); + b->memory = 1; + b->pos = data; + b->start = data; + b->last = b->pos + len; + b->end = b->last; + } + + cl = ngx_alloc_chain_link(r->pool); + cl->buf = b; + cl->next = NULL; + + if (*ll != NULL) { + cl->next = (*ll)->next; + (*ll)->next = cl; + *ll = cl; + } else { + *ll = cl; + cl->next = cl; + } +} + +static void +ngx_http_dav_ext_flush(ngx_http_request_t *r, ngx_chain_t **ll) +{ + ngx_chain_t *cl; + + cl = (*ll)->next; + (*ll)->next = NULL; + ngx_http_output_filter(r, cl); + *ll = NULL; +} + +/* output shortcuts + + NB: these shortcuts assume 2 variables exist in current context: + r - request ptr + ll - chain ptr ptr + + output chains are buffered in circular list & flushed on demand +*/ + +/* output buffer copy */ +#define NGX_HTTP_DAV_EXT_OUTCB(data, len) \ + ngx_http_dav_ext_output(r, ll, NGX_HTTP_DAV_EXT_COPY, (data), (len)) + +/* output string (no copy) */ +#define NGX_HTTP_DAV_EXT_OUTS(s) \ + ngx_http_dav_ext_output(r, ll, 0, (s)->data, (s)->len) + +/* output escaped string */ +#define NGX_HTTP_DAV_EXT_OUTES(s) \ + ngx_http_dav_ext_output(r, ll, NGX_HTTP_DAV_EXT_ESCAPE, (s)->data, (s)->len) + +/* output literal */ +#define NGX_HTTP_DAV_EXT_OUTL(s) \ + ngx_http_dav_ext_output(r, ll, 0, (u_char*)(s), sizeof(s) - 1) + +static ngx_int_t +ngx_http_dav_ext_send_propfind_atts(ngx_http_request_t *r, + char *path, ngx_str_t *uri, ngx_chain_t **ll, ngx_uint_t props) +{ + struct stat st; + struct tm stm; + u_char buf[256]; + ngx_str_t name; + + if (stat(path, &st)) { + + ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, + "dav_ext stat failed on '%s'", path); + + return NGX_HTTP_NOT_FOUND; + } + + if (props & NGX_HTTP_DAV_EXT_PROP_creationdate) { + + /* output file ctime (attr change time) as creation time */ + if (gmtime_r(&st.st_ctime, &stm) == NULL) + return NGX_ERROR; + + /* ISO 8601 time format + 2012-02-20T16:15:00Z */ + NGX_HTTP_DAV_EXT_OUTCB(buf, strftime((char*)buf, sizeof(buf), + "" + "%Y-%m-%dT%TZ" + "\n", + + &stm)); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_displayname) { + NGX_HTTP_DAV_EXT_OUTL( + "" + ); + + if (uri->len) { + + for(name.data = uri->data + uri->len; + name.data >= uri->data + 1 && name.data[-1] != '/'; + --name.data); + + name.len = uri->data + uri->len - name.data; + + NGX_HTTP_DAV_EXT_OUTES(&name); + } + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_getcontentlanguage) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_getcontentlength) { + NGX_HTTP_DAV_EXT_OUTCB(buf, ngx_snprintf(buf, sizeof(buf), + "" + "%O" + "\n", + + st.st_size) - buf); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_getcontenttype) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_getetag) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_getlastmodified) { + + if (gmtime_r(&st.st_mtime, &stm) == NULL) + return NGX_ERROR; + + /* RFC 2822 time format */ + NGX_HTTP_DAV_EXT_OUTCB(buf, strftime((char*)buf, sizeof(buf), + "" + "%a, %d %b %Y %T GMT" + "\n", + + &stm)); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_lockdiscovery) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_resourcetype) { + if (S_ISDIR(st.st_mode)) { + NGX_HTTP_DAV_EXT_OUTL( + "" + "" + "\n" + ); + } else { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + } + + if (props & NGX_HTTP_DAV_EXT_PROP_source) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + if (props & NGX_HTTP_DAV_EXT_PROP_supportedlock) { + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + } + + return NGX_OK; +} + +static ngx_int_t +ngx_http_dav_ext_send_propfind_item(ngx_http_request_t *r, + char *path, ngx_str_t *uri) +{ + ngx_http_dav_ext_ctx_t *ctx; + ngx_chain_t *l = NULL, **ll = &l; + u_char vbuf[8]; + ngx_str_t status_line = ngx_string("200 OK"); + + ctx = ngx_http_get_module_ctx(r, ngx_http_dav_ext_module); + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "" + ); + + NGX_HTTP_DAV_EXT_OUTES(uri); + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "\n" + "\n" + ); + + if (ctx->propfind == NGX_HTTP_DAV_EXT_PROPFIND_NAMES) { + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ); + + } else { + + switch (ngx_http_dav_ext_send_propfind_atts(r, path, uri, ll, + ctx->propfind == NGX_HTTP_DAV_EXT_PROPFIND_SELECTED ? + ctx->props : (ngx_uint_t)-1)) + { + case NGX_HTTP_NOT_FOUND: + ngx_str_set(&status_line, "404 Not Found"); + break; + + case NGX_OK: + case NGX_HTTP_OK: + break; + + default: + ngx_str_set(&status_line, "500 Internal Server Error"); + } + } + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "HTTP/" + ); + + NGX_HTTP_DAV_EXT_OUTCB(vbuf, ngx_snprintf(vbuf, sizeof(vbuf), "%d.%d ", + r->http_major, r->http_minor) - vbuf); + + NGX_HTTP_DAV_EXT_OUTS(&status_line); + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "\n" + "\n" + + ); + + ngx_http_dav_ext_flush(r, ll); + + return NGX_OK; +} + +/* path returned by this function is terminated + with a hidden (out-of-len) null */ +static void ngx_http_dav_ext_make_child(ngx_pool_t *pool, ngx_str_t *parent, + u_char *child, size_t chlen, ngx_str_t *path) +{ + u_char *s; + + path->data = ngx_palloc(pool, parent->len + 2 + chlen); + s = path->data; + s = ngx_cpymem(s, parent->data, parent->len); + if (parent->len > 0 && s[-1] != '/') + *s++ = '/'; + s = ngx_cpymem(s, child, chlen); + path->len = s - path->data; + *s = 0; +} + +#define DAV_EXT_INFINITY (-1) + +static ngx_int_t +ngx_http_dav_ext_send_propfind(ngx_http_request_t *r) +{ + size_t root; + ngx_str_t path, spath, ruri, suri; + ngx_chain_t *l = NULL, **ll = &l; + DIR *dir; + int depth; + struct dirent *de; + size_t len, uc_len; + ngx_http_variable_value_t vv; + ngx_str_t depth_name = ngx_string("depth"); + u_char *p, *uc; + + if (ngx_http_variable_unknown_header(&vv, &depth_name, + &r->headers_in.headers.part, 0) == NGX_OK + && vv.valid) + { + if (vv.len == sizeof("infinity") -1 + && !ngx_strncasecmp(vv.data, (u_char*)"infinity", vv.len)) + { + depth = DAV_EXT_INFINITY; + } else { + depth = ngx_atoi(vv.data, vv.len); + } + + } else { + depth = DAV_EXT_INFINITY; + } + + p = ngx_http_map_uri_to_path(r, &path, &root, 0); + + if (p == NULL || !path.len) { + + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "dav_ext error mapping uri to path"); + + return NGX_ERROR; + } + + path.len = p - path.data; + *p = 0; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http propfind path: \"%V\"", &path); + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + "\n" + ); + + ngx_http_dav_ext_flush(r, ll); +/* + ruri.data = ngx_palloc(r->pool, r->uri.len + 2 * ngx_escape_uri(NULL, + r->uri.data, r->uri.len, NGX_ESCAPE_URI)); + if (ruri.data == NULL) { + return NGX_ERROR; + } + + ruri.len = (u_char *) ngx_escape_uri(ruri.data, r->uri.data, r->uri.len, + NGX_ESCAPE_URI) - ruri.data; +*/ + ruri = r->unparsed_uri; + + ngx_http_dav_ext_send_propfind_item(r, (char*)path.data, &ruri); + + if (depth) { + + /* treat infinite depth as 1 for performance reasons */ + + if ((dir = opendir((char*)path.data))) { + + while((de = readdir(dir))) { + + if (!strcmp(de->d_name, ".") + || !strcmp(de->d_name, "..")) + { + continue; + } + + len = strlen(de->d_name); + + ngx_http_dav_ext_make_child(r->pool, &path, + (u_char*)de->d_name, len, &spath); + + /* escape uri component */ + + uc = ngx_palloc(r->pool, len + 2 * ngx_escape_uri(NULL, + (u_char *) de->d_name, len, NGX_ESCAPE_URI_COMPONENT)); + if (uc == NULL) { + return NGX_ERROR; + } + + uc_len = (u_char*)ngx_escape_uri(uc, (u_char *) de->d_name, len, + NGX_ESCAPE_URI_COMPONENT) - uc; + + ngx_http_dav_ext_make_child(r->pool, &ruri, uc, uc_len, &suri); + + ngx_http_dav_ext_send_propfind_item(r, (char*)spath.data, &suri); + + } + + closedir(dir); + } + + } + + NGX_HTTP_DAV_EXT_OUTL( + "\n" + ); + + if (*ll && (*ll)->buf) { + (*ll)->buf->last_buf = 1; + } + + ngx_http_dav_ext_flush(r, ll); + + return NGX_OK; +} + +static void +ngx_http_dav_ext_propfind_handler(ngx_http_request_t *r) +{ + ngx_chain_t *c; + ngx_buf_t *b; + XML_Parser parser; + ngx_uint_t status; + ngx_http_dav_ext_ctx_t *ctx; + + ctx = ngx_http_get_module_ctx(r, ngx_http_dav_ext_module); + + if (ctx == NULL) { + ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_dav_ext_ctx_t)); + ngx_http_set_ctx(r, ctx, ngx_http_dav_ext_module); + } + + c = r->request_body->bufs; + + status = NGX_OK; + + parser = XML_ParserCreate(NULL); + + XML_SetUserData(parser, ctx); + + XML_SetElementHandler(parser, + ngx_http_dav_ext_start_xml_elt, + ngx_http_dav_ext_end_xml_elt); + + for(; c != NULL && c->buf != NULL && !c->buf->last_buf; c = c->next) { + + b = c ->buf; + + if (!XML_Parse(parser, (const char*)b->pos, b->last - b->pos, b->last_buf)) { + + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "dav_ext propfind XML error"); + + status = NGX_ERROR; + + break; + } + + } + + XML_ParserFree(parser); + + if (status == NGX_OK) { + + r->headers_out.status = 207; + + ngx_str_set(&r->headers_out.status_line, "207 Multi-Status"); + + ngx_http_send_header(r); + + ngx_http_finalize_request(r, ngx_http_dav_ext_send_propfind(r)); + + } else { + + r->headers_out.status = NGX_HTTP_INTERNAL_SERVER_ERROR; + + r->header_only = 1; + + r->headers_out.content_length_n = 0; + + ngx_http_finalize_request(r, ngx_http_send_header(r)); + + } + +} + +static ngx_int_t +ngx_http_dav_ext_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_table_elt_t *h; + ngx_http_dav_ext_loc_conf_t *delcf; + + delcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module); + + if (!(r->method & delcf->methods)) { + return NGX_DECLINED; + } + + switch (r->method) { + + case NGX_HTTP_PROPFIND: + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "dav_ext propfind"); + + rc = ngx_http_read_client_request_body(r, + ngx_http_dav_ext_propfind_handler); + + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + return rc; + } + + return NGX_DONE; + + case NGX_HTTP_OPTIONS: + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "dav_ext options"); + + h = ngx_list_push(&r->headers_out.headers); + + if (h == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + ngx_str_set(&h->key, "DAV"); + ngx_str_set(&h->value, "1"); + h->hash = 1; + + h = ngx_list_push(&r->headers_out.headers); + + if (h == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* FIXME: it looks so ugly because I cannot access nginx dav module */ + ngx_str_set(&h->key, "Allow"); + ngx_str_set(&h->value, "GET,HEAD,PUT,DELETE,MKCOL,COPY,MOVE,PROPFIND,OPTIONS"); + h->hash = 1; + + r->headers_out.status = NGX_HTTP_OK; + r->header_only = 1; + r->headers_out.content_length_n = 0; + + ngx_http_send_header(r); + + return NGX_OK; + + } + + return NGX_DECLINED; +} + +static void * +ngx_http_dav_ext_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_dav_ext_loc_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_dav_ext_loc_conf_t)); + if (conf == NULL) { + return NULL; + } + + return conf; +} + +static char * +ngx_http_dav_ext_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_http_dav_ext_loc_conf_t *prev = parent; + ngx_http_dav_ext_loc_conf_t *conf = child; + + ngx_conf_merge_bitmask_value(conf->methods, prev->methods, + (NGX_CONF_BITMASK_SET|NGX_HTTP_DAV_EXT_OFF)); + + return NGX_CONF_OK; +} + +static ngx_int_t +ngx_http_dav_ext_init(ngx_conf_t *cf) +{ + ngx_http_handler_pt *h; + ngx_http_core_main_conf_t *cmcf; + + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); + + h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers); + + if (h == NULL) { + return NGX_ERROR; + } + + *h = ngx_http_dav_ext_handler; + + return NGX_OK; +} + diff --git a/debian/modules/nginx-development-kit/README b/debian/modules/nginx-development-kit/README new file mode 100644 index 0000000..50a2d95 --- /dev/null +++ b/debian/modules/nginx-development-kit/README @@ -0,0 +1,139 @@ + Nginx Development Kit (NDK) + =========================== + +Synopsis + + The NDK is an Nginx module that is designed to extend the core functionality of the + excellent Nginx webserver in a way that can be used as a basis of other Nginx modules. + + It has functions and macros to deal with generic tasks that don't currently have + generic code as part of the core distribution. The NDK itself adds few features + that are seen from a user's point of view - it's just designed to help reduce the + code that Nginx module developers need to write. + + Nginx module developers wishing to use any of the features in the NDK should specify + that the NDK is a dependency of their module, and that users will need to compile + it as well when they compile their own modules. They will also need to declare in + their own modules which features of the NDK they wish to use (explained below). + + If you are not an Nginx module developer, then the only useful part of this project + will be the 'usage for users' section below. + + +Status + + The NDK is now considered to be stable. It is already being used in quite a few third + party modules. + + +Features + + - additional conf_set functions for regexes, complex/script values, paths... + - macros to simplify tasks like checking for NULL values when doing ngx_array_push + - patches to the main source code + - ngx_auto_lib_core generic external library handler is included (see separate readme) + + + +Design + + modular : + + The kit itself is designed in a modular way, so that only the required code is compiled. + It's possible to add just a single NDK module, a few or all of them. + + auto-generated & easily extensible : + + Many of the macros available in the NDK are auto-generated from simple configuration + files. This makes creating similar macros for your own code very simple - it's usually + just the case of adding an extra line to a config file and re-running the build script. + + +Usage for users + + If another Nginx module you wish to use specifies that the NDK is a dependency, you + will need to do the following : + + 1 - download the source (http://github.com/simpl/ngx_devel_kit) + + 2 - unpack the source (tar -xzf $name) + + 3 - compile Nginx with the following extra option + + --add-module=/path/to/src + + e.g. + + ./configure --add-module=/path/to/ndk/base --add-module=/path/to/another/mod + + +Usage for developers + + To use the NDK in your own module, you need to add the following : + + 1 - add this line to your module + + #include + + note : since the NDK includes the following lines + + #include + #include + #include + + you can replace these with the single include above. + + 2 - add the following line in the config file for your module : + + have=NDK_[module_name] . auto/have + + for each NDK module that you wish to use (you need to include auto/have multiple + times if you wish to use multiple NDK modules. + + + Note : the old method of setting + + CFLAGS="$CFLAGS -DNDK_[module_name]" + + is now deprecated. It will still work, but results in unnecessary lines being + displayed when compiling Nginx. + + + Warning : using NDK_ALL + + You can also set NDK_ALL to include all the NDK modules. This is primarily as + a convenience in the early stages of development of another module. However, + + DO NOT LEAVE 'NDK_ALL' IN YOUR CONFIG FILE WHEN PUBLISHING + + Although the NDK is fairly small now, it could in time become a large repository + of code that would, if using NDK_ALL, result in considerably more code being compiled + than is necessary. + + +Todo + + - documentation for modules that don't already have it + - additional phase-handler functions + - generically testing for needing to add a handler + - remove dependency of set_var on OpenSSL being compiled in + + +License + + BSD + + +Contributing / Feedback + + If you are an Nginx module developer, and have developed some functions that are + generic in nature (or would be easily adapted to be so), then please send them to + me at the address below, and I'll add them to the kit. + + +Author + + Marcus Clyne (contact at simpl dot it) + + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md b/debian/modules/nginx-development-kit/README_AUTO_LIB similarity index 96% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md rename to debian/modules/nginx-development-kit/README_AUTO_LIB index f2c3371..fd2776f 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md +++ b/debian/modules/nginx-development-kit/README_AUTO_LIB @@ -10,7 +10,7 @@ cross-platform way to include external libraries. Any developers of Nginx modules are encouraged to use Auto Lib Core to handle library dependencies for their modules rather than writing their own custom handler from scratch. -Note : The latest version can be found [here](https://github.com/simplresty/ngx_auto_lib). +Note : the latest version can be found at github.com/simpl/ngx_auto_lib Information for end users @@ -68,7 +68,7 @@ Specifying a path to find a library If the version of a library you wish to include is in any of the standard paths (e.g. /usr/local, /usr ...), you will not need to specify a path to include the library. -If you do wish to specify a specific path, in most cases just specifying +If you do wish to specify a specific path, in most cases just specifying [PFX]=/path/to/library will be sufficient. e.g. $ export MOZJS=/path/to/mozjs @@ -106,8 +106,8 @@ searched. When searching under [PFX]_BASE no prefix is added to the search, but when searching under the directory that the Nginx source is located in, the prefix [pfx]- is automatically added. -Note : there is currently a minor bug (due to the implementation of the 'sort' command) -means versions that include hyphens (e.g. 1.0.0-beta5) are checked before versions like +Note : there is currently a minor bug (due to the implementation of the 'sort' command) +means versions that include hyphens (e.g. 1.0.0-beta5) are checked before versions like 1.0.0a. This will be fixed soon, and searching of -build folders before normal source ones will be added too. @@ -119,7 +119,7 @@ Shared or static? The default for most libraries is to look for shared libraries, though this can be overridden by the user by setting [PFX]_SHARED=NO. -In the near future the default action will be to look for shared libraries then to look +In the near future the default action will be to look for shared libraries then to look for static libraries in each directory searched unless one of [PFX]_SHARED and/or [PFX]_STATIC = NO. If both are set to NO, then Auto Lib will not be used at all. @@ -154,7 +154,7 @@ How Auto Lib Core works ----------------------- Auto Lib Core works as an interface layer between the module and the auto/feature part of -the Nginx source. This is the file that results in the 'checking for ...' lines that you +the Nginx source. This is the file that results in the 'checking for ...' lines that you see when you call ./configure. auto/feature works by using a few key variables (see below) to generate some C code, trying @@ -162,8 +162,8 @@ to compile it to see if it works and optionally running the code. This output fi autotest.c (located under the objs/ directory whilst configure is running, but is deleted after each call to auto/feature). -Normally, whenever an external library is required, a module developer will write a number -of calls to auto/feature manually in their config files - e.g. to check under a range of +Normally, whenever an external library is required, a module developer will write a number +of calls to auto/feature manually in their config files - e.g. to check under a range of different possible locations to find a library. Apart from being tedious, this is obviously potentially error-prone. @@ -180,7 +180,7 @@ Option 1 : located - add the following line to your config file - . $ngx_addon_dir/ngx_auto_lib_core + . $ngx_addon_dir/ngx_auto_lib_core NOTE : if you want to include the file in a different directory to your config file, you will need to change both the include line in your config file AND @@ -189,7 +189,7 @@ has $ngx_addon_dir/ngx_auto_lib_core in it) Option 2 : -- make the Nginx Development Kit (github.com/simpl-it/ngx_devel_kit) a dependency +- make the Nginx Development Kit (github.com/simpl-it/ngx_devel_kit) a dependency for your module (Auto Lib Core is included automatically with it) @@ -229,10 +229,10 @@ Calling ngx_auto_lib_init() and ngx_auto_lib_run() You can pass either one or two variables to ngx_auto_lib_init(). The first is the name of the library as it will appear when running ./configure, the second is the prefix that is -used for internal variables and looking for directory prefixes. If the second is not +used for internal variables and looking for directory prefixes. If the second is not specified, it defaults to the first. -The init function resets all key variables and functions, so it must be called before +The init function resets all key variables and functions, so it must be called before setting any other variables or functions that are to be used as hooks (see the notes below). ngx_auto_lib_run() should be called in the config files after all the variables and hooks @@ -315,9 +315,9 @@ Hooks To facilitate using Auto Lib Core in a flexible way, a number of 'hooks' have been placed in the testing cycle. These hooks are implemented as functions that you define -in your config file which are called if required by the core library. In the core +in your config file which are called if required by the core library. In the core library they are left as empty functions that return either 0 or 1. Any functions -you write will +you write will Note : ngx_auto_lib_init() resets the variables and functions each time it is called, so you must DEFINE HOOKS AFTER YOU CALL ngx_auto_lib_init. @@ -337,7 +337,7 @@ Although in most cases Auto Lib Core will be used where external libraries are definitely required (for a module to work), this may not always be the case. In the standard Nginx Auto Lib module (github.com/simpl-it/ngx_auto_lib) - which is designed to improve the inclusion of OpenSSL, PCRE and Zlib libraries and increase compilation -speed where possible - the libraries are not always required, so checks are made to +speed where possible - the libraries are not always required, so checks are made to see if it is necessary. @@ -348,11 +348,11 @@ How Auto Lib Core checks if a library is required - ngx_auto_lib_check_require() - search for USE_[PFX]=YES (it is set to YES by default for most modules) - search for any external libraries that have been included in the CORE_LIBS or ADDON_LIBS variables that use the same lib name as any set in ngx_feature_lib_names -- search for any macros that have been defined either in the CFLAGS variable or using - auto/have or auto/define as set in the ngx_feature_check_macros_defined and +- search for any macros that have been defined either in the CFLAGS variable or using + auto/have or auto/define as set in the ngx_feature_check_macros_defined and ngx_feature_ngx_macros_non_zero variables - any custom checks implemented by creating an ngx_auto_lib_check hook function (which - should return 0 if the library is required and return 1 at the end if the module is + should return 0 if the library is required and return 1 at the end if the module is not required) @@ -378,8 +378,8 @@ that the linker links to is the same as the one specified. This is done because To do ----- -- Change how library paths are searched to include both shared and static libraries -- Touch up documentation +- change how library paths are searched to include both shared and static libraries +- touch up documentation License @@ -391,4 +391,5 @@ License Copyright --------- - [Marcus Clyne](https://github.com/mclyne) (c) 2010 + Marcus Clyne (c) 2010 (http://simpl.it) + diff --git a/debian/modules/nginx-development-kit/TODO b/debian/modules/nginx-development-kit/TODO new file mode 100644 index 0000000..0acf8bf --- /dev/null +++ b/debian/modules/nginx-development-kit/TODO @@ -0,0 +1 @@ +- for backward compatability, add the ndk_macros diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array b/debian/modules/nginx-development-kit/auto/actions/array similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array rename to debian/modules/nginx-development-kit/auto/actions/array diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc b/debian/modules/nginx-development-kit/auto/actions/palloc similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc rename to debian/modules/nginx-development-kit/auto/actions/palloc diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build b/debian/modules/nginx-development-kit/auto/build similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build rename to debian/modules/nginx-development-kit/auto/build diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements b/debian/modules/nginx-development-kit/auto/data/action_replacements similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements rename to debian/modules/nginx-development-kit/auto/data/action_replacements diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types b/debian/modules/nginx-development-kit/auto/data/action_types similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types rename to debian/modules/nginx-development-kit/auto/data/action_types diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args b/debian/modules/nginx-development-kit/auto/data/conf_args similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args rename to debian/modules/nginx-development-kit/auto/data/conf_args diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs b/debian/modules/nginx-development-kit/auto/data/conf_locs similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs rename to debian/modules/nginx-development-kit/auto/data/conf_locs diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros b/debian/modules/nginx-development-kit/auto/data/conf_macros similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros rename to debian/modules/nginx-development-kit/auto/data/conf_macros diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts b/debian/modules/nginx-development-kit/auto/data/contexts similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts rename to debian/modules/nginx-development-kit/auto/data/contexts diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files b/debian/modules/nginx-development-kit/auto/data/header_files similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files rename to debian/modules/nginx-development-kit/auto/data/header_files diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers b/debian/modules/nginx-development-kit/auto/data/headers similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers rename to debian/modules/nginx-development-kit/auto/data/headers diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies b/debian/modules/nginx-development-kit/auto/data/module_dependencies similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies rename to debian/modules/nginx-development-kit/auto/data/module_dependencies diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional b/debian/modules/nginx-development-kit/auto/data/modules_optional similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional rename to debian/modules/nginx-development-kit/auto/data/modules_optional diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes b/debian/modules/nginx-development-kit/auto/data/prefixes similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes rename to debian/modules/nginx-development-kit/auto/data/prefixes diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h b/debian/modules/nginx-development-kit/auto/src/array.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h rename to debian/modules/nginx-development-kit/auto/src/array.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h b/debian/modules/nginx-development-kit/auto/src/conf_cmd_basic.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h rename to debian/modules/nginx-development-kit/auto/src/conf_cmd_basic.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h b/debian/modules/nginx-development-kit/auto/src/conf_merge.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h rename to debian/modules/nginx-development-kit/auto/src/conf_merge.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h b/debian/modules/nginx-development-kit/auto/src/palloc.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h rename to debian/modules/nginx-development-kit/auto/src/palloc.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen b/debian/modules/nginx-development-kit/auto/text/autogen similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen rename to debian/modules/nginx-development-kit/auto/text/autogen diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/config b/debian/modules/nginx-development-kit/config similarity index 64% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/config rename to debian/modules/nginx-development-kit/config index 8cb7ad0..65563d7 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/config +++ b/debian/modules/nginx-development-kit/config @@ -18,8 +18,8 @@ ndk_get_nginx_version() { # We get the Nginx version number from the string form rather than # nginx_version because it is available in more (every?) version - cat src/core/nginx.h | - grep '#define NGINX_VERSION' | + cat src/core/nginx.h | + grep '#define NGINX_VERSION' | sed -r \ -e 's/[^0-9.]*([0-9.]+).*/\1/' \ -e 's/([0-9]+\.[0-9]+\.)([0-9]{1})$/\100\2/' \ @@ -35,26 +35,10 @@ ndk_get_nginx_version() { ngx_addon_name=ngx_devel_kit ngx_objs_dirs="$ngx_addon_dir/objs $NGX_OBJS/addon/ndk" -NDK_SRCS="$ngx_addon_dir/src/ndk.c" -NDK_DEPS="$ngx_addon_dir/src/ndk.h" -NDK_INCS="$ngx_addon_dir/src $ngx_objs_dirs" - CORE_INCS="$CORE_INCS $ngx_objs_dirs" HTTP_INCS="$HTTP_INCS $ngx_addon_dir/src $ngx_objs_dir" - -if test -n "$ngx_module_link"; then - ngx_module_type=HTTP - ngx_module_name="ndk_http_module" - ngx_module_srcs="$NDK_SRCS" - ngx_module_deps="$NDK_DEPS" - ngx_module_incs="$NDK_INCS" - - . auto/module -else - HTTP_MODULES="$HTTP_MODULES ndk_http_module" - NGX_ADDON_SRCS="$NGX_ADDON_SRCS $NDK_SRCS" - NGX_ADDON_DEPS="$NGX_ADDON_SRCS $NDK_DEPS" -fi +HTTP_MODULES="$HTTP_MODULES ndk_http_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ndk.c" have=NDK . auto/have @@ -62,4 +46,4 @@ have=NDK . auto/have ## INCLUDES ## ############## -. $ngx_addon_dir/ngx_auto_lib_core +. $ngx_addon_dir/ngx_auto_lib_core \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros b/debian/modules/nginx-development-kit/docs/core/action_macros similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros rename to debian/modules/nginx-development-kit/docs/core/action_macros diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds b/debian/modules/nginx-development-kit/docs/core/conf_cmds similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds rename to debian/modules/nginx-development-kit/docs/core/conf_cmds diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var b/debian/modules/nginx-development-kit/docs/modules/set_var similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var rename to debian/modules/nginx-development-kit/docs/modules/set_var diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info b/debian/modules/nginx-development-kit/docs/patches/more_logging_info similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info rename to debian/modules/nginx-development-kit/docs/patches/more_logging_info diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list b/debian/modules/nginx-development-kit/docs/upstream/list similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list rename to debian/modules/nginx-development-kit/docs/upstream/list diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README b/debian/modules/nginx-development-kit/examples/README similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README rename to debian/modules/nginx-development-kit/examples/README diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config b/debian/modules/nginx-development-kit/examples/http/set_var/config similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config rename to debian/modules/nginx-development-kit/examples/http/set_var/config diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c b/debian/modules/nginx-development-kit/examples/http/set_var/ngx_http_set_var_examples_module.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c rename to debian/modules/nginx-development-kit/examples/http/set_var/ngx_http_set_var_examples_module.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core b/debian/modules/nginx-development-kit/ngx_auto_lib_core similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core rename to debian/modules/nginx-development-kit/ngx_auto_lib_core diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES b/debian/modules/nginx-development-kit/notes/CHANGES similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES rename to debian/modules/nginx-development-kit/notes/CHANGES diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE b/debian/modules/nginx-development-kit/notes/LICENSE similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE rename to debian/modules/nginx-development-kit/notes/LICENSE diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h b/debian/modules/nginx-development-kit/objs/ndk_array.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h rename to debian/modules/nginx-development-kit/objs/ndk_array.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h b/debian/modules/nginx-development-kit/objs/ndk_conf_cmd_basic.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h rename to debian/modules/nginx-development-kit/objs/ndk_conf_cmd_basic.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h b/debian/modules/nginx-development-kit/objs/ndk_conf_cmd_extra.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h rename to debian/modules/nginx-development-kit/objs/ndk_conf_cmd_extra.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h b/debian/modules/nginx-development-kit/objs/ndk_conf_merge.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h rename to debian/modules/nginx-development-kit/objs/ndk_conf_merge.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c b/debian/modules/nginx-development-kit/objs/ndk_config.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c rename to debian/modules/nginx-development-kit/objs/ndk_config.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h b/debian/modules/nginx-development-kit/objs/ndk_config.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h rename to debian/modules/nginx-development-kit/objs/ndk_config.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h b/debian/modules/nginx-development-kit/objs/ndk_includes.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h rename to debian/modules/nginx-development-kit/objs/ndk_includes.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h b/debian/modules/nginx-development-kit/objs/ndk_palloc.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h rename to debian/modules/nginx-development-kit/objs/ndk_palloc.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config b/debian/modules/nginx-development-kit/patches/auto_config similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config rename to debian/modules/nginx-development-kit/patches/auto_config diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions b/debian/modules/nginx-development-kit/patches/expose_rewrite_functions similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions rename to debian/modules/nginx-development-kit/patches/expose_rewrite_functions diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler b/debian/modules/nginx-development-kit/patches/rewrite_phase_handler similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler rename to debian/modules/nginx-development-kit/patches/rewrite_phase_handler diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h b/debian/modules/nginx-development-kit/src/hash/md5.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h rename to debian/modules/nginx-development-kit/src/hash/md5.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c b/debian/modules/nginx-development-kit/src/hash/murmurhash2.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c rename to debian/modules/nginx-development-kit/src/hash/murmurhash2.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h b/debian/modules/nginx-development-kit/src/hash/sha.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h rename to debian/modules/nginx-development-kit/src/hash/sha.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c b/debian/modules/nginx-development-kit/src/ndk.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c rename to debian/modules/nginx-development-kit/src/ndk.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h b/debian/modules/nginx-development-kit/src/ndk.h similarity index 75% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h rename to debian/modules/nginx-development-kit/src/ndk.h index e08dfac..febcc32 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h +++ b/debian/modules/nginx-development-kit/src/ndk.h @@ -13,8 +13,8 @@ #include -#define ndk_version 3004 -#define NDK_VERSION "0.3.4" +#define ndk_version 2015 +#define NDK_VERSION "0.2.15" #if (NGX_DEBUG) @@ -28,6 +28,11 @@ #endif +#if !(NDK) +#error At least one module requires the Nginx Development Kit to be compiled with \ +the source (add --with-module=/path/to/devel/kit/src to configure command) +#endif + #include diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c b/debian/modules/nginx-development-kit/src/ndk_buf.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c rename to debian/modules/nginx-development-kit/src/ndk_buf.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h b/debian/modules/nginx-development-kit/src/ndk_buf.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h rename to debian/modules/nginx-development-kit/src/ndk_buf.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c b/debian/modules/nginx-development-kit/src/ndk_complex_path.c similarity index 95% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c rename to debian/modules/nginx-development-kit/src/ndk_complex_path.c index 8b32713..a66a808 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c +++ b/debian/modules/nginx-development-kit/src/ndk_complex_path.c @@ -99,6 +99,7 @@ ndk_conf_set_http_complex_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *c char *p = conf; ngx_str_t *path; + ngx_array_t *a; ngx_conf_post_t *post; ndk_http_complex_path_t *cp; @@ -112,14 +113,13 @@ ndk_conf_set_http_complex_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *c path++; cp->a = ndk_http_complex_path_create_compile (cf, path, cp->prefix); - if (cp->a == NULL) { + if (cp->a == NULL) /* TODO : log */ return NGX_CONF_ERROR; - } if (cmd->post) { post = cmd->post; - return post->post_handler (cf, post, cp->a); + return post->post_handler (cf, post, a); } return NGX_CONF_OK; diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h b/debian/modules/nginx-development-kit/src/ndk_complex_path.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h rename to debian/modules/nginx-development-kit/src/ndk_complex_path.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c b/debian/modules/nginx-development-kit/src/ndk_complex_value.c similarity index 98% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c rename to debian/modules/nginx-development-kit/src/ndk_complex_value.c index 97681ff..bfca2cd 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c +++ b/debian/modules/nginx-development-kit/src/ndk_complex_value.c @@ -50,7 +50,7 @@ ndk_http_complex_value_array_create (ngx_conf_t *cf, char **s, ngx_int_t n) ngx_int_t ndk_http_complex_value_array_compile (ngx_conf_t *cf, ngx_array_t *a) { - ngx_uint_t i; + ngx_int_t i; ngx_http_complex_value_t *cv; if (a == NULL || a == NGX_CONF_UNSET_PTR) { @@ -109,7 +109,7 @@ ndk_conf_set_http_complex_value_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, ngx_http_complex_value_t *cv; ngx_array_t **a; ngx_conf_post_t *post; - ngx_uint_t i, alloc; + ngx_int_t i, alloc; a = (ngx_array_t **) (p + cmd->offset); diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h b/debian/modules/nginx-development-kit/src/ndk_complex_value.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h rename to debian/modules/nginx-development-kit/src/ndk_complex_value.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c b/debian/modules/nginx-development-kit/src/ndk_conf_file.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c rename to debian/modules/nginx-development-kit/src/ndk_conf_file.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h b/debian/modules/nginx-development-kit/src/ndk_conf_file.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h rename to debian/modules/nginx-development-kit/src/ndk_conf_file.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c b/debian/modules/nginx-development-kit/src/ndk_debug.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c rename to debian/modules/nginx-development-kit/src/ndk_debug.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h b/debian/modules/nginx-development-kit/src/ndk_debug.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h rename to debian/modules/nginx-development-kit/src/ndk_debug.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c b/debian/modules/nginx-development-kit/src/ndk_encoding.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c rename to debian/modules/nginx-development-kit/src/ndk_encoding.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h b/debian/modules/nginx-development-kit/src/ndk_encoding.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h rename to debian/modules/nginx-development-kit/src/ndk_encoding.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c b/debian/modules/nginx-development-kit/src/ndk_hash.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c rename to debian/modules/nginx-development-kit/src/ndk_hash.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h b/debian/modules/nginx-development-kit/src/ndk_hash.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h rename to debian/modules/nginx-development-kit/src/ndk_hash.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c b/debian/modules/nginx-development-kit/src/ndk_http.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c rename to debian/modules/nginx-development-kit/src/ndk_http.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h b/debian/modules/nginx-development-kit/src/ndk_http.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h rename to debian/modules/nginx-development-kit/src/ndk_http.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h b/debian/modules/nginx-development-kit/src/ndk_http_headers.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h rename to debian/modules/nginx-development-kit/src/ndk_http_headers.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c b/debian/modules/nginx-development-kit/src/ndk_log.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c rename to debian/modules/nginx-development-kit/src/ndk_log.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h b/debian/modules/nginx-development-kit/src/ndk_log.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h rename to debian/modules/nginx-development-kit/src/ndk_log.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h b/debian/modules/nginx-development-kit/src/ndk_parse.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h rename to debian/modules/nginx-development-kit/src/ndk_parse.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c b/debian/modules/nginx-development-kit/src/ndk_path.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c rename to debian/modules/nginx-development-kit/src/ndk_path.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h b/debian/modules/nginx-development-kit/src/ndk_path.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h rename to debian/modules/nginx-development-kit/src/ndk_path.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c b/debian/modules/nginx-development-kit/src/ndk_process.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c rename to debian/modules/nginx-development-kit/src/ndk_process.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h b/debian/modules/nginx-development-kit/src/ndk_process.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h rename to debian/modules/nginx-development-kit/src/ndk_process.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c b/debian/modules/nginx-development-kit/src/ndk_regex.c similarity index 98% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c rename to debian/modules/nginx-development-kit/src/ndk_regex.c index c1efd86..d5893df 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c +++ b/debian/modules/nginx-development-kit/src/ndk_regex.c @@ -100,7 +100,7 @@ ndk_conf_set_regex_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_array_t **a; ngx_regex_elt_t *re; ngx_regex_compile_t rc; - ngx_uint_t i, n = 0; + ngx_uint_t i, n; u_char errstr[NGX_MAX_CONF_ERRSTR]; a = (ngx_array_t **) (p + cmd->offset); @@ -162,7 +162,7 @@ ndk_conf_set_regex_array_caseless_slot (ngx_conf_t *cf, ngx_command_t *cmd, void ngx_array_t **a; ngx_regex_elt_t *re; ngx_regex_compile_t rc; - ngx_uint_t i, n = 0; + ngx_uint_t i, n; u_char errstr[NGX_MAX_CONF_ERRSTR]; a = (ngx_array_t **) (p + cmd->offset); diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h b/debian/modules/nginx-development-kit/src/ndk_regex.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h rename to debian/modules/nginx-development-kit/src/ndk_regex.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c b/debian/modules/nginx-development-kit/src/ndk_rewrite.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c rename to debian/modules/nginx-development-kit/src/ndk_rewrite.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h b/debian/modules/nginx-development-kit/src/ndk_rewrite.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h rename to debian/modules/nginx-development-kit/src/ndk_rewrite.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c b/debian/modules/nginx-development-kit/src/ndk_set_var.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c rename to debian/modules/nginx-development-kit/src/ndk_set_var.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h b/debian/modules/nginx-development-kit/src/ndk_set_var.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h rename to debian/modules/nginx-development-kit/src/ndk_set_var.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c b/debian/modules/nginx-development-kit/src/ndk_string.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c rename to debian/modules/nginx-development-kit/src/ndk_string.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h b/debian/modules/nginx-development-kit/src/ndk_string.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h rename to debian/modules/nginx-development-kit/src/ndk_string.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string_util.h b/debian/modules/nginx-development-kit/src/ndk_string_util.h similarity index 98% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string_util.h rename to debian/modules/nginx-development-kit/src/ndk_string_util.h index 18a28f0..d23b8e1 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string_util.h +++ b/debian/modules/nginx-development-kit/src/ndk_string_util.h @@ -10,5 +10,5 @@ #define ngx_null_enum { ngx_null_string, 0 } -#define ndk_memcpyp(d,s) ngx_memcpy(d,s,sizeof(*s)) +#define ndk_memcpyp(d,s) ngx_memcpy(d,s,sizeof(s)) diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c b/debian/modules/nginx-development-kit/src/ndk_upstream_list.c similarity index 99% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c rename to debian/modules/nginx-development-kit/src/ndk_upstream_list.c index 3a83a25..7381777 100644 --- a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c +++ b/debian/modules/nginx-development-kit/src/ndk_upstream_list.c @@ -145,7 +145,7 @@ ndk_upstream_list (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) /* allocate space for all buckets */ - bucket = ngx_palloc (cf->pool, buckets * sizeof (ngx_str_t *)); + bucket = ngx_palloc (cf->pool, buckets * sizeof (ngx_str_t **)); if (bucket == NULL) return NGX_CONF_ERROR; diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h b/debian/modules/nginx-development-kit/src/ndk_upstream_list.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h rename to debian/modules/nginx-development-kit/src/ndk_upstream_list.h diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c b/debian/modules/nginx-development-kit/src/ndk_uri.c similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c rename to debian/modules/nginx-development-kit/src/ndk_uri.c diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h b/debian/modules/nginx-development-kit/src/ndk_uri.h similarity index 100% rename from modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h rename to debian/modules/nginx-development-kit/src/ndk_uri.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/LICENSE b/debian/modules/nginx-echo/LICENSE similarity index 79% rename from modules_deb/libnginx-mod-http-echo-0.63/LICENSE rename to debian/modules/nginx-echo/LICENSE index 6feffbf..0403cb3 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/LICENSE +++ b/debian/modules/nginx-echo/LICENSE @@ -1,4 +1,5 @@ -Copyright (C) 2009-2014, Yichun "agentzh" Zhang . +Copyright (c) 2009, Taobao Inc., Alibaba Group ( http://www.taobao.com ). +Copyright (c) 2009, agentzh . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -12,6 +13,10 @@ are met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the Taobao Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/modules_deb/libnginx-mod-http-echo-0.63/README.markdown b/debian/modules/nginx-echo/README.markdown similarity index 73% rename from modules_deb/libnginx-mod-http-echo-0.63/README.markdown rename to debian/modules/nginx-echo/README.markdown index a6b25e3..d94fae6 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/README.markdown +++ b/debian/modules/nginx-echo/README.markdown @@ -1,3 +1,8 @@ + + Name ==== @@ -8,7 +13,6 @@ Name Table of Contents ================= -* [Name](#name) * [Status](#status) * [Version](#version) * [Synopsis](#synopsis) @@ -46,6 +50,7 @@ Table of Contents * [$echo_response_status](#echo_response_status) * [Installation](#installation) * [Compatibility](#compatibility) +* [Known Issues](#known-issues) * [Modules that use this module for testing](#modules-that-use-this-module-for-testing) * [Community](#community) * [English Mailing List](#english-mailing-list) @@ -68,203 +73,203 @@ This module is production ready. Version ======= -This document describes ngx_echo [v0.62](https://github.com/openresty/echo-nginx-module/tags) released on 2 July, 2020. +This document describes ngx_echo [v0.56](https://github.com/agentzh/echo-nginx-module/tags) released on 2 September 2014. Synopsis ======== ```nginx - location /hello { - echo "hello, world!"; - } + location /hello { + echo "hello, world!"; + } ``` ```nginx - location /hello { - echo -n "hello, "; - echo "world!"; - } + location /hello { + echo -n "hello, "; + echo "world!"; + } ``` ```nginx - location /timed_hello { - echo_reset_timer; - echo hello world; - echo "'hello world' takes about $echo_timer_elapsed sec."; - echo hiya igor; - echo "'hiya igor' takes about $echo_timer_elapsed sec."; - } + location /timed_hello { + echo_reset_timer; + echo hello world; + echo "'hello world' takes about $echo_timer_elapsed sec."; + echo hiya igor; + echo "'hiya igor' takes about $echo_timer_elapsed sec."; + } ``` ```nginx - location /echo_with_sleep { - echo hello; - echo_flush; # ensure the client can see previous output immediately - echo_sleep 2.5; # in sec - echo world; - } + location /echo_with_sleep { + echo hello; + echo_flush; # ensure the client can see previous output immediately + echo_sleep 2.5; # in sec + echo world; + } ``` ```nginx - # in the following example, accessing /echo yields - # hello - # world - # blah - # hiya - # igor - location /echo { - echo_before_body hello; - echo_before_body world; - proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; - echo_after_body hiya; - echo_after_body igor; - } - location /echo/more { - echo blah; - } + # in the following example, accessing /echo yields + # hello + # world + # blah + # hiya + # igor + location /echo { + echo_before_body hello; + echo_before_body world; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + echo_after_body hiya; + echo_after_body igor; + } + location /echo/more { + echo blah; + } ``` ```nginx - # the output of /main might be - # hello - # world - # took 0.000 sec for total. - # and the whole request would take about 2 sec to complete. - location /main { - echo_reset_timer; - - # subrequests in parallel - echo_location_async /sub1; - echo_location_async /sub2; - - echo "took $echo_timer_elapsed sec for total."; - } - location /sub1 { - echo_sleep 2; - echo hello; - } - location /sub2 { - echo_sleep 1; - echo world; - } + # the output of /main might be + # hello + # world + # took 0.000 sec for total. + # and the whole request would take about 2 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in parallel + echo_location_async /sub1; + echo_location_async /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } ``` ```nginx - # the output of /main might be - # hello - # world - # took 3.003 sec for total. - # and the whole request would take about 3 sec to complete. - location /main { - echo_reset_timer; - - # subrequests in series (chained by CPS) - echo_location /sub1; - echo_location /sub2; - - echo "took $echo_timer_elapsed sec for total."; - } - location /sub1 { - echo_sleep 2; - echo hello; - } - location /sub2 { - echo_sleep 1; - echo world; - } + # the output of /main might be + # hello + # world + # took 3.003 sec for total. + # and the whole request would take about 3 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in series (chained by CPS) + echo_location /sub1; + echo_location /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } ``` ```nginx - # Accessing /dup gives - # ------ END ------ - location /dup { - echo_duplicate 3 "--"; - echo_duplicate 1 " END "; - echo_duplicate 3 "--"; - echo; - } + # Accessing /dup gives + # ------ END ------ + location /dup { + echo_duplicate 3 "--"; + echo_duplicate 1 " END "; + echo_duplicate 3 "--"; + echo; + } ``` ```nginx - # /bighello will generate 1000,000,000 hello's. - location /bighello { - echo_duplicate 1000_000_000 'hello'; - } + # /bighello will generate 1000,000,000 hello's. + location /bighello { + echo_duplicate 1000_000_000 'hello'; + } ``` ```nginx - # echo back the client request - location /echoback { - echo_duplicate 1 $echo_client_request_headers; - echo "\r"; - - echo_read_request_body; - - echo_request_body; - } + # echo back the client request + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + + echo_read_request_body; + + echo_request_body; + } ``` ```nginx - # GET /multi will yields - # querystring: foo=Foo - # method: POST - # body: hi - # content length: 2 - # /// - # querystring: bar=Bar - # method: PUT - # body: hello - # content length: 5 - # /// - location /multi { - echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; - echo_subrequest_async PUT '/sub' -q 'bar=Bar' -b 'hello'; - } - location /sub { - echo "querystring: $query_string"; - echo "method: $echo_request_method"; - echo "body: $echo_request_body"; - echo "content length: $http_content_length"; - echo '///'; - } + # GET /multi will yields + # querystring: foo=Foo + # method: POST + # body: hi + # content length: 2 + # /// + # querystring: bar=Bar + # method: PUT + # body: hello + # content length: 5 + # /// + location /multi { + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -b 'hello'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } ``` ```nginx - # GET /merge?/foo.js&/bar/blah.js&/yui/baz.js will merge the .js resources together - location /merge { - default_type 'text/javascript'; - echo_foreach_split '&' $query_string; - echo "/* JS File $echo_it */"; - echo_location_async $echo_it; - echo; - echo_end; - } + # GET /merge?/foo.js&/bar/blah.js&/yui/baz.js will merge the .js resources together + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } ``` ```nginx - # accessing /if?val=abc yields the "hit" output - # while /if?val=bcd yields "miss": - location ^~ /if { - set $res miss; - if ($arg_val ~* '^a') { - set $res hit; - echo $res; - } - echo $res; - } + # accessing /if?val=abc yields the "hit" output + # while /if?val=bcd yields "miss": + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } ``` [Back to TOC](#table-of-contents) @@ -284,9 +289,9 @@ People will also find it useful in real-world applications that need to This is a special dual-role module that can *lazily* serve as a content handler or register itself as an output filter only upon demand. By default, this module does not do anything at all. -Technically, this module has also demonstrated the following techniques that might be helpful for module writers: +Technially, this module has also demonstrated the following techniques that might be helpful for module writers: -1. Issue parallel subrequests directly from content handler. +1. Issue parallel subreqeusts directly from content handler. 1. Issue chained subrequests directly from content handler, by passing continuation along the subrequest chain. 1. Issue subrequests with all HTTP 1.1 methods and even an optional faked HTTP request body. 1. Interact with the Nginx event model directly from content handler using custom events and timers, and resume the content handler back if necessary. @@ -311,43 +316,43 @@ The MIME type set by the [standard default_type directive](http://nginx.org/en/d ```nginx - location /hello { - default_type text/plain; - echo hello; - } + location /hello { + default_type text/plain; + echo hello; + } ``` Then on the client side: ```bash - $ curl -I 'http://localhost/echo' - HTTP/1.1 200 OK - Server: nginx/0.8.20 - Date: Sat, 17 Oct 2009 03:40:19 GMT - Content-Type: text/plain - Connection: keep-alive + $ curl -I 'http://localhost/echo' + HTTP/1.1 200 OK + Server: nginx/0.8.20 + Date: Sat, 17 Oct 2009 03:40:19 GMT + Content-Type: text/plain + Connection: keep-alive ``` Since the [v0.22](#v022) release, all of the directives are allowed in the [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [if](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) directive block, for instance: ```nginx - location ^~ /if { - set $res miss; - if ($arg_val ~* '^a') { - set $res hit; - echo $res; - } - echo $res; - } +location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; +} ``` [Back to TOC](#table-of-contents) echo ---- -**syntax:** *echo \[options\] <string>...* +**syntax:** *echo [options] <string>...* **default:** *no* @@ -361,8 +366,8 @@ Note that the data might be buffered by Nginx's underlying buffer. To force the ```nginx - echo hello world; - echo_flush; + echo hello world; + echo_flush; ``` When no argument is specified, *echo* emits the trailing newline alone, just like the *echo* command in shell. @@ -371,7 +376,7 @@ Variables may appear in the arguments. An example is ```nginx - echo The current request uri is $request_uri; + echo The current request uri is $request_uri; ``` where [$request_uri](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri) is a variable exposed by the [ngx_http_core_module](http://nginx.org/en/docs/http/ngx_http_core_module.html). @@ -380,80 +385,78 @@ This command can be used multiple times in a single location configuration, as i ```nginx - location /echo { - echo hello; - echo world; - } +location /echo { + echo hello; + echo world; +} ``` The output on the client side looks like this ```bash - $ curl 'http://localhost/echo' - hello - world +$ curl 'http://localhost/echo' +hello +world ``` -Special characters like newlines (`\n`) and tabs (`\t`) can be escaped using C-style escaping sequences. But a notable exception is the dollar sign (`$`). As of Nginx 0.8.20, there's still no clean way to escape this character. (A work-around might be to use a `$echo_dollor` variable that is always evaluated to the constant `$` character. This feature will possibly be introduced in a future version of this module.) +Special characters like newlines (`\n`) and tabs (`\t`) can be escaped using C-style escaping sequences. But a notable exception is the dollar sign (`$`). As of Nginx 0.8.20, there's still no clean way to esacpe this characters. (A work-around might be to use a `$echo_dollor` variable that is always evaluated to the constant `$` character. This feature will possibly be introduced in a future version of this module.) As of the echo [v0.28](#v028) release, one can suppress the trailing newline character in the output by using the `-n` option, as in ```nginx - location /echo { - echo -n "hello, "; - echo "world"; - } +location /echo { + echo -n "hello, "; + echo "world"; +} ``` Accessing `/echo` gives ```bash - $ curl 'http://localhost/echo' - hello, world +$ curl 'http://localhost/echo' +hello, world ``` Leading `-n` in variable values won't take effect and will be emitted literally, as in ```nginx - location /echo { - set $opt -n; - echo $opt "hello,"; - echo "world"; - } +location /echo { + set $opt -n; + echo $opt "hello,"; + echo "world"; +} ``` This gives the following output ```bash - $ curl 'http://localhost/echo' - -n hello, - world +$ curl 'http://localhost/echo' +-n hello, +world ``` One can output leading `-n` literals and other options using the special `--` option like this ```nginx - location /echo { - echo -- -n is an option; - } +location /echo { + echo -- -n is an option; +} ``` which yields ```bash - $ curl 'http://localhost/echo' - -n is an option +$ curl 'http://localhost/echo' +-n is an option ``` -Use this form when you want to output anything leading with a dash (`-`). - [Back to TOC](#table-of-contents) echo_duplicate @@ -466,26 +469,26 @@ echo_duplicate **phase:** *content* -Outputs duplication of a string indicated by the second argument, using the count specified in the first argument. +Outputs duplication of a string indicated by the second argument, using the times specified in the first argument. For instance, ```nginx - location /dup { - echo_duplicate 3 "abc"; - } + location /dup { + echo_duplicate 3 "abc"; + } ``` -will lead to the output of `"abcabcabc"`. +will lead to an output of `"abcabcabc"`. Underscores are allowed in the count number, just like in Perl. For example, to emit 1000,000,000 instances of `"hello, world"`: ```nginx - location /many_hellos { - echo_duplicate 1000_000_000 "hello, world"; - } + location /many_hellos { + echo_duplicate 1000_000_000 "hello, world"; + } ``` The `count` argument could be zero, but not negative. The second `string` argument could be an empty string ("") likewise. @@ -494,21 +497,20 @@ Unlike the [echo](#echo) directive, no trailing newline is appended to the resul ```nginx - location /echo_art { - echo_duplicate 2 '---'; - echo_duplicate 1 ' END '; # we don't want a trailing newline here - echo_duplicate 2 '---'; - echo; # we want a trailing newline here... - } + location /echo_art { + echo_duplicate 2 '---'; + echo_duplicate 1 ' END '; # we don't want a trailing newline here + echo_duplicate 2 '---'; + echo; # we want a trailing newline here... + } ``` You get ```bash - ------ END ------ -``` -But use of the `-n` option in [echo](#echo) is more appropriate for this purpose. + ------ END ------ +``` This directive was first introduced in [version 0.11](#v011). @@ -534,14 +536,14 @@ Consider the following example: ```nginx - location /flush { - echo hello; - - echo_flush; - - echo_sleep 1; - echo world; - } + location /flush { + echo hello; + + echo_flush; + + echo_sleep 1; + echo world; + } ``` Then on the client side, using curl to access `/flush`, you'll see the "hello" line immediately, but only after 1 second, the last "world" line. Without calling `echo_flush` in the example above, you'll most likely see no output until 1 second is elapsed due to the internal buffering of Nginx. @@ -550,14 +552,14 @@ This directive will fail to flush the output buffer in case of subrequests get i ```nginx - location /main { - echo_location_async /sub; - echo hello; - echo_flush; - } - location /sub { - echo_sleep 1; - } + location /main { + echo_location_async /sub; + echo hello; + echo_flush; + } + location /sub { + echo_sleep 1; + } ``` Then the client won't see "hello" appear even if `echo_flush` has been executed before the subrequest to `/sub` has actually started executing. The outputs of `/main` that are sent *after* [echo_location_async](#echo_location_async) will be postponed and buffered firmly. @@ -566,14 +568,14 @@ This does *not* apply to outputs sent before the subrequest initiated. For a mod ```nginx - location /main { - echo hello; - echo_flush; - echo_location_async /sub; - } - location /sub { - echo_sleep 1; - } + location /main { + echo hello; + echo_flush; + echo_location_async /sub; + } + location /sub { + echo_sleep 1; + } ``` The client will immediately see "hello" before `/sub` enters sleeping. @@ -602,10 +604,10 @@ An example is ```nginx - location /echo_after_sleep { - echo_sleep 1.234; - echo resumed!; - } + location /echo_after_sleep { + echo_sleep 1.234; + echo resumed!; + } ``` Behind the scene, it sets up a per-request "sleep" ngx_event_t object, and adds a timer using that custom event to the Nginx event model and just waits for a timeout on that event. Because the "sleep" event is per-request, this directive can work in parallel subrequests. @@ -648,24 +650,24 @@ The timer begin time is default to the starting time of the current request and ```nginx - location /timed_sleep { - echo_sleep 0.03; - echo "$echo_timer_elapsed sec elapsed."; - - echo_reset_timer; - - echo_sleep 0.02; - echo "$echo_timer_elapsed sec elapsed."; - } + location /timed_sleep { + echo_sleep 0.03; + echo "$echo_timer_elapsed sec elapsed."; + + echo_reset_timer; + + echo_sleep 0.02; + echo "$echo_timer_elapsed sec elapsed."; + } ``` The output on the client side might be ```bash - $ curl 'http://localhost/timed_sleep' - 0.032 sec elapsed. - 0.020 sec elapsed. +$ curl 'http://localhost/timed_sleep' +0.032 sec elapsed. +0.020 sec elapsed. ``` The actual figures you get on your side may vary a bit due to your system's current activities. @@ -696,29 +698,29 @@ Here's an example for echo'ing back the original HTTP client request (both heade ```nginx - location /echoback { - echo_duplicate 1 $echo_client_request_headers; - echo "\r"; - echo_read_request_body; - echo $request_body; - } + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + echo_read_request_body; + echo $request_body; + } ``` The content of `/echoback` looks like this on my side (I was using Perl's LWP utility to access this location on the server): ```bash - $ (echo hello; echo world) | lwp-request -m POST 'http://localhost/echoback' - POST /echoback HTTP/1.1 - TE: deflate,gzip;q=0.3 - Connection: TE, close - Host: localhost - User-Agent: lwp-request/5.818 libwww-perl/5.820 - Content-Length: 12 - Content-Type: application/x-www-form-urlencoded - - hello - world + $ (echo hello; echo world) | lwp-request -m POST 'http://localhost/echoback' + POST /echoback HTTP/1.1 + TE: deflate,gzip;q=0.3 + Connection: TE, close + Host: localhost + User-Agent: lwp-request/5.818 libwww-perl/5.820 + Content-Length: 12 + Content-Type: application/x-www-form-urlencoded + + hello + world ``` Because `/echoback` is the main request, [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) holds the original client request body. @@ -747,55 +749,55 @@ A very simple example is ```nginx - location /main { - echo_location_async /sub; - echo world; - } - location /sub { - echo hello; - } +location /main { + echo_location_async /sub; + echo world; +} +location /sub { + echo hello; +} ``` Accessing `/main` gets ```bash - hello - world + hello + world ``` Calling multiple locations in parallel is also possible: ```nginx - location /main { - echo_reset_timer; - echo_location_async /sub1; - echo_location_async /sub2; - echo "took $echo_timer_elapsed sec for total."; - } - location /sub1 { - echo_sleep 2; # sleeps 2 sec - echo hello; - } - location /sub2 { - echo_sleep 1; # sleeps 1 sec - echo world; - } +location /main { + echo_reset_timer; + echo_location_async /sub1; + echo_location_async /sub2; + echo "took $echo_timer_elapsed sec for total."; +} +location /sub1 { + echo_sleep 2; # sleeps 2 sec + echo hello; +} +location /sub2 { + echo_sleep 1; # sleeps 1 sec + echo world; +} ``` Accessing `/main` yields ```bash - $ time curl 'http://localhost/main' - hello - world - took 0.000 sec for total. - - real 0m2.006s - user 0m0.000s - sys 0m0.004s + $ time curl 'http://localhost/main' + hello + world + took 0.000 sec for total. + + real 0m2.006s + user 0m0.000s + sys 0m0.004s ``` You can see that the main handler `/main` does *not* wait the subrequests `/sub1` and `/sub2` to complete and quickly goes on, hence the "0.000 sec" timing result. The whole request, however takes approximately 2 sec in total to complete because `/sub1` and `/sub2` run in parallel (or "concurrently" to be more accurate). @@ -806,20 +808,20 @@ Locations can also take an optional querystring argument, for instance ```nginx - location /main { - echo_location_async /sub 'foo=Foo&bar=Bar'; - } - location /sub { - echo $arg_foo $arg_bar; - } +location /main { + echo_location_async /sub 'foo=Foo&bar=Bar'; +} +location /sub { + echo $arg_foo $arg_bar; +} ``` Accessing `/main` yields ```bash - $ curl 'http://localhost/main' - Foo Bar + $ curl 'http://localhost/main' + Foo Bar ``` Querystrings is *not* allowed to be concatenated onto the `location` argument with "?" directly, for example, `/sub?foo=Foo&bar=Bar` is an invalid location, and shouldn't be fed as the first argument to this directive. @@ -832,18 +834,20 @@ This directive is logically equivalent to the GET version of [echo_subrequest_as ```nginx - echo_location_async /foo 'bar=Bar'; + echo_location_async /foo 'bar=Bar'; ``` is logically equivalent to ```nginx - echo_subrequest_async GET /foo -q 'bar=Bar'; + echo_subrequest_async GET /foo -q 'bar=Bar'; ``` But calling this directive is slightly faster than calling [echo_subrequest_async](#echo_subrequest_async) using `GET` because we don't have to parse the HTTP method names like `GET` and options like `-q`. +There is a known issue with this directive when disabling the standard [standard SSI module](http://nginx.org/en/docs/http/ngx_http_ssi_module.html). See [Known Issues](#known-issues) for more details. + This directive is first introduced in [version 0.09](#v009) of this module and requires at least Nginx 0.7.46. [Back to TOC](#table-of-contents) @@ -866,48 +870,48 @@ Consider the following example: ```nginx - location /main { - echo_reset_timer; - echo_location /sub1; - echo_location /sub2; - echo "took $echo_timer_elapsed sec for total."; - } - location /sub1 { - echo_sleep 2; - echo hello; - } - location /sub2 { - echo_sleep 1; - echo world; - } +location /main { + echo_reset_timer; + echo_location /sub1; + echo_location /sub2; + echo "took $echo_timer_elapsed sec for total."; +} +location /sub1 { + echo_sleep 2; + echo hello; +} +location /sub2 { + echo_sleep 1; + echo world; +} ``` The location `/main` above will take for total 3 sec to complete (compared to 2 sec if [echo_location_async](#echo_location_async) is used instead here). Here's the result in action on my machine: ```bash - $ curl 'http://localhost/main' - hello - world - took 3.003 sec for total. - - real 0m3.027s - user 0m0.020s - sys 0m0.004s + $ curl 'http://localhost/main' + hello + world + took 3.003 sec for total. + + real 0m3.027s + user 0m0.020s + sys 0m0.004s ``` This directive is logically equivalent to the GET version of [echo_subrequest](#echo_subrequest). For example, ```nginx - echo_location /foo 'bar=Bar'; + echo_location /foo 'bar=Bar'; ``` is logically equivalent to ```nginx - echo_subrequest GET /foo -q 'bar=Bar'; + echo_subrequest GET /foo -q 'bar=Bar'; ``` But calling this directive is slightly faster than calling [echo_subrequest](#echo_subrequest) using `GET` because we don't have to parse the HTTP method names like `GET` and options like `-q`. @@ -940,67 +944,67 @@ Here's a small example demonstrating its usage: ```nginx - location /multi { - # body defined as string - echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; - # body defined as path to a file, relative to nginx prefix path if not absolute - echo_subrequest_async PUT '/sub' -q 'bar=Bar' -f '/tmp/hello.txt'; - } - location /sub { - echo "querystring: $query_string"; - echo "method: $echo_request_method"; - echo "body: $echo_request_body"; - echo "content length: $http_content_length"; - echo '///'; - } +location /multi { + # body defined as string + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + # body defined as path to a file, relative to nginx prefix path if not absolute + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -f '/tmp/hello.txt'; +} +location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; +} ``` Then on the client side: ```bash - $ echo -n hello > /tmp/hello.txt - $ curl 'http://localhost/multi' - querystring: foo=Foo - method: POST - body: hi - content length: 2 - /// - querystring: bar=Bar - method: PUT - body: hello - content length: 5 - /// + $ echo -n hello > /tmp/hello.txt + $ curl 'http://localhost/multi' + querystring: foo=Foo + method: POST + body: hi + content length: 2 + /// + querystring: bar=Bar + method: PUT + body: hello + content length: 5 + /// ``` Here's more funny example using the standard [proxy module](#httpproxymodule) to handle the subrequest: ```nginx - location /main { - echo_subrequest_async POST /sub -b 'hello, world'; - } - location /sub { - proxy_pass $scheme://127.0.0.1:$server_port/proxied; - } - location /proxied { - echo "method: $echo_request_method."; - - # we need to read body explicitly here...or $echo_request_body - # will evaluate to empty ("") - echo_read_request_body; - - echo "body: $echo_request_body."; - } +location /main { + echo_subrequest_async POST /sub -b 'hello, world'; +} +location /sub { + proxy_pass $scheme://127.0.0.1:$server_port/proxied; +} +location /proxied { + echo "method: $echo_request_method."; + + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo_read_request_body; + + echo "body: $echo_request_body."; +} ``` Then on the client side, we can see that ```bash - $ curl 'http://localhost/main' - method: POST. - body: hello, world. + $ curl 'http://localhost/main' + method: POST. + body: hello, world. ``` Nginx named locations like `@foo` is *not* supported here. @@ -1022,6 +1026,8 @@ The `-f` option to define a file path for the body was introduced in the [releas See also the [echo_subrequest](#echo_subrequest) and [echo_location_async](#echo_location_async) directives. +There is a known issue with this directive when disabling the standard [standard SSI module](http://nginx.org/en/docs/http/ngx_http_ssi_module.html). See [Known Issues](#known-issues) for more details. + [Back to TOC](#table-of-contents) echo_subrequest @@ -1058,21 +1064,21 @@ Split the second argument `string` using the delimiter specified in the first ar ```nginx - location /loop { - echo_foreach_split ',' $arg_list; - echo "item: $echo_it"; - echo_end; - } + location /loop { + echo_foreach_split ',' $arg_list; + echo "item: $echo_it"; + echo_end; + } ``` Accessing /main yields ```bash - $ curl 'http://localhost/loop?list=cat,dog,mouse' - item: cat - item: dog - item: mouse + $ curl 'http://localhost/loop?list=cat,dog,mouse' + item: cat + item: dog + item: mouse ``` As seen in the previous example, this directive should always be accompanied by an [echo_end](#echo_end) directive. @@ -1083,41 +1089,41 @@ The `delimiter` argument could contain *multiple* arbitrary characters, like ```nginx - # this outputs "cat\ndog\nmouse\n" - echo_foreach_split -- '-a-' 'cat-a-dog-a-mouse'; - echo $echo_it; - echo_end; + # this outputs "cat\ndog\nmouse\n" + echo_foreach_split -- '-a-' 'cat-a-dog-a-mouse'; + echo $echo_it; + echo_end; ``` Logically speaking, this looping structure is just the `foreach` loop combined with a `split` function call in Perl (using the previous example): ```perl - foreach (split ',', $arg_list) { - print "item $_\n"; - } + foreach (split ',', $arg_list) { + print "item $_\n"; + } ``` People will also find it useful in merging multiple `.js` or `.css` resources into a whole. Here's an example: ```nginx - location /merge { - default_type 'text/javascript'; - - echo_foreach_split '&' $query_string; - echo "/* JS File $echo_it */"; - echo_location_async $echo_it; - echo; - echo_end; - } + location /merge { + default_type 'text/javascript'; + + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } ``` Then accessing /merge to merge the `.js` resources specified in the query string: ```bash - $ curl 'http://localhost/merge?/foo/bar.js&/yui/blah.js&/baz.js' + $ curl 'http://localhost/merge?/foo/bar.js&/yui/blah.js&/baz.js' ``` One can also use third-party Nginx cache module to cache the merged response generated by the `/merge` location in the previous example. @@ -1158,9 +1164,9 @@ Behind the scene, it's implemented roughly like this: ```C - if (r->request_body && r->request_body->bufs) { - return ngx_http_output_filter(r, r->request_body->bufs); - } + if (r->request_body && r->request_body->bufs) { + return ngx_http_output_filter(r, r->request_body->bufs); + } ``` Unlike the [$echo_request_body](#echo_request_body) and $request_body variables, this directive will show the whole request body even if some parts or all parts of it are saved in temporary files on the disk. @@ -1189,38 +1195,38 @@ Does an internal redirect to the location specified. An optional query string ca ```nginx - location /foo { - echo_exec /bar weight=5; - } - location /bar { - echo $arg_weight; - } + location /foo { + echo_exec /bar weight=5; + } + location /bar { + echo $arg_weight; + } ``` Or equivalently ```nginx - location /foo { - echo_exec /bar?weight=5; - } - location /bar { - echo $arg_weight; - } + location /foo { + echo_exec /bar?weight=5; + } + location /bar { + echo $arg_weight; + } ``` Named locations are also supported. Here's an example: ```nginx - location /foo { - echo_exec @bar; - } - location @bar { - # you'll get /foo rather than @bar - # due to a potential bug in nginx. - echo $echo_request_uri; - } + location /foo { + echo_exec @bar; + } + location @bar { + # you'll get /foo rather than @bar + # due to a potential bug in nginx. + echo $echo_request_uri; + } ``` But query string (if any) will always be ignored for named location redirects due to a limitation in the `ngx_http_named_location` function. @@ -1249,10 +1255,10 @@ Here is an example, ```nginx - location = /bad { - echo_status 404; - echo "Something is missing..."; - } +location = /bad { + echo_status 404; + echo "Something is missing..."; +} ``` then we get a response like this: @@ -1283,7 +1289,7 @@ Every filter directive supports variable interpolation in its arguments (if any) echo_before_body ---------------- -**syntax:** *echo_before_body \[options\] \[argument\]...* +**syntax:** *echo_before_body [options] [argument]...* **default:** *no* @@ -1297,21 +1303,21 @@ An example is ```nginx - location /echo { - echo_before_body hello; - proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; - } - location /echo/more { - echo world - } +location /echo { + echo_before_body hello; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; +} +location /echo/more { + echo world +} ``` Accessing `/echo` from the client side yields ```bash - hello - world + hello + world ``` In the previous sample, we borrow the [standard proxy module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) to serve as the underlying content handler that generates the "main contents". @@ -1320,21 +1326,21 @@ Multiple instances of this filter directive are also allowed, as in: ```nginx - location /echo { - echo_before_body hello; - echo_before_body world; - echo !; - } +location /echo { + echo_before_body hello; + echo_before_body world; + echo !; +} ``` On the client side, the output is like ```bash - $ curl 'http://localhost/echo' - hello - world - ! + $ curl 'http://localhost/echo' + hello + world + ! ``` In this example, we also use the [content handler directives](#content-handler-directives) provided by this module as the underlying content handler. @@ -1347,7 +1353,7 @@ This directive can be mixed with its brother directive [echo_after_body](#echo_a echo_after_body --------------- -**syntax:** *echo_after_body \[argument\]...* +**syntax:** *echo_after_body [argument]...* **default:** *no* @@ -1361,13 +1367,13 @@ Here's a simple example: ```nginx - location /echo { - echo_after_body hello; - proxy_pass http://127.0.0.1:$server_port$request_uri/more; - } - location /echo/more { - echo world - } +location /echo { + echo_after_body hello; + proxy_pass http://127.0.0.1:$server_port$request_uri/more; +} +location /echo/more { + echo world +} ``` Accessing `/echo` from the client side yields @@ -1381,12 +1387,12 @@ Multiple instances are allowed, as in: ```nginx - location /echo { - echo_after_body hello; - echo_after_body world; - echo i; - echo say; - } +location /echo { + echo_after_body hello; + echo_after_body world; + echo i; + echo say; +} ``` The output on the client side while accessing the `/echo` location looks like @@ -1473,28 +1479,26 @@ A simple example is below: ```nginx - location /echoback { - echo "headers are:" - echo $echo_client_request_headers; - } + location /echoback { + echo "headers are:" + echo $echo_client_request_headers; + } ``` Accessing `/echoback` yields ```bash - $ curl 'http://localhost/echoback' - headers are - GET /echoback HTTP/1.1 - User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g - Host: localhost:1984 - Accept: */* + $ curl 'http://localhost/echoback' + headers are + GET /echoback HTTP/1.1 + User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g + Host: localhost:1984 + Accept: */* ``` Behind the scene, it recovers `r->main->header_in` (or the large header buffers, if any) on the C level and does not construct the headers itself by traversing parsed results in the request object. -This varible is always evaluated to an empty value in HTTP/2 requests for now due to the current implementation. - This variable was first introduced in [version 0.15](#v015). [Back to TOC](#table-of-contents) @@ -1530,15 +1534,15 @@ Consider the following example ```Nginx - location /main { - echo "main pre: $echo_incr"; - echo_location_async /sub; - echo_location_async /sub; - echo "main post: $echo_incr"; - } - location /sub { - echo "sub: $echo_incr"; - } +location /main { + echo "main pre: $echo_incr"; + echo_location_async /sub; + echo_location_async /sub; + echo "main post: $echo_incr"; +} +location /sub { + echo "sub: $echo_incr"; +} ``` Accessing `/main` yields @@ -1566,38 +1570,30 @@ This directive was first introduced in the [v0.23 release](#v023). Installation ============ -You're recommended to install this module (as well as the Nginx core and many other goodies) via the [OpenResty bundle](http://openresty.org). See [the detailed instructions](http://openresty.org/#Installation) for downloading and installing OpenResty into your system. This is the easiest and most safe way to set things up. +You're recommended to install this module (as well as the Nginx core and many other goodies) via the [ngx_openresty bundle](http://openresty.org). See [the detailed instructions](http://openresty.org/#Installation) for downloading and installing ngx_openresty into your system. This is the easiest and most safe way to set things up. Alternatively, you can install this module manually with the Nginx source: Grab the nginx source code from [nginx.org](http://nginx.org/), for example, -the version 1.11.2 (see [nginx compatibility](#compatibility)), and then build the source with this module: +the version 1.7.4 (see [nginx compatibility](#compatibility)), and then build the source with this module: ```bash - $ wget 'http://nginx.org/download/nginx-1.11.2.tar.gz' - $ tar -xzvf nginx-1.11.2.tar.gz - $ cd nginx-1.11.2/ +$ wget 'http://nginx.org/download/nginx-1.7.4.tar.gz' +$ tar -xzvf nginx-1.7.4.tar.gz +$ cd nginx-1.7.4/ - # Here we assume you would install you nginx under /opt/nginx/. - $ ./configure --prefix=/opt/nginx \ - --add-module=/path/to/echo-nginx-module - - $ make -j2 - $ make install +# Here we assume you would install you nginx under /opt/nginx/. +$ ./configure --prefix=/opt/nginx \ + --add-module=/path/to/echo-nginx-module + +$ make -j2 +$ make install ``` -Download the latest version of the release tarball of this module from [echo-nginx-module file list](https://github.com/openresty/echo-nginx-module/tags). +Download the latest version of the release tarball of this module from [echo-nginx-module file list](https://github.com/agentzh/echo-nginx-module/tags). -Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the -`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) -directive, for example, - -```nginx -load_module /path/to/modules/ngx_http_echo_module.so; -``` - -Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org). +Also, this module is included and enabled by default in the [ngx_openresty bundle](http://openresty.org). [Back to TOC](#table-of-contents) @@ -1606,16 +1602,7 @@ Compatibility The following versions of Nginx should work with this module: -* **1.16.x** -* **1.15.x** (last tested: 1.15.8) -* **1.14.x** -* **1.13.x** (last tested: 1.13.6) -* **1.12.x** -* **1.11.x** (last tested: 1.11.2) -* **1.10.x** -* **1.9.x** (last tested: 1.9.15) -* **1.8.x** -* **1.7.x** (last tested: 1.7.10) +* **1.7.x** (last tested: 1.7.4) * **1.6.x** * **1.5.x** (last tested: 1.5.12) * **1.4.x** (last tested: 1.4.4) @@ -1639,6 +1626,20 @@ If you find that any particular version of Nginx above 0.7.21 does not work with [Back to TOC](#table-of-contents) +Known Issues +============ + +Due to an unknown bug in Nginx (it still exists in Nginx 1.7.4), the [standard SSI module](http://nginx.org/en/docs/http/ngx_http_ssi_module.html) is required to ensure that the contents of the subrequests issued by [echo_locatoin_async](#echo_location_async) and [echo_subrequest_async](#echo_subrequest_async) are correctly merged into the output chains of the main one. Fortunately, the SSI module is enabled by default during Nginx's `configure` process. + +If calling this directive without SSI module enabled, you'll get truncated response without contents of any subrequests and get an alert message in your Nginx's `error.log`, like this: + +```nginx + + [alert] 24212#0: *1 the http output chain is empty, client: 127.0.0.1, ... +``` + +[Back to TOC](#table-of-contents) + Modules that use this module for testing ======================================== @@ -1677,7 +1678,7 @@ Report Bugs Although a lot of effort has been put into testing and code tuning, there must be some serious bugs lurking somewhere in this module. So whenever you are bitten by any quirks, please don't hesitate to -1. create a ticket on the [issue tracking interface](https://github.com/openresty/echo-nginx-module/issues) provided by GitHub, +1. create a ticket on the [issue tracking interface](https://github.com/agentzh/echo-nginx-module/issues) provided by GitHub, 1. or send a bug report, questions, or even patches to the [OpenResty Community](#community). [Back to TOC](#table-of-contents) @@ -1685,14 +1686,14 @@ Although a lot of effort has been put into testing and code tuning, there must b Source Repository ================= -Available on github at [openresty/echo-nginx-module](https://github.com/openresty/echo-nginx-module). +Available on github at [agentzh/echo-nginx-module](https://github.com/agentzh/echo-nginx-module). [Back to TOC](#table-of-contents) Changes ======= -The changes of every release of this module can be obtained from the OpenResty bundle's change logs: +The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: @@ -1701,14 +1702,14 @@ The changes of every release of this module can be obtained from the OpenResty b Test Suite ========== -This module comes with a Perl-driven test suite. The [test cases](https://github.com/openresty/echo-nginx-module/tree/master/t/) are -[declarative](https://github.com/openresty/echo-nginx-module/blob/master/t/echo.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. +This module comes with a Perl-driven test suite. The [test cases](https://github.com/agentzh/echo-nginx-module/tree/master/t/) are +[declarative](https://github.com/agentzh/echo-nginx-module/blob/master/t/echo.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. To run it on your side: ```bash - $ PATH=/path/to/your/nginx-with-echo-module:$PATH prove -r t +$ PATH=/path/to/your/nginx-with-echo-module:$PATH prove -r t ``` You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. @@ -1728,14 +1729,14 @@ TODO ```nginx - echo_log debug "I am being called."; + echo_log debug "I am being called."; ``` * Add support for options `-h` and `-t` to [echo_subrequest_async](#echo_subrequest_async) and [echo_subrequest](#echo_subrequest). For example ```nginx - echo_subrequest POST /sub -q 'foo=Foo&bar=Bar' -b 'hello' -t 'text/plan' -h 'X-My-Header: blah blah' + echo_subrequest POST /sub -q 'foo=Foo&bar=Bar' -b 'hello' -t 'text/plan' -h 'X-My-Header: blah blah' ``` * Add options to control whether a subrequest should inherit cached variables from its parent request (i.e. the current request that is calling the subrequest in question). Currently none of the subrequests issued by this module inherit the cached variables from the parent request. @@ -1746,38 +1747,38 @@ TODO ```nginx - echo_foreach 'cat' 'dog' 'mouse'; - echo_location_async "/animals/$echo_it"; - echo_end; + echo_foreach 'cat' 'dog' 'mouse'; + echo_location_async "/animals/$echo_it"; + echo_end; ``` * Add new directive *echo_foreach_range*, as in ```nginx - echo_foreach_range '[1..100]' '[a-zA-z0-9]'; - echo_location_async "/item/$echo_it"; - echo_end; + echo_foreach_range '[1..100]' '[a-zA-z0-9]'; + echo_location_async "/item/$echo_it"; + echo_end; ``` * Add new directive *echo_repeat*, as in ```nginx - echo_repeat 10 $i { - echo "Page $i"; - echo_location "/path/to/page/$i"; - } + echo_repeat 10 $i { + echo "Page $i"; + echo_location "/path/to/page/$i"; + } ``` This is just another way of saying ```nginx - echo_foreach_range $i [1..10]; - echo "Page $i"; - echo_location "/path/to/page/$i"; - echo_end; + echo_foreach_range $i [1..10]; + echo "Page $i"; + echo_location "/path/to/page/$i"; + echo_end; ``` Thanks Marcus Clyne for providing this idea. @@ -1786,9 +1787,9 @@ Thanks Marcus Clyne for providing this idea. ```nginx - echo_random_min 10 - echo_random_max 200 - echo "random number: $echo_random"; + echo_random_min 10 + echo_random_max 200 + echo "random number: $echo_random"; ``` Thanks Marcus Clyne for providing this idea. @@ -1805,7 +1806,7 @@ You'll be very welcomed to submit patches to the [author](#author) or just ask f Author ====== -Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, OpenResty Inc. +Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, CloudFlare Inc. This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. @@ -1814,7 +1815,7 @@ This wiki page is also maintained by the author himself, and everybody is encour Copyright & License =================== -Copyright (c) 2009-2018, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. +Copyright (c) 2009-2014, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. This module is licensed under the terms of the BSD license. @@ -1845,7 +1846,5 @@ See Also * The original [blog post](http://agentzh.blogspot.com/2009/10/hacking-on-nginx-echo-module.html) about this module's initial development. * The standard [addition filter module](http://nginx.org/en/docs/http/ngx_http_addition_module.html). * The standard [proxy module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html). -* The [OpenResty](http://openresty.org) bundle. - -[Back to TOC](#table-of-contents) +* The [ngx_openresty](http://openresty.org) bundle. diff --git a/debian/modules/nginx-echo/config b/debian/modules/nginx-echo/config new file mode 100644 index 0000000..c0cead0 --- /dev/null +++ b/debian/modules/nginx-echo/config @@ -0,0 +1,5 @@ +ngx_addon_name=ngx_http_echo_module +HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_echo_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_echo_module.c $ngx_addon_dir/src/ngx_http_echo_util.c $ngx_addon_dir/src/ngx_http_echo_timer.c $ngx_addon_dir/src/ngx_http_echo_var.c $ngx_addon_dir/src/ngx_http_echo_handler.c $ngx_addon_dir/src/ngx_http_echo_filter.c $ngx_addon_dir/src/ngx_http_echo_sleep.c $ngx_addon_dir/src/ngx_http_echo_location.c $ngx_addon_dir/src/ngx_http_echo_echo.c $ngx_addon_dir/src/ngx_http_echo_request_info.c $ngx_addon_dir/src/ngx_http_echo_subrequest.c $ngx_addon_dir/src/ngx_http_echo_foreach.c" +NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ngx_http_echo_module.h $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_echo_handler.h $ngx_addon_dir/src/ngx_http_echo_util.h $ngx_addon_dir/src/ngx_http_echo_sleep.h $ngx_addon_dir/src/ngx_http_echo_filter.h $ngx_addon_dir/src/ngx_http_echo_var.h $ngx_addon_dir/src/ngx_http_echo_location.h $ngx_addon_dir/src/ngx_http_echo_echo.h $ngx_addon_dir/src/ngx_http_echo_request_info.h $ngx_addon_dir/src/ngx_http_echo_subrequest.h $ngx_addon_dir/src/ngx_http_echo_foreach.h" + diff --git a/debian/modules/nginx-echo/doc/HttpEchoModule.wiki b/debian/modules/nginx-echo/doc/HttpEchoModule.wiki new file mode 100644 index 0000000..0f03b10 --- /dev/null +++ b/debian/modules/nginx-echo/doc/HttpEchoModule.wiki @@ -0,0 +1,1558 @@ += Name = + +'''ngx_echo''' - Brings "echo", "sleep", "time", "exec" and more shell-style goodies to Nginx config file. + +''This module is not distributed with the Nginx source.'' See [[#Installation|the installation instructions]]. + += Status = + +This module is production ready. + += Version = + +This document describes ngx_echo [https://github.com/agentzh/echo-nginx-module/tags v0.56] released on 2 September 2014. + += Synopsis = + + + location /hello { + echo "hello, world!"; + } + + + + location /hello { + echo -n "hello, "; + echo "world!"; + } + + + + location /timed_hello { + echo_reset_timer; + echo hello world; + echo "'hello world' takes about $echo_timer_elapsed sec."; + echo hiya igor; + echo "'hiya igor' takes about $echo_timer_elapsed sec."; + } + + + + location /echo_with_sleep { + echo hello; + echo_flush; # ensure the client can see previous output immediately + echo_sleep 2.5; # in sec + echo world; + } + + + + # in the following example, accessing /echo yields + # hello + # world + # blah + # hiya + # igor + location /echo { + echo_before_body hello; + echo_before_body world; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + echo_after_body hiya; + echo_after_body igor; + } + location /echo/more { + echo blah; + } + + + + # the output of /main might be + # hello + # world + # took 0.000 sec for total. + # and the whole request would take about 2 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in parallel + echo_location_async /sub1; + echo_location_async /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } + + + + # the output of /main might be + # hello + # world + # took 3.003 sec for total. + # and the whole request would take about 3 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in series (chained by CPS) + echo_location /sub1; + echo_location /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } + + + + # Accessing /dup gives + # ------ END ------ + location /dup { + echo_duplicate 3 "--"; + echo_duplicate 1 " END "; + echo_duplicate 3 "--"; + echo; + } + + + + # /bighello will generate 1000,000,000 hello's. + location /bighello { + echo_duplicate 1000_000_000 'hello'; + } + + + + # echo back the client request + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + + echo_read_request_body; + + echo_request_body; + } + + + + # GET /multi will yields + # querystring: foo=Foo + # method: POST + # body: hi + # content length: 2 + # /// + # querystring: bar=Bar + # method: PUT + # body: hello + # content length: 5 + # /// + location /multi { + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -b 'hello'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } + + + + # GET /merge?/foo.js&/bar/blah.js&/yui/baz.js will merge the .js resources together + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } + + + + # accessing /if?val=abc yields the "hit" output + # while /if?val=bcd yields "miss": + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } + + += Description = + +This module wraps lots of Nginx internal APIs for streaming input and output, parallel/sequential subrequests, timers and sleeping, as well as various meta data accessing. + +Basically it provides various utilities that help testing and debugging of other modules by trivially emulating different kinds of faked subrequest locations. + +People will also find it useful in real-world applications that need to + +# serve static contents directly from memory (loading from the Nginx config file). +# wrap the upstream response with custom header and footer (kinda like the [[HttpAdditionModule|addition module]] but with contents read directly from the config file and Nginx variables). +# merge contents of various "Nginx locations" (i.e., subrequests) together in a single main request (using [[#echo_location|echo_location]] and its friends). + +This is a special dual-role module that can ''lazily'' serve as a content handler or register itself as an output filter only upon demand. By default, this module does not do anything at all. + +Technially, this module has also demonstrated the following techniques that might be helpful for module writers: + +# Issue parallel subreqeusts directly from content handler. +# Issue chained subrequests directly from content handler, by passing continuation along the subrequest chain. +# Issue subrequests with all HTTP 1.1 methods and even an optional faked HTTP request body. +# Interact with the Nginx event model directly from content handler using custom events and timers, and resume the content handler back if necessary. +# Dual-role module that can (lazily) serve as a content handler or an output filter or both. +# Nginx config file variable creation and interpolation. +# Streaming output control using output_chain, flush and its friends. +# Read client request body from the content handler, and returns back (asynchronously) to the content handler after completion. +# Use Perl-based declarative [[#Test Suite|test suite]] to drive the development of Nginx C modules. + += Content Handler Directives = + +Use of the following directives register this module to the current Nginx location as a content handler. If you want to use another module, like the [[HttpProxyModule|standard proxy module]], as the content handler, use the [[#Filter Directives|filter directives]] provided by this module. + +All the content handler directives can be mixed together in a single Nginx location and they're supposed to run sequentially just as in the Bash scripting language. + +Every content handler directive supports variable interpolation in its arguments (if any). + +The MIME type set by the [[HttpCoreModule#default_type|standard default_type directive]] is respected by this module, as in: + + + location /hello { + default_type text/plain; + echo hello; + } + + +Then on the client side: + + + $ curl -I 'http://localhost/echo' + HTTP/1.1 200 OK + Server: nginx/0.8.20 + Date: Sat, 17 Oct 2009 03:40:19 GMT + Content-Type: text/plain + Connection: keep-alive + + +Since the [[#v0.22|v0.22]] release, all of the directives are allowed in the [[HttpRewriteModule|rewrite module]]'s [[HttpRewriteModule#if|if]] directive block, for instance: + + + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } + + +== echo == +'''syntax:''' ''echo [options] ...'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Sends arguments joined by spaces, along with a trailing newline, out to the client. + +Note that the data might be buffered by Nginx's underlying buffer. To force the output data flushed immediately, use the [[#echo_flush|echo_flush]] command just after echo, as in + + + echo hello world; + echo_flush; + + +When no argument is specified, ''echo'' emits the trailing newline alone, just like the ''echo'' command in shell. + +Variables may appear in the arguments. An example is + + + echo The current request uri is $request_uri; + + +where [[HttpCoreModule#$request_uri|$request_uri]] is a variable exposed by the [[HttpCoreModule]]. + +This command can be used multiple times in a single location configuration, as in + + + location /echo { + echo hello; + echo world; + } + + +The output on the client side looks like this + + + $ curl 'http://localhost/echo' + hello + world + + +Special characters like newlines (\n) and tabs (\t) can be escaped using C-style escaping sequences. But a notable exception is the dollar sign ($). As of Nginx 0.8.20, there's still no clean way to esacpe this characters. (A work-around might be to use a $echo_dollor variable that is always evaluated to the constant $ character. This feature will possibly be introduced in a future version of this module.) + +As of the echo [[#v0.28|v0.28]] release, one can suppress the trailing newline character in the output by using the -n option, as in + + + location /echo { + echo -n "hello, "; + echo "world"; + } + + +Accessing /echo gives + + + $ curl 'http://localhost/echo' + hello, world + + +Leading -n in variable values won't take effect and will be emitted literally, as in + + + location /echo { + set $opt -n; + echo $opt "hello,"; + echo "world"; + } + + +This gives the following output + + + $ curl 'http://localhost/echo' + -n hello, + world + + +One can output leading -n literals and other options using the special -- option like this + + + location /echo { + echo -- -n is an option; + } + + +which yields + + + $ curl 'http://localhost/echo' + -n is an option + + +== echo_duplicate == +'''syntax:''' ''echo_duplicate '' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Outputs duplication of a string indicated by the second argument, using the times specified in the first argument. + +For instance, + + + location /dup { + echo_duplicate 3 "abc"; + } + + +will lead to an output of "abcabcabc". + +Underscores are allowed in the count number, just like in Perl. For example, to emit 1000,000,000 instances of "hello, world": + + + location /many_hellos { + echo_duplicate 1000_000_000 "hello, world"; + } + + +The count argument could be zero, but not negative. The second string argument could be an empty string ("") likewise. + +Unlike the [[#echo|echo]] directive, no trailing newline is appended to the result. So it's possible to "abuse" this directive as a no-trailing-newline version of [[#echo|echo]] by using "count" 1, as in + + + location /echo_art { + echo_duplicate 2 '---'; + echo_duplicate 1 ' END '; # we don't want a trailing newline here + echo_duplicate 2 '---'; + echo; # we want a trailing newline here... + } + + +You get + + + ------ END ------ + + +This directive was first introduced in [[#v0.11|version 0.11]]. + +== echo_flush == +'''syntax:''' ''echo_flush'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Forces the data potentially buffered by underlying Nginx output filters to send immediately to the client side via socket. + +Note that techically the command just emits a ngx_buf_t object with flush slot set to 1, so certain weird third-party output filter module could still block it before it reaches Nginx's (last) write filter. + +This directive does not take any argument. + +Consider the following example: + + + location /flush { + echo hello; + + echo_flush; + + echo_sleep 1; + echo world; + } + + +Then on the client side, using curl to access /flush, you'll see the "hello" line immediately, but only after 1 second, the last "world" line. Without calling echo_flush in the example above, you'll most likely see no output until 1 second is elapsed due to the internal buffering of Nginx. + +This directive will fail to flush the output buffer in case of subrequests get involved. Consider the following example: + + + location /main { + echo_location_async /sub; + echo hello; + echo_flush; + } + location /sub { + echo_sleep 1; + } + + +Then the client won't see "hello" appear even if echo_flush has been executed before the subrequest to /sub has actually started executing. The outputs of /main that are sent ''after'' [[#echo_location_async|echo_location_async]] will be postponed and buffered firmly. + +This does ''not'' apply to outputs sent before the subrequest initiated. For a modified version of the example given above: + + + location /main { + echo hello; + echo_flush; + echo_location_async /sub; + } + location /sub { + echo_sleep 1; + } + + +The client will immediately see "hello" before /sub enters sleeping. + +See also [[#echo|echo]], [[#echo_sleep|echo_sleep]], and [[#echo_location_async|echo_location_async]]. + +== echo_sleep == +'''syntax:''' ''echo_sleep '' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Sleeps for the time period specified by the argument, which is in seconds. + +This operation is non-blocking on server side, so unlike the [[#echo_blocking_sleep|echo_blocking_sleep]] directive, it won't block the whole Nginx worker process. + +The period might takes three digits after the decimal point and must be greater than 0.001. + +An example is + + + location /echo_after_sleep { + echo_sleep 1.234; + echo resumed!; + } + + +Behind the scene, it sets up a per-request "sleep" ngx_event_t object, and adds a timer using that custom event to the Nginx event model and just waits for a timeout on that event. Because the "sleep" event is per-request, this directive can work in parallel subrequests. + +== echo_blocking_sleep == +'''syntax:''' ''echo_blocking_sleep '' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +This is a blocking version of the [[#echo_sleep|echo_sleep]] directive. + +See the documentation of [[#echo_sleep|echo_sleep]] for more detail. + +Behind the curtain, it calls the ngx_msleep macro provided by the Nginx core which maps to usleep on POSIX-compliant systems. + +Note that this directive will block the current Nginx worker process completely while being executed, so never use it in production environment. + +== echo_reset_timer == +'''syntax:''' ''echo_reset_timer'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Reset the timer begin time to ''now'', i.e., the time when this command is executed during request. + +The timer begin time is default to the starting time of the current request and can be overridden by this directive, potentially multiple times in a single location. For example: + + + location /timed_sleep { + echo_sleep 0.03; + echo "$echo_timer_elapsed sec elapsed."; + + echo_reset_timer; + + echo_sleep 0.02; + echo "$echo_timer_elapsed sec elapsed."; + } + + +The output on the client side might be + + + $ curl 'http://localhost/timed_sleep' + 0.032 sec elapsed. + 0.020 sec elapsed. + + +The actual figures you get on your side may vary a bit due to your system's current activities. + +Invocation of this directive will force the underlying Nginx timer to get updated to the current system time (regardless the timer resolution specified elsewhere in the config file). Furthermore, references of the [[#$echo_timer_elapsed|$echo_timer_elapsed]] variable will also trigger timer update forcibly. + +See also [[#echo_sleep|echo_sleep]] and [[#$echo_timer_elapsed|$echo_timer_elapsed]]. + +== echo_read_request_body == +'''syntax:''' ''echo_read_request_body'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Explicitly reads request body so that the [[HttpCoreModule#$request_body|$request_body]] variable will always have non-empty values (unless the body is so big that it has been saved by Nginx to a local temporary file). + +Note that this might not be the original client request body because the current request might be a subrequest with a "artificial" body specified by its parent. + +This directive does not generate any output itself, just like [[#echo_sleep|echo_sleep]]. + +Here's an example for echo'ing back the original HTTP client request (both headers and body are included): + + + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + echo_read_request_body; + echo $request_body; + } + + +The content of /echoback looks like this on my side (I was using Perl's LWP utility to access this location on the server): + + + $ (echo hello; echo world) | lwp-request -m POST 'http://localhost/echoback' + POST /echoback HTTP/1.1 + TE: deflate,gzip;q=0.3 + Connection: TE, close + Host: localhost + User-Agent: lwp-request/5.818 libwww-perl/5.820 + Content-Length: 12 + Content-Type: application/x-www-form-urlencoded + + hello + world + + +Because /echoback is the main request, [[HttpCoreModule#$request_body|$request_body]] holds the original client request body. + +Before Nginx 0.7.56, it makes no sense to use this directive because [[HttpCoreModule#$request_body|$request_body]] was first introduced in Nginx 0.7.58. + +This directive itself was first introduced in the echo module's [[#v0.14|v0.14 release]]. + +== echo_location_async == +'''syntax:''' ''echo_location_async []'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Issue GET subrequest to the location specified (first argument) with optional url arguments specified in the second argument. + +As of Nginx 0.8.20, the location argument does ''not'' support named location, due to a limitation in the ngx_http_subrequest function. The same is true for its brother, the [[#echo_location|echo_location]] directive. + +A very simple example is + + + location /main { + echo_location_async /sub; + echo world; + } + location /sub { + echo hello; + } + + +Accessing /main gets + + + hello + world + + +Calling multiple locations in parallel is also possible: + + + location /main { + echo_reset_timer; + echo_location_async /sub1; + echo_location_async /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; # sleeps 2 sec + echo hello; + } + location /sub2 { + echo_sleep 1; # sleeps 1 sec + echo world; + } + + +Accessing /main yields + + + $ time curl 'http://localhost/main' + hello + world + took 0.000 sec for total. + + real 0m2.006s + user 0m0.000s + sys 0m0.004s + + +You can see that the main handler /main does ''not'' wait the subrequests /sub1 and /sub2 to complete and quickly goes on, hence the "0.000 sec" timing result. The whole request, however takes approximately 2 sec in total to complete because /sub1 and /sub2 run in parallel (or "concurrently" to be more accurate). + +If you use [[#echo_blocking_sleep|echo_blocking_sleep]] in the previous example instead, then you'll get the same output, but with 3 sec total response time, because "blocking sleep" blocks the whole Nginx worker process. + +Locations can also take an optional querystring argument, for instance + + + location /main { + echo_location_async /sub 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } + + +Accessing /main yields + + + $ curl 'http://localhost/main' + Foo Bar + + +Querystrings is ''not'' allowed to be concatenated onto the location argument with "?" directly, for example, /sub?foo=Foo&bar=Bar is an invalid location, and shouldn't be fed as the first argument to this directive. + +Technically speaking, this directive is an example that Nginx content handler issues one or more subrequests directly. AFAIK, the [https://connectical.com/projects/ngx-fancyindex/wiki fancyindex module] also does such kind of things ;) + +Nginx named locations like @foo is ''not'' supported here. + +This directive is logically equivalent to the GET version of [[#echo_subrequest_async|echo_subrequest_async]]. For example, + + + echo_location_async /foo 'bar=Bar'; + + +is logically equivalent to + + + echo_subrequest_async GET /foo -q 'bar=Bar'; + + +But calling this directive is slightly faster than calling [[#echo_subrequest_async|echo_subrequest_async]] using GET because we don't have to parse the HTTP method names like GET and options like -q. + +There is a known issue with this directive when disabling the standard [[HttpSsiModule|standard SSI module]]. See [[#Known Issues|Known Issues]] for more details. + +This directive is first introduced in [[#v0.09|version 0.09]] of this module and requires at least Nginx 0.7.46. + +== echo_location == +'''syntax:''' ''echo_location []'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Just like the [[#echo_location_async|echo_location_async]] directive, but echo_location issues subrequests ''in series'' rather than in parallel. That is, the content handler directives following this directive won't be executed until the subrequest issued by this directive completes. + +The final response body is almost always equivalent to the case when [[#echo_location_async|echo_location_async]] is used instead, only if timing variables is used in the outputs. + +Consider the following example: + + + location /main { + echo_reset_timer; + echo_location /sub1; + echo_location /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } + + +The location /main above will take for total 3 sec to complete (compared to 2 sec if [[#echo_location_async|echo_location_async]] is used instead here). Here's the result in action on my machine: + + + $ curl 'http://localhost/main' + hello + world + took 3.003 sec for total. + + real 0m3.027s + user 0m0.020s + sys 0m0.004s + + +This directive is logically equivalent to the GET version of [[#echo_subrequest|echo_subrequest]]. For example, + + + echo_location /foo 'bar=Bar'; + + +is logically equivalent to + + + echo_subrequest GET /foo -q 'bar=Bar'; + + +But calling this directive is slightly faster than calling [[#echo_subrequest|echo_subrequest]] using GET because we don't have to parse the HTTP method names like GET and options like -q. + +Behind the scene, it creates an ngx_http_post_subrequest_t object as a ''continuation'' and passes it into the ngx_http_subrequest function call. Nginx will later reopen this "continuation" in the subrequest's ngx_http_finalize_request function call. We resumes the execution of the parent-request's content handler and starts to run the next directive (command) if any. + +Nginx named locations like @foo is ''not'' supported here. + +This directive was first introduced in the [[#v0.12|release v0.12]]. + +See also [[#echo_location_async|echo_location_async]] for more details about the meaning of the arguments. + +== echo_subrequest_async == +'''syntax:''' ''echo_subrequest_async [-q ] [-b ] [-f ]'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Initiate an asynchronous subrequest using HTTP method, an optional url arguments (or querystring) and an optional request body which can be defined as a string or as a path to a file which contains the body. + +This directive is very much like a generalized version of the [[#echo_location_async|echo_location_async]] directive. + +Here's a small example demonstrating its usage: + + + location /multi { + # body defined as string + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + # body defined as path to a file, relative to nginx prefix path if not absolute + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -f '/tmp/hello.txt'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } + + +Then on the client side: + + + $ echo -n hello > /tmp/hello.txt + $ curl 'http://localhost/multi' + querystring: foo=Foo + method: POST + body: hi + content length: 2 + /// + querystring: bar=Bar + method: PUT + body: hello + content length: 5 + /// + + +Here's more funny example using the standard [[#HttpProxyModule|proxy module]] to handle the subrequest: + + + location /main { + echo_subrequest_async POST /sub -b 'hello, world'; + } + location /sub { + proxy_pass $scheme://127.0.0.1:$server_port/proxied; + } + location /proxied { + echo "method: $echo_request_method."; + + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo_read_request_body; + + echo "body: $echo_request_body."; + } + + +Then on the client side, we can see that + + + $ curl 'http://localhost/main' + method: POST. + body: hello, world. + + +Nginx named locations like @foo is ''not'' supported here. + +This directive takes several options: + + + -q Specify the URL arguments (or URL querystring) for the subrequest. + + -f Specify the path for the file whose content will be serve as the + subrequest's request body. + + -b Specify the request body data + + +This directive was first introduced in the [[#v0.15|release v0.15]]. + +The -f option to define a file path for the body was introduced in the [[#v0.35|release v0.35]]. + +See also the [[#echo_subrequest|echo_subrequest]] and [[#echo_location_async|echo_location_async]] directives. + +There is a known issue with this directive when disabling the standard [[HttpSsiModule|standard SSI module]]. See [[#Known Issues|Known Issues]] for more details. + +== echo_subrequest == +'''syntax:''' ''echo_subrequest [-q ] [-b ] [-f ]'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +This is the synchronous version of the [[#echo_subrequest_async|echo_subrequest_async]] directive. And just like [[#echo_location|echo_location]], it does not block the Nginx worker process (while [[#echo_blocking_sleep|echo_blocking_sleep]] does), rather, it uses continuation to pass control along the subrequest chain. + +See [[#echo_subrequest_async|echo_subrequest_async]] for more details. + +Nginx named locations like @foo is ''not'' supported here. + +This directive was first introduced in the [[#v0.15|release v0.15]]. + +== echo_foreach_split == +'''syntax:''' ''echo_foreach_split '' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Split the second argument string using the delimiter specified in the first argument, and then iterate through the resulting items. For instance: + + + location /loop { + echo_foreach_split ',' $arg_list; + echo "item: $echo_it"; + echo_end; + } + + +Accessing /main yields + + + $ curl 'http://localhost/loop?list=cat,dog,mouse' + item: cat + item: dog + item: mouse + + +As seen in the previous example, this directive should always be accompanied by an [[#echo_end|echo_end]] directive. + +Parallel echo_foreach_split loops are allowed, but nested ones are currently forbidden. + +The delimiter argument could contain ''multiple'' arbitrary characters, like + + + # this outputs "cat\ndog\nmouse\n" + echo_foreach_split -- '-a-' 'cat-a-dog-a-mouse'; + echo $echo_it; + echo_end; + + +Logically speaking, this looping structure is just the foreach loop combined with a split function call in Perl (using the previous example): + + + foreach (split ',', $arg_list) { + print "item $_\n"; + } + + +People will also find it useful in merging multiple .js or .css resources into a whole. Here's an example: + + + location /merge { + default_type 'text/javascript'; + + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } + + +Then accessing /merge to merge the .js resources specified in the query string: + + + $ curl 'http://localhost/merge?/foo/bar.js&/yui/blah.js&/baz.js' + + +One can also use third-party Nginx cache module to cache the merged response generated by the /merge location in the previous example. + +This directive was first introduced in the [[#v0.17|release v0.17]]. + +== echo_end == +'''syntax:''' ''echo_end'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +This directive is used to terminate the body of looping and conditional control structures like [[#echo_foreach_split|echo_foreach_split]]. + +This directive was first introduced in the [[#v0.17|release v0.17]]. + +== echo_request_body == +'''syntax:''' ''echo_request_body'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Outputs the contents of the request body previous read. + +Behind the scene, it's implemented roughly like this: + + + if (r->request_body && r->request_body->bufs) { + return ngx_http_output_filter(r, r->request_body->bufs); + } + + +Unlike the [[#$echo_request_body|$echo_request_body]] and $request_body variables, this directive will show the whole request body even if some parts or all parts of it are saved in temporary files on the disk. + +It is a "no-op" if no request body has been read yet. + +This directive was first introduced in the [[#v0.18|release v0.18]]. + +See also [[#echo_read_request_body|echo_read_request_body]] and the [[HttpChunkinModule|chunkin module]]. + +== echo_exec == +'''syntax:''' ''echo_exec []'' + +'''syntax:''' ''echo_exec '' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Does an internal redirect to the location specified. An optional query string can be specified for normal locations, as in + + + location /foo { + echo_exec /bar weight=5; + } + location /bar { + echo $arg_weight; + } + + +Or equivalently + + + location /foo { + echo_exec /bar?weight=5; + } + location /bar { + echo $arg_weight; + } + + +Named locations are also supported. Here's an example: + + + location /foo { + echo_exec @bar; + } + location @bar { + # you'll get /foo rather than @bar + # due to a potential bug in nginx. + echo $echo_request_uri; + } + + +But query string (if any) will always be ignored for named location redirects due to a limitation in the ngx_http_named_location function. + +Never try to echo things before the echo_exec directive or you won't see the proper response of the location you want to redirect to. Because any echoing will cause the original location handler to send HTTP headers before the redirection happens. + +Technically speaking, this directive exposes the Nginx internal API functions ngx_http_internal_redirect and ngx_http_named_location. + +This directive was first introduced in the [[#v0.21|v0.21 release]]. + +== echo_status == +'''syntax:''' ''echo_status '' + +'''default:''' ''echo_status 200'' + +'''context:''' ''location, location if'' + +'''phase:''' ''content'' + +Specify the default response status code. Default to 200. This directive is declarative and the relative order with other echo-like directives is not important. + +Here is an example, + + + location = /bad { + echo_status 404; + echo "Something is missing..."; + } + + +then we get a response like this: + + + HTTP/1.1 404 Not Found + Server: nginx/1.2.1 + Date: Sun, 24 Jun 2012 03:58:18 GMT + Content-Type: text/plain + Transfer-Encoding: chunked + Connection: keep-alive + + Something is missing... + + +This directive was first introduced in the v0.40 release. + += Filter Directives = + +Use of the following directives trigger the filter registration of this module. By default, no filter will be registered by this module. + +Every filter directive supports variable interpolation in its arguments (if any). + +== echo_before_body == +'''syntax:''' ''echo_before_body [options] [argument]...'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''output filter'' + +It's the filter version of the [[#echo|echo]] directive, and prepends its output to the beginning of the original outputs generated by the underlying content handler. + +An example is + + + location /echo { + echo_before_body hello; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world + } + + +Accessing /echo from the client side yields + + + hello + world + + +In the previous sample, we borrow the [[HttpProxyModule|standard proxy module]] to serve as the underlying content handler that generates the "main contents". + +Multiple instances of this filter directive are also allowed, as in: + + + location /echo { + echo_before_body hello; + echo_before_body world; + echo !; + } + + +On the client side, the output is like + + + $ curl 'http://localhost/echo' + hello + world + ! + + +In this example, we also use the [[#Content Handler Directives|content handler directives]] provided by this module as the underlying content handler. + +This directive also supports the -n and -- options like the [[#echo|echo]] directive. + +This directive can be mixed with its brother directive [[#echo_after_body|echo_after_body]]. + +== echo_after_body == +'''syntax:''' ''echo_after_body [argument]...'' + +'''default:''' ''no'' + +'''context:''' ''location, location if'' + +'''phase:''' ''output filter'' + +It's very much like the [[#echo_before_body|echo_before_body]] directive, but ''appends'' its output to the end of the original outputs generated by the underlying content handler. + +Here's a simple example: + + + location /echo { + echo_after_body hello; + proxy_pass http://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world + } + + +Accessing /echo from the client side yields + + + world + hello + + +Multiple instances are allowed, as in: + + + location /echo { + echo_after_body hello; + echo_after_body world; + echo i; + echo say; + } + + +The output on the client side while accessing the /echo location looks like + + + i + say + hello + world + + +This directive also supports the -n and -- options like the [[#echo|echo]] directive. + +This directive can be mixed with its brother directive [[#echo_before_body|echo_before_body]]. + += Variables = + +== $echo_it == + +This is a "topic variable" used by [[#echo_foreach_split|echo_foreach_split]], just like the $_ variable in Perl. + +== $echo_timer_elapsed == + +This variable holds the seconds elapsed since the start of the current request (might be a subrequest though) or the last invocation of the [[#echo_reset_timer|echo_reset_timer]] command. + +The timing result takes three digits after the decimal point. + +References of this variable will force the underlying Nginx timer to update to the current system time, regardless the timer resolution settings elsewhere in the config file, just like the [[#echo_reset_timer|echo_reset_timer]] directive. + +== $echo_request_body == + +Evaluates to the current (sub)request's request body previously read if no part of the body has been saved to a temporary file. To always show the request body even if it's very large, use the [[#echo_request_body|echo_request_body]] directive. + +== $echo_request_method == + +Evaluates to the HTTP request method of the current request (it can be a subrequest). + +Behind the scene, it just takes the string data stored in r->method_name. + +Compare it to the [[#$echo_client_request_method|$echo_client_request_method]] variable. + +At least for Nginx 0.8.20 and older, the [[HttpCoreModule#$request_method|$request_method]] variable provided by the [[HttpCoreModule|http core module]] is actually doing what our [[#$echo_client_request_method|$echo_client_request_method]] is doing. + +This variable was first introduced in our [[#v0.15|v0.15 release]]. + +== $echo_client_request_method == + +Always evaluates to the main request's HTTP method even if the current request is a subrequest. + +Behind the scene, it just takes the string data stored in r->main->method_name. + +Compare it to the [[#$echo_request_method|$echo_request_method]] variable. + +This variable was first introduced in our [[#v0.15|v0.15 release]]. + +== $echo_client_request_headers == + +Evaluates to the original client request's headers. + +Just as the name suggests, it will always take the main request (or the client request) even if it's currently executed in a subrequest. + +A simple example is below: + + + location /echoback { + echo "headers are:" + echo $echo_client_request_headers; + } + + +Accessing /echoback yields + + + $ curl 'http://localhost/echoback' + headers are + GET /echoback HTTP/1.1 + User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g + Host: localhost:1984 + Accept: */* + + +Behind the scene, it recovers r->main->header_in (or the large header buffers, if any) on the C level and does not construct the headers itself by traversing parsed results in the request object. + +This variable was first introduced in [[#v0.15|version 0.15]]. + +== $echo_cacheable_request_uri == + +Evaluates to the parsed form of the URI (usually led by /) of the current (sub-)request. Unlike the [[#$echo_request_uri|$echo_request_uri]] variable, it is cacheable. + +See [[#$echo_request_uri|$echo_request_uri]] for more details. + +This variable was first introduced in [[#v0.17|version 0.17]]. + +== $echo_request_uri == + +Evaluates to the parsed form of the URI (usually led by /) of the current (sub-)request. Unlike the [[#$echo_cacheable_request_uri|$echo_cacheable_request_uri]] variable, it is ''not'' cacheable. + +This is quite different from the [[HttpCoreModule#$request_uri|$request_uri]] variable exported by the [[HttpCoreModule]], because $request_uri is the ''unparsed'' form of the current request's URI. + +This variable was first introduced in [[#v0.17|version 0.17]]. + +== $echo_incr == + +It is a counter that always generate the current counting number, starting from 1. The counter is always associated with the main request even if it is accessed within a subrequest. + +Consider the following example + + + location /main { + echo "main pre: $echo_incr"; + echo_location_async /sub; + echo_location_async /sub; + echo "main post: $echo_incr"; + } + location /sub { + echo "sub: $echo_incr"; + } + + +Accessing /main yields + + main pre: 1 + sub: 3 + sub: 4 + main post: 2 + +This directive was first introduced in the [[#v0.18|v0.18 release]]. + +== $echo_response_status == + +Evaluates to the status code of the current (sub)request, null if not any. + +Behind the scene, it's just the textual representation of r->headers_out->status. + +This directive was first introduced in the [[#v0.23|v0.23 release]]. + += Installation = + +You're recommended to install this module (as well as the Nginx core and many other goodies) via the [http://openresty.org ngx_openresty bundle]. See [http://openresty.org/#Installation the detailed instructions] for downloading and installing ngx_openresty into your system. This is the easiest and most safe way to set things up. + +Alternatively, you can install this module manually with the Nginx source: + +Grab the nginx source code from [http://nginx.org/ nginx.org], for example, +the version 1.7.4 (see [[#Compatibility|nginx compatibility]]), and then build the source with this module: + + + $ wget 'http://nginx.org/download/nginx-1.7.4.tar.gz' + $ tar -xzvf nginx-1.7.4.tar.gz + $ cd nginx-1.7.4/ + + # Here we assume you would install you nginx under /opt/nginx/. + $ ./configure --prefix=/opt/nginx \ + --add-module=/path/to/echo-nginx-module + + $ make -j2 + $ make install + + +Download the latest version of the release tarball of this module from [https://github.com/agentzh/echo-nginx-module/tags echo-nginx-module file list]. + +Also, this module is included and enabled by default in the [http://openresty.org ngx_openresty bundle]. + += Compatibility = + +The following versions of Nginx should work with this module: + +* '''1.7.x''' (last tested: 1.7.4) +* '''1.6.x''' +* '''1.5.x''' (last tested: 1.5.12) +* '''1.4.x''' (last tested: 1.4.4) +* '''1.3.x''' (last tested: 1.3.7) +* '''1.2.x''' (last tested: 1.2.9) +* '''1.1.x''' (last tested: 1.1.5) +* '''1.0.x''' (last tested: 1.0.11) +* '''0.9.x''' (last tested: 0.9.4) +* '''0.8.x''' (last tested: 0.8.54) +* '''0.7.x >= 0.7.21''' (last tested: 0.7.68) + +In particular, + +* the directive [[#echo_location_async|echo_location_async]] and its brother [[#echo_subrequest_async|echo_subrequest_async]] do ''not'' work with '''0.7.x < 0.7.46'''. +* the [[#echo_after_body|echo_after_body]] directive does ''not'' work at all with nginx '''< 0.8.7'''. +* the [[#echo_sleep|echo_sleep]] directive cannot be used after [[#echo_location|echo_location]] or [[#echo_subrequest|echo_subrequest]] for nginx '''< 0.8.11'''. + +Earlier versions of Nginx like 0.6.x and 0.5.x will ''not'' work at all. + +If you find that any particular version of Nginx above 0.7.21 does not work with this module, please consider [[#Report Bugs|reporting a bug]]. + += Known Issues = + +Due to an unknown bug in Nginx (it still exists in Nginx 1.7.4), the [[HttpSsiModule|standard SSI module]] is required to ensure that the contents of the subrequests issued by [[#echo_location_async|echo_locatoin_async]] and [[#echo_subrequest_async|echo_subrequest_async]] are correctly merged into the output chains of the main one. Fortunately, the SSI module is enabled by default during Nginx's configure process. + +If calling this directive without SSI module enabled, you'll get truncated response without contents of any subrequests and get an alert message in your Nginx's error.log, like this: + + + [alert] 24212#0: *1 the http output chain is empty, client: 127.0.0.1, ... + + += Modules that use this module for testing = + +The following modules take advantage of this echo module in their test suite: + +* The [[HttpMemcModule|memc]] module that supports almost the whole memcached TCP protocol. +* The [[HttpChunkinModule|chunkin]] module that adds HTTP 1.1 chunked input support to Nginx. +* The [[HttpHeadersMoreModule|headers_more]] module that allows you to add, set, and clear input and output headers under the conditions that you specify. +* The echo module itself. + +Please mail me other modules that use echo in any form and I'll add them to the list above :) + += Community = + +== English Mailing List == + +The [https://groups.google.com/group/openresty-en openresty-en] mailing list is for English speakers. + +== Chinese Mailing List == + +The [https://groups.google.com/group/openresty openresty] mailing list is for Chinese speakers. + += Report Bugs = + +Although a lot of effort has been put into testing and code tuning, there must be some serious bugs lurking somewhere in this module. So whenever you are bitten by any quirks, please don't hesitate to + +# create a ticket on the [https://github.com/agentzh/echo-nginx-module/issues issue tracking interface] provided by GitHub, +# or send a bug report, questions, or even patches to the [[#Community|OpenResty Community]]. + += Source Repository = + +Available on github at [https://github.com/agentzh/echo-nginx-module agentzh/echo-nginx-module]. + += Changes = + +The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: + +http://openresty.org/#Changes + += Test Suite = + +This module comes with a Perl-driven test suite. The [https://github.com/agentzh/echo-nginx-module/tree/master/t/ test cases] are +[https://github.com/agentzh/echo-nginx-module/blob/master/t/echo.t declarative] too. Thanks to the [http://search.cpan.org/perldoc?Test::Nginx Test::Nginx] module in the Perl world. + +To run it on your side: + + + $ PATH=/path/to/your/nginx-with-echo-module:$PATH prove -r t + + +You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. + +Because a single nginx server (by default, localhost:1984) is used across all the test scripts (.t files), it's meaningless to run the test suite in parallel by specifying -jN when invoking the prove utility. + +Some parts of the test suite requires standard modules [[HttpProxyModule|proxy]], [[HttpRewriteModule|rewrite]] and [[HttpSsiModule|SSI]] to be enabled as well when building Nginx. + += TODO = + +* Fix the [[#echo_after_body|echo_after_body]] directive in subrequests. +* Add directives ''echo_read_client_request_body'' and ''echo_request_headers''. +* Add new directive ''echo_log'' to use Nginx's logging facility directly from the config file and specific loglevel can be specified, as in + + + echo_log debug "I am being called."; + + +* Add support for options -h and -t to [[#echo_subrequest_async|echo_subrequest_async]] and [[#echo_subrequest|echo_subrequest]]. For example + + + echo_subrequest POST /sub -q 'foo=Foo&bar=Bar' -b 'hello' -t 'text/plan' -h 'X-My-Header: blah blah' + + +* Add options to control whether a subrequest should inherit cached variables from its parent request (i.e. the current request that is calling the subrequest in question). Currently none of the subrequests issued by this module inherit the cached variables from the parent request. +* Add new variable ''$echo_active_subrequests'' to show r->main->count - 1. +* Add the ''echo_file'' and ''echo_cached_file'' directives. +* Add new varaible ''$echo_request_headers'' to accompany the existing [[#$echo_client_request_headers|$echo_client_request_headers]] variable. +* Add new directive ''echo_foreach'', as in + + + echo_foreach 'cat' 'dog' 'mouse'; + echo_location_async "/animals/$echo_it"; + echo_end; + + +* Add new directive ''echo_foreach_range'', as in + + + echo_foreach_range '[1..100]' '[a-zA-z0-9]'; + echo_location_async "/item/$echo_it"; + echo_end; + + +* Add new directive ''echo_repeat'', as in + + + echo_repeat 10 $i { + echo "Page $i"; + echo_location "/path/to/page/$i"; + } + + +This is just another way of saying + + + echo_foreach_range $i [1..10]; + echo "Page $i"; + echo_location "/path/to/page/$i"; + echo_end; + + +Thanks Marcus Clyne for providing this idea. + +* Add new variable $echo_random which always returns a random non-negative integer with the lower/upper limit specified by the new directives echo_random_min and echo_random_max. For example, + + + echo_random_min 10 + echo_random_max 200 + echo "random number: $echo_random"; + + +Thanks Marcus Clyne for providing this idea. + += Getting involved = + +You'll be very welcomed to submit patches to the [[#Author|author]] or just ask for a commit bit to the [[#Source Repository|source repository]] on GitHub. + += Author = + +Yichun "agentzh" Zhang (章亦春) '''', CloudFlare Inc. + +This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. + += Copyright & License = + +Copyright (c) 2009-2014, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. + +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += See Also = + +* The original [http://agentzh.blogspot.com/2009/10/hacking-on-nginx-echo-module.html blog post] about this module's initial development. +* The standard [[HttpAdditionModule|addition filter module]]. +* The standard [[HttpProxyModule|proxy module]]. +* The [http://openresty.org ngx_openresty] bundle. + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h b/debian/modules/nginx-echo/src/ddebug.h similarity index 90% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h rename to debian/modules/nginx-echo/src/ddebug.h index a92d7a7..e812446 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h +++ b/debian/modules/nginx-echo/src/ddebug.h @@ -1,7 +1,6 @@ #ifndef DDEBUG_H #define DDEBUG_H -#include #include #include @@ -20,8 +19,7 @@ #include -static ngx_inline void -dd(const char * fmt, ...) { +static void dd(const char * fmt, ...) { } # endif @@ -30,8 +28,7 @@ dd(const char * fmt, ...) { # define dd_enter() dd_enter_helper(r, __func__) -static ngx_inline void -dd_enter_helper(ngx_http_request_t *r, const char *func) { +static void dd_enter_helper(ngx_http_request_t *r, const char *func) { ngx_http_posted_request_t *pr; fprintf(stderr, ">enter %s %.*s %.*s?%.*s c:%d m:%p r:%p ar:%p pr:%p", @@ -71,12 +68,10 @@ dd_enter_helper(ngx_http_request_t *r, const char *func) { #include -static ngx_inline void -dd(const char * fmt, ...) { +static void dd(const char * fmt, ...) { } -static ngx_inline void -dd_enter() { +static void dd_enter() { } # endif diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c b/debian/modules/nginx-echo/src/ngx_http_echo_echo.c similarity index 98% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c rename to debian/modules/nginx-echo/src/ngx_http_echo_echo.c index f5789f5..5fa5a7f 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_echo.c @@ -94,6 +94,7 @@ ngx_http_echo_exec_echo(ngx_http_request_t *r, ngx_chain_t *cl = NULL; /* the head of the chain link */ ngx_chain_t **ll = &cl; /* always point to the address of the last link */ + dd_enter(); if (computed_args == NULL) { @@ -172,7 +173,6 @@ ngx_http_echo_exec_echo(ngx_http_request_t *r, if (opts && opts->nelts > 0) { opt = opts->elts; - /* FIXME handle other unrecognized options here */ if (opt[0].len == 1 && opt[0].data[0] == 'n') { goto done; } @@ -287,13 +287,15 @@ ngx_http_echo_exec_echo_duplicate(ngx_http_request_t *r, { ngx_str_t *computed_arg; ngx_str_t *computed_arg_elts; - ssize_t i, count; + ssize_t i, count; ngx_str_t *str; u_char *p; - ngx_int_t rc; + ngx_int_t rc; + ngx_buf_t *buf; ngx_chain_t *cl; + dd_enter(); computed_arg_elts = computed_args->elts; diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h b/debian/modules/nginx-echo/src/ngx_http_echo_echo.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h rename to debian/modules/nginx-echo/src/ngx_http_echo_echo.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c b/debian/modules/nginx-echo/src/ngx_http_echo_filter.c similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c rename to debian/modules/nginx-echo/src/ngx_http_echo_filter.c diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h b/debian/modules/nginx-echo/src/ngx_http_echo_filter.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h rename to debian/modules/nginx-echo/src/ngx_http_echo_filter.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c b/debian/modules/nginx-echo/src/ngx_http_echo_foreach.c similarity index 96% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c rename to debian/modules/nginx-echo/src/ngx_http_echo_foreach.c index a4a2b54..44e1549 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_foreach.c @@ -14,7 +14,7 @@ ngx_http_echo_it_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { ngx_http_echo_ctx_t *ctx; - ngx_uint_t i; + ngx_uint_t i; ngx_array_t *choices; ngx_str_t *choice_elts, *choice; @@ -156,8 +156,8 @@ ngx_http_echo_exec_echo_end(ngx_http_request_t *r, { if (ctx->foreach == NULL) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "Found a echo_end that has no corresponding echo_foreach " - "before it."); + "Found a echo_end that has no corresponding echo_foreach " + "before it."); return NGX_ERROR; } diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h b/debian/modules/nginx-echo/src/ngx_http_echo_foreach.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h rename to debian/modules/nginx-echo/src/ngx_http_echo_foreach.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c b/debian/modules/nginx-echo/src/ngx_http_echo_handler.c similarity index 98% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c rename to debian/modules/nginx-echo/src/ngx_http_echo_handler.c index 120c8b0..bb506e3 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_handler.c @@ -93,7 +93,7 @@ ngx_http_echo_wev_handler(ngx_http_request_t *r) dd("finalizing with rc %d", (int) rc); dd("finalize request %.*s with %d", (int) r->uri.len, r->uri.data, - (int) rc); + (int) rc); ngx_http_finalize_request(r, rc); } @@ -164,6 +164,7 @@ ngx_http_echo_run_cmds(ngx_http_request_t *r) ngx_http_echo_cmd_t *cmd_elts; ngx_array_t *opts = NULL; + elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); cmds = elcf->handler_cmds; if (cmds == NULL) { @@ -181,7 +182,7 @@ ngx_http_echo_run_cmds(ngx_http_request_t *r) } dd("exec handler: %.*s: %i", (int) r->uri.len, r->uri.data, - (int) ctx->next_handler_cmd); + (int) ctx->next_handler_cmd); cmd_elts = cmds->elts; @@ -213,14 +214,8 @@ ngx_http_echo_run_cmds(ngx_http_request_t *r) } } - if (computed_args == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - /* do command dispatch based on the opcode */ - switch (cmd->opcode) { - case echo_opcode_echo_sync: rc = ngx_http_echo_exec_echo_sync(r, ctx); break; @@ -356,6 +351,7 @@ read_request_body: ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "unknown opcode: %d", cmd->opcode); return NGX_HTTP_INTERNAL_SERVER_ERROR; + break; } if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h b/debian/modules/nginx-echo/src/ngx_http_echo_handler.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h rename to debian/modules/nginx-echo/src/ngx_http_echo_handler.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c b/debian/modules/nginx-echo/src/ngx_http_echo_location.c similarity index 98% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c rename to debian/modules/nginx-echo/src/ngx_http_echo_location.c index 820e504..bfabb5e 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_location.c @@ -89,10 +89,6 @@ ngx_http_echo_exec_echo_location(ngx_http_request_t *r, ngx_uint_t flags = 0; ngx_http_echo_ctx_t *sr_ctx; - if (computed_args == NULL) { - return NGX_ERROR; - } - computed_arg_elts = computed_args->elts; location = computed_arg_elts[0]; diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h b/debian/modules/nginx-echo/src/ngx_http_echo_location.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h rename to debian/modules/nginx-echo/src/ngx_http_echo_location.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c b/debian/modules/nginx-echo/src/ngx_http_echo_module.c similarity index 91% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c rename to debian/modules/nginx-echo/src/ngx_http_echo_module.c index 8d736d7..eade972 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_module.c @@ -17,57 +17,55 @@ #include "ngx_http_echo_var.h" #include "ngx_http_echo_util.h" - #include #include #include - /* config init handler */ -static void *ngx_http_echo_create_loc_conf(ngx_conf_t *cf); -static char *ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, +static void * ngx_http_echo_create_loc_conf(ngx_conf_t *cf); +static char * ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child); static void *ngx_http_echo_create_main_conf(ngx_conf_t *cf); static ngx_int_t ngx_http_echo_post_config(ngx_conf_t *cf); /* config directive handlers */ -static char *ngx_http_echo_echo(ngx_conf_t *cf, ngx_command_t *cmd, +static char * ngx_http_echo_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_request_body(ngx_conf_t *cf, +static char * ngx_http_echo_echo_request_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_sleep(ngx_conf_t *cf, ngx_command_t *cmd, +static char * ngx_http_echo_echo_sleep(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_flush(ngx_conf_t *cf, ngx_command_t *cmd, +static char * ngx_http_echo_echo_flush(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_blocking_sleep(ngx_conf_t *cf, +static char * ngx_http_echo_echo_blocking_sleep(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_reset_timer(ngx_conf_t *cf, +static char * ngx_http_echo_echo_reset_timer(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_before_body(ngx_conf_t *cf, +static char * ngx_http_echo_echo_before_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_after_body(ngx_conf_t *cf, +static char * ngx_http_echo_echo_after_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_location_async(ngx_conf_t *cf, +static char * ngx_http_echo_echo_location_async(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_location(ngx_conf_t *cf, +static char * ngx_http_echo_echo_location(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_subrequest_async(ngx_conf_t *cf, +static char * ngx_http_echo_echo_subrequest_async(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_subrequest(ngx_conf_t *cf, +static char * ngx_http_echo_echo_subrequest(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_duplicate(ngx_conf_t *cf, +static char * ngx_http_echo_echo_duplicate(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_read_request_body(ngx_conf_t *cf, +static char * ngx_http_echo_echo_read_request_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_foreach_split(ngx_conf_t *cf, +static char * ngx_http_echo_echo_foreach_split(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_end(ngx_conf_t *cf, +static char * ngx_http_echo_echo_end(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_abort_parent(ngx_conf_t *cf, +static char * ngx_http_echo_echo_abort_parent(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_echo_exec(ngx_conf_t *cf, +static char * ngx_http_echo_echo_exec(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, +static char * ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, ngx_http_echo_cmd_category_t cat, ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -311,7 +309,7 @@ ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, /* cmds_ptr points to ngx_http_echo_loc_conf_t's * handler_cmds, before_body_cmds, or after_body_cmds * array, depending on the actual offset */ - cmds_ptr = (ngx_array_t **) (((u_char *) conf) + cmd->offset); + cmds_ptr = (ngx_array_t**)(((u_char*)conf) + cmd->offset); if (*cmds_ptr == NULL) { *cmds_ptr = ngx_array_create(cf->pool, 1, @@ -346,7 +344,7 @@ ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, args_ptr = &echo_cmd->args; *args_ptr = ngx_array_create(cf->pool, 1, - sizeof(ngx_http_echo_arg_template_t)); + sizeof(ngx_http_echo_arg_template_t)); if (*args_ptr == NULL) { return NGX_CONF_ERROR; @@ -632,9 +630,6 @@ ngx_http_echo_echo_exec(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static void * ngx_http_echo_create_main_conf(ngx_conf_t *cf) { -#if nginx_version >= 1011011 - ngx_pool_cleanup_t *cln; -#endif ngx_http_echo_main_conf_t *emcf; emcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_echo_main_conf_t)); @@ -646,16 +641,6 @@ ngx_http_echo_create_main_conf(ngx_conf_t *cf) * hmcf->requires_filter = 0; */ -#if nginx_version >= 1011011 - cln = ngx_pool_cleanup_add(cf->pool, 0); - if (cln == NULL) { - return NULL; - } - - cln->data = emcf; - cln->handler = ngx_http_echo_request_headers_cleanup; -#endif - return emcf; } diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h b/debian/modules/nginx-echo/src/ngx_http_echo_module.h similarity index 85% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h rename to debian/modules/nginx-echo/src/ngx_http_echo_module.h index ce0a305..b2ae1b4 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h +++ b/debian/modules/nginx-echo/src/ngx_http_echo_module.h @@ -1,8 +1,4 @@ - -/* - * Copyright (C) Yichun Zhang (agentzh) - */ - +/* Copyright (C) by agentzh */ #ifndef NGX_HTTP_ECHO_MODULE_H #define NGX_HTTP_ECHO_MODULE_H @@ -92,10 +88,6 @@ typedef struct { typedef struct { ngx_int_t requires_filter; -#if nginx_version >= 1011011 - ngx_buf_t **busy_buf_ptrs; - ngx_int_t busy_buf_ptr_count; -#endif } ngx_http_echo_main_conf_t; @@ -138,12 +130,6 @@ typedef struct { unsigned done:1; unsigned run_post_subrequest:1; - unsigned header_sent:1; /* r->header_sent is not sufficient - * because special header filters like - * ngx_http_image_filter_module's may - * intercept the whole header filter chain - * leaving r->header_sent unset. So we - * should always test both flags. */ } ngx_http_echo_ctx_t; diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c b/debian/modules/nginx-echo/src/ngx_http_echo_request_info.c similarity index 84% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c rename to debian/modules/nginx-echo/src/ngx_http_echo_request_info.c index 7dd3683..9e75ac2 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_request_info.c @@ -17,13 +17,10 @@ static void ngx_http_echo_post_read_request_body(ngx_http_request_t *r); -#if nginx_version >= 1011011 -void ngx_http_echo_request_headers_cleanup(void *data); -#endif ngx_int_t -ngx_http_echo_exec_echo_read_request_body(ngx_http_request_t *r, +ngx_http_echo_exec_echo_read_request_body(ngx_http_request_t* r, ngx_http_echo_ctx_t *ctx) { return ngx_http_read_client_request_body(r, @@ -182,11 +179,6 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, ngx_int_t i, j; ngx_buf_t *b, *first = NULL; unsigned found; -#if nginx_version >= 1011011 - ngx_buf_t **bb; - ngx_chain_t *cl; - ngx_http_echo_main_conf_t *emcf; -#endif ngx_connection_t *c; ngx_http_request_t *mr; ngx_http_connection_t *hc; @@ -195,18 +187,6 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, hc = r->main->http_connection; c = mr->connection; -#if (NGX_HTTP_V2) - /* TODO */ - if (mr->stream) { - v->not_found = 1; - return NGX_OK; - } -#endif - -#if nginx_version >= 1011011 - emcf = ngx_http_get_module_main_conf(r, ngx_http_echo_module); -#endif - size = 0; b = c->buffer; @@ -222,40 +202,30 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, <= b->pos) { first = b; - size += b->pos - mr->request_line.data; + + if (mr->header_in == b) { + size += mr->header_in->pos - mr->request_line.data; + + } else { + /* the subsequent part of the header is in the large header + * buffers */ +#if 1 + p = b->pos; + size += p - mr->request_line.data; + + /* skip truncated header entries (if any) */ + while (b->pos > b->start && b->pos[-1] != LF) { + b->pos--; + size--; + } +#endif + } } if (hc->nbusy) { b = NULL; - -#if nginx_version >= 1011011 - if (hc->nbusy > emcf->busy_buf_ptr_count) { - if (emcf->busy_buf_ptrs) { - ngx_free(emcf->busy_buf_ptrs); - } - - emcf->busy_buf_ptrs = ngx_alloc(hc->nbusy * sizeof(ngx_buf_t *), - r->connection->log); - - if (emcf->busy_buf_ptrs == NULL) { - return NGX_ERROR; - } - - emcf->busy_buf_ptr_count = hc->nbusy; - } - - bb = emcf->busy_buf_ptrs; - for (cl = hc->busy; cl; cl = cl->next) { - *bb++ = cl->buf; - } - - bb = emcf->busy_buf_ptrs; - for (i = hc->nbusy; i > 0; i--) { - b = bb[i - 1]; -#else for (i = 0; i < hc->nbusy; i++) { b = hc->busy[i]; -#endif if (first == NULL) { if (mr->request_line.data >= b->pos @@ -269,6 +239,11 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, first = b; } + if (b == mr->header_in) { + size += mr->header_in->pos - b->start; + break; + } + size += b->pos - b->start; } } @@ -285,22 +260,17 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, last = v->data; b = c->buffer; - found = 0; - if (first == b) { - found = 1; - pos = b->pos; + if (mr->header_in == b) { + pos = mr->header_in->pos; + + } else { + pos = b->pos; + } last = ngx_copy(v->data, mr->request_line.data, pos - mr->request_line.data); - if (b != mr->header_in) { - /* skip truncated header entries (if any) */ - while (last > v->data && last[-1] != LF) { - last--; - } - } - i = 0; for (p = v->data; p != last; p++) { if (*p == '\0') { @@ -319,15 +289,9 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, } if (hc->nbusy) { - -#if nginx_version >= 1011011 - bb = emcf->busy_buf_ptrs; - for (i = hc->nbusy; i > 0; i--) { - b = bb[i - 1]; -#else + found = (b == c->buffer); for (i = 0; i < hc->nbusy; i++) { b = hc->busy[i]; -#endif if (!found) { if (b != first) { @@ -340,7 +304,12 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, p = last; - pos = b->pos; + if (b == mr->header_in) { + pos = mr->header_in->pos; + + } else { + pos = b->pos; + } if (b == first) { dd("request line: %.*s", (int) mr->request_line.len, @@ -503,20 +472,4 @@ ngx_http_echo_response_status_variable(ngx_http_request_t *r, return NGX_OK; } - -#if nginx_version >= 1011011 -void -ngx_http_echo_request_headers_cleanup(void *data) -{ - ngx_http_echo_main_conf_t *emcf; - - emcf = (ngx_http_echo_main_conf_t *) data; - - if (emcf->busy_buf_ptrs) { - ngx_free(emcf->busy_buf_ptrs); - emcf->busy_buf_ptrs = NULL; - } -} -#endif - /* vi:set ft=c ts=4 sw=4 et fdm=marker: */ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h b/debian/modules/nginx-echo/src/ngx_http_echo_request_info.h similarity index 58% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h rename to debian/modules/nginx-echo/src/ngx_http_echo_request_info.h index aa5730b..160d612 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h +++ b/debian/modules/nginx-echo/src/ngx_http_echo_request_info.h @@ -1,36 +1,31 @@ #ifndef ECHO_REQUEST_INFO_H #define ECHO_REQUEST_INFO_H - #include "ngx_http_echo_module.h" - ngx_int_t ngx_http_echo_exec_echo_read_request_body( - ngx_http_request_t *r, ngx_http_echo_ctx_t *ctx); + ngx_http_request_t* r, ngx_http_echo_ctx_t *ctx); ngx_int_t ngx_http_echo_request_method_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_client_request_method_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_request_body_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_cacheable_request_uri_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_request_uri_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); + ngx_http_variable_value_t *v, uintptr_t data); ngx_int_t ngx_http_echo_response_status_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); - -#if nginx_version >= 1011011 -void ngx_http_echo_request_headers_cleanup(void *data); -#endif + ngx_http_variable_value_t *v, uintptr_t data); #endif /* ECHO_REQUEST_INFO_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c b/debian/modules/nginx-echo/src/ngx_http_echo_sleep.c similarity index 93% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c rename to debian/modules/nginx-echo/src/ngx_http_echo_sleep.c index c96fa5a..13fffdf 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_sleep.c @@ -39,13 +39,13 @@ ngx_http_echo_exec_echo_sleep(ngx_http_request_t *r, if (delay == NGX_ERROR) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "invalid sleep duration \"%V\"", &computed_arg_elts[0]); + "invalid sleep duration \"%V\"", &computed_arg_elts[0]); return NGX_HTTP_BAD_REQUEST; } dd("adding timer with delay %lu ms, r:%.*s", (unsigned long) delay, - (int) r->uri.len, r->uri.data); + (int) r->uri.len, r->uri.data); ngx_add_timer(&ctx->sleep, (ngx_msec_t) delay); @@ -135,7 +135,7 @@ ngx_http_echo_sleep_event_handler(ngx_event_t *ev) * and delete our timer and then quit. */ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, - "echo sleep event handler: \"%V?%V\"", &r->uri, &r->args); + "echo sleep handler: \"%V?%V\"", &r->uri, &r->args); /* if (r->done) { @@ -172,7 +172,7 @@ ngx_http_echo_exec_echo_blocking_sleep(ngx_http_request_t *r, if (delay == NGX_ERROR) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "invalid sleep duration \"%V\"", &computed_arg_elts[0]); + "invalid sleep duration \"%V\"", &computed_arg_elts[0]); return NGX_HTTP_BAD_REQUEST; } @@ -188,7 +188,7 @@ static void ngx_http_echo_sleep_cleanup(void *data) { ngx_http_request_t *r = data; - ngx_http_echo_ctx_t *ctx; + ngx_http_echo_ctx_t *ctx; dd("echo sleep cleanup"); diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h b/debian/modules/nginx-echo/src/ngx_http_echo_sleep.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h rename to debian/modules/nginx-echo/src/ngx_http_echo_sleep.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c b/debian/modules/nginx-echo/src/ngx_http_echo_subrequest.c similarity index 96% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c rename to debian/modules/nginx-echo/src/ngx_http_echo_subrequest.c index 0980d58..fd240d6 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_subrequest.c @@ -165,7 +165,7 @@ ngx_http_echo_exec_echo_subrequest(ngx_http_request_t *r, */ dd("creating sr ctx for %.*s: %p", (int) parsed_sr->location->len, - parsed_sr->location->data, sr_ctx); + parsed_sr->location->data, sr_ctx); psr = ngx_palloc(r->pool, sizeof(ngx_http_post_subrequest_t)); @@ -177,7 +177,7 @@ ngx_http_echo_exec_echo_subrequest(ngx_http_request_t *r, psr->data = sr_ctx; rc = ngx_http_subrequest(r, parsed_sr->location, parsed_sr->query_string, - &sr, psr, 0); + &sr, psr, 0); if (rc != NGX_OK) { return NGX_ERROR; @@ -263,10 +263,10 @@ ngx_http_echo_parse_subrequest_spec(ngx_http_request_t *r, } if (ngx_strncmp("-f", arg->data, arg->len) == 0) { - dd("found option -f"); - to_write = &body_file; - expecting_opt = 0; - continue; + dd("found option -f"); + to_write = &body_file; + expecting_opt = 0; + continue; } } @@ -425,7 +425,7 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr, /* we do not inherit the parent request's variables */ cmcf = ngx_http_get_module_main_conf(sr, ngx_http_core_module); sr->variables = ngx_pcalloc(sr->pool, cmcf->variables.nelts - * sizeof(ngx_http_variable_value_t)); + * sizeof(ngx_http_variable_value_t)); if (sr->variables == NULL) { return NGX_ERROR; @@ -453,7 +453,7 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr, static ngx_int_t ngx_http_echo_parse_method_name(ngx_str_t **method_name_ptr) { - const ngx_str_t *method_name = *method_name_ptr; + const ngx_str_t* method_name = *method_name_ptr; switch (method_name->len) { case 3: @@ -640,7 +640,7 @@ ngx_http_echo_exec_exec(ngx_http_request_t *r, ngx_str_t *uri; ngx_str_t *user_args; ngx_str_t args; - ngx_uint_t flags = 0; + ngx_uint_t flags; ngx_str_t *computed_arg; computed_arg = computed_args->elts; @@ -688,7 +688,7 @@ ngx_http_echo_exec_exec(ngx_http_request_t *r, #endif dd("named location: %.*s, c:%d", (int) uri->len, uri->data, - (int) r->main->count); + (int) r->main->count); return ngx_http_named_location(r, uri); } @@ -709,9 +709,7 @@ ngx_http_echo_set_content_length_header(ngx_http_request_t *r, off_t len) r->headers_in.content_length_n = len; if (ngx_list_init(&r->headers_in.headers, r->pool, 20, - sizeof(ngx_table_elt_t)) - != NGX_OK) - { + sizeof(ngx_table_elt_t)) != NGX_OK) { return NGX_ERROR; } @@ -742,7 +740,7 @@ ngx_http_echo_set_content_length_header(ngx_http_request_t *r, off_t len) h->hash = ngx_http_echo_content_length_hash; dd("r content length: %.*s", - (int) r->headers_in.content_length->value.len, + (int)r->headers_in.content_length->value.len, r->headers_in.content_length->value.data); pr = r->parent; @@ -768,10 +766,9 @@ ngx_http_echo_set_content_length_header(ngx_http_request_t *r, off_t len) i = 0; } - if (header[i].key.len == sizeof("Content-Length") - 1 - && ngx_strncasecmp(header[i].key.data, (u_char *) "Content-Length", - sizeof("Content-Length") - 1) - == 0) + if (header[i].key.len == sizeof("Content-Length") - 1 && + ngx_strncasecmp(header[i].key.data, (u_char *) "Content-Length", + sizeof("Content-Length") - 1) == 0) { continue; } diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h b/debian/modules/nginx-echo/src/ngx_http_echo_subrequest.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h rename to debian/modules/nginx-echo/src/ngx_http_echo_subrequest.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c b/debian/modules/nginx-echo/src/ngx_http_echo_timer.c similarity index 92% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c rename to debian/modules/nginx-echo/src/ngx_http_echo_timer.c index e2777ee..41dada9 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_timer.c @@ -17,10 +17,10 @@ ngx_http_echo_timer_elapsed_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { ngx_http_echo_ctx_t *ctx; - ngx_msec_int_t ms; + ngx_msec_int_t ms; u_char *p; ngx_time_t *tp; - size_t size; + size_t size; ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); if (ctx == NULL) { @@ -64,7 +64,8 @@ ngx_http_echo_timer_elapsed_variable(ngx_http_request_t *r, return NGX_ERROR; } - v->len = ngx_snprintf(p, size, "%T.%03M", ms / 1000, ms % 1000) - p; + v->len = ngx_snprintf(p, size, "%T.%03M", + ms / 1000, ms % 1000) - p; v->data = p; v->valid = 1; diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h b/debian/modules/nginx-echo/src/ngx_http_echo_timer.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h rename to debian/modules/nginx-echo/src/ngx_http_echo_timer.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c b/debian/modules/nginx-echo/src/ngx_http_echo_util.c similarity index 93% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c rename to debian/modules/nginx-echo/src/ngx_http_echo_util.c index fed0587..6332dc6 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c +++ b/debian/modules/nginx-echo/src/ngx_http_echo_util.c @@ -40,11 +40,11 @@ ngx_http_echo_eval_cmd_args(ngx_http_request_t *r, ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args, ngx_array_t *opts) { - unsigned expecting_opts = 1; ngx_uint_t i; ngx_array_t *args = cmd->args; ngx_str_t *arg, *raw, *opt; ngx_http_echo_arg_template_t *value; + ngx_flag_t expecting_opts = 1; value = args->elts; @@ -105,7 +105,7 @@ ngx_http_echo_eval_cmd_args(ngx_http_request_t *r, ngx_int_t -ngx_http_echo_send_chain_link(ngx_http_request_t *r, +ngx_http_echo_send_chain_link(ngx_http_request_t* r, ngx_http_echo_ctx_t *ctx, ngx_chain_t *in) { ngx_int_t rc; @@ -136,19 +136,17 @@ ngx_http_echo_send_chain_link(ngx_http_request_t *r, return NGX_OK; } - /* FIXME we should udpate chains to recycle chain links and bufs */ return ngx_http_output_filter(r, in); } ngx_int_t -ngx_http_echo_send_header_if_needed(ngx_http_request_t *r, +ngx_http_echo_send_header_if_needed(ngx_http_request_t* r, ngx_http_echo_ctx_t *ctx) { - ngx_int_t rc; ngx_http_echo_loc_conf_t *elcf; - if (!r->header_sent && !ctx->header_sent) { + if (!r->header_sent) { elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); r->headers_out.status = (ngx_uint_t) elcf->status; @@ -160,9 +158,7 @@ ngx_http_echo_send_header_if_needed(ngx_http_request_t *r, ngx_http_clear_content_length(r); ngx_http_clear_accept_ranges(r); - rc = ngx_http_send_header(r); - ctx->header_sent = 1; - return rc; + return ngx_http_send_header(r); } return NGX_OK; diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h b/debian/modules/nginx-echo/src/ngx_http_echo_util.h similarity index 61% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h rename to debian/modules/nginx-echo/src/ngx_http_echo_util.h index d620d09..34fd596 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h +++ b/debian/modules/nginx-echo/src/ngx_http_echo_util.h @@ -11,7 +11,7 @@ #include "ngx_http_echo_module.h" -#define ngx_http_echo_strcmp_const(a, b) \ +#define ngx_http_echo_strcmp_const(a, b) \ ngx_strncmp(a, b, sizeof(b) - 1) @@ -38,20 +38,20 @@ ngx_http_echo_hash_str(u_char *src, size_t n) extern ngx_uint_t ngx_http_echo_content_length_hash; -ngx_http_echo_ctx_t *ngx_http_echo_create_ctx(ngx_http_request_t *r); +ngx_http_echo_ctx_t * ngx_http_echo_create_ctx(ngx_http_request_t *r); ngx_int_t ngx_http_echo_eval_cmd_args(ngx_http_request_t *r, - ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args, - ngx_array_t *opts); -ngx_int_t ngx_http_echo_send_header_if_needed(ngx_http_request_t *r, - ngx_http_echo_ctx_t *ctx); -ngx_int_t ngx_http_echo_send_chain_link(ngx_http_request_t *r, - ngx_http_echo_ctx_t *ctx, ngx_chain_t *cl); + ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args, + ngx_array_t *opts); +ngx_int_t ngx_http_echo_send_header_if_needed(ngx_http_request_t* r, + ngx_http_echo_ctx_t *ctx); +ngx_int_t ngx_http_echo_send_chain_link(ngx_http_request_t* r, + ngx_http_echo_ctx_t *ctx, ngx_chain_t *cl); ssize_t ngx_http_echo_atosz(u_char *line, size_t n); -u_char *ngx_http_echo_strlstrn(u_char *s1, u_char *last, u_char *s2, size_t n); +u_char * ngx_http_echo_strlstrn(u_char *s1, u_char *last, u_char *s2, size_t n); ngx_int_t ngx_http_echo_post_request_at_head(ngx_http_request_t *r, - ngx_http_posted_request_t *pr); -u_char *ngx_http_echo_rebase_path(ngx_pool_t *pool, u_char *src, size_t osize, - size_t *nsize); + ngx_http_posted_request_t *pr); +u_char * ngx_http_echo_rebase_path(ngx_pool_t *pool, u_char *src, size_t osize, + size_t *nsize); ngx_int_t ngx_http_echo_flush_postponed_outputs(ngx_http_request_t *r); diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c b/debian/modules/nginx-echo/src/ngx_http_echo_var.c similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c rename to debian/modules/nginx-echo/src/ngx_http_echo_var.c diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h b/debian/modules/nginx-echo/src/ngx_http_echo_var.h similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h rename to debian/modules/nginx-echo/src/ngx_http_echo_var.h diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t b/debian/modules/nginx-echo/t/abort-parent.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t rename to debian/modules/nginx-echo/t/abort-parent.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t b/debian/modules/nginx-echo/t/blocking-sleep.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t rename to debian/modules/nginx-echo/t/blocking-sleep.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t b/debian/modules/nginx-echo/t/echo-after-body.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t rename to debian/modules/nginx-echo/t/echo-after-body.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t b/debian/modules/nginx-echo/t/echo-before-body.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t rename to debian/modules/nginx-echo/t/echo-before-body.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t b/debian/modules/nginx-echo/t/echo-duplicate.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t rename to debian/modules/nginx-echo/t/echo-duplicate.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t b/debian/modules/nginx-echo/t/echo-timer.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t rename to debian/modules/nginx-echo/t/echo-timer.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo.t b/debian/modules/nginx-echo/t/echo.t similarity index 88% rename from modules_deb/libnginx-mod-http-echo-0.63/t/echo.t rename to debian/modules/nginx-echo/t/echo.t index b181259..629682e 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/t/echo.t +++ b/debian/modules/nginx-echo/t/echo.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(2); -plan tests => repeat_each() * (2 * blocks() + 6); +plan tests => repeat_each() * (2 * blocks() + 5); #$Test::Nginx::LWP::LogLevel = 'debug'; @@ -382,35 +382,3 @@ foo bar baz"] --- response_body chop hello world - - -=== TEST 27: image filter ---- config - location = /gif { - empty_gif; - } - - location = /t { - default_type image/gif; - image_filter resize 10 10; - set $gif1 ''; - set $gif2 ''; - rewrite_by_lua ' - local res = ngx.location.capture("/gif") - local data = res.body - ngx.var.gif1 = string.sub(data, 1, #data - 1) - ngx.var.gif2 = string.sub(data, #data) - '; - echo -n $gif1; - echo -n $gif2; - } ---- request - GET /t ---- stap -F(ngx_http_image_header_filter) { - println("image header filter") -} ---- stap_out -image header filter ---- response_body_like: . - diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/exec.t b/debian/modules/nginx-echo/t/exec.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/exec.t rename to debian/modules/nginx-echo/t/exec.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t b/debian/modules/nginx-echo/t/filter-used.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t rename to debian/modules/nginx-echo/t/filter-used.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t b/debian/modules/nginx-echo/t/foreach-split.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t rename to debian/modules/nginx-echo/t/foreach-split.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t b/debian/modules/nginx-echo/t/gzip.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t rename to debian/modules/nginx-echo/t/gzip.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/if.t b/debian/modules/nginx-echo/t/if.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/if.t rename to debian/modules/nginx-echo/t/if.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/incr.t b/debian/modules/nginx-echo/t/incr.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/incr.t rename to debian/modules/nginx-echo/t/incr.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t b/debian/modules/nginx-echo/t/location-async.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t rename to debian/modules/nginx-echo/t/location-async.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/location.t b/debian/modules/nginx-echo/t/location.t similarity index 99% rename from modules_deb/libnginx-mod-http-echo-0.63/t/location.t rename to debian/modules/nginx-echo/t/location.t index 48c851e..90514c8 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/t/location.t +++ b/debian/modules/nginx-echo/t/location.t @@ -149,7 +149,7 @@ after sr 2 --- response_body_like ^hello world -took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ +took 0\.0(?:2[5-9]|3[0-5]) sec for total\.$ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t b/debian/modules/nginx-echo/t/mixed.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t rename to debian/modules/nginx-echo/t/mixed.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t b/debian/modules/nginx-echo/t/request-body.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t rename to debian/modules/nginx-echo/t/request-body.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t b/debian/modules/nginx-echo/t/request-info.t similarity index 82% rename from modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t rename to debian/modules/nginx-echo/t/request-info.t index dd34da4..77e01a9 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t +++ b/debian/modules/nginx-echo/t/request-info.t @@ -5,7 +5,7 @@ use Test::Nginx::Socket; repeat_each(2); -plan tests => repeat_each() * (3 * blocks() + 14); +plan tests => repeat_each() * (3 * blocks() + 6); run_tests(); @@ -353,7 +353,6 @@ $headers}] === TEST 17: small header, multi-line header -multi-line header is not supported since 1.21 --- config location /t { echo -n $echo_client_request_headers; @@ -376,13 +375,10 @@ Foo: bar baz\r } --- no_error_log [error] ---- skip_nginx -3: >= 1.21.1 === TEST 18: large header, multi-line header -multi-line header is not supported since 1.21 --- config client_header_buffer_size 10; large_client_header_buffers 50 567; @@ -407,8 +403,6 @@ Connection: close\r --- no_error_log [error] ---- skip_nginx -3: >= 1.21.1 @@ -749,122 +743,3 @@ Content-Length: 5 --- no_error_log [error] - - -=== TEST 31: two pipelined requests with large headers ---- config - client_header_buffer_size 10; - large_client_header_buffers 3 5610; - location /t { - echo -n $echo_client_request_headers; - } ---- pipelined_requests eval -["GET /t", "GET /t"] ---- more_headers eval -CORE::join "\n", map { "Header$_: value-$_" } 1..585 - ---- response_body eval -[qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: keep-alive\r -} -.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..585) . "\r\n\r\n", -qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: close\r -} -.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..585) . "\r\n\r\n", -, -] - ---- no_error_log -[error] ---- timeout: 5 - - - -=== TEST 32: a request with large header and a smaller pipelined request following ---- config - client_header_buffer_size 10; - large_client_header_buffers 2 1921; - location /t { - echo -n $echo_client_request_headers; - } ---- pipelined_requests eval -["GET /t", "GET /t"] ---- more_headers eval -[CORE::join("\n", map { "Header$_: value-$_" } 1..170), "Foo: bar\n"] - ---- response_body eval -[qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: keep-alive\r -} -.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..170) . "\r\n\r\n", -qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: close\r -Foo: bar\r -\r -}, -] - ---- no_error_log -[error] ---- timeout: 5 - - - -=== TEST 33: a request with large header and a smaller pipelined request following ---- config - client_header_buffer_size 10; - large_client_header_buffers 2 1921; - location /t { - echo -n $echo_client_request_headers; - } ---- pipelined_requests eval -["GET /t", "GET /t" . ("a" x 512)] ---- more_headers eval -[CORE::join("\n", map { "Header$_: value-$_" } 1..170), "Foo: bar\n"] - ---- response_body eval -[qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: keep-alive\r -} -.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..170) . "\r\n\r\n", -qq{GET /t} . ("a" x 512) . qq{ HTTP/1.1\r -Host: localhost\r -Connection: close\r -Foo: bar\r -\r -}, -] - ---- no_error_log -[error] ---- timeout: 5 - - - -=== TEST 34: invalid header line started with whitespace since nginx 1.21.1 ---- config - client_header_buffer_size 10; - large_client_header_buffers 50 567; - location /t { - echo -n $echo_client_request_headers; - } - ---- raw_request eval -my $headers = (CORE::join "\r\n", map { "Header$_: value-$_\r\n hello $_ world blah blah" } 1..512) . "\r\n\r\n"; - -qq{GET /t HTTP/1.1\r -Host: localhost\r -Connection: close\r -$headers} - ---- error_code: 400 ---- no_error_log -[error] ---- skip_nginx -2: < 1.21.1 diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t b/debian/modules/nginx-echo/t/sleep.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t rename to debian/modules/nginx-echo/t/sleep.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/status.t b/debian/modules/nginx-echo/t/status.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/status.t rename to debian/modules/nginx-echo/t/status.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t b/debian/modules/nginx-echo/t/subrequest-async.t similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t rename to debian/modules/nginx-echo/t/subrequest-async.t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t b/debian/modules/nginx-echo/t/subrequest.t similarity index 99% rename from modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t rename to debian/modules/nginx-echo/t/subrequest.t index 6d965d0..7562f12 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t +++ b/debian/modules/nginx-echo/t/subrequest.t @@ -130,7 +130,7 @@ after sr 2 --- response_body_like ^hello world -took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ +took 0\.0(?:2[5-9]|3[0-5]) sec for total\.$ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/unused.t b/debian/modules/nginx-echo/t/unused.t similarity index 88% rename from modules_deb/libnginx-mod-http-echo-0.63/t/unused.t rename to debian/modules/nginx-echo/t/unused.t index f3c6e9e..c761e44 100644 --- a/modules_deb/libnginx-mod-http-echo-0.63/t/unused.t +++ b/debian/modules/nginx-echo/t/unused.t @@ -60,9 +60,6 @@ echo body filter, uri "/echo?blah" === TEST 3: (after) filters used (multiple http {} blocks) -This test case won't run with nginx 1.9.3+ since duplicate http {} blocks -have been prohibited since then. ---- SKIP --- http_config postpone_output 1; --- config @@ -90,9 +87,6 @@ echo body filter, uri "/echo?blah" === TEST 4: (before) filters used (multiple http {} blocks) -This test case won't run with nginx 1.9.3+ since duplicate http {} blocks -have been prohibited since then. ---- SKIP --- http_config postpone_output 1; --- config diff --git a/modules_deb/libnginx-mod-http-echo-0.63/util/build.sh b/debian/modules/nginx-echo/util/build.sh similarity index 88% rename from modules_deb/libnginx-mod-http-echo-0.63/util/build.sh rename to debian/modules/nginx-echo/util/build.sh index 45949bb..d96527c 100755 --- a/modules_deb/libnginx-mod-http-echo-0.63/util/build.sh +++ b/debian/modules/nginx-echo/util/build.sh @@ -7,22 +7,24 @@ version=$1 force=$2 home=~ + #--without-http_ssi_module \ #--with-cc=gcc46 \ ngx-build $force $version \ - --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB:/usr/local/lib" \ + --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB:$LUAJIT_LIB:/usr/local/lib" \ --with-cc-opt="-DDEBUG_MALLOC" \ --with-http_stub_status_module \ - --with-http_image_filter_module \ --without-mail_pop3_module \ --without-mail_imap_module \ --without-mail_smtp_module \ --without-http_upstream_ip_hash_module \ + --without-http_empty_gif_module \ --without-http_memcached_module \ --without-http_referer_module \ --without-http_autoindex_module \ --without-http_auth_basic_module \ --without-http_userid_module \ + --with-http_addition_module \ --add-module=$root/../ndk-nginx-module \ --add-module=$root/../set-misc-nginx-module \ --add-module=$root/../eval-nginx-module \ @@ -31,10 +33,9 @@ ngx-build $force $version \ --add-module=$root/../headers-more-nginx-module \ --add-module=$root/../lua-nginx-module \ --add-module=$root $opts \ - --with-http_v2_module \ --with-select_module \ --with-poll_module \ - --without-http_ssi_module \ + --with-rtsig_module \ --with-debug || exit 1 #--add-module=$root/../lz-session-nginx-module \ #--add-module=$home/work/ndk \ diff --git a/debian/modules/nginx-echo/util/releng b/debian/modules/nginx-echo/util/releng new file mode 100755 index 0000000..b3ad9f2 --- /dev/null +++ b/debian/modules/nginx-echo/util/releng @@ -0,0 +1,8 @@ +#!/bin/bash + +./update-readme +ack '.{81}' src/ngx_http_*.[ch] +ack '(?<=\#define)\s*DDEBUG\s*[12]' src +echo ======================================= +ack '(?<=This document describes echo-nginx-module v)\d+\.\d+' README + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl b/debian/modules/nginx-echo/util/wiki2pod.pl similarity index 100% rename from modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl rename to debian/modules/nginx-echo/util/wiki2pod.pl diff --git a/debian/modules/nginx-echo/valgrind.suppress b/debian/modules/nginx-echo/valgrind.suppress new file mode 100644 index 0000000..0f8e871 --- /dev/null +++ b/debian/modules/nginx-echo/valgrind.suppress @@ -0,0 +1,38 @@ +{ + + Memcheck:Addr4 + fun:lj_str_new + fun:lua_setfield + fun:ngx_http_lua_cache_store_code +} +{ + + Memcheck:Addr4 + fun:lj_str_new + fun:lua_getfield + fun:ngx_http_lua_cache_load_code +} +{ + + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init +} +{ + + Memcheck:Cond + fun:index + fun:expand_dynamic_string_token + fun:_dl_map_object + fun:map_doit + fun:_dl_catch_error + fun:do_preload + fun:dl_main +} diff --git a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/LICENCE b/debian/modules/nginx-http-push/LICENCE similarity index 90% rename from modules_deb/libnginx-mod-nchan-1.3.7+dfsg/LICENCE rename to debian/modules/nginx-http-push/LICENCE index aed1f30..ad9c957 100644 --- a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/LICENCE +++ b/debian/modules/nginx-http-push/LICENCE @@ -1,6 +1,6 @@ This work is distributed under the MIT Licence. -Written by Leo Ponomarev (slact) 2009-2015. +Copyright (c) 2009 Leo Ponomarev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -11,7 +11,7 @@ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above authorship notice and this permission notice shall be +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, diff --git a/debian/modules/nginx-http-push/README b/debian/modules/nginx-http-push/README new file mode 100644 index 0000000..fece50a --- /dev/null +++ b/debian/modules/nginx-http-push/README @@ -0,0 +1,206 @@ +NGiNX HTTP push module - Turn NGiNX into an adept HTTP Push (Comet) server. + +This module takes care of all the connection juggling, and exposes a simple +interface to broadcast messages to clients via plain old HTTP requests. +This makes it possible to write live-updating applications without having to +wait on idle connections via upstream proxies or making your code all +asynchronous and concurrent. + +---------------- Configuration Directives & Variables ------------------------ +Variables: +$push_channel_id + A token uniquely identifying a communication channel. Must be present in the + context of the push_subscriber and push_publisher directives. + Example: + set $push_channel_id $arg_id; + #channel id is now the url query string parameter "id" + #(/foo/bar?id=channel_id_string) + +Directives: + +==Publisher/Subscriber== + +push_subscriber [ long-poll | interval-poll ] + default: long-poll + context: server, location + Defines a server or location as a subscriber. This location represents a + subscriber's interface to a channel's message queue. The queue is traversed + automatically via caching information request headers (If-Modified-Since and + If-None-Match), beginning with the oldest available message. Requests for + upcoming messages are handled in accordance with the setting provided. + See the protocol documentation for a detailed description. + +push_subscriber_concurrency [ last | first | broadcast ] + default: broadcast + context: http, server, location + Controls how multiple subscriber requests to a channel (identified by + some common ID) are handled. + The values work as follows: + - broadcast: any number of concurrent subscriber requests may be held. + - last: only the most recent subscriber request is kept, all others get + a 409 Conflict response. + - first: only the oldest subscriber request is kept, all others get a + 409 Conflict response. + +push_publisher + default: none + context: server, location + Defines a server or location as a message publisher. Requests to a publisher + location are treated as messages to be sent to subscribers. See the protocol + documentation for a detailed description. + +== Message storage == + +push_store_messages [ on | off ] + default: on + context: http, server, location + Whether or not message queuing is enabled. "Off" is equivalent to the setting + push_channel_buffer_length 0; + +push_max_reserved_memory [ size ] + default: 32M + context: http + The size of the memory chunk this module will use for all message queuing + and buffering. + +push_min_message_buffer_length [ number ] + default: 1 + context: http, server, location + The minimum number of messages to store per channel. A channel's message + buffer will retain at least this many most recent messages. + +push_max_message_buffer_length [ number ] + default: 10 + context: http, server, location + The maximum number of messages to store per channel. A channel's message + buffer will retain at most this many most recent messages. + +push_message_buffer_length [ number ] + default: none + context: http, server, location + The exact number of messages to store per channel. Sets both + push_max_message_buffer_length and push_min_message_buffer_length to this + value. + +push_delete_oldest_received_message [ on | off ] + default: off + context: http, server, location + When enabled, as soon as the oldest message in a channel's message queue has + been received by a subscriber, it is deleted -- provided there are more than + push_min_message_buffer_length messages in the channel's message buffer. + Recommend avoiding this directive as it violates subscribers' assumptions of + GET request idempotence. + +push_message_timeout [ time ] + default: 1h + context: http, server, location + The length of time a message may be queued before it is considered expired. + If you do not want messages to expire, set this to 0. Applicable only if a + push_publisher is present in this or a child context. + +push_subscriber_timeout [ time ] + default: 0 + context: http, server, location + The length of time a subscriber's long-polling connection can last before + it's timed out. If you don't want subscriber's connection to timeout, set + this to 0. Applicable only if a push_subscriber is present in this or a + child context. + +push_channel_timeout [ time ] + default: 0 + context: http, server, location + The length of time a channel will be removed after it has no subscriber and + no queued messages. If you want to remove a channel as soon as possible, + set this to 0. Applicable only if a push_publisher or push_subscriber is + present in this or a child context and push_subscriber_timeout is greater + than 0. This value should be greater than push_subscriber_timeout to make + sense. + +== Security == + +push_authorized_channels_only [ on | off ] + default: off + context: http, server, location + Whether or not a subscriber may create a channel by making a request to a + push_subscriber location. If set to on, a publisher must send a POST or PUT + request before a subscriber can request messages on the channel. Otherwise, + all subscriber requests to nonexistent channels will get a 403 Forbidden + response. + +push_channel_group [ string ] + default: (none) + context: server, location + Because settings are bound to locations and not individual channels, + it is useful to be able to have channels that can be reached only from some + locations and never others. That's where this setting comes in. Think of it + as a prefix string for the channel id. + +push_max_channel_id_length [ number ] + default: 512 + context: main, server, location + Maximum permissible channel id length (number of characters). + Longer ids will be truncated. + +push_max_channel_subscribers [ number ] + default: 0 (unlimited) + context: main, server, location + Maximum concurrent subscribers. Pretty self-explanatory. + +--------------------------- Example Config ----------------------------------- +http { + #maximum amount of memory the push module is allowed to use + #for buffering and stuff + push_max_reserved_memory 12M; #default is 3M + + # internal publish endpoint (keep it private / protected) + location /publish { + set $push_channel_id $arg_channel; #/?channel=239aff3 or some-such + push_publisher; + + push_message_timeout 2h; # expire buffered messages after 2 hours + push_max_message_buffer_length 10; # store absolutely at most 10 messages + push_min_message_recipients 0; # minimum recipients before purge + } + + # public long-polling endpoint + location /activity { + push_subscriber; + + # how multiple subscriber requests to the same channel id are handled + # - last: only the most recent subscriber request is kept, 409 for others. + # - first: only the oldest subscriber request is kept, 409 for others. + # - broadcast: any number of subscriber requests may be long-polling. + push_subscriber_concurrency broadcast; + set $push_channel_id $arg_channel; #/?channel=239aff3 or some-such + default_type text/plain; + } +} + +---------------------------- Operation --------------------------------------- +The following describes what is likely to be the most commonly desired setup: + +Assuming the example config given above, +Clients will connect to http://example.com/activity?id=... and have the +response delayed until a message is POSTed to http://example.com/publish?id=... +Messages can be sent to clients that have not yet connected, i.e. they are +queued. + +Upon sending a request to a push_publisher location, the message, contained in +the publisher request body, will be sent to the channel identified by +$push_channel_id and to all presently connected channel subscribers. If there +are no subscribers waiting for a message at the time, the publisher will be +sent to with a with a 202 Accepted response. Otherwise, a 201 Created response +is sent. Additionally, the body of the publisher response will contain +information about the channel (number of current subscribers, message queue +length, etc). + +If you intend to have the publisher be a server-side application, it's a damn +good idea to make sure the push_publisher location is not publicly accessible. + +Traversal through a channel's message buffer by a subscriber requires proper +HTTP caching support from the subscriber client. Make sure it correctly sends +Last-Modified and Etag headers. (All modern web browsers do this.) + +----------------------- Protocol Spec -------------------------------------- +This module is unconditionally (fully) compliant with the Basic HTTP Push +Relay Protocol, Rev. 2.21, found in the file protocol.txt. diff --git a/debian/modules/nginx-http-push/changelog.txt b/debian/modules/nginx-http-push/changelog.txt new file mode 100644 index 0000000..0479987 --- /dev/null +++ b/debian/modules/nginx-http-push/changelog.txt @@ -0,0 +1,53 @@ + fix: turning on gzip cleared Etag subscriber response header + fix: channels incorrectly deleted when overwhelmed with connections + feature: CORS support via OPTIONS request method response + fix: file descriptor leak when restarting nginx via SIGHUP + improve: concurrency for interprocess notifications + refactor: completely encapsulated message store + fix: slow memory leak introduced in 0.7 + fix: memory leak when not using message buffer +0.712 (Mar. 21 2014) + fix: intermittently dropped long-polling connections on internal redirects + fix: unable to proxy long-polling subscribers. (thanks wandenberg and sanmai) +0.711 (Mar. 13 2014) + fix: incompatibility with cache manager (proxy_cache and fastcgi_cache directives) +0.71 (Mar. 1 2014) + fix: removed unused variables and functions to quiet down GCC +0.7: (Feb. 20 2014) + fix: last-in concurrency setting wasn't working reliably + refactor: partially separated message storage. add a test harness. + fix: segfault from concurrency bug while garbage-collecting channels + fix: some large messages got lost +0.692 (Feb. 3 2010) + fix: error log reported failed close() for some publisher requests with large messages + fix: occasional memory leak during message deletion + fix: worker messages intended for dead worker processes were not deleted +0.691 (Feb. 2 2010) + fix: server reload (via SIGHUP signal) was failing + fix: segfault on messages longer than client_body_buffer_size (thanks wfelipe) + change: removed push_min_message_recipients, added push_delete_oldest_received_message +0.69 (Nov. 17 2009) + fix: publisher got a 201 Created response even if the channel had no subscribers at the time (should be 202 Accepted) + fix: small memory leak after each message broadcast to a channel + feature: optional push_max_channel_subscribers setting added + fix: first-in concurrency setting wasn't responding to subscribers with a correct status code on conflict + fix: reused subscriber connections sometimes failed to receive messages + unfeature: no more nginx 0.6 support. not worth the hassle. +0.683 (Nov. 10 2009) + change: default max. reserved memory size changed form 16MB to 32 MB + change: unused node garbage collection made a little more aggressive (max. 3 unused channels per channel search instead of 1) + fix: unused nodes were deleted only on channel id hash collision (very rare) + fix: segmentation fault from allocating insufficient memory for interprocess messaging +0.681 (Nov. 6 2009) + feature: added push_message_buffer_length setting, which sets push_message_max_buffer_length and push_message_min_buffer_length at once. + fix: publisher channel info text/json response now uses double quotes instead of single. + fix: interprocess messages were not removed from shared memory correctly, causing weird errors +0.68 (Nov. 5 2009) + change: default push_subscriber_concurrency value is now "broadcast" + fix: incorrect error messages for invalid push_pubscriber and push_subscriber_concurrency settings + change: removed deprecated push_buffer_size and push_queue_messages settings + feature: rudimentary content-type negotiation for publisher channel info response. + support text/plain, text/json, text/yaml and application/xml (and mimetype equivalents) + fix: publisher GET response has HTTP status 0 +0.67beta (Nov. 4 2009) and older + see git repository diff --git a/debian/modules/nginx-http-push/config b/debian/modules/nginx-http-push/config new file mode 100644 index 0000000..375337b --- /dev/null +++ b/debian/modules/nginx-http-push/config @@ -0,0 +1,26 @@ +ngx_feature="http_push_module" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs= +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test= + +ngx_addon_name=ngx_http_push_module +HTTP_MODULES="$HTTP_MODULES ngx_http_push_module" +CORE_INCS="$CORE_INCS \ + $ngx_addon_dir/src" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ + ${ngx_addon_dir}/src/ngx_http_push_defs.c \ + ${ngx_addon_dir}/src/store/rbtree_util.c \ + ${ngx_addon_dir}/src/store/ngx_http_push_module_ipc.c \ + ${ngx_addon_dir}/src/store/memory/store.c \ + ${ngx_addon_dir}/src/store/ngx_rwlock.c \ + ${ngx_addon_dir}/src/ngx_http_push_module.c \ + " + +have=NGX_HTTP_HEADERS . auto/have +. auto/feature + +CORE_LIBS="$CORE_LIBS $ngx_feature_libs" +CORE_INCS="$CORE_INCS $ngx_feature_incs" \ No newline at end of file diff --git a/debian/modules/nginx-http-push/protocol.txt b/debian/modules/nginx-http-push/protocol.txt new file mode 100644 index 0000000..5233003 --- /dev/null +++ b/debian/modules/nginx-http-push/protocol.txt @@ -0,0 +1,191 @@ + Basic HTTP Push Relay Protocol + + Rev. 2.23 + +1. Introduction + + 1.1. Purpose + + The primary purpose of this protocol is to enable a method of + long-polling, transparent to the web client, where client connections + idle only on the HTTP server and need not be forwarded. + + 1.2. Requirements + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in RFC2119. An + implementation is not compliant if it fails to satisfy one or more of + the MUST or REQUIRED level requirements for the protocols it + implements. + + An implementation that satisfies all the MUST or REQUIRED level and all + the SHOULD level requirements for its protocols is said to be + "unconditionally compliant"; one that satisfies all the MUST level + requirements but not all the SHOULD level requirements for its + protocols is said to be "conditionally compliant." + + 1.3. Terminology + + This specification uses a number of terms to refer to the roles played + by participants in, and objects of, this protocol: + + server + The HTTP server implementing this protocol. + + client + A program that initiates TCP/IP connections with the HTTP server + for the purpose of sending HTTP requests. + + message + Application specific data, usually enclosed in a request or + response body. + + channel + A resource representing an isolated pathway for message + transmission. Each channel has a single unique message queue. + + subscriber + A client that sends HTTP requests to the server for the purposes + of receiving messages via some channel. + + publisher + A client that sends HTTP requests to the server in order to + transmit messages to subscribers via a channel. + + channel id + A unique identifier for a channel. + + location + A url (or set of urls) on the server. + +2. Requirements + + 2.1. Server Requirements + + The HTTP server MUST have a mechanism of specifying a url, or a set of + urls as publisher and subscriber locations. All requests to the + publisher location MUST be treated as publisher requests, all to the + subscriber location as subscriber requests. + + The server MUST implement a mechanism for identifying channels with + unique ids. This MAY, for example, be a url parameter (/foo/?id=123) or + a cookie. Methods of channel identification other than those using the + url MAY be used, but are strongly discouraged. + + The server MUST accept requests on publisher locations and respond to + them immediately. It MUST also accept requests on subscriber locations, + but need not respond immediately. + + 2.2. Client Requirements + + All clients must prodice valid HTTP requests. Subscriber clients must + have a caching mechanism that appropriately reacts to Last-Modified and + Etag response headers (web browsers, for example). + + 2.3. The Channel ID + + It is not the responsibility of the server to generate IDs. + +3. Server Operation + + A publisher request functions as notification to the server of a + message to send to some subscribers over some channel. A subscriber + request notifies the server of the subscriber's intent to receive a + message. + + 3.1. The Subscriber + + The server MUST accept all valid HTTP GET requests to the subscriber + location. All other request methods SHOULD be responded to with a 405 + Method Not Allowed status code. + + Subscriber requests are considered notifications of intent to receive + some message. Subscribers may request existing messages, messages that + are not yet available, and messages that are no longer available. The + requested message is identified using the If-Modified-Since and + If-None-Match request headers. A request with no If-Modified-Since + header MUST be assumed to be requesting the oldest available message in + a channel. Each 200 OK response containing a message MUST have its + Last-Modified and Etag headers set so that a request using those + headers will be interpreted as a request for the next available + message. Additionally, said 200 OK MUST contain the Content-Type header + of the message publisher request, unless no Content-Type header had + been provided or it is explicitly overridden by server configuration. + + There are several common mechanisms for performing an HTTP server push. + The rest of the behavior of the server in response to a subscriber + request SHOULD be configurable and MUST be selected from the following + list of mechanisms: + + Long-Polling + Requests for existing messages will be responded to immediately; + responses to requests for messages not yet available MUST be + delayed until the message becomes available. Delayed responses + MUST satisfy all of the following conditions: + + + A 200 OK response containing the message (and its + Content-Type) MUST be sent immediately after the message + becomes available. The entire response must be + indistinguishable from a response to a request for an existing + message. + + If the channel the subscriber is waiting on is deleted or for + some reason becomes unavailable, the server MUST immediately + send a 410 Gone response. + + If another subscriber has conflicted with this request, the + server MUST immediately send a 409 Conflict response. + + Interval-Polling + All requests will be responded to immediately. Requests for + messages not yet available MUST produce a 304 Not Modified + response code. + + In addition, when the server receives more than one concurrent + subscriber request on the same channel, it MUST do one of the + following: + + Broadcast + No additional actions are performed + + Last-in, first-out + All but the most recent long-held subscriber request on the + channel are sent a 409 Conflict response. + + First-in, last-out + All but the oldest request will be sent a 409 Conflict + + The server SHOULD make this selection configurable, and MUST default to + broadcast behavior. + + 3.2. The Publisher + + The server MUST accept all valid HTTP requests to the publisher + location. The server, when sent a publisher request, MUST satisfy all + of the following conditions: + * GET requests receive a 200 OK response for existing channels and a + 404 Not Found otherwise. + * PUT requests receive a 200 OK response. The request creates a + channel if no channel with the given channel id exists. + * DELETE requests receive a 200 OK if the channel identified by the + channel id exists and has been completely deleted. All subscribers + MUST have been sent a 410 Gone response. Requests for nonexistent + channels MUST be responded to with a 404 Not Found. + * POST requests are used to send messages. The request MAY contain a + body in any encoding representing a message to be sent over the + channel. The message MUST be immediately delivered to all currently + long-held subscriber requests. Additionally, the message MAY be + stored for future retrieval and the oldest message stored for the + channel MAY be deleted. + A POST request MUST be replied to with a 201 Created if there were + any long-held subscribers that have been sent this message, and + with a 202 Accepted otherwise. + The Content-Type header of the request MUST be forwarded with the + message. + + Message storage limits SHOULD be configurable. publisher locations + SHOULD be configurable to allow foregoing message storage on POST + requests. All 200-level responses MUST, in the response body, contain + information about the applicable channel. This information MAY contain + the number of stored messages and the number of subscribers' requests + being long-held prior to this request. The server MAY implement a + content-negotiation scheme for this information. diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_defs.c b/debian/modules/nginx-http-push/src/ngx_http_push_defs.c new file mode 100644 index 0000000..65b8243 --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_defs.c @@ -0,0 +1,59 @@ +#include +#include "ngx_http_push_defs.h" + +//string constants +//headers +const ngx_str_t NGX_HTTP_PUSH_HEADER_ETAG = ngx_string("Etag"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_IF_NONE_MATCH = ngx_string("If-None-Match"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_VARY = ngx_string("Vary"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_ALLOW = ngx_string("Allow"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_CACHE_CONTROL = ngx_string("Cache-Control"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_PRAGMA = ngx_string("Pragma"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_HEADERS = ngx_string("Access-Control-Allow-Headers"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_METHODS = ngx_string("Access-Control-Allow-Methods"); +const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = ngx_string("Access-Control-Allow-Origin"); + +//header values +const ngx_str_t NGX_HTTP_PUSH_CACHE_CONTROL_VALUE = ngx_string("no-cache"); + +//status strings +const ngx_str_t NGX_HTTP_PUSH_HTTP_STATUS_409 = ngx_string("409 Conflict"); +const ngx_str_t NGX_HTTP_PUSH_HTTP_STATUS_410 = ngx_string("410 Gone"); + +//other stuff +const ngx_str_t NGX_HTTP_PUSH_ANYSTRING= ngx_string("*"); +const ngx_str_t NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_PUBLISHER_HEADERS = ngx_string("Content-Type, Origin"); +const ngx_str_t NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_SUBSCRIBER_HEADERS = ngx_string("If-None-Match, If-Modified-Since, Origin"); +const ngx_str_t NGX_HTTP_PUSH_ALLOW_GET_POST_PUT_DELETE_OPTIONS= ngx_string("GET, POST, PUT, DELETE, OPTIONS"); +const ngx_str_t NGX_HTTP_PUSH_ALLOW_GET_OPTIONS= ngx_string("GET, OPTIONS"); +const ngx_str_t NGX_HTTP_PUSH_VARY_HEADER_VALUE = ngx_string("If-None-Match, If-Modified-Since"); + + +const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_PLAIN = ngx_string( + "queued messages: %ui" CRLF + "last requested: %d sec. ago (-1=never)" CRLF + "active subscribers: %ui" + "\0"); + +const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_JSON = ngx_string( + "{\"messages\": %ui, " + "\"requested\": %d, " + "\"subscribers\": %ui }" + "\0"); + +const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_XML = ngx_string( + "" CRLF + "" CRLF + " %ui" CRLF + " %d" CRLF + " %ui" CRLF + "" + "\0"); + +const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_YAML = ngx_string( + "---" CRLF + "messages: %ui" CRLF + "requested: %d" CRLF + "subscribers: %ui" CRLF + CRLF + "\0"); diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_defs.h b/debian/modules/nginx-http-push/src/ngx_http_push_defs.h new file mode 100644 index 0000000..1481501 --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_defs.h @@ -0,0 +1,73 @@ + +#define NGX_HTTP_PUSH_DEFAULT_SHM_SIZE 33554432 //32 megs +#define NGX_HTTP_PUSH_DEFAULT_BUFFER_TIMEOUT 3600 +#define NGX_HTTP_PUSH_DEFAULT_SUBSCRIBER_TIMEOUT 0 //default: never timeout +//(liucougar: this is a bit confusing, but it is what's the default behavior before this option is introducecd) +#define NGX_HTTP_PUSH_DEFAULT_CHANNEL_TIMEOUT 5 //default: timeout in 5 seconds + +#define NGX_HTTP_PUSH_DEFAULT_MIN_MESSAGES 1 +#define NGX_HTTP_PUSH_DEFAULT_MAX_MESSAGES 10 + +#define NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_LASTIN 0 +#define NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_FIRSTIN 1 +#define NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_BROADCAST 2 + +#define NGX_HTTP_PUSH_MECHANISM_LONGPOLL 0 +#define NGX_HTTP_PUSH_MECHANISM_INTERVALPOLL 1 + +#define NGX_HTTP_PUSH_MIN_MESSAGE_RECIPIENTS 0 + +#define NGX_HTTP_PUSH_MAX_CHANNEL_ID_LENGTH 1024 //bytes + +#ifndef NGX_HTTP_CONFLICT +#define NGX_HTTP_CONFLICT 409 +#endif + +#ifndef NGX_HTTP_GONE +#define NGX_HTTP_GONE 410 +#endif + +#ifndef NGX_HTTP_CREATED +#define NGX_HTTP_CREATED 201 +#endif + +#ifndef NGX_HTTP_ACCEPTED +#define NGX_HTTP_ACCEPTED 202 +#endif + + +#define NGX_HTTP_PUSH_MESSAGE_RECEIVED 9000 +#define NGX_HTTP_PUSH_MESSAGE_QUEUED 9001 + +#define NGX_HTTP_PUSH_MESSAGE_FOUND 1000 +#define NGX_HTTP_PUSH_MESSAGE_EXPECTED 1001 +#define NGX_HTTP_PUSH_MESSAGE_EXPIRED 1002 + +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_ETAG; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_IF_NONE_MATCH; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_VARY; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_ALLOW; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_CACHE_CONTROL; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_PRAGMA; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_METHODS; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_HEADERS; +extern const ngx_str_t NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN; + +//header values +extern const ngx_str_t NGX_HTTP_PUSH_CACHE_CONTROL_VALUE; + +//status strings +extern const ngx_str_t NGX_HTTP_PUSH_HTTP_STATUS_409; +extern const ngx_str_t NGX_HTTP_PUSH_HTTP_STATUS_410; + +//other stuff +extern const ngx_str_t NGX_HTTP_PUSH_ANYSTRING; +extern const ngx_str_t NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_PUBLISHER_HEADERS; +extern const ngx_str_t NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_SUBSCRIBER_HEADERS; +extern const ngx_str_t NGX_HTTP_PUSH_ALLOW_GET_POST_PUT_DELETE_OPTIONS; +extern const ngx_str_t NGX_HTTP_PUSH_ALLOW_GET_OPTIONS; +extern const ngx_str_t NGX_HTTP_PUSH_VARY_HEADER_VALUE; +extern const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_PLAIN; +extern const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_JSON; +extern const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_XML; +extern const ngx_str_t NGX_HTTP_PUSH_CHANNEL_INFO_YAML; \ No newline at end of file diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_module.c b/debian/modules/nginx-http-push/src/ngx_http_push_module.c new file mode 100755 index 0000000..2703ee0 --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_module.c @@ -0,0 +1,783 @@ +/* + * Copyright 2009 Leo Ponomarev. + */ + +#include + +#include +#include + +ngx_int_t ngx_http_push_worker_processes; +ngx_pool_t *ngx_http_push_pool; +ngx_module_t ngx_http_push_module; + +ngx_http_push_store_t *ngx_http_push_store = &ngx_http_push_store_memory; + + +ngx_int_t ngx_http_push_respond_status_only(ngx_http_request_t *r, ngx_int_t status_code, const ngx_str_t *statusline) { + r->headers_out.status=status_code; + if(statusline!=NULL) { + r->headers_out.status_line.len =statusline->len; + r->headers_out.status_line.data=statusline->data; + } + r->headers_out.content_length_n = 0; + r->header_only = 1; + return ngx_http_send_header(r); +} + +void ngx_http_push_clean_timeouted_subscriber(ngx_event_t *ev) +{ + ngx_http_push_subscriber_t *subscriber = NULL; + ngx_http_request_t *r = NULL; + + subscriber = ev->data; + r = subscriber->request; + + if (r->connection->destroyed) { + return; + } + + ngx_int_t rc = ngx_http_push_respond_status_only(r, NGX_HTTP_NOT_MODIFIED, NULL); + ngx_http_finalize_request(r, rc); + //the subscriber and channel counter will be freed by the pool cleanup callback +} + +void ngx_http_push_subscriber_del_timer(ngx_http_push_subscriber_t *sb) { + if (sb->event.timer_set) { + ngx_del_timer(&sb->event); + } +} + +void ngx_http_push_subscriber_clear_ctx(ngx_http_push_subscriber_t *sb) { + ngx_http_push_subscriber_del_timer(sb); + sb->clndata->subscriber = NULL; + sb->clndata->channel = NULL; +} + + +#define NGX_HTTP_BUF_ALLOC_SIZE(buf) \ +(sizeof(*buf) + \ +(((buf)->temporary || (buf)->memory) ? ngx_buf_size(buf) : 0) + \ +(((buf)->file!=NULL) ? (sizeof(*(buf)->file) + (buf)->file->name.len + 1) : 0)) + +//buffer is _copied_ +ngx_chain_t * ngx_http_push_create_output_chain(ngx_buf_t *buf, ngx_pool_t *pool, ngx_log_t *log) { + ngx_chain_t *out; + ngx_file_t *file; + + if((out = ngx_pcalloc(pool, sizeof(*out)))==NULL) { + return NULL; + } + ngx_buf_t *buf_copy; + + if((buf_copy = ngx_pcalloc(pool, NGX_HTTP_BUF_ALLOC_SIZE(buf)))==NULL) { + return NULL; + } + ngx_http_push_copy_preallocated_buffer(buf, buf_copy); + + if (buf->file!=NULL) { + file = buf_copy->file; + file->log=log; + if(file->fd==NGX_INVALID_FILE) { + file->fd=ngx_open_file(file->name.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, NGX_FILE_OWNER_ACCESS); + } + if(file->fd==NGX_INVALID_FILE) { + return NULL; + } + } + buf_copy->last_buf = 1; + out->buf = buf_copy; + out->next = NULL; + return out; +} + +#define NGX_HTTP_PUSH_NO_CHANNEL_ID_MESSAGE "No channel id provided." +static ngx_str_t * ngx_http_push_get_channel_id(ngx_http_request_t *r, ngx_http_push_loc_conf_t *cf) { + ngx_http_variable_value_t *vv = ngx_http_get_indexed_variable(r, cf->index); + ngx_str_t *group = &cf->channel_group; + size_t group_len = group->len; + size_t var_len; + size_t len; + ngx_str_t *id; + if (vv == NULL || vv->not_found || vv->len == 0) { + ngx_buf_t *buf = ngx_create_temp_buf(r->pool, sizeof(NGX_HTTP_PUSH_NO_CHANNEL_ID_MESSAGE)); + ngx_chain_t *chain; + if(buf==NULL) { + return NULL; + } + buf->pos=(u_char *)NGX_HTTP_PUSH_NO_CHANNEL_ID_MESSAGE; + buf->last=buf->pos + sizeof(NGX_HTTP_PUSH_NO_CHANNEL_ID_MESSAGE)-1; + chain = ngx_http_push_create_output_chain(buf, r->pool, r->connection->log); + buf->last_buf=1; + r->headers_out.content_length_n=ngx_buf_size(buf); + r->headers_out.status=NGX_HTTP_NOT_FOUND; + r->headers_out.content_type.len = sizeof("text/plain") - 1; + r->headers_out.content_type.data = (u_char *) "text/plain"; + r->headers_out.content_type_len = r->headers_out.content_type.len; + ngx_http_send_header(r); + ngx_http_output_filter(r, chain); + ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, + "push module: the $push_channel_id variable is required but is not set"); + return NULL; + } + //maximum length limiter for channel id + var_len = vv->len <= cf->max_channel_id_length ? vv->len : cf->max_channel_id_length; + len = group_len + 1 + var_len; + if((id = ngx_palloc(r->pool, sizeof(*id) + len))==NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "push module: unable to allocate memory for $push_channel_id string"); + return NULL; + } + id->len=len; + id->data=(u_char *)(id+1); + ngx_memcpy(id->data, group->data, group_len); + id->data[group_len]='/'; + ngx_memcpy(id->data + group_len + 1, vv->data, var_len); + return id; +} + +ngx_table_elt_t * ngx_http_push_add_response_header(ngx_http_request_t *r, const ngx_str_t *header_name, const ngx_str_t *header_value) { + ngx_table_elt_t *h = ngx_list_push(&r->headers_out.headers); + if (h == NULL) { + return NULL; + } + h->hash = 1; + h->key.len = header_name->len; + h->key.data = header_name->data; + h->value.len = header_value->len; + h->value.data = header_value->data; + return h; +} + +static ngx_str_t * ngx_http_push_find_in_header_value(ngx_http_request_t * r, ngx_str_t header_name) { + ngx_uint_t i; + ngx_list_part_t *part = &r->headers_in.headers.part; + ngx_table_elt_t *header= part->elts; + + for (i = 0; /* void */ ; i++) { + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + part = part->next; + header = part->elts; + i = 0; + } + if (header[i].key.len == header_name.len + && ngx_strncasecmp(header[i].key.data, header_name.data, header[i].key.len) == 0) { + return &header[i].value; + } + } + return NULL; +} + +ngx_int_t ngx_http_push_allow_caching(ngx_http_request_t * r) { + ngx_str_t *tmp_header; + ngx_str_t header_checks[2] = { NGX_HTTP_PUSH_HEADER_CACHE_CONTROL, NGX_HTTP_PUSH_HEADER_PRAGMA }; + ngx_int_t i = 0; + + for(; i < 2; i++) { + tmp_header = ngx_http_push_find_in_header_value(r, header_checks[i]); + + if (tmp_header != NULL) { + return !!ngx_strncasecmp(tmp_header->data, NGX_HTTP_PUSH_CACHE_CONTROL_VALUE.data, tmp_header->len); + } + } + + return 1; +} + +void ngx_http_push_subscriber_cleanup(ngx_http_push_subscriber_cleanup_t *data) { + if(data->subscriber!=NULL) { //still queued up + ngx_http_push_subscriber_t* sb = data->subscriber; + ngx_http_push_subscriber_del_timer(sb); + ngx_queue_remove(&data->subscriber->queue); + ngx_pfree(ngx_http_push_pool, data->subscriber); //was there an error? oh whatever. + } + if (data->rchain != NULL) { + ngx_pfree(data->rpool, data->rchain->buf); + ngx_pfree(data->rpool, data->rchain); + data->rchain=NULL; + } + if(data->buf_use_count != NULL && --(*data->buf_use_count) <= 0) { + ngx_buf_t *buf; + ngx_pfree(ngx_http_push_pool, data->buf_use_count); + buf=data->buf; + if(buf->file) { + ngx_close_file(buf->file->fd); + } + ngx_pfree(ngx_http_push_pool, buf); + } + + if(data->channel!=NULL) { //we're expected to decrement the subscriber count + ngx_http_push_store->lock(); + data->channel->subscribers--; + ngx_http_push_store->unlock(); + } +} + +ngx_str_t * ngx_http_push_subscriber_get_etag(ngx_http_request_t * r) { + ngx_uint_t i; + ngx_list_part_t *part = &r->headers_in.headers.part; + ngx_table_elt_t *header= part->elts; + + for (i = 0; /* void */ ; i++) { + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + part = part->next; + header = part->elts; + i = 0; + } + if (header[i].key.len == NGX_HTTP_PUSH_HEADER_IF_NONE_MATCH.len + && ngx_strncasecmp(header[i].key.data, NGX_HTTP_PUSH_HEADER_IF_NONE_MATCH.data, header[i].key.len) == 0) { + return &header[i].value; + } + } + return NULL; +} + +ngx_int_t ngx_http_push_subscriber_get_msg_id(ngx_http_request_t *r, ngx_http_push_msg_id_t *id) { + ngx_str_t *if_none_match = ngx_http_push_subscriber_get_etag(r); + ngx_int_t tag=0; + id->time=(r->headers_in.if_modified_since == NULL) ? 0 : ngx_http_parse_time(r->headers_in.if_modified_since->value.data, r->headers_in.if_modified_since->value.len); + if(if_none_match==NULL || (if_none_match!=NULL && (tag = ngx_atoi(if_none_match->data, if_none_match->len))==NGX_ERROR)) { + tag=0; + } + id->tag=ngx_abs(tag); + return NGX_OK; +} + +//allocates nothing +ngx_int_t ngx_http_push_prepare_response_to_subscriber_request(ngx_http_request_t *r, ngx_chain_t *chain, ngx_str_t *content_type, ngx_str_t *etag, time_t last_modified) { + ngx_int_t res; + if (content_type!=NULL) { + r->headers_out.content_type.len=content_type->len; + r->headers_out.content_type.data = content_type->data; + r->headers_out.content_type_len = r->headers_out.content_type.len; + } + if(last_modified) { + //if-modified-since header + r->headers_out.last_modified_time=last_modified; + } + if(etag!=NULL) { + //etag, if we need one + if ((ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ETAG, etag))==NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + } + //Vary header needed for proper HTTP caching. + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_VARY, &NGX_HTTP_PUSH_VARY_HEADER_VALUE); + + r->headers_out.status=NGX_HTTP_OK; + //we know the entity length, and we're using just one buffer. so no chunking please. + r->headers_out.content_length_n=ngx_buf_size(chain->buf); + if((res = ngx_http_send_header(r)) >= NGX_HTTP_SPECIAL_RESPONSE) { + return res; + } + + return ngx_http_output_filter(r, chain); +} + +//allocates message and responds to subscriber +ngx_int_t ngx_http_push_alloc_for_subscriber_response(ngx_pool_t *pool, ngx_int_t shared, ngx_http_push_msg_t *msg, ngx_chain_t **chain, ngx_str_t **content_type, ngx_str_t **etag, time_t *last_modified) { + if(etag != NULL && (*etag = ngx_http_push_store->message_etag(msg, pool))==NULL) { + //oh, nevermind... + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate memory for Etag header"); + return NGX_ERROR; + } + if(content_type != NULL && (*content_type= ngx_http_push_store->message_content_type(msg, pool))==NULL) { + //oh, nevermind... + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate memory for Content Type header"); + if(pool == NULL) { + ngx_free(*etag); + } + else { + ngx_pfree(pool, *etag); + } + return NGX_ERROR; + } + + //preallocate output chain. yes, same one for every waiting subscriber + if(chain != NULL && (*chain = ngx_http_push_create_output_chain(msg->buf, pool, ngx_cycle->log))==NULL) { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate buffer chain while responding to subscriber request"); + if(pool == NULL) { + ngx_free(*etag); + ngx_free(*content_type); + } + else { + ngx_pfree(pool, *etag); + ngx_pfree(pool, *content_type); + } + return NGX_ERROR; + } + + if(last_modified != NULL) { + *last_modified = msg->message_time; + } + ngx_http_push_store->unlock(); + + + if(pool!=NULL && shared == 0 && ((*chain)->buf->file!=NULL)) { + //close file when we're done with it + ngx_pool_cleanup_t *cln; + ngx_pool_cleanup_file_t *clnf; + + if((cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t)))==NULL) { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate buffer chain pool cleanup while responding to subscriber request"); + ngx_pfree(pool, *etag); + ngx_pfree(pool, *content_type); + ngx_pfree(pool, *chain); + return NGX_ERROR; + } + cln->handler = ngx_pool_cleanup_file; + clnf = cln->data; + clnf->fd = (*chain)->buf->file->fd; + clnf->name = (*chain)->buf->file->name.data; + clnf->log = ngx_cycle->log; + } + return NGX_OK; +} + + + +static void ngx_http_push_match_channel_info_subtype(size_t off, u_char *cur, size_t rem, u_char **priority, const ngx_str_t **format, ngx_str_t *content_type) { + static ngx_http_push_content_subtype_t subtypes[] = { + { "json" , 4, &NGX_HTTP_PUSH_CHANNEL_INFO_JSON }, + { "yaml" , 4, &NGX_HTTP_PUSH_CHANNEL_INFO_YAML }, + { "xml" , 3, &NGX_HTTP_PUSH_CHANNEL_INFO_XML }, + { "x-json", 6, &NGX_HTTP_PUSH_CHANNEL_INFO_JSON }, + { "x-yaml", 6, &NGX_HTTP_PUSH_CHANNEL_INFO_YAML } + }; + u_char *start = cur + off; + ngx_uint_t i; + + for(i=0; i<(sizeof(subtypes)/sizeof(ngx_http_push_content_subtype_t)); i++) { + if(ngx_strncmp(start, subtypes[i].subtype, remstart) { + *format = subtypes[i].format; + *priority = start; + content_type->data=cur; + content_type->len= off + 1 + subtypes[i].len; + } + } + } +} + +//print information about a channel +static ngx_int_t ngx_http_push_channel_info(ngx_http_request_t *r, ngx_uint_t messages, ngx_uint_t subscribers, time_t last_seen) { + ngx_buf_t *b; + ngx_uint_t len; + ngx_str_t content_type = ngx_string("text/plain"); + const ngx_str_t *format = &NGX_HTTP_PUSH_CHANNEL_INFO_PLAIN; + time_t time_elapsed = ngx_time() - last_seen; + + if(r->headers_in.accept) { + //lame content-negotiation (without regard for qvalues) + u_char *accept = r->headers_in.accept->value.data; + size_t len = r->headers_in.accept->value.len; + size_t rem; + u_char *cur = accept; + u_char *priority=&accept[len-1]; + for(rem=len; (cur = ngx_strnstr(cur, "text/", rem))!=NULL; cur += sizeof("text/")-1) { + rem=len - ((size_t)(cur-accept)+sizeof("text/")-1); + if(ngx_strncmp(cur+sizeof("text/")-1, "plain", rem<5 ? rem : 5)==0) { + if(priority) { + format = &NGX_HTTP_PUSH_CHANNEL_INFO_PLAIN; + priority = cur+sizeof("text/")-1; + //content-type is already set by default + } + } + ngx_http_push_match_channel_info_subtype(sizeof("text/")-1, cur, rem, &priority, &format, &content_type); + } + cur = accept; + for(rem=len; (cur = ngx_strnstr(cur, "application/", rem))!=NULL; cur += sizeof("application/")-1) { + rem=len - ((size_t)(cur-accept)+sizeof("application/")-1); + ngx_http_push_match_channel_info_subtype(sizeof("application/")-1, cur, rem, &priority, &format, &content_type); + } + } + + r->headers_out.content_type.len = content_type.len; + r->headers_out.content_type.data = content_type.data; + r->headers_out.content_type_len = r->headers_out.content_type.len; + + len = format->len - 8 - 1 + 3*NGX_INT_T_LEN; //minus 8 sprintf + + if ((b = ngx_create_temp_buf(r->pool, len)) == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + b->last = ngx_sprintf(b->last, (char *)format->data, messages, last_seen==0 ? -1 : (ngx_int_t) time_elapsed ,subscribers); + + //lastly, set the content-length, because if the status code isn't 200, nginx may not do so automatically + r->headers_out.content_length_n = ngx_buf_size(b); + + if (ngx_http_send_header(r) > NGX_HTTP_SPECIAL_RESPONSE) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + return ngx_http_output_filter(r, ngx_http_push_create_output_chain(b, r->pool, r->connection->log)); +} + + + +#define NGX_HTTP_PUSH_MAKE_CONTENT_TYPE(content_type, content_type_len, msg, pool) \ + if(((content_type) = ngx_palloc(pool, sizeof(*content_type)+content_type_len))!=NULL) { \ + (content_type)->len=content_type_len; \ + (content_type)->data=(u_char *)((content_type)+1); \ + ngx_memcpy(content_type->data, (msg)->content_type.data, content_type_len); \ + } + +#define NGX_HTTP_PUSH_OPTIONS_OK_MESSAGE "Go ahead" + + +ngx_int_t ngx_push_longpoll_subscriber_enqueue(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *subscriber, ngx_int_t subscriber_timeout) { + ngx_http_cleanup_t *cln; + ngx_http_push_subscriber_cleanup_t *clndata; + ngx_http_request_t *r = subscriber->request; + //attach a cleaner to remove the request from the channel and handle shared buffer deallocation. + if ((cln=ngx_http_cleanup_add(r, sizeof(*clndata))) == NULL) { //make sure we can. + return NGX_ERROR; + } + cln->handler = (ngx_http_cleanup_pt) ngx_http_push_subscriber_cleanup; + clndata = (ngx_http_push_subscriber_cleanup_t *) cln->data; + clndata->channel=channel; + clndata->subscriber=subscriber; + clndata->buf_use_count=0; + clndata->buf=NULL; + clndata->rchain=NULL; + clndata->rpool=NULL; + subscriber->clndata=clndata; + + //set up subscriber timeout event + ngx_memzero(&subscriber->event, sizeof(subscriber->event)); + if (subscriber_timeout > 0) { + subscriber->event.handler = ngx_http_push_clean_timeouted_subscriber; + subscriber->event.data = subscriber; + subscriber->event.log = r->connection->log; + ngx_add_timer(&subscriber->event, subscriber_timeout * 1000); + } + + r->read_event_handler = ngx_http_test_reading; + r->write_event_handler = ngx_http_request_empty_handler; + r->main->count++; //this is the right way to hold and finalize the request... maybe + //r->keepalive = 1; //stayin' alive!! + return NGX_OK; +} + +/* +ngx_int_t ngx_push_longpoll_subscriber_dequeue(ngx_http_push_subscriber_t *subscriber) { + return NGX_OK; +} +*/ + +static ngx_int_t ngx_http_push_response_channel_ptr_info(ngx_http_push_channel_t *channel, ngx_http_request_t *r, ngx_int_t status_code) { + time_t last_seen = 0; + ngx_uint_t subscribers = 0; + ngx_uint_t messages = 0; + if(channel!=NULL) { + ngx_http_push_store->lock(); + subscribers = channel->subscribers; + last_seen = channel->last_seen; + messages = channel->messages; + ngx_http_push_store->unlock(); + r->headers_out.status = status_code == (ngx_int_t) NULL ? NGX_HTTP_OK : status_code; + if (status_code == NGX_HTTP_CREATED) { + r->headers_out.status_line.len =sizeof("201 Created")- 1; + r->headers_out.status_line.data=(u_char *) "201 Created"; + } + else if (status_code == NGX_HTTP_ACCEPTED) { + r->headers_out.status_line.len =sizeof("202 Accepted")- 1; + r->headers_out.status_line.data=(u_char *) "202 Accepted"; + } + ngx_http_push_channel_info(r, messages, subscribers, last_seen); + } + else { + //404! + r->headers_out.status=NGX_HTTP_NOT_FOUND; + //just the headers, please. we don't care to describe the situation or + //respond with an html page + r->headers_out.content_length_n=0; + r->header_only = 1; + ngx_http_send_header(r); + } + return NGX_OK; +} + +static ngx_int_t ngx_http_push_response_channel_info(ngx_str_t *channel_id, ngx_http_request_t *r, ngx_int_t status_code) { + ngx_http_push_channel_t *channel; + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + channel = channel_id == NULL ? NULL : ngx_http_push_store->find_channel(channel_id, cf->channel_timeout, NULL); + return ngx_http_push_response_channel_ptr_info(channel, r, status_code); +} + +static ngx_int_t subscribe_longpoll_callback(ngx_int_t status, ngx_http_request_t *r) { + ngx_http_finalize_request(r, status); + return NGX_OK; +} + +static ngx_int_t subscribe_intervalpoll_callback(ngx_http_push_msg_t *msg, ngx_int_t msg_search_outcome, ngx_http_request_t *r) { + ngx_chain_t *chain; + ngx_str_t *content_type, *etag; + time_t last_modified; + switch(msg_search_outcome) { + case NGX_HTTP_PUSH_MESSAGE_EXPECTED: + //interval-polling subscriber requests get a 304 with their entity tags preserved. + if (r->headers_in.if_modified_since != NULL) { + r->headers_out.last_modified_time=ngx_http_parse_time(r->headers_in.if_modified_since->value.data, r->headers_in.if_modified_since->value.len); + } + if ((etag=ngx_http_push_subscriber_get_etag(r)) != NULL) { + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ETAG, etag); + } + ngx_http_finalize_request(r, NGX_HTTP_NOT_MODIFIED); + return NGX_OK; + + case NGX_HTTP_PUSH_MESSAGE_FOUND: + ngx_http_push_alloc_for_subscriber_response(r->pool, 0, msg, &chain, &content_type, &etag, &last_modified); + ngx_http_push_prepare_response_to_subscriber_request(r, chain, content_type, etag, last_modified); + ngx_http_push_store->release_message(NULL, msg); + ngx_http_finalize_request(r, NGX_OK); + return NGX_OK; + + default: + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return NGX_ERROR; + } +} + +ngx_int_t ngx_http_push_subscriber_handler(ngx_http_request_t *r) { + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + ngx_str_t *channel_id; + ngx_http_push_msg_id_t msg_id; + + if((channel_id=ngx_http_push_get_channel_id(r, cf)) == NULL) { + return r->headers_out.status ? NGX_OK : NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + switch(r->method) { + case NGX_HTTP_GET: + ngx_http_push_subscriber_get_msg_id(r, &msg_id); + + r->main->count++; //let it linger until callback + switch(cf->subscriber_poll_mechanism) { + ngx_int_t msg_search_outcome; + + //for NGX_HTTP_PUSH_MECHANISM_LONGPOLL + case NGX_HTTP_PUSH_MECHANISM_INTERVALPOLL: + ngx_http_push_store->get_message(channel_id, &msg_id, &msg_search_outcome, r, &subscribe_intervalpoll_callback); + break; + + case NGX_HTTP_PUSH_MECHANISM_LONGPOLL: + ngx_http_push_store->subscribe(channel_id, &msg_id, r, &subscribe_longpoll_callback); + break; + } + return NGX_DONE; + + case NGX_HTTP_OPTIONS: + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, &NGX_HTTP_PUSH_ANYSTRING); + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_HEADERS, &NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_SUBSCRIBER_HEADERS); + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_METHODS, &NGX_HTTP_PUSH_ALLOW_GET_OPTIONS); + r->headers_out.content_length_n = 0; + r->header_only = 1; + r->headers_out.status=NGX_HTTP_OK; + ngx_http_send_header(r); + return NGX_OK; + + default: + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ALLOW, &NGX_HTTP_PUSH_ALLOW_GET_OPTIONS); //valid HTTP for the win + return NGX_HTTP_NOT_ALLOWED; + } +} + +static ngx_int_t publish_callback(ngx_int_t status, ngx_http_push_channel_t *ch, ngx_http_request_t *r) { + switch(status) { + case NGX_HTTP_PUSH_MESSAGE_QUEUED: + //message was queued successfully, but there were no subscribers to receive it. + ngx_http_finalize_request(r, ngx_http_push_response_channel_ptr_info(ch, r, NGX_HTTP_ACCEPTED)); + return NGX_OK; + + case NGX_HTTP_PUSH_MESSAGE_RECEIVED: + //message was queued successfully, and it was already sent to at least one subscriber + ngx_http_finalize_request(r, ngx_http_push_response_channel_ptr_info(ch, r, NGX_HTTP_CREATED)); + return NGX_OK; + + case NGX_ERROR: + //WTF? + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: error broadcasting message to workers"); + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return NGX_ERROR; + + default: + //for debugging, mostly. I don't expect this branch to behit during regular operation + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: TOTALLY UNEXPECTED error broadcasting message to workers"); + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return NGX_ERROR; + } +} + +static void ngx_http_push_publisher_body_handler(ngx_http_request_t * r) { + ngx_str_t *channel_id; + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + ngx_uint_t method = r->method; + + if((channel_id = ngx_http_push_get_channel_id(r, cf))==NULL) { + ngx_http_finalize_request(r, r->headers_out.status ? NGX_OK : NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + + switch(method) { + case NGX_HTTP_POST: + case NGX_HTTP_PUT: + ngx_http_push_store->publish(channel_id, r, &publish_callback); + break; + + case NGX_HTTP_DELETE: + ngx_http_finalize_request(r, ngx_http_push_response_channel_info(channel_id, r, NGX_HTTP_OK)); + ngx_http_push_store->delete_channel(channel_id); + break; + + case NGX_HTTP_GET: + ngx_http_finalize_request(r, ngx_http_push_response_channel_info(channel_id, r, NGX_HTTP_OK)); + break; + + case NGX_HTTP_OPTIONS: + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, &NGX_HTTP_PUSH_ANYSTRING); + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_HEADERS, &NGX_HTTP_PUSH_ACCESS_CONTROL_ALLOWED_PUBLISHER_HEADERS); + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ACCESS_CONTROL_ALLOW_METHODS, &NGX_HTTP_PUSH_ALLOW_GET_POST_PUT_DELETE_OPTIONS); + r->header_only = 1; + r->headers_out.content_length_n = 0; + r->headers_out.status=NGX_HTTP_OK; + ngx_http_send_header(r); + ngx_http_finalize_request(r, NGX_HTTP_OK); + break; + + default: + //some other weird request method + ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ALLOW, &NGX_HTTP_PUSH_ALLOW_GET_POST_PUT_DELETE_OPTIONS); + ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); + break; + } +} + +ngx_int_t ngx_http_push_respond_to_subscribers(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel, ngx_http_push_msg_t *msg, ngx_int_t status_code, const ngx_str_t *status_line) { + + //copy everything we need first + ngx_str_t *content_type=NULL; + ngx_str_t *etag=NULL; + time_t last_modified; + ngx_chain_t *chain=NULL; + ngx_http_request_t *r; + ngx_buf_t *buffer; + ngx_chain_t *rchain; + ngx_buf_t *rbuffer; + ngx_int_t *buf_use_count; + ngx_http_push_subscriber_cleanup_t *clndata; + ngx_http_push_subscriber_t *cur=NULL; + ngx_int_t responded_subscribers=0; + + if(sentinel==NULL) { + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "respond_to_subscribers with sentinel==NULL"); + return NGX_OK; + } + + if(msg!=NULL) { + if(ngx_http_push_alloc_for_subscriber_response(ngx_http_push_pool, 1, msg, &chain, &content_type, &etag, &last_modified)==NGX_ERROR) { + ngx_http_push_store->release_message(channel, msg); + return NGX_ERROR; + } + + buffer = chain->buf; + buffer->recycled = 1; + + buf_use_count = ngx_pcalloc(ngx_http_push_pool, sizeof(*buf_use_count)); + *buf_use_count = ngx_http_push_store->channel_worker_subscribers(sentinel); + } + + while((cur=ngx_http_push_store->next_subscriber(channel, sentinel, cur, 1))!=NULL) { + //in this block, nothing in shared memory should be dereferenced. + r=cur->request; + + if(msg!=NULL) { + //chain and buffer for this request + rchain = ngx_pcalloc(r->pool, sizeof(*rchain)); + rchain->next = NULL; + rbuffer = ngx_pcalloc(r->pool, sizeof(*rbuffer)); + rchain->buf = rbuffer; + ngx_memcpy(rbuffer, buffer, sizeof(*buffer)); + + //request buffer cleanup + clndata = cur->clndata; + clndata->buf = buffer; + clndata->buf_use_count = buf_use_count; + clndata->rchain = rchain; + clndata->rpool = r->pool; + + if (rbuffer->in_file && (fcntl(rbuffer->file->fd, F_GETFD) == -1)) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: buffer in invalid file descriptor"); + } + //cleanup oughtn't dequeue anything. or decrement the subscriber count, for that matter + ngx_http_push_subscriber_clear_ctx(cur); + ngx_http_finalize_request(r, ngx_http_push_prepare_response_to_subscriber_request(r, rchain, content_type, etag, last_modified)); //BAM! + } + else { + ngx_http_push_subscriber_clear_ctx(cur); + ngx_http_finalize_request(r, ngx_http_push_respond_status_only(r, status_code, status_line)); + } + responded_subscribers++; + } + if(msg!=NULL) { + ngx_http_push_store->release_message(channel, msg); + ngx_pfree(ngx_http_push_pool, etag); + ngx_pfree(ngx_http_push_pool, content_type); + ngx_pfree(ngx_http_push_pool, chain); + } + + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "respond_to_subscribers with msg %p finished", msg); + ngx_http_push_store->lock(); + channel->subscribers-=responded_subscribers; + //is the message still needed? + ngx_http_push_store->unlock(); + ngx_http_push_store->release_subscriber_sentinel(channel, sentinel); + return NGX_OK; +} + +ngx_int_t ngx_http_push_publisher_handler(ngx_http_request_t * r) { + ngx_int_t rc; + + /* Instruct ngx_http_read_subscriber_request_body to store the request + body entirely in a memory buffer or in a file */ + r->request_body_in_single_buf = 1; + r->request_body_in_persistent_file = 1; + r->request_body_in_clean_file = 0; + r->request_body_file_log_level = 0; + + rc = ngx_http_read_client_request_body(r, ngx_http_push_publisher_body_handler); + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + return rc; + } + return NGX_DONE; +} + +void ngx_http_push_copy_preallocated_buffer(ngx_buf_t *buf, ngx_buf_t *cbuf) { + if (cbuf!=NULL) { + ngx_memcpy(cbuf, buf, sizeof(*buf)); //overkill? + if(buf->temporary || buf->memory) { //we don't want to copy mmpapped memory, so no ngx_buf_in_momory(buf) + cbuf->pos = (u_char *) (cbuf+1); + cbuf->last = cbuf->pos + ngx_buf_size(buf); + cbuf->start=cbuf->pos; + cbuf->end = cbuf->start + ngx_buf_size(buf); + ngx_memcpy(cbuf->pos, buf->pos, ngx_buf_size(buf)); + cbuf->memory=ngx_buf_in_memory_only(buf) ? 1 : 0; + } + if (buf->file!=NULL) { + cbuf->file = (ngx_file_t *) (cbuf+1) + ((buf->temporary || buf->memory) ? ngx_buf_size(buf) : 0); + cbuf->file->fd=NGX_INVALID_FILE; + cbuf->file->log=NULL; + cbuf->file->offset=buf->file->offset; + cbuf->file->sys_offset=buf->file->sys_offset; + cbuf->file->name.len=buf->file->name.len; + cbuf->file->name.data=(u_char *) (cbuf->file+1); + ngx_memcpy(cbuf->file->name.data, buf->file->name.data, buf->file->name.len); + } + } +} diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_module.h b/debian/modules/nginx-http-push/src/ngx_http_push_module.h new file mode 100644 index 0000000..7c79cde --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_module.h @@ -0,0 +1,31 @@ +#include +#include +#include +#include + + +extern ngx_pool_t *ngx_http_push_pool; +extern ngx_int_t ngx_http_push_worker_processes; +extern ngx_module_t ngx_http_push_module; +extern ngx_http_push_store_t *ngx_http_push_store; + +ngx_int_t ngx_http_push_respond_status_only(ngx_http_request_t *r, ngx_int_t status_code, const ngx_str_t *statusline); +void ngx_http_push_clean_timeouted_subscriber(ngx_event_t *ev); +ngx_int_t ngx_http_push_allow_caching(ngx_http_request_t *r); +ngx_int_t ngx_http_push_subscriber_get_msg_id(ngx_http_request_t *r, ngx_http_push_msg_id_t *id); +void ngx_http_push_subscriber_cleanup(ngx_http_push_subscriber_cleanup_t *data); +ngx_str_t * ngx_http_push_subscriber_get_etag(ngx_http_request_t * r); +ngx_table_elt_t * ngx_http_push_add_response_header(ngx_http_request_t *r, const ngx_str_t *header_name, const ngx_str_t *header_value); +ngx_chain_t * ngx_http_push_create_output_chain(ngx_buf_t *buf, ngx_pool_t *pool, ngx_log_t *log); +ngx_int_t ngx_http_push_prepare_response_to_subscriber_request(ngx_http_request_t *r, ngx_chain_t *chain, ngx_str_t *content_type, ngx_str_t *etag, time_t last_modified); +ngx_int_t ngx_push_longpoll_subscriber_enqueue(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *subscriber, ngx_int_t subscriber_timeout); +ngx_int_t ngx_push_longpoll_subscriber_dequeue(ngx_http_push_subscriber_t *subscriber); +ngx_int_t ngx_http_push_alloc_for_subscriber_response(ngx_pool_t *pool, ngx_int_t shared, ngx_http_push_msg_t *msg, ngx_chain_t **chain, ngx_str_t **content_type, ngx_str_t **etag, time_t *last_modified); + + +ngx_int_t ngx_http_push_subscriber_handler(ngx_http_request_t *r); +ngx_int_t ngx_http_push_publisher_handler(ngx_http_request_t *r); +ngx_int_t ngx_http_push_respond_to_subscribers(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel, ngx_http_push_msg_t *msg, ngx_int_t status_code, const ngx_str_t *status_line); +ngx_int_t ngx_http_push_respond_status_only(ngx_http_request_t *r, ngx_int_t status_code, const ngx_str_t *statusline); +ngx_int_t ngx_http_push_subscriber_get_etag_int(ngx_http_request_t * r); +void ngx_http_push_copy_preallocated_buffer(ngx_buf_t *buf, ngx_buf_t *cbuf); diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_module_setup.c b/debian/modules/nginx-http-push/src/ngx_http_push_module_setup.c new file mode 100644 index 0000000..ea05d93 --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_module_setup.c @@ -0,0 +1,361 @@ +ngx_module_t ngx_http_push_module; + +static ngx_int_t ngx_http_push_init_module(ngx_cycle_t *cycle) { + ngx_core_conf_t *ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + ngx_http_push_worker_processes = ccf->worker_processes; + //initialize subscriber queues + //pool, please + if((ngx_http_push_pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, cycle->log))==NULL) { //I trust the cycle pool size to be a well-tuned one. + return NGX_ERROR; + } + + //initialize storage engine + return ngx_http_push_store->init_module(cycle); +} + +static ngx_int_t ngx_http_push_init_worker(ngx_cycle_t *cycle) { + if (ngx_process != NGX_PROCESS_WORKER) { + //not a worker, stop initializing stuff. + return NGX_OK; + } + + if(ngx_http_push_store->init_worker(cycle)!=NGX_OK) { + return NGX_ERROR; + } + return NGX_OK; +} + +static ngx_int_t ngx_http_push_postconfig(ngx_conf_t *cf) { + return ngx_http_push_store->init_postconfig(cf); +} + +//main config +static void * ngx_http_push_create_main_conf(ngx_conf_t *cf) { + ngx_http_push_main_conf_t *mcf = ngx_pcalloc(cf->pool, sizeof(*mcf)); + if(mcf == NULL) { + return NGX_CONF_ERROR; + } + + ngx_http_push_store->create_main_conf(cf, mcf); + + return mcf; +} + +//location config stuff +static void *ngx_http_push_create_loc_conf(ngx_conf_t *cf) { + ngx_http_push_loc_conf_t *lcf = ngx_pcalloc(cf->pool, sizeof(*lcf)); + if(lcf == NULL) { + return NGX_CONF_ERROR; + } + lcf->buffer_timeout=NGX_CONF_UNSET; + lcf->max_messages=NGX_CONF_UNSET; + lcf->min_messages=NGX_CONF_UNSET; + lcf->subscriber_concurrency=NGX_CONF_UNSET; + lcf->subscriber_poll_mechanism=NGX_CONF_UNSET; + lcf->subscriber_timeout=NGX_CONF_UNSET; + lcf->authorize_channel=NGX_CONF_UNSET; + lcf->delete_oldest_received_message=NGX_CONF_UNSET; + lcf->max_channel_id_length=NGX_CONF_UNSET; + lcf->max_channel_subscribers=NGX_CONF_UNSET; + lcf->ignore_queue_on_no_cache=NGX_CONF_UNSET; + lcf->channel_timeout=NGX_CONF_UNSET; + lcf->channel_group.data=NULL; + return lcf; +} + +static char * ngx_http_push_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) { + ngx_http_push_loc_conf_t *prev = parent, *conf = child; + ngx_conf_merge_sec_value(conf->buffer_timeout, prev->buffer_timeout, NGX_HTTP_PUSH_DEFAULT_BUFFER_TIMEOUT); + ngx_conf_merge_value(conf->max_messages, prev->max_messages, NGX_HTTP_PUSH_DEFAULT_MAX_MESSAGES); + ngx_conf_merge_value(conf->min_messages, prev->min_messages, NGX_HTTP_PUSH_DEFAULT_MIN_MESSAGES); + ngx_conf_merge_value(conf->subscriber_concurrency, prev->subscriber_concurrency, NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_BROADCAST); + ngx_conf_merge_value(conf->subscriber_poll_mechanism, prev->subscriber_poll_mechanism, NGX_HTTP_PUSH_MECHANISM_LONGPOLL); + ngx_conf_merge_sec_value(conf->subscriber_timeout, prev->subscriber_timeout, NGX_HTTP_PUSH_DEFAULT_SUBSCRIBER_TIMEOUT); + ngx_conf_merge_value(conf->authorize_channel, prev->authorize_channel, 0); + ngx_conf_merge_value(conf->delete_oldest_received_message, prev->delete_oldest_received_message, 0); + ngx_conf_merge_value(conf->max_channel_id_length, prev->max_channel_id_length, NGX_HTTP_PUSH_MAX_CHANNEL_ID_LENGTH); + ngx_conf_merge_value(conf->max_channel_subscribers, prev->max_channel_subscribers, 0); + ngx_conf_merge_value(conf->ignore_queue_on_no_cache, prev->ignore_queue_on_no_cache, 0); + ngx_conf_merge_value(conf->channel_timeout, prev->channel_timeout, NGX_HTTP_PUSH_DEFAULT_CHANNEL_TIMEOUT); + ngx_conf_merge_str_value(conf->channel_group, prev->channel_group, ""); + + //sanity checks + if(conf->max_messages < conf->min_messages) { + //min/max buffer size makes sense? + ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "push_max_message_buffer_length cannot be smaller than push_min_message_buffer_length."); + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + +static ngx_str_t ngx_http_push_channel_id = ngx_string("push_channel_id"); //channel id variable +//publisher and subscriber handlers now. +static char *ngx_http_push_setup_handler(ngx_conf_t *cf, void * conf, ngx_int_t (*handler)(ngx_http_request_t *)) { + ngx_http_core_loc_conf_t *clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + ngx_http_push_loc_conf_t *plcf = conf; + clcf->handler = handler; + clcf->if_modified_since = NGX_HTTP_IMS_OFF; + plcf->index = ngx_http_get_variable_index(cf, &ngx_http_push_channel_id); + if (plcf->index == NGX_ERROR) { + return NGX_CONF_ERROR; + } + return NGX_CONF_OK; +} + +typedef struct { + char *str; + ngx_int_t val; +} ngx_http_push_strval_t; + +static ngx_int_t ngx_http_push_strval(ngx_str_t string, ngx_http_push_strval_t strval[], ngx_int_t strval_len, ngx_int_t *val) { + ngx_int_t i; + for(i=0; ioffset); + + if (*field != NGX_CONF_UNSET) { + return "is duplicate"; + } + + ngx_str_t value = (((ngx_str_t *) cf->args->elts)[1]); + if(ngx_http_push_strval(value, concurrency, 3, field)!=NGX_OK) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "invalid push_subscriber_concurrency value: %V", &value); + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + +static char *ngx_http_push_publisher(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { + return ngx_http_push_setup_handler(cf, conf, &ngx_http_push_publisher_handler); +} + +static char *ngx_http_push_subscriber(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { + static ngx_http_push_strval_t mech[] = { + { "interval-poll", NGX_HTTP_PUSH_MECHANISM_INTERVALPOLL }, + { "long-poll" , NGX_HTTP_PUSH_MECHANISM_LONGPOLL } + }; + ngx_int_t *field = (ngx_int_t *) ((char *) conf + cmd->offset); + if (*field != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if(cf->args->nelts==1) { //no argument given + *field = NGX_HTTP_PUSH_MECHANISM_LONGPOLL; //default + } + else { + ngx_str_t value = (((ngx_str_t *) cf->args->elts)[1]); + if(ngx_http_push_strval(value, mech, 2, field)!=NGX_OK) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "invalid push_subscriber value: %V", &value); + return NGX_CONF_ERROR; + } + } + + return ngx_http_push_setup_handler(cf, conf, &ngx_http_push_subscriber_handler); +} + +static void ngx_http_push_exit_worker(ngx_cycle_t *cycle) { + ngx_http_push_store->exit_worker(cycle); +} + +static void ngx_http_push_exit_master(ngx_cycle_t *cycle) { + ngx_http_push_store->exit_master(cycle); +} + +static char *ngx_http_push_set_message_buffer_length(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { + char *p = conf; + ngx_int_t *min, *max; + ngx_str_t *value; + ngx_int_t intval; + min = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, min_messages)); + max = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, max_messages)); + if(*min != NGX_CONF_UNSET || *max != NGX_CONF_UNSET) { + return "is duplicate"; + } + value = cf->args->elts; + if((intval = ngx_atoi(value[1].data, value[1].len))==NGX_ERROR) { + return "invalid number"; + } + *min = intval; + *max = intval; + + return NGX_CONF_OK; +} + +static char *ngx_http_push_store_messages_directive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { + char *p = conf; + ngx_str_t *val = cf->args->elts; + + + if (ngx_strcasecmp(val[1].data, (u_char *) "off") == 0) { + ngx_int_t *min, *max; + min = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, min_messages)); + max = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, max_messages)); + *min=0; + *max=0; + } + return NGX_CONF_OK; +} + +static ngx_command_t ngx_http_push_commands[] = { + + { ngx_string("push_message_timeout"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_sec_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, buffer_timeout), + NULL }, + + { ngx_string("push_max_reserved_memory"), + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + NGX_HTTP_MAIN_CONF_OFFSET, + offsetof(ngx_http_push_main_conf_t, shm_size), + NULL }, + + { ngx_string("push_min_message_buffer_length"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, min_messages), + NULL }, + + { ngx_string("push_max_message_buffer_length"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, max_messages), + NULL }, + + { ngx_string("push_message_buffer_length"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_http_push_set_message_buffer_length, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("push_delete_oldest_received_message"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, delete_oldest_received_message), + NULL }, + + { ngx_string("push_publisher"), + NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS, + ngx_http_push_publisher, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("push_subscriber"), + NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS|NGX_CONF_TAKE1, + ngx_http_push_subscriber, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, subscriber_poll_mechanism), + NULL }, + + { ngx_string("push_subscriber_concurrency"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_http_push_set_subscriber_concurrency, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, subscriber_concurrency), + NULL }, + + { ngx_string("push_subscriber_timeout"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_sec_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, subscriber_timeout), + NULL }, + + { ngx_string("push_authorized_channels_only"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, authorize_channel), + NULL }, + + { ngx_string("push_store_messages"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_http_push_store_messages_directive, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("push_channel_group"), + NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_str_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, channel_group), + NULL }, + + { ngx_string("push_max_channel_id_length"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, max_channel_id_length), + NULL }, + + { ngx_string("push_max_channel_subscribers"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, max_channel_subscribers), + NULL }, + { ngx_string("push_ignore_queue_on_no_cache"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, ignore_queue_on_no_cache), + NULL }, + + { ngx_string("push_channel_timeout"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_sec_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_push_loc_conf_t, channel_timeout), + NULL }, + + ngx_null_command +}; + +static ngx_http_module_t ngx_http_push_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_push_postconfig, /* postconfiguration */ + ngx_http_push_create_main_conf, /* create main configuration */ + NULL, /* init main configuration */ + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + ngx_http_push_create_loc_conf, /* create location configuration */ + ngx_http_push_merge_loc_conf, /* merge location configuration */ +}; + +ngx_module_t ngx_http_push_module = { + NGX_MODULE_V1, + &ngx_http_push_module_ctx, /* module context */ + ngx_http_push_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + ngx_http_push_init_module, /* init module */ + ngx_http_push_init_worker, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + ngx_http_push_exit_worker, /* exit process */ + ngx_http_push_exit_master, /* exit master */ + NGX_MODULE_V1_PADDING +}; diff --git a/debian/modules/nginx-http-push/src/ngx_http_push_types.h b/debian/modules/nginx-http-push/src/ngx_http_push_types.h new file mode 100644 index 0000000..656d9de --- /dev/null +++ b/debian/modules/nginx-http-push/src/ngx_http_push_types.h @@ -0,0 +1,120 @@ +//on with the declarations +typedef struct { + size_t shm_size; +} ngx_http_push_main_conf_t; + +typedef struct { + ngx_atomic_int_t lock; + ngx_atomic_t mutex; + ngx_int_t write_pid; +} ngx_rwlock_t; + + +typedef struct { + time_t time; //tag message by time + ngx_int_t tag; //used in conjunction with message_time if more than one message have the same time. +} ngx_http_push_msg_id_t; + +//message queue +typedef struct { + ngx_queue_t queue; //this MUST be first. + ngx_str_t content_type; + // ngx_str_t charset; + ngx_buf_t *buf; + time_t expires; + ngx_uint_t delete_oldest_received_min_messages; //NGX_MAX_UINT32_VALUE for 'never' + time_t message_time; //tag message by time + ngx_int_t message_tag; //used in conjunction with message_time if more than one message have the same time. + ngx_int_t refcount; +} ngx_http_push_msg_t; + +typedef struct ngx_http_push_subscriber_cleanup_s ngx_http_push_subscriber_cleanup_t; + +//subscriber request queue +typedef struct { + ngx_queue_t queue; //this MUST be first. + ngx_http_request_t *request; + ngx_http_push_subscriber_cleanup_t *clndata; + ngx_event_t event; +} ngx_http_push_subscriber_t; + +typedef struct { + ngx_queue_t queue; + pid_t pid; + ngx_int_t slot; + ngx_http_push_subscriber_t *subscriber_sentinel; +} ngx_http_push_pid_queue_t; + +//our typecast-friendly rbtree node (channel) +typedef struct { + ngx_rbtree_node_t node; //this MUST be first. + ngx_str_t id; + ngx_http_push_msg_t *message_queue; + ngx_uint_t messages; + ngx_http_push_pid_queue_t *workers_with_subscribers; + ngx_uint_t subscribers; + time_t last_seen; + time_t expires; +} ngx_http_push_channel_t; + +//cleaning supplies +struct ngx_http_push_subscriber_cleanup_s { + ngx_http_push_subscriber_t *subscriber; + ngx_http_push_channel_t *channel; + ngx_int_t *buf_use_count; + ngx_buf_t *buf; + ngx_chain_t *rchain; + ngx_pool_t *rpool; +}; + +//garbage collecting goodness +typedef struct { + ngx_queue_t queue; + ngx_http_push_channel_t *channel; +} ngx_http_push_channel_queue_t; + +//messages to worker processes +typedef struct { + ngx_queue_t queue; + ngx_http_push_msg_t *msg; //->shared memory + ngx_int_t status_code; + ngx_pid_t pid; + ngx_http_push_channel_t *channel; //->shared memory + ngx_http_push_subscriber_t *subscriber_sentinel; //->a worker's local pool +} ngx_http_push_worker_msg_t; + +typedef struct { + ngx_queue_t queue; + ngx_rwlock_t lock; +} ngx_http_push_worker_msg_sentinel_t; + +//shared memory +typedef struct { + ngx_rbtree_t tree; + ngx_uint_t channels; //# of channels being used + ngx_uint_t messages; //# of channels being used + ngx_http_push_worker_msg_sentinel_t *ipc; //interprocess stuff +} ngx_http_push_shm_data_t; + +typedef struct { + ngx_int_t index; + time_t buffer_timeout; + ngx_int_t min_messages; + ngx_int_t max_messages; + ngx_int_t subscriber_concurrency; + ngx_int_t subscriber_poll_mechanism; + time_t subscriber_timeout; + ngx_int_t authorize_channel; + ngx_int_t delete_oldest_received_message; + ngx_str_t channel_group; + ngx_int_t max_channel_id_length; + ngx_int_t max_channel_subscribers; + ngx_int_t ignore_queue_on_no_cache; + time_t channel_timeout; +} ngx_http_push_loc_conf_t; + +typedef struct { + char *subtype; + size_t len; + const ngx_str_t *format; +} ngx_http_push_content_subtype_t; diff --git a/debian/modules/nginx-http-push/src/store/memory/store.c b/debian/modules/nginx-http-push/src/store/memory/store.c new file mode 100755 index 0000000..65fa04c --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/memory/store.c @@ -0,0 +1,1180 @@ +#include + +#include "store.h" +#include +#include +#include + +#define NGX_HTTP_PUSH_BROADCAST_CHECK(val, fail, r, errormessage) \ + if (val == fail) { \ + ngx_log_error(NGX_LOG_ERR, (r)->connection->log, 0, errormessage); \ + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); \ + return NULL; \ + } + +#define NGX_HTTP_PUSH_BROADCAST_CHECK_LOCKED(val, fail, r, errormessage, shpool) \ + if (val == fail) { \ + ngx_shmtx_unlock(&(shpool)->mutex); \ + ngx_log_error(NGX_LOG_ERR, (r)->connection->log, 0, errormessage); \ + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); \ + return NULL; \ + } + +#define NGX_HTTP_BUF_ALLOC_SIZE(buf) \ + (sizeof(*buf) + \ + (((buf)->temporary || (buf)->memory) ? ngx_buf_size(buf) : 0) + \ + (((buf)->file!=NULL) ? (sizeof(*(buf)->file) + (buf)->file->name.len + 1) : 0)) + +#define ENQUEUED_DBG "msg %p enqueued. ref:%i, p:%p n:%p" +#define CREATED_DBG "msg %p created ref:%i, p:%p n:%p" +#define FREED_DBG "msg %p freed. ref:%i, p:%p n:%p" +#define RESERVED_DBG "msg %p reserved. ref:%i, p:%p n:%p" +#define RELEASED_DBG "msg %p released. ref:%i, p:%p n:%p" + +//#define DEBUG_SHM_ALLOC 1 + +static ngx_http_push_channel_queue_t channel_gc_sentinel; +static ngx_slab_pool_t *ngx_http_push_shpool = NULL; +static ngx_shm_zone_t *ngx_http_push_shm_zone = NULL; + +static ngx_int_t ngx_http_push_store_send_worker_message(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *subscriber_sentinel, ngx_pid_t pid, ngx_int_t worker_slot, ngx_http_push_msg_t *msg, ngx_int_t status_code); + +static ngx_int_t ngx_http_push_channel_collector(ngx_http_push_channel_t * channel) { + if((ngx_http_push_clean_channel_locked(channel))!=NULL) { //we're up for deletion + ngx_http_push_channel_queue_t *trashy; + if((trashy = ngx_alloc(sizeof(*trashy), ngx_cycle->log))!=NULL) { + //yeah, i'm allocating memory during garbage collection. sue me. + trashy->channel=channel; + ngx_queue_insert_tail(&channel_gc_sentinel.queue, &trashy->queue); + return NGX_OK; + } + return NGX_ERROR; + } + return NGX_OK; +} + +static void ngx_http_push_store_lock_shmem(void){ + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); +} +static void ngx_http_push_store_unlock_shmem(void){ + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); +} + +//garbage-collecting slab allocator +static void * ngx_http_push_slab_alloc_locked(size_t size, char *label) { + void *p; + if((p = ngx_slab_alloc_locked(ngx_http_push_shpool, size))==NULL) { + ngx_http_push_channel_queue_t *ccur, *cnext; + ngx_uint_t collected = 0; + //failed. emergency garbage sweep, then. + + //collect channels + ngx_queue_init(&channel_gc_sentinel.queue); + ngx_http_push_walk_rbtree(ngx_http_push_channel_collector, ngx_http_push_shm_zone); + for(ccur=(ngx_http_push_channel_queue_t *)ngx_queue_next(&channel_gc_sentinel.queue); ccur != &channel_gc_sentinel; ccur=cnext) { + cnext = (ngx_http_push_channel_queue_t *)ngx_queue_next(&ccur->queue); + ngx_http_push_delete_channel_locked(ccur->channel, ngx_http_push_shm_zone); + ngx_free(ccur); + collected++; + } + + //todo: collect worker messages maybe + + ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "push module: out of shared memory. emergency garbage collection deleted %ui unused channels.", collected); + + p = ngx_slab_alloc_locked(ngx_http_push_shpool, size); + } +#if (DEBUG_SHM_ALLOC == 1) + if (p != NULL) { + if(label==NULL) + label="none"; + ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "shpool alloc addr %p size %ui label %s", p, size, label); + } +#endif + return p; +} + +static void * ngx_http_push_slab_alloc(size_t size, char *label) { + void * p; + ngx_http_push_store_lock_shmem(); + p= ngx_http_push_slab_alloc_locked(size, label); + ngx_http_push_store_unlock_shmem(); + return p; +} + +static void ngx_http_push_slab_free_locked(void *ptr) { + ngx_slab_free_locked(ngx_http_push_shpool, ptr); + #if (DEBUG_SHM_ALLOC == 1) + ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "shpool free addr %p", ptr); + #endif +} +/* +static void ngx_http_push_slab_free(void *ptr) { + ngx_http_push_store_lock_shmem(); + ngx_http_push_slab_free_locked(ptr); + ngx_http_push_store_unlock_shmem(); +}*/ + +//shpool is assumed to be locked. +static ngx_http_push_msg_t *ngx_http_push_get_latest_message_locked(ngx_http_push_channel_t * channel) { + ngx_queue_t *sentinel = &channel->message_queue->queue; + if(ngx_queue_empty(sentinel)) { + return NULL; + } + ngx_queue_t *qmsg = ngx_queue_last(sentinel); + return ngx_queue_data(qmsg, ngx_http_push_msg_t, queue); +} + +//shpool must be locked. No memory is freed. O(1) +static ngx_http_push_msg_t *ngx_http_push_get_oldest_message_locked(ngx_http_push_channel_t * channel) { + ngx_queue_t *sentinel = &channel->message_queue->queue; + if(ngx_queue_empty(sentinel)) { + return NULL; + } + ngx_queue_t *qmsg = ngx_queue_head(sentinel); + return ngx_queue_data(qmsg, ngx_http_push_msg_t, queue); +} + +static void ngx_http_push_store_reserve_message_locked(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg) { + if(msg == NULL) { + return; + } + msg->refcount++; + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, RESERVED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + //we need a refcount because channel messages MAY be dequed before they are used up. It thus falls on the IPC stuff to free it. +} + +static void ngx_http_push_store_reserve_message_num_locked(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t reservations) { + if(msg == NULL) { + return; + } + msg->refcount+=reservations; + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, RESERVED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + //we need a refcount because channel messages MAY be dequed before they are used up. It thus falls on the IPC stuff to free it. +} + +static void ngx_http_push_store_reserve_message(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg) { + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + ngx_http_push_store_reserve_message_locked(channel, msg); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + //we need a refcount because channel messages MAY be dequed before they are used up. It thus falls on the IPC stuff to free it. +} + + + +//free memory for a message. +static ngx_inline void ngx_http_push_free_message_locked(ngx_http_push_msg_t *msg, ngx_slab_pool_t *shpool) { + if(msg->buf->file!=NULL) { + // i'd like to release the shpool lock here while i do stuff to this file, but that + // might unlock during channel rbtree traversal, which is Bad News. + if(msg->buf->file->fd!=NGX_INVALID_FILE) { + ngx_close_file(msg->buf->file->fd); + } + ngx_delete_file(msg->buf->file->name.data); //should I care about deletion errors? doubt it. + } + ngx_http_push_slab_free_locked(msg->buf); //separate block, remember? + ngx_http_push_slab_free_locked(msg); + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, FREED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + if(msg->refcount < 0) { //something worth exploring went wrong + raise(SIGSEGV); + } + ((ngx_http_push_shm_data_t *) ngx_http_push_shm_zone->data)->messages--; +} + +// remove a message from queue and free all associated memory. assumes shpool is already locked. +static ngx_int_t ngx_http_push_delete_message_locked(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t force) { + if (msg==NULL) { + return NGX_OK; + } + if(channel!=NULL) { + ngx_queue_remove(&msg->queue); + channel->messages--; + } + if(msg->refcount<=0 || force) { + //nobody needs this message, or we were forced at integer-point to delete + ngx_http_push_free_message_locked(msg, ngx_http_push_shpool); + } + return NGX_OK; +} + +static void ngx_http_push_store_release_message_locked(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg) { + if(msg == NULL) { + return; + } + msg->refcount--; + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, RELEASED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + if(msg->queue.next==NULL && msg->refcount<=0) { + //message had been dequeued and nobody needs it anymore + ngx_http_push_free_message_locked(msg, ngx_http_push_shpool); + } + if(channel != NULL && channel->messages > msg->delete_oldest_received_min_messages && ngx_http_push_get_oldest_message_locked(channel) == msg) { + ngx_http_push_delete_message_locked(channel, msg, 0); + } +} + +static void ngx_http_push_store_release_message(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg) { + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + ngx_http_push_store_release_message_locked(channel, msg); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); +} + +static ngx_int_t ngx_http_push_delete_message(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t force) { + ngx_int_t ret; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + ret = ngx_http_push_delete_message_locked(channel, msg, force); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + return ret; +} + + +/** find message with entity tags matching those of the request r. + * @param r subscriber request + */ +static ngx_http_push_msg_t * ngx_http_push_find_message_locked(ngx_http_push_channel_t *channel, ngx_http_push_msg_id_t *msgid, ngx_int_t *status) { + //TODO: consider using an RBTree for message storage. + ngx_queue_t *sentinel = &channel->message_queue->queue; + ngx_queue_t *cur = ngx_queue_head(sentinel); + ngx_http_push_msg_t *msg; + + time_t time = msgid->time; + ngx_int_t tag = msgid->tag; + + //channel's message buffer empty? + if(channel->messages==0) { + *status=NGX_HTTP_PUSH_MESSAGE_EXPECTED; //wait. + return NULL; + } + + // do we want a future message? + msg = ngx_queue_data(sentinel->prev, ngx_http_push_msg_t, queue); + if(time <= msg->message_time) { //that's an empty check (Sentinel's values are zero) + if(time == msg->message_time) { + if(tag >= msg->message_tag) { + *status=NGX_HTTP_PUSH_MESSAGE_EXPECTED; + return NULL; + } + } + } + else { + *status=NGX_HTTP_PUSH_MESSAGE_EXPECTED; + return NULL; + } + + while(cur!=sentinel) { + msg = ngx_queue_data(cur, ngx_http_push_msg_t, queue); + if (time < msg->message_time) { + *status = NGX_HTTP_PUSH_MESSAGE_FOUND; + return msg; + } + else if(time == msg->message_time) { + while (tag >= msg->message_tag && time == msg->message_time && ngx_queue_next(cur)!=sentinel) { + cur=ngx_queue_next(cur); + msg = ngx_queue_data(cur, ngx_http_push_msg_t, queue); + } + if(time == msg->message_time && tag < msg->message_tag) { + *status = NGX_HTTP_PUSH_MESSAGE_FOUND; + return msg; + } + continue; + } + cur=ngx_queue_next(cur); + } + *status = NGX_HTTP_PUSH_MESSAGE_EXPIRED; //message too old and was not found. + return NULL; +} + +static ngx_http_push_channel_t * ngx_http_push_store_find_channel(ngx_str_t *id, time_t channel_timeout, ngx_int_t (*callback)(ngx_http_push_channel_t *channel)) { + //get the channel and check channel authorization while we're at it. + ngx_http_push_channel_t *channel; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + channel = ngx_http_push_find_channel(id, channel_timeout, ngx_http_push_shm_zone); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + if(callback!=NULL) { + callback(channel); + } + return channel; +} + +//temporary cheat +static ngx_int_t ngx_http_push_store_publish_raw(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t status_code, const ngx_str_t *status_line) { + + //subscribers are queued up in a local pool. Queue heads, however, are located + //in shared memory, identified by pid. + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + ngx_http_push_pid_queue_t *sentinel = channel->workers_with_subscribers; + ngx_http_push_subscriber_t *subscriber_sentinels[NGX_MAX_PROCESSES]; + ngx_http_push_pid_queue_t *pid_queues[NGX_MAX_PROCESSES]; + ngx_int_t sub_sentinel_count=0; + + ngx_http_push_pid_queue_t *cur; + ngx_int_t i, received; + received = channel->subscribers > 0 ? NGX_HTTP_PUSH_MESSAGE_RECEIVED : NGX_HTTP_PUSH_MESSAGE_QUEUED; + + //we need to reserve the message for all the workers in advance + for(cur=(ngx_http_push_pid_queue_t *)ngx_queue_next(&sentinel->queue); cur != sentinel; cur=(ngx_http_push_pid_queue_t *)ngx_queue_next(&cur->queue)) { + if(cur->subscriber_sentinel != NULL) { + pid_queues[sub_sentinel_count] = cur; + subscriber_sentinels[sub_sentinel_count] = cur->subscriber_sentinel; + /* + * each time all of a worker's subscribers are removed, so is the sentinel. + * this is done to make garbage collection easier. Assuming we want to avoid + * placing the sentinel in shared memory (for now -- it's a little tricky + * to debug), the owner of the worker pool must be the one to free said sentinel. + * But channels may be deleted by different worker processes, and it seems unwieldy + * (for now) to do IPC just to delete one stinkin' sentinel. Hence a new sentinel + * is used every time the subscriber queue is emptied. + */ + cur->subscriber_sentinel = NULL; //think about it it terms of garbage collection. it'll make sense. sort of. + sub_sentinel_count++; + } + } + if(sub_sentinel_count > 0) { + ngx_http_push_store_reserve_message_num_locked(channel, msg, sub_sentinel_count); + } + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + + ngx_http_push_subscriber_t *subscriber_sentinel=NULL; + for(i=0; i < sub_sentinel_count; i++) { + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + subscriber_sentinel = subscriber_sentinels[i]; + pid_t worker_pid = pid_queues[i]->pid; + ngx_int_t worker_slot = pid_queues[i]->slot; + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + //if(msg != NULL) + // ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "publish msg %p (ref: %i) for worker %i (slot %i)", msg, msg->refcount, worker_pid, worker_slot); + + + if(subscriber_sentinel != NULL) { + if(worker_pid == ngx_pid) { + //my subscribers + ngx_http_push_respond_to_subscribers(channel, subscriber_sentinel, msg, status_code, status_line); + } + else { + //some other worker's subscribers + //interprocess communication breakdown + if(ngx_http_push_store_send_worker_message(channel, subscriber_sentinel, worker_pid, worker_slot, msg, status_code) != NGX_ERROR) { + ngx_http_push_alert_worker(worker_pid, worker_slot); + } + else { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: error communicating with some other worker process"); + } + } + } else { + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "subscriber sentinel is NULL"); + } + + + } + return received; +} + +static ngx_int_t ngx_http_push_store_delete_channel(ngx_str_t *channel_id) { + ngx_http_push_channel_t *channel; + ngx_http_push_msg_t *msg, *sentinel; + ngx_http_push_store_lock_shmem(); + channel = ngx_http_push_find_channel(channel_id, NGX_HTTP_PUSH_DEFAULT_CHANNEL_TIMEOUT, ngx_http_push_shm_zone); + if (channel == NULL) { + ngx_http_push_store_unlock_shmem(); + return NGX_OK; + } + sentinel = channel->message_queue; + msg = sentinel; + + while((msg=(ngx_http_push_msg_t *)ngx_queue_next(&msg->queue))!=sentinel) { + //force-delete all the messages + ngx_http_push_delete_message_locked(NULL, msg, 1); + } + channel->messages=0; + + //410 gone + ngx_http_push_store_unlock_shmem(); + + ngx_http_push_store_publish_raw(channel, NULL, NGX_HTTP_GONE, &NGX_HTTP_PUSH_HTTP_STATUS_410); + + ngx_http_push_store_lock_shmem(); + ngx_http_push_delete_channel_locked(channel, ngx_http_push_shm_zone); + ngx_http_push_store_unlock_shmem(); + return NGX_OK; +} + +static ngx_http_push_channel_t * ngx_http_push_store_get_channel(ngx_str_t *id, time_t channel_timeout, ngx_int_t (*callback)(ngx_http_push_channel_t *channel)) { + //get the channel and check channel authorization while we're at it. + ngx_http_push_channel_t *channel; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + channel = ngx_http_push_get_channel(id, channel_timeout, ngx_http_push_shm_zone); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + if(channel==NULL) { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate memory for new channel"); + } + if(callback!=NULL) { + callback(channel); + } + return channel; +} + +static ngx_http_push_msg_t * ngx_http_push_store_get_channel_message(ngx_http_push_channel_t *channel, ngx_http_push_msg_id_t *msgid, ngx_int_t *msg_search_outcome, ngx_http_push_loc_conf_t *cf) { + ngx_http_push_msg_t *msg; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + msg = ngx_http_push_find_message_locked(channel, msgid, msg_search_outcome); + if(*msg_search_outcome == NGX_HTTP_PUSH_MESSAGE_FOUND) { + ngx_http_push_store_reserve_message_locked(channel, msg); + } + channel->last_seen = ngx_time(); + channel->expires = ngx_time() + cf->channel_timeout; + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + return msg; +} + +static ngx_int_t default_get_message_callback(ngx_http_push_msg_t *msg, ngx_int_t msg_search_outcome, ngx_http_request_t *r) { + return NGX_OK; +} + +static ngx_http_push_msg_t * ngx_http_push_store_get_message(ngx_str_t *channel_id, ngx_http_push_msg_id_t *msg_id, ngx_int_t *msg_search_outcome, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_http_push_msg_t *msg, ngx_int_t msg_search_outcome, ngx_http_request_t *r)) { + ngx_http_push_channel_t *channel; + ngx_http_push_msg_t *msg; + if(callback==NULL) { + callback=&default_get_message_callback; + } + ngx_http_push_store_lock_shmem(); + channel = ngx_http_push_get_channel(channel_id, NGX_HTTP_PUSH_DEFAULT_CHANNEL_TIMEOUT, ngx_http_push_shm_zone); + ngx_http_push_store_unlock_shmem(); + if (channel == NULL) { + return NULL; + } + msg = ngx_http_push_store_get_channel_message(channel, msg_id, msg_search_outcome, ngx_http_get_module_loc_conf(r, ngx_http_push_module)); + callback(msg, *msg_search_outcome, r); + return msg; +} + +// shared memory zone initializer +static ngx_int_t ngx_http_push_init_shm_zone(ngx_shm_zone_t * shm_zone, void *data) { + if(data) { /* zone already initialized */ + shm_zone->data = data; + return NGX_OK; + } + + ngx_slab_pool_t *shpool = (ngx_slab_pool_t *) shm_zone->shm.addr; + ngx_rbtree_node_t *sentinel; + ngx_http_push_shm_data_t *d; + + ngx_http_push_shpool = shpool; //we'll be using this a bit. + #if (DEBUG_SHM_ALLOC == 1) + ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "ngx_http_push_shpool start %p size %i", shpool->start, (u_char *)shpool->end - (u_char *)shpool->start); + #endif + + if ((d = (ngx_http_push_shm_data_t *)ngx_http_push_slab_alloc(sizeof(*d), "shm data")) == NULL) { //shm_data + return NGX_ERROR; + } + d->channels=0; + d->messages=0; + shm_zone->data = d; + d->ipc=NULL; + //initialize rbtree + if ((sentinel = ngx_http_push_slab_alloc(sizeof(*sentinel), "channel rbtree sentinel"))==NULL) { + return NGX_ERROR; + } + ngx_rbtree_init(&d->tree, sentinel, ngx_http_push_rbtree_insert); + return NGX_OK; +} + +//shared memory +static ngx_str_t ngx_push_shm_name = ngx_string("push_module"); //shared memory segment name +static ngx_int_t ngx_http_push_set_up_shm(ngx_conf_t *cf, size_t shm_size) { + ngx_http_push_shm_zone = ngx_shared_memory_add(cf, &ngx_push_shm_name, shm_size, &ngx_http_push_module); + if (ngx_http_push_shm_zone == NULL) { + return NGX_ERROR; + } + ngx_http_push_shm_zone->init = ngx_http_push_init_shm_zone; + ngx_http_push_shm_zone->data = (void *) 1; + return NGX_OK; +} + +//initialization +static ngx_int_t ngx_http_push_store_init_module(ngx_cycle_t *cycle) { + ngx_core_conf_t *ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + ngx_http_push_worker_processes = ccf->worker_processes; + //initialize our little IPC + return ngx_http_push_init_ipc(cycle, ngx_http_push_worker_processes); +} + +//will be called once per worker +static ngx_int_t ngx_http_push_store_init_ipc_shm(ngx_int_t workers) { + ngx_slab_pool_t *shpool = (ngx_slab_pool_t *) ngx_http_push_shm_zone->shm.addr; + ngx_http_push_shm_data_t *d = (ngx_http_push_shm_data_t *) ngx_http_push_shm_zone->data; + ngx_http_push_worker_msg_sentinel_t *worker_messages=NULL; + ngx_shmtx_lock(&shpool->mutex); + if(d->ipc==NULL) { + //ipc uninitialized. get it done! + if((worker_messages = ngx_http_push_slab_alloc_locked(sizeof(*worker_messages)*NGX_MAX_PROCESSES, "IPC worker message sentinel array"))==NULL) { + ngx_shmtx_unlock(&shpool->mutex); + return NGX_ERROR; + } + d->ipc=worker_messages; + } + else { + worker_messages=d->ipc; + } + + ngx_queue_init(&worker_messages[ngx_process_slot].queue); + ngx_rwlock_init(&worker_messages[ngx_process_slot].lock); + + ngx_shmtx_unlock(&shpool->mutex); + return NGX_OK; +} + +static ngx_int_t ngx_http_push_store_init_worker(ngx_cycle_t *cycle) { + ngx_core_conf_t *ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); + if(ngx_http_push_store_init_ipc_shm(ccf->worker_processes) == NGX_OK) { + return ngx_http_push_ipc_init_worker(cycle); + } + else { + return NGX_ERROR; + } +} + +static ngx_int_t ngx_http_push_store_init_postconfig(ngx_conf_t *cf) { + ngx_http_push_main_conf_t *conf = ngx_http_conf_get_module_main_conf(cf, ngx_http_push_module); + + //initialize shared memory + size_t shm_size; + if(conf->shm_size==NGX_CONF_UNSET_SIZE) { + conf->shm_size=NGX_HTTP_PUSH_DEFAULT_SHM_SIZE; + } + shm_size = ngx_align(conf->shm_size, ngx_pagesize); + if (shm_size < 8 * ngx_pagesize) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "The push_max_reserved_memory value must be at least %udKiB", (8 * ngx_pagesize) >> 10); + shm_size = 8 * ngx_pagesize; + } + if(ngx_http_push_shm_zone && ngx_http_push_shm_zone->shm.size != shm_size) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "Cannot change memory area size without restart, ignoring change"); + } + ngx_conf_log_error(NGX_LOG_INFO, cf, 0, "Using %udKiB of shared memory for push module", shm_size >> 10); + + return ngx_http_push_set_up_shm(cf, shm_size); +} + +static void ngx_http_push_store_create_main_conf(ngx_conf_t *cf, ngx_http_push_main_conf_t *mcf) { + mcf->shm_size=NGX_CONF_UNSET_SIZE; +} + +//great justice appears to be at hand +static ngx_int_t ngx_http_push_movezig_channel_locked(ngx_http_push_channel_t * channel) { + ngx_queue_t *sentinel = &channel->message_queue->queue; + ngx_http_push_msg_t *msg=NULL; + while(!ngx_queue_empty(sentinel)) { + msg = ngx_queue_data(ngx_queue_head(sentinel), ngx_http_push_msg_t, queue); + ngx_http_push_delete_message_locked(channel, msg, 1); + } + return NGX_OK; +} +static ngx_int_t ngx_http_push_store_channel_subscribers(ngx_http_push_channel_t * channel) { + ngx_int_t subs; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + subs = channel->subscribers; + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + return subs; +} + +static ngx_int_t ngx_http_push_store_channel_worker_subscribers(ngx_http_push_subscriber_t * worker_sentinel) { + ngx_http_push_subscriber_t *cur; + ngx_int_t count=0; + cur=(ngx_http_push_subscriber_t *)ngx_queue_head(&worker_sentinel->queue); + while(cur!=worker_sentinel) { + count++; + cur=(ngx_http_push_subscriber_t *)ngx_queue_next(&cur->queue); + } + return count; +} + +static ngx_http_push_subscriber_t *ngx_http_push_store_channel_next_subscriber(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel, ngx_http_push_subscriber_t *cur, int release_previous) { + ngx_http_push_subscriber_t *next; + if(cur==NULL) { + next=(ngx_http_push_subscriber_t *)ngx_queue_head(&sentinel->queue); + } + else{ + next=(ngx_http_push_subscriber_t *)ngx_queue_next(&cur->queue); + if(release_previous==1 && cur!=sentinel) { + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "freeing subscriber cursor at %p.", cur); + ngx_pfree(ngx_http_push_pool, cur); + } + } + return next!=sentinel ? next : NULL; +} + +static ngx_int_t ngx_http_push_store_channel_release_subscriber_sentinel(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel) { + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "freeing subscriber sentinel at %p.", sentinel); + ngx_pfree(ngx_http_push_pool, sentinel); + return NGX_OK; +} + +static void ngx_http_push_store_exit_worker(ngx_cycle_t *cycle) { + ngx_http_push_ipc_exit_worker(cycle); +} + +static void ngx_http_push_store_exit_master(ngx_cycle_t *cycle) { + //destroy channel tree in shared memory + ngx_http_push_walk_rbtree(ngx_http_push_movezig_channel_locked, ngx_http_push_shm_zone); + //deinitialize IPC + ngx_http_push_shutdown_ipc(cycle); +} + +static ngx_http_push_subscriber_t * ngx_http_push_store_subscribe_raw(ngx_http_push_channel_t *channel, ngx_http_request_t *r) { + ngx_http_push_pid_queue_t *sentinel, *cur, *found; + ngx_http_push_subscriber_t *subscriber; + ngx_http_push_subscriber_t *subscriber_sentinel; + //ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + + //subscribers are queued up in a local pool. Queue sentinels are separate and also local, but not in the pool. + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + sentinel = channel->workers_with_subscribers; + cur = (ngx_http_push_pid_queue_t *)ngx_queue_head(&sentinel->queue); + found = NULL; + + while(cur!=sentinel) { + if(cur->pid==ngx_pid) { + found = cur; + break; + } + cur = (ngx_http_push_pid_queue_t *)ngx_queue_next(&cur->queue); + } + if(found == NULL) { //found nothing + if((found=ngx_http_push_slab_alloc_locked(sizeof(*found), "worker subscriber sentinel"))==NULL) { + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: unable to allocate worker subscriber queue marker in shared memory"); + return NULL; + } + //initialize + ngx_queue_insert_tail(&sentinel->queue, &found->queue); + found->pid=ngx_pid; + found->slot=ngx_process_slot; + found->subscriber_sentinel=NULL; + } + if((subscriber = ngx_palloc(ngx_http_push_pool, sizeof(*subscriber)))==NULL) { //unable to allocate request queue element + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: unable to allocate subscriber worker's memory pool"); + return NULL; + } + channel->subscribers++; // do this only when we know everything went okay. + + //figure out the subscriber sentinel + subscriber_sentinel = ((ngx_http_push_pid_queue_t *)found)->subscriber_sentinel; + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "reserve subscriber sentinel at %p", subscriber_sentinel); + + if(subscriber_sentinel==NULL) { + //it's perfectly normal for the sentinel to be NULL. + if((subscriber_sentinel=ngx_palloc(ngx_http_push_pool, sizeof(*subscriber_sentinel)))==NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: unable to allocate channel subscriber sentinel"); + return NULL; + } + ngx_queue_init(&subscriber_sentinel->queue); + ((ngx_http_push_pid_queue_t *)found)->subscriber_sentinel=subscriber_sentinel; + } + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "add to subscriber sentinel at %p", subscriber_sentinel); + ngx_queue_insert_tail(&subscriber_sentinel->queue, &subscriber->queue); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + + subscriber->request = r; + return subscriber; +} + +static ngx_int_t ngx_http_push_handle_subscriber_concurrency(ngx_http_push_channel_t *channel, ngx_http_request_t *r, ngx_http_push_loc_conf_t *cf) { + ngx_int_t max_subscribers = cf->max_channel_subscribers; + ngx_int_t current_subscribers = ngx_http_push_store->channel_subscribers(channel) ; + + + if(current_subscribers==0) { + //empty channels are always okay. + return NGX_OK; + } + + if(max_subscribers!=0 && current_subscribers >= max_subscribers) { + //max_channel_subscribers setting + ngx_http_push_respond_status_only(r, NGX_HTTP_FORBIDDEN, NULL); + return NGX_DECLINED; + } + + //nonzero number of subscribers present + switch(cf->subscriber_concurrency) { + case NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_BROADCAST: + return NGX_OK; + + case NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_LASTIN: + //send "everyone" a 409 Conflict response. + //in most reasonable cases, there'll be at most one subscriber on the + //channel. However, since settings are bound to locations and not + //specific channels, this assumption need not hold. Hence this broadcast. + ngx_http_push_store_publish_raw(channel, NULL, NGX_HTTP_NOT_FOUND, &NGX_HTTP_PUSH_HTTP_STATUS_409); + + return NGX_OK; + + case NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_FIRSTIN: + ngx_http_push_respond_status_only(r, NGX_HTTP_NOT_FOUND, &NGX_HTTP_PUSH_HTTP_STATUS_409); + return NGX_DECLINED; + + default: + return NGX_ERROR; + } +} + +static ngx_int_t default_subscribe_callback(ngx_int_t status, ngx_http_request_t *r) { + return status; +} + +static ngx_int_t ngx_http_push_store_subscribe(ngx_str_t *channel_id, ngx_http_push_msg_id_t *msg_id, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_int_t status, ngx_http_request_t *r)) { + ngx_http_push_channel_t *channel; + ngx_http_push_msg_t *msg; + ngx_int_t msg_search_outcome; + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + + + if(callback == NULL) { + callback=&default_subscribe_callback; + } + + if (cf->authorize_channel==1) { + channel = ngx_http_push_store_find_channel(channel_id, cf->channel_timeout, NULL); + }else{ + channel = ngx_http_push_store_get_channel(channel_id, cf->channel_timeout, NULL); + } + if (channel==NULL) { + //unable to allocate channel OR channel not found + if(cf->authorize_channel) { + return callback(NGX_HTTP_FORBIDDEN, r); + } + else { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate shared memory for channel"); + return callback(NGX_HTTP_INTERNAL_SERVER_ERROR, r); + } + } + + switch(ngx_http_push_handle_subscriber_concurrency(channel, r, cf)) { + case NGX_DECLINED: //this request was declined for some reason. + //status codes and whatnot should have already been written. just get out of here quickly. + return callback(NGX_OK, r); + case NGX_ERROR: + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: error handling subscriber concurrency setting"); + return callback(NGX_ERROR, r); + } + + + msg = ngx_http_push_store->get_channel_message(channel, msg_id, &msg_search_outcome, cf); + + if (cf->ignore_queue_on_no_cache && !ngx_http_push_allow_caching(r)) { + msg_search_outcome = NGX_HTTP_PUSH_MESSAGE_EXPECTED; + msg = NULL; + } + + switch(msg_search_outcome) { + //for message-found: + ngx_str_t *etag; + ngx_str_t *content_type; + ngx_chain_t *chain; + time_t last_modified; + ngx_http_push_subscriber_t *subscriber; + + case NGX_HTTP_PUSH_MESSAGE_EXPECTED: + // ♫ It's gonna be the future soon ♫ + if ((subscriber = ngx_http_push_store_subscribe_raw(channel, r))==NULL) { + return callback(NGX_HTTP_INTERNAL_SERVER_ERROR, r); + } + if(ngx_push_longpoll_subscriber_enqueue(channel, subscriber, cf->subscriber_timeout) == NGX_OK) { + return callback(NGX_DONE, r); + } + else { + return callback(NGX_ERROR, r); + } + + case NGX_HTTP_PUSH_MESSAGE_EXPIRED: + //subscriber wants an expired message + //TODO: maybe respond with entity-identifiers for oldest available message? + return callback(NGX_HTTP_NO_CONTENT, r); + + case NGX_HTTP_PUSH_MESSAGE_FOUND: + ngx_http_push_alloc_for_subscriber_response(r->pool, 0, msg, &chain, &content_type, &etag, &last_modified); + ngx_int_t ret=ngx_http_push_prepare_response_to_subscriber_request(r, chain, content_type, etag, last_modified); + ngx_http_push_store->release_message(channel, msg); + return callback(ret, r); + + default: //we shouldn't be here. + return callback(NGX_HTTP_INTERNAL_SERVER_ERROR, r); + } +} + +static ngx_str_t * ngx_http_push_store_etag_from_message(ngx_http_push_msg_t *msg, ngx_pool_t *pool){ + ngx_str_t *etag; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + if(pool!=NULL && (etag = ngx_palloc(pool, sizeof(*etag) + NGX_INT_T_LEN))==NULL) { + return NULL; + } + else if(pool==NULL && (etag = ngx_alloc(sizeof(*etag) + NGX_INT_T_LEN, ngx_cycle->log))==NULL) { + return NULL; + } + etag->data = (u_char *)(etag+1); + etag->len = ngx_sprintf(etag->data,"%ui", msg->message_tag)- etag->data; + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + return etag; +} + +static ngx_str_t * ngx_http_push_store_content_type_from_message(ngx_http_push_msg_t *msg, ngx_pool_t *pool){ + ngx_str_t *content_type; + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + if(pool != NULL && (content_type = ngx_palloc(pool, sizeof(*content_type) + msg->content_type.len))==NULL) { + return NULL; + } + else if(pool == NULL && (content_type = ngx_alloc(sizeof(*content_type) + msg->content_type.len, ngx_cycle->log))==NULL) { + return NULL; + } + content_type->data = (u_char *)(content_type+1); + content_type->len = msg->content_type.len; + ngx_memcpy(content_type->data, msg->content_type.data, content_type->len); + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + return content_type; +} + +// this function adapted from push stream module. thanks Wandenberg Peixoto and Rogério Carvalho Schneider +static ngx_buf_t * ngx_http_push_request_body_to_single_buffer(ngx_http_request_t *r) { + ngx_buf_t *buf = NULL; + ngx_chain_t *chain; + ssize_t n; + off_t len; + + chain = r->request_body->bufs; + if (chain->next == NULL) { + return chain->buf; + } + if (chain->buf->in_file) { + if (ngx_buf_in_memory(chain->buf)) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: can't handle a buffer in a temp file and in memory "); + } + if (chain->next != NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: error reading request body with multiple "); + } + return chain->buf; + } + buf = ngx_create_temp_buf(r->pool, r->headers_in.content_length_n + 1); + if (buf != NULL) { + ngx_memset(buf->start, '\0', r->headers_in.content_length_n + 1); + while ((chain != NULL) && (chain->buf != NULL)) { + len = ngx_buf_size(chain->buf); + // if buffer is equal to content length all the content is in this buffer + if (len >= r->headers_in.content_length_n) { + buf->start = buf->pos; + buf->last = buf->pos; + len = r->headers_in.content_length_n; + } + if (chain->buf->in_file) { + n = ngx_read_file(chain->buf->file, buf->start, len, 0); + if (n == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "push module: cannot read file with request body"); + return NULL; + } + buf->last = buf->last + len; + ngx_delete_file(chain->buf->file->name.data); + chain->buf->file->fd = NGX_INVALID_FILE; + } else { + buf->last = ngx_copy(buf->start, chain->buf->pos, len); + } + + chain = chain->next; + buf->start = buf->last; + } + } + return buf; +} + + +static ngx_http_push_msg_t * ngx_http_push_store_create_message(ngx_http_push_channel_t *channel, ngx_http_request_t *r) { + ngx_buf_t *buf = NULL, *buf_copy; + size_t content_type_len; + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + ngx_http_push_msg_t *msg, *previous_msg; + + //first off, we'll want to extract the body buffer + + //note: this works mostly because of r->request_body_in_single_buf = 1; + //which, i suppose, makes this module a little slower than it could be. + //this block is a little hacky. might be a thorn for forward-compatibility. + if(r->headers_in.content_length_n == -1 || r->headers_in.content_length_n == 0) { + buf = ngx_create_temp_buf(r->pool, 0); + //this buffer will get copied to shared memory in a few lines, + //so it does't matter what pool we make it in. + } + else if(r->request_body->bufs!=NULL) { + buf = ngx_http_push_request_body_to_single_buffer(r); + } + else { + ngx_log_error(NGX_LOG_ERR, (r)->connection->log, 0, "push module: unexpected publisher message request body buffer location. please report this to the push module developers."); + return NULL; + } + + NGX_HTTP_PUSH_BROADCAST_CHECK(buf, NULL, r, "push module: can't find or allocate publisher request body buffer"); + + content_type_len = (r->headers_in.content_type!=NULL ? r->headers_in.content_type->value.len : 0); + + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + + //create a buffer copy in shared mem + msg = ngx_http_push_slab_alloc_locked(sizeof(*msg) + content_type_len, "message + content_type"); + NGX_HTTP_PUSH_BROADCAST_CHECK_LOCKED(msg, NULL, r, "push module: unable to allocate message in shared memory", ngx_http_push_shpool); + previous_msg=ngx_http_push_get_latest_message_locked(channel); //need this for entity-tags generation + + buf_copy = ngx_http_push_slab_alloc_locked(NGX_HTTP_BUF_ALLOC_SIZE(buf), "message buffer copy"); + NGX_HTTP_PUSH_BROADCAST_CHECK_LOCKED(buf_copy, NULL, r, "push module: unable to allocate buffer in shared memory", ngx_http_push_shpool) //magic nullcheck + ngx_http_push_copy_preallocated_buffer(buf, buf_copy); + + msg->buf=buf_copy; + + //Stamp the new message with entity tags + msg->message_time=ngx_time(); //ESSENTIAL TODO: make sure this ends up producing GMT time + msg->message_tag=(previous_msg!=NULL && msg->message_time == previous_msg->message_time) ? (previous_msg->message_tag + 1) : 0; + + //store the content-type + if(content_type_len>0) { + msg->content_type.len=r->headers_in.content_type->value.len; + msg->content_type.data=(u_char *) (msg+1); //we had reserved a contiguous chunk, myes? + ngx_memcpy(msg->content_type.data, r->headers_in.content_type->value.data, msg->content_type.len); + } + else { + msg->content_type.len=0; + msg->content_type.data=NULL; + } + + //queue stuff ought to be NULL + msg->queue.prev=NULL; + msg->queue.next=NULL; + + msg->refcount=0; + + //set message expiration time + time_t message_timeout = cf->buffer_timeout; + msg->expires = (message_timeout==0 ? 0 : (ngx_time() + message_timeout)); + + msg->delete_oldest_received_min_messages = cf->delete_oldest_received_message ? (ngx_uint_t) cf->min_messages : NGX_MAX_UINT32_VALUE; + //NGX_MAX_UINT32_VALUE to disable, otherwise = min_message_buffer_size of the publisher location from whence the message came + + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, CREATED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + return msg; +} + +static ngx_int_t ngx_http_push_store_enqueue_message(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_http_push_loc_conf_t *cf) { + ngx_shmtx_lock(&ngx_http_push_shpool->mutex); + ngx_queue_insert_tail(&channel->message_queue->queue, &msg->queue); + channel->messages++; + + //now see if the queue is too big + if(channel->messages > (ngx_uint_t) cf->max_messages) { + //exceeeds max queue size. don't force it, someone might still be using this message. + ngx_http_push_delete_message_locked(channel, ngx_http_push_get_oldest_message_locked(channel), 0); + } + if(channel->messages > (ngx_uint_t) cf->min_messages) { + //exceeeds min queue size. maybe delete the oldest message + //no, don't do anything for now. This feature is badly implemented and I think I'll deprecate it. + } + + ngx_shmtx_unlock(&ngx_http_push_shpool->mutex); + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, ENQUEUED_DBG, msg, msg->refcount, msg->queue.prev, msg->queue.next); + return NGX_OK; +} + +static ngx_int_t default_publish_callback(ngx_int_t status, ngx_http_push_channel_t *ch, ngx_http_request_t *r) { + return status; +} + +static ngx_int_t ngx_http_push_store_publish_message(ngx_str_t *channel_id, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_int_t status, ngx_http_push_channel_t *ch, ngx_http_request_t *r)) { + ngx_http_push_channel_t *channel; + ngx_http_push_msg_t *msg; + ngx_http_push_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_module); + ngx_int_t result=0; + if(callback==NULL) { + callback=&default_publish_callback; + } + if((channel=ngx_http_push_store_get_channel(channel_id, cf->channel_timeout, NULL))==NULL) { //always returns a channel, unless no memory left + return callback(NGX_ERROR, NULL, r); + //ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + } + + if((msg = ngx_http_push_store_create_message(channel, r))==NULL) { + return callback(NGX_ERROR, channel, r); + //ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + } + + if(cf->max_messages > 0) { //channel buffers exist + ngx_http_push_store_enqueue_message(channel, msg, cf); + } + else if(cf->max_messages == 0) { + ngx_http_push_store_reserve_message(NULL, msg); + } + result= ngx_http_push_store_publish_raw(channel, msg, 0, NULL); + return callback(result, channel, r); +} + +static ngx_int_t ngx_http_push_store_send_worker_message(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *subscriber_sentinel, ngx_pid_t pid, ngx_int_t worker_slot, ngx_http_push_msg_t *msg, ngx_int_t status_code) { + ngx_http_push_worker_msg_sentinel_t *worker_messages = ((ngx_http_push_shm_data_t *)ngx_http_push_shm_zone->data)->ipc; + ngx_http_push_worker_msg_sentinel_t *sentinel = &worker_messages[worker_slot]; + ngx_http_push_worker_msg_t *newmessage; + if((newmessage=ngx_http_push_slab_alloc(sizeof(*newmessage), "IPC worker message"))==NULL) { + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate worker message"); + return NGX_ERROR; + } + newmessage->msg = msg; + newmessage->status_code = status_code; + newmessage->pid = pid; + newmessage->subscriber_sentinel = subscriber_sentinel; + newmessage->channel = channel; + + ngx_http_push_store_lock_shmem(); + ngx_queue_insert_tail(&sentinel->queue, &newmessage->queue); + ngx_http_push_store_unlock_shmem(); + return NGX_OK; + +} + +static void ngx_http_push_store_receive_worker_message(void) { + ngx_http_push_worker_msg_t *prev_worker_msg, *worker_msg; + ngx_http_push_worker_msg_sentinel_t *sentinel; + const ngx_str_t *status_line = NULL; + ngx_http_push_channel_t *channel; + ngx_http_push_subscriber_t *subscriber_sentinel; + ngx_int_t worker_msg_pid; + + ngx_int_t status_code; + ngx_http_push_msg_t *msg; + + sentinel = &(((ngx_http_push_shm_data_t *)ngx_http_push_shm_zone->data)->ipc)[ngx_process_slot]; + + ngx_http_push_store_lock_shmem(); + worker_msg = (ngx_http_push_worker_msg_t *)ngx_queue_next(&sentinel->queue); + ngx_http_push_store_unlock_shmem(); + while((void *)worker_msg != (void *)sentinel) { + + ngx_http_push_store_lock_shmem(); + worker_msg_pid = worker_msg->pid; + ngx_http_push_store_unlock_shmem(); + + if(worker_msg_pid == ngx_pid) { + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "process_worker_message processing proper worker_msg "); + //everything is okay. + + ngx_http_push_store_lock_shmem(); + status_code = worker_msg->status_code; + msg = worker_msg->msg; + channel = worker_msg->channel; + subscriber_sentinel = worker_msg->subscriber_sentinel; + ngx_http_push_store_unlock_shmem(); + + if(msg==NULL) { + //just a status line, is all + //status code only. + switch(status_code) { + case NGX_HTTP_CONFLICT: + status_line=&NGX_HTTP_PUSH_HTTP_STATUS_409; + break; + + case NGX_HTTP_GONE: + status_line=&NGX_HTTP_PUSH_HTTP_STATUS_410; + break; + + case 0: + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: worker message contains neither a channel message nor a status code"); + //let's let the subscribers know that something went wrong and they might've missed a message + status_code = NGX_HTTP_INTERNAL_SERVER_ERROR; + //intentional fall-through + default: + status_line=NULL; + } + } + + ngx_http_push_respond_to_subscribers(channel, subscriber_sentinel, msg, status_code, status_line); + } + else { + //that's quite bad you see. a previous worker died with an undelivered message. + //but all its subscribers' connections presumably got canned, too. so it's not so bad after all. + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "process_worker_message processing INVALID worker_msg "); + + ngx_http_push_store_lock_shmem(); + + ngx_http_push_pid_queue_t *channel_worker_sentinel = worker_msg->channel->workers_with_subscribers; + + ngx_http_push_pid_queue_t *channel_worker_cur = channel_worker_sentinel; + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: worker %i intercepted a message intended for another worker process (%i) that probably died", ngx_pid, worker_msg->pid); + + //delete that invalid sucker. + while((channel_worker_cur=(ngx_http_push_pid_queue_t *)ngx_queue_next(&channel_worker_cur->queue))!=channel_worker_sentinel) { + if(channel_worker_cur->pid == worker_msg->pid) { + ngx_queue_remove(&channel_worker_cur->queue); + ngx_http_push_slab_free_locked(channel_worker_cur); + break; + } + } + + ngx_http_push_store_unlock_shmem(); + + } + //It may be worth it to memzero worker_msg for debugging purposes. + prev_worker_msg = worker_msg; + + ngx_http_push_store_lock_shmem(); + worker_msg = (ngx_http_push_worker_msg_t *)ngx_queue_next(&worker_msg->queue); + ngx_http_push_slab_free_locked(prev_worker_msg); + ngx_http_push_store_unlock_shmem(); + + } + ngx_http_push_store_lock_shmem(); + ngx_queue_init(&sentinel->queue); //reset the worker message sentinel + ngx_http_push_store_unlock_shmem(); + //ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "process_worker_message finished"); + return; +} + +ngx_http_push_store_t ngx_http_push_store_memory = { + //init + &ngx_http_push_store_init_module, + &ngx_http_push_store_init_worker, + &ngx_http_push_store_init_postconfig, + &ngx_http_push_store_create_main_conf, + + //shutdown + &ngx_http_push_store_exit_worker, + &ngx_http_push_store_exit_master, + + //async-friendly functions with callbacks + &ngx_http_push_store_get_message, //+callback + &ngx_http_push_store_subscribe, //+callback + &ngx_http_push_store_publish_message, //+callback + + //channel stuff, + &ngx_http_push_store_get_channel, //creates channel if not found, +callback + &ngx_http_push_store_find_channel, //returns channel or NULL if not found, +callback + &ngx_http_push_store_delete_channel, + + &ngx_http_push_store_get_channel_message, + &ngx_http_push_store_reserve_message, + &ngx_http_push_store_release_message, + + //channel properties + &ngx_http_push_store_channel_subscribers, + &ngx_http_push_store_channel_worker_subscribers, + &ngx_http_push_store_channel_next_subscriber, + &ngx_http_push_store_channel_release_subscriber_sentinel, + + //legacy shared-memory store helpers + &ngx_http_push_store_lock_shmem, + &ngx_http_push_store_unlock_shmem, + &ngx_http_push_slab_alloc_locked, + &ngx_http_push_slab_free_locked, + + //message stuff + &ngx_http_push_store_create_message, + &ngx_http_push_delete_message, + &ngx_http_push_delete_message_locked, + &ngx_http_push_store_enqueue_message, + &ngx_http_push_store_etag_from_message, + &ngx_http_push_store_content_type_from_message, + + //interprocess communication + &ngx_http_push_store_send_worker_message, + &ngx_http_push_store_receive_worker_message + + +}; diff --git a/debian/modules/nginx-http-push/src/store/memory/store.h b/debian/modules/nginx-http-push/src/store/memory/store.h new file mode 100644 index 0000000..cb9dea3 --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/memory/store.h @@ -0,0 +1 @@ +extern ngx_http_push_store_t ngx_http_push_store_memory; \ No newline at end of file diff --git a/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.c b/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.c new file mode 100644 index 0000000..ba37224 --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.c @@ -0,0 +1,146 @@ +//worker processes of the world, unite. +#include +#include +#include + +static void ngx_http_push_channel_handler(ngx_event_t *ev); +#define NGX_CMD_HTTP_PUSH_CHECK_MESSAGES 49 + +static ngx_socket_t ngx_http_push_socketpairs[NGX_MAX_PROCESSES][2]; +ngx_int_t ngx_http_push_init_ipc(ngx_cycle_t *cycle, ngx_int_t workers) { +//initialize socketpairs for workers in advance. + static int invalid_sockets_initialized = 0; + int i, s = 0, on = 1; + ngx_int_t last_expected_process = ngx_last_process; + + if(!invalid_sockets_initialized) { + for(i=0; i< NGX_MAX_PROCESSES; i++) { + ngx_http_push_socketpairs[i][0]=NGX_INVALID_FILE; + ngx_http_push_socketpairs[i][1]=NGX_INVALID_FILE; + } + invalid_sockets_initialized=1; + } + + /* here's the deal: we have no control over fork()ing, nginx's internal + * socketpairs are unusable for our purposes (as of nginx 0.8 -- check the + * code to see why), and the module initialization callbacks occur before + * any workers are spawned. Rather than futzing around with existing + * socketpairs, we populate our own socketpairs array. + * Trouble is, ngx_spawn_process() creates them one-by-one, and we need to + * do it all at once. So we must guess all the workers' ngx_process_slots in + * advance. Meaning the spawning logic must be copied to the T. + * ... with some allowances for already-opened sockets... + */ + for(i=0; i < workers; i++) { + //copypasta from os/unix/ngx_process.c (ngx_spawn_process) + while (s < last_expected_process && ngx_processes[s].pid != -1) { + //find empty existing slot + s++; + } + ngx_socket_t *socks = ngx_http_push_socketpairs[s]; + if(socks[0] == NGX_INVALID_FILE || socks[1] == NGX_INVALID_FILE) { + //copypasta from os/unix/ngx_process.c (ngx_spawn_process) + if (socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "socketpair() failed on socketpair while initializing push module"); + return NGX_ERROR; + } + if (ngx_nonblocking(socks[0]) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, ngx_nonblocking_n " failed on socketpair while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + if (ngx_nonblocking(socks[1]) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, ngx_nonblocking_n " failed on socketpair while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + if (ioctl(socks[0], FIOASYNC, &on) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "ioctl(FIOASYNC) failed on socketpair while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + + if (fcntl(socks[0], F_SETOWN, ngx_pid) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "fcntl(F_SETOWN) failed on socketpair while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + if (fcntl(socks[0], F_SETFD, FD_CLOEXEC) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "fcntl(FD_CLOEXEC) failed on socketpair while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + + if (fcntl(socks[1], F_SETFD, FD_CLOEXEC) == -1) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "fcntl(FD_CLOEXEC) failed while initializing push module"); + ngx_close_channel(socks, cycle->log); + return NGX_ERROR; + } + } + s++; //NEXT!! + } + return NGX_OK; +} + +ngx_int_t ngx_http_push_shutdown_ipc(ngx_cycle_t *cycle) { + int i; + for (i=0; ilog); + } + } + return NGX_OK; +} + +void ngx_http_push_ipc_exit_worker(ngx_cycle_t *cycle) { + ngx_http_push_shutdown_ipc(cycle); +} + +ngx_int_t ngx_http_push_ipc_init_worker(ngx_cycle_t *cycle) { + if (ngx_add_channel_event(cycle, ngx_http_push_socketpairs[ngx_process_slot][1], NGX_READ_EVENT, ngx_http_push_channel_handler) == NGX_ERROR) { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "failed to register channel handler while initializing push module worker"); + return NGX_ERROR; + } + return NGX_OK; +} + +static void ngx_http_push_channel_handler(ngx_event_t *ev) { + //copypasta from os/unix/ngx_process_cycle.c (ngx_channel_handler) + ngx_int_t n; + ngx_channel_t ch; + ngx_connection_t *c; + if (ev->timedout) { + ev->timedout = 0; + return; + } + c = ev->data; + + while(1) { + n = ngx_read_channel(c->fd, &ch, sizeof(ch), ev->log); + if (n == NGX_ERROR) { + if (ngx_event_flags & NGX_USE_EPOLL_EVENT) { + ngx_del_conn(c, 0); + } + ngx_close_connection(c); + return; + } + if ((ngx_event_flags & NGX_USE_EVENTPORT_EVENT) && (ngx_add_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR)) { + return; + } + if (n == NGX_AGAIN) { + return; + } + //ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, "push module: channel command: %d", ch.command); + + if (ch.command==NGX_CMD_HTTP_PUSH_CHECK_MESSAGES) { + ngx_http_push_store->receive_worker_message(); + } + } +} + +ngx_int_t ngx_http_push_alert_worker(ngx_pid_t pid, ngx_int_t slot) { + //seems ch doesn't need to have fd set. odd, but roll with it. pid and process slot also unnecessary. + static ngx_channel_t ch = {NGX_CMD_HTTP_PUSH_CHECK_MESSAGES, 0, 0, -1}; + return ngx_write_channel(ngx_http_push_socketpairs[slot][0], &ch, sizeof(ngx_channel_t), ngx_cycle->log); +} + diff --git a/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.h b/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.h new file mode 100644 index 0000000..01e7669 --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.h @@ -0,0 +1,5 @@ +ngx_int_t ngx_http_push_alert_worker(ngx_pid_t pid,ngx_int_t slot); +ngx_int_t ngx_http_push_ipc_init_worker(ngx_cycle_t *cycle); +void ngx_http_push_ipc_exit_worker(ngx_cycle_t *cycle); +ngx_int_t ngx_http_push_shutdown_ipc(ngx_cycle_t *cycle); +ngx_int_t ngx_http_push_init_ipc(ngx_cycle_t *cycle,ngx_int_t workers); \ No newline at end of file diff --git a/debian/modules/nginx-http-push/src/store/ngx_http_push_store.h b/debian/modules/nginx-http-push/src/store/ngx_http_push_store.h new file mode 100755 index 0000000..fb54d97 --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/ngx_http_push_store.h @@ -0,0 +1,51 @@ +typedef struct { + //init + ngx_int_t (*init_module)(ngx_cycle_t *cycle); + ngx_int_t (*init_worker)(ngx_cycle_t *cycle); + ngx_int_t (*init_postconfig)(ngx_conf_t *cf); + void (*create_main_conf)(ngx_conf_t *cf, ngx_http_push_main_conf_t *mcf); + + //quit + void (*exit_worker)(ngx_cycle_t *cycle); + void (*exit_master)(ngx_cycle_t *cycle); + + + //async-friendly functions with callbacks + ngx_http_push_msg_t * (*get_message) (ngx_str_t *channel_id, ngx_http_push_msg_id_t *msg_id, ngx_int_t *msg_search_outcome, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_http_push_msg_t *msg, ngx_int_t msg_search_outcome, ngx_http_request_t *r)); + ngx_int_t (*subscribe) (ngx_str_t *channel_id, ngx_http_push_msg_id_t *msg_id, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_int_t status, ngx_http_request_t *r)); + ngx_int_t (*publish) (ngx_str_t *channel_id, ngx_http_request_t *r, ngx_int_t (*callback)(ngx_int_t status, ngx_http_push_channel_t *ch, ngx_http_request_t *r)); + + //channel actions + ngx_http_push_channel_t *(*get_channel)(ngx_str_t *id, time_t channel_timeout, ngx_int_t (*callback)(ngx_http_push_channel_t *channel)); + ngx_http_push_channel_t *(*find_channel)(ngx_str_t *id, time_t channel_timeout, ngx_int_t (*callback)(ngx_http_push_channel_t *channel)); + + ngx_int_t (*delete_channel)(ngx_str_t *channel_id); + ngx_http_push_msg_t *(*get_channel_message)(ngx_http_push_channel_t *channel, ngx_http_push_msg_id_t *msgid, ngx_int_t *msg_search_outcome, ngx_http_push_loc_conf_t *cf); + + void (*reserve_message)(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg); + void (*release_message)(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg); + + //channel properties + ngx_int_t (*channel_subscribers)(ngx_http_push_channel_t * channel); + ngx_int_t (*channel_worker_subscribers)(ngx_http_push_subscriber_t * worker_sentinel); + ngx_http_push_subscriber_t *(*next_subscriber)(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel, ngx_http_push_subscriber_t *cur, int release_previous); + ngx_int_t (*release_subscriber_sentinel)(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *sentinel); + + void (*lock)(void); //legacy shared-memory store helpers + void (*unlock)(void); + void * (*alloc_locked)(size_t size, char * label); + void (*free_locked)(void *ptr); + + //message actions and properties + ngx_http_push_msg_t * (*create_message)(ngx_http_push_channel_t *channel, ngx_http_request_t *r); + ngx_int_t (*delete_message)(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t force); + ngx_int_t (*delete_message_locked)(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_int_t force); + ngx_int_t (*enqueue_message)(ngx_http_push_channel_t *channel, ngx_http_push_msg_t *msg, ngx_http_push_loc_conf_t *cf); + ngx_str_t * (*message_etag)(ngx_http_push_msg_t *msg, ngx_pool_t *pool); + ngx_str_t * (*message_content_type)(ngx_http_push_msg_t *msg, ngx_pool_t *pool); + + //ipc + ngx_int_t (*send_worker_message)(ngx_http_push_channel_t *channel, ngx_http_push_subscriber_t *subscriber_sentinel, ngx_pid_t pid, ngx_int_t worker_slot, ngx_http_push_msg_t *msg, ngx_int_t status_code); + void (*receive_worker_message)(void); +} ngx_http_push_store_t; + diff --git a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.c b/debian/modules/nginx-http-push/src/store/ngx_rwlock.c similarity index 96% rename from modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.c rename to debian/modules/nginx-http-push/src/store/ngx_rwlock.c index a8359a3..c5e2383 100644 --- a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.c +++ b/debian/modules/nginx-http-push/src/store/ngx_rwlock.c @@ -1,11 +1,11 @@ -#include +#include #include "ngx_rwlock.h" #define NGX_RWLOCK_SPIN 2048 #define NGX_RWLOCK_WRITE -1 -#define DISABLE_RWLOCK 0 //just use a regular mutex for everything -#define DEBUG_NGX_RWLOCK 1 +#define DISABLE_RWLOCK 1 //just use a regular mutex for everything +//#define DEBUG_NGX_RWLOCK 1 void ngx_rwlock_init(ngx_rwlock_t *lock) { lock->mutex=1; @@ -106,7 +106,7 @@ void ngx_rwlock_release_read(ngx_rwlock_t *lock) { #endif } -static int ngx_rwlock_write_check(ngx_rwlock_t *lock) { +int ngx_rwlock_write_check(ngx_rwlock_t *lock) { if(lock->lock==0) { rwl_lock_mutex(lock); if(lock->lock==0) { @@ -175,4 +175,4 @@ void ngx_rwlock_release_write(ngx_rwlock_t *lock) { else { ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0, "rwlock %p tried to release nonexistent write lock, lock=%i.", lock, lock->lock); } -} +} \ No newline at end of file diff --git a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.h b/debian/modules/nginx-http-push/src/store/ngx_rwlock.h similarity index 100% rename from modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.h rename to debian/modules/nginx-http-push/src/store/ngx_rwlock.h diff --git a/debian/modules/nginx-http-push/src/store/rbtree_util.c b/debian/modules/nginx-http-push/src/store/rbtree_util.c new file mode 100644 index 0000000..735bfcc --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/rbtree_util.c @@ -0,0 +1,246 @@ +#include +#include "rbtree_util.h" + +ngx_http_push_channel_t * ngx_http_push_clean_channel_locked(ngx_http_push_channel_t * channel) { + ngx_queue_t *sentinel = &channel->message_queue->queue; + time_t now = ngx_time(); + ngx_http_push_msg_t *msg=NULL; + while(!ngx_queue_empty(sentinel)){ + msg = ngx_queue_data(ngx_queue_head(sentinel), ngx_http_push_msg_t, queue); + if (msg!=NULL && msg->expires != 0 && now > msg->expires) { + ngx_http_push_store->delete_message_locked(channel, msg, 0); + } + else { //definitely a message left to send + return NULL; + } + } + //at this point, the queue is empty + return (channel->subscribers==0 && (channel->expires <= now)) ? channel : NULL; //if no waiting requests and channel expired, return this channel to be deleted +} + +static ngx_int_t ngx_http_push_delete_node_locked(ngx_rbtree_t *tree, ngx_rbtree_node_t *trash) { +//assume the shm zone is already locked + if(trash != NULL){ //take out the trash + ngx_rbtree_delete(tree, trash); + + //delete the worker-subscriber queue + ngx_queue_t *sentinel = (ngx_queue_t *)((ngx_http_push_channel_t *)trash)->workers_with_subscribers; + ngx_queue_t *cur = ngx_queue_head(sentinel); + ngx_queue_t *next; + while(cur!=sentinel) { + next = ngx_queue_next(cur); + ngx_http_push_store->free_locked(cur); + cur = next; + } + + ngx_http_push_store->free_locked(trash); + ngx_http_push_store->free_locked(sentinel); + return NGX_OK; + } + return NGX_DECLINED; +} + +ngx_int_t ngx_http_push_delete_channel_locked(ngx_http_push_channel_t *trash, ngx_shm_zone_t *shm_zone) { + ngx_int_t res; + res = ngx_http_push_delete_node_locked(&((ngx_http_push_shm_data_t *) shm_zone->data)->tree, (ngx_rbtree_node_t *)trash); + if(res==NGX_OK) { + ((ngx_http_push_shm_data_t *) shm_zone->data)->channels--; + return NGX_OK; + } + return res; + +} + +ngx_http_push_channel_t * ngx_http_push_find_channel(ngx_str_t *id, time_t timeout, ngx_shm_zone_t *shm_zone) { + ngx_rbtree_t *tree = &((ngx_http_push_shm_data_t *) shm_zone->data)->tree; + uint32_t hash; + ngx_rbtree_node_t *node, *sentinel; + ngx_int_t rc; + ngx_http_push_channel_t *up = NULL; + ngx_http_push_channel_t *trash[] = { NULL, NULL, NULL }; + + ngx_uint_t i, trashed=0; + if (tree==NULL) { + return NULL; + } + + hash = ngx_crc32_short(id->data, id->len); + + node = tree->root; + sentinel = tree->sentinel; + + while (node != sentinel) { + + //every search is responsible for deleting a couple of empty, if it comes across them + if (trashed < (sizeof(trash) / sizeof(*trash))) { + if((trash[trashed]=ngx_http_push_clean_channel_locked((ngx_http_push_channel_t *) node))!=NULL) { + trashed++; + } + } + + if (hash < node->key) { + node = node->left; + continue; + } + + if (hash > node->key) { + node = node->right; + continue; + } + + /* hash == node->key */ + + do { + up = (ngx_http_push_channel_t *) node; + + rc = ngx_memn2cmp(id->data, up->id.data, id->len, up->id.len); + + if (rc == 0) { + //found + for(i=0; iexpires = ngx_time() + timeout; + ngx_http_push_clean_channel_locked(up); + return up; + } + + node = (rc < 0) ? node->left : node->right; + + } while (node != sentinel && hash == node->key); + + break; + } + //not found + for(i=0; idata)->tree; + if((up = ngx_http_push_store->alloc_locked(sizeof(*up) + id->len + sizeof(ngx_http_push_msg_t), "channel"))==NULL) { + return NULL; + } + if((worker_queue_sentinel=ngx_http_push_store->alloc_locked(sizeof(*worker_queue_sentinel), "channel worker queue sentinel"))==NULL) { + ngx_http_push_store->free_locked(up); + ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "push module: unable to allocate worker queue sentinel"); + return NULL; + } + ngx_queue_init(&worker_queue_sentinel->queue); + + up->id.data = (u_char *) (up+1); //contiguous piggy + up->message_queue = (ngx_http_push_msg_t *) (up->id.data + id->len); + + up->id.len = (u_char) id->len; + ngx_memcpy(up->id.data, id->data, up->id.len); + up->node.key = ngx_crc32_short(id->data, id->len); + ngx_rbtree_insert(tree, (ngx_rbtree_node_t *) up); + + //initialize queues + ngx_queue_init(&up->message_queue->queue); + up->messages=0; + + up->workers_with_subscribers=worker_queue_sentinel; + up->subscribers=0; + + up->last_seen=ngx_time(); + + up->expires = ngx_time() + timeout; + + ((ngx_http_push_shm_data_t *) shm_zone->data)->channels++; + + return up; +} + + +void ngx_rbtree_generic_insert( + ngx_rbtree_node_t *temp, + ngx_rbtree_node_t *node, + ngx_rbtree_node_t *sentinel, + int (*compare)(const ngx_rbtree_node_t *left, const ngx_rbtree_node_t *right)) +{ + for ( ;; ) { + if (node->key < temp->key) { + + if (temp->left == sentinel) { + temp->left = node; + break; + } + + temp = temp->left; + + } else if (node->key > temp->key) { + + if (temp->right == sentinel) { + temp->right = node; + break; + } + + temp = temp->right; + + } else { /* node->key == temp->key */ + if (compare(node, temp) < 0) { + + if (temp->left == sentinel) { + temp->left = node; + break; + } + + temp = temp->left; + + } else { + + if (temp->right == sentinel) { + temp->right = node; + break; + } + + temp = temp->right; + } + } + } + + node->parent = temp; + node->left = sentinel; + node->right = sentinel; + ngx_rbt_red(node); +} + +void ngx_http_push_rbtree_walker(ngx_rbtree_t *tree, ngx_int_t (*apply)(ngx_http_push_channel_t * channel), ngx_rbtree_node_t *node) { + ngx_rbtree_node_t *sentinel = tree->sentinel; + + if(node!=sentinel) { + apply((ngx_http_push_channel_t *)node); + if(node->left!=NULL) { + ngx_http_push_rbtree_walker(tree, apply, node->left); + } + if(node->right!=NULL) { + ngx_http_push_rbtree_walker(tree, apply, node->right); + } + } +} + + +static int ngx_http_push_compare_rbtree_node(const ngx_rbtree_node_t *v_left, const ngx_rbtree_node_t *v_right) +{ + ngx_http_push_channel_t *left = (ngx_http_push_channel_t *) v_left, *right = (ngx_http_push_channel_t *) v_right; + return ngx_memn2cmp(left->id.data, right->id.data, left->id.len, right->id.len); +} + +void ngx_http_push_rbtree_insert(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) +{ + ngx_rbtree_generic_insert(temp, node, sentinel, ngx_http_push_compare_rbtree_node); +} + diff --git a/debian/modules/nginx-http-push/src/store/rbtree_util.h b/debian/modules/nginx-http-push/src/store/rbtree_util.h new file mode 100644 index 0000000..3850c1d --- /dev/null +++ b/debian/modules/nginx-http-push/src/store/rbtree_util.h @@ -0,0 +1,9 @@ +void ngx_http_push_rbtree_insert(ngx_rbtree_node_t *temp,ngx_rbtree_node_t *node,ngx_rbtree_node_t *sentinel); +void ngx_http_push_rbtree_walker(ngx_rbtree_t *tree,ngx_int_t(*apply)(ngx_http_push_channel_t *channel),ngx_rbtree_node_t *node); +void ngx_rbtree_generic_insert(ngx_rbtree_node_t *temp,ngx_rbtree_node_t *node,ngx_rbtree_node_t *sentinel,int(*compare)(const ngx_rbtree_node_t *left,const ngx_rbtree_node_t *right)); +ngx_http_push_channel_t *ngx_http_push_get_channel(ngx_str_t *id,time_t timeout,ngx_shm_zone_t *shm_zoneg); +ngx_http_push_channel_t *ngx_http_push_find_channel(ngx_str_t *id,time_t timeout,ngx_shm_zone_t *shm_zone); +ngx_int_t ngx_http_push_delete_channel_locked(ngx_http_push_channel_t *trash,ngx_shm_zone_t *shm_zone); +ngx_http_push_channel_t *ngx_http_push_clean_channel_locked(ngx_http_push_channel_t *channel); +#define ngx_http_push_walk_rbtree(apply, shm_zone) \ +ngx_http_push_rbtree_walker(&((ngx_http_push_shm_data_t *) shm_zone->data)->tree, apply, ((ngx_http_push_shm_data_t *) shm_zone->data)->tree.root) diff --git a/debian/modules/nginx-http-push/tests/.gitignore b/debian/modules/nginx-http-push/tests/.gitignore new file mode 100644 index 0000000..0f672e0 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/.gitignore @@ -0,0 +1,5 @@ +coredump/* +clang-analyzer/* +.nginx.thisrun.conf +Gemfile.lock +errors*.log diff --git a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/Gemfile b/debian/modules/nginx-http-push/tests/Gemfile similarity index 61% rename from modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/Gemfile rename to debian/modules/nginx-http-push/tests/Gemfile index b792720..60a6eb7 100644 --- a/modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/Gemfile +++ b/debian/modules/nginx-http-push/tests/Gemfile @@ -1,11 +1,9 @@ #!/usr/bin/ruby source 'https://rubygems.org' +gem 'typhoeus' +gem 'json' +gem 'nokogiri' gem 'pry' -gem 'pry-debundle' -gem 'pry-rescue' - +gem 'celluloid' gem 'minitest' gem 'minitest-reporters' - -gem "redis" -gem "hsss" diff --git a/debian/modules/nginx-http-push/tests/chattertest.rb b/debian/modules/nginx-http-push/tests/chattertest.rb new file mode 100755 index 0000000..8db309b --- /dev/null +++ b/debian/modules/nginx-http-push/tests/chattertest.rb @@ -0,0 +1,43 @@ +#!/usr/bin/ruby +require 'test/unit' +require 'securerandom' +require "./pubsub.rb" + +#invocation: ./chattertest.rb [channel] [pub/sub] [concurrency/message] +role, channel, sub_concurrency, pub_msg = nil, nil, nil, nil +#parse args +raise "Not enough args. ./chattertest.rb [channel] [pub/sub] [concurrency/message]" if ARGV.length < 3 +channel=ARGV[0] +role=ARGV[1] +sub_concurrency=ARGV[2].to_i if role=="sub" +pub_msg=ARGV[2] if role=="pub" + + +def url(part) + "http://127.0.0.1:8082/#{part}" +end +def pubsub(concurrent_clients=1, opt={}) + urlpart=opt[:urlpart] || 'broadcast' + timeout = opt[:timeout] || 120 + sub_url=opt[:sub] || "sub/#{urlpart}/" + pub_url=opt[:pub] || "pub/" + chan_id = opt[:channel] || SecureRandom.hex + sub = Subscriber.new url("#{sub_url}#{chan_id}"), concurrent_clients, timeout: timeout, quit_message: 'FIN' + pub = Publisher.new url("#{pub_url}#{chan_id}") + return pub, sub +end + + +pub, sub = pubsub(sub_concurrency, channel: channel) +if role=="sub" + puts "Subscribing #{sub_concurrency} client(s) to channel #{channel}." + sub.on_message do |msg| + puts "got message \"#{msg.to_s}\"" + end + sub.run false +elsif role=="pub" + puts "Publishing #{pub_msg} to channel #{channel}" + pub.post pub_msg +else + raise "unknown role #{role}" +end \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/debug.sh b/debian/modules/nginx-http-push/tests/debug.sh new file mode 100755 index 0000000..7dd3cf5 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/debug.sh @@ -0,0 +1,11 @@ +#!/bin/zsh +TESTDIR=`pwd` +SRCDIR=$(readlink -m $TESTDIR/../src) +ln -sf $TESTDIR/nginx $SRCDIR/nginx >/dev/null +ln -sf $TESTDIR/nginx-pushmodule/src/nginx/src/ $SRCDIR/nginx-source >/dev/null +if [[ "$1" = <-> ]]; then + sudo kdbg -p $1 $SRCDIR/nginx +else + kdbg $SRCDIR/nginx $1 +fi +rm $SRCDIR/nginx $SRCDIR/nginx-source \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/examine_coredump.sh b/debian/modules/nginx-http-push/tests/examine_coredump.sh new file mode 100755 index 0000000..97e7421 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/examine_coredump.sh @@ -0,0 +1,17 @@ +#!/bin/zsh +target=$1 +core_dir="./coredump" +if [ -z $target ]; then + target=$(realpath ./nginx) + dump=$core_dir/last.core +else + dump=$core_dir/$target.core +fi + +mkdir $core_dir 2>/dev/null + +echo "saving coredump for $target at $dump" + +sudo systemd-coredumpctl dump $target > $dump +kdbg ./nginx "$dump" 2>/dev/null +# rm "$dump" #keep it around for now diff --git a/debian/modules/nginx-http-push/tests/memparse.lua b/debian/modules/nginx-http-push/tests/memparse.lua new file mode 100755 index 0000000..d8dcea6 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/memparse.lua @@ -0,0 +1,257 @@ +#!/usr/bin/luajit +local lines_tailed=100000 +local filename="errors.log" +local follow=false + +local write=io.write + +local shm, size_by_label, count_by_label, weird_log +function init() + print "initialize" + shm, size_by_label, count_by_label, weird_log={}, {}, {}, {} + memmap={} +end + +function err(str, ...) + str = str or "Unknown error occurred" + io.stderr:write(str:format(...)) + io.stderr:write("\n") +end +function printf(str, ...) + print(str:format(...)) +end + + +local poolsize=0 +local poolstart=0 +local memmap={} +local membuckets=1024 +local bucketsize=0 + +local resolve_weird_log; do + local weirdlog={} + resolve_weird_log=function(line, is_weird) + local prev = weirdlog[1] + if prev and prev.ptr == line.ptr and prev.t == line.t and prev.pid ~= line.pid then + if prev.action == "free" and line.action == "alloc" then + --oh, a free happened in a different worker and at the same time? + --the log was probably written out-of-sequence + table.remove(weirdlog, 1) + alloc_raw(line.ptr, line.size, line.lbl, line.t, line.pid) + free_raw(prev.ptr, prev.t, prev.pid) + printf("resolved weird free/alloc at %s", line.ptr) + return false + elseif prev.action == "alloc" and line.action == "free" then + --oh, an alloc happened in a different worker and at the same time? + --the log was probably written out-of-sequence + table.remove(weirdlog, 1) + free_raw(line.ptr, line.t, line.pid) + alloc_raw(prev.ptr, prev.size, prev.lbl, prev.t, prev.pid) + printf("resolved weird alloc/free at %s", line.ptr) + return false + end + end + if is_weird then + table.insert(weirdlog, 1, line) + return false + else + return true + end + end +end + +local memmap_add +do + local bucketsize=0 + memmap_add= function(starthex, size, val) + if not poolsize or not poolstart then return err("poolsize or poolstart not known") end + val = val or 1 + local start=tonumber(starthex, 16) + if not start then return err("starthex was not a hex number") end + --start should be relative to pool start + start=start-poolstart + + if not size then + if shm[starthex] then + size=shm[starthex].size + else + err("shm[%s] is nil", starthex) + end + end + + local bstart = math.floor(start/poolsize * membuckets) + local bend = math.floor((start+size)/poolsize * membuckets) + + for i=bstart, bend do + memmap[i]=(memmap[i] or 0)+val + if memmap[i]<0 then + err("negative memmap at bucket %s", i) + memmap[i]=0 + end + end +end +end + +function alloc(ptr, size, label, time, pid) + size=tonumber(size) + local looks_weird=false + if shm[ptr] ~= nil then + err("BAD ALLOC AT ptr %s pid %i time %s", ptr, pid, time) + looks_weird = true + end + if resolve_weird_log({action="alloc", ptr=ptr, size=size, lbl=label, t=time, pid=pid}, looks_weird) then + alloc_raw(ptr, size, label, time, pid) + end +end +function alloc_raw(ptr, size, label, time, pid) + shm[ptr]={size=size, label=label, time=time} + size_by_label[label]=(size_by_label[label] or 0) + size + count_by_label[label]=(count_by_label[label] or 0) + 1 + memmap_add(ptr, size) +end + +function free(ptr, time, pid) + local looks_weird=false + local ref=shm[ptr] + if ref == nil then + err ("DOUBLE FREE AT ptr %s pid %i time %s", ptr, pid, time) + looks_weird = true + end + if resolve_weird_log({action="free", ptr=ptr, size=nil, lbl=nil, t=time, pid=pid}, looks_weird) then + free_raw(ptr, time, pid) + end +end +function free_raw(ptr, time, pid) + local ref=shm[ptr] + if ref==nil then + err("executed double free on ptr %s pid %i time %s", ptr, pid, time) + return + end + memmap_add(ptr, nil, -1) + size_by_label[ref.label]=size_by_label[ref.label]-ref.size + count_by_label[ref.label]=(count_by_label[ref.label] or 0) - 1 + shm[ptr]=nil +end + +function formatsize(bytes) + if bytes<1024 then + return string.format("%ib", bytes) + elseif bytes > 1024 and bytes < 1048576 then + return string.format("%.3gKb", bytes/1024) + else + return string.format("%.3gMb", bytes/1048576) + end +end + +local alphabet={1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} +function summary() + local compare=function(a,b) + return a[2] > b[2] + end + local total=0; + local resort={} + for k,v in pairs(size_by_label) do table.insert(resort, {k, v}) end + table.sort(resort, compare) + for k,v in ipairs(resort) do + printf("%-40s %-10s %i", v[1], formatsize(v[2]), count_by_label[v[1]]) + total = total + v[2] + end + print (" -------- ") + printf("%-40s %s", "total", formatsize(total)) + + --memory map + local n + for i=0,membuckets do + n=memmap[i] + if n==0 or n == nil then + write("-") + elseif n<#alphabet then + write(alphabet[n] or "?") + else + write("#") + end + end + print "" +end + + +function parse_line(str) + local out_of_memory + local time,errlevel, pid, msg=str:match("(%d+/%d+/%d+%s+%d+:%d+:%d+)%s+%[(%w+)%]%s+(%d+)#%d+:%s+(.+)") + if msg ~= nil then + local ptr, size, label, start + + if errlevel == "crit" then + print("CRITICAL:", time, pid, msg) + if msg == "ngx_slab_alloc() failed: no memory" then + return true + end + end + ptr, size, label = msg:match("shpool alloc addr (%w+) size (%d+) label (.+)") + if ptr then + alloc(ptr, size, label, time, pid) + return ptr + end + + ptr = msg:match("shpool free addr (%w+)") + if ptr then + free(ptr, time, pid) + return ptr + end + + start, size = msg:match("ngx_http_push_shpool start (%w+) size (%d+)") + if size and start then + poolsize=tonumber(size) + poolstart = tonumber(start, 16) + printf("shm start %s size %s", start, formatsize(poolsize)) + end + end +end + + + +---------------------------------------------------------------- +--NO FUNCTIONS DEFINED BELOW THIS LINE PLEASE (except lambdas)-- + +--handle arguments +if arg[1] == "tail" or arg[1] == "follow" then + follow=true +elseif arg[1] ~= nil then + filename=arg[1] +end + + +init() + + +if follow then + local lasttime, now=os.time(), nil + print "follow errors.log" + local tailin = io.popen(string.format('tail --lines=%s -F %s 2>&1', lines_tailed, filename), 'r') + for line in tailin:lines() do + now=os.time() + if line:match('truncated') or + line:match(("‘%s’ has become inaccessible: No such file or directory"):format(filename)) then + --reset + init() + elseif parse_line(line) == true then + summary() + lasttime=now + elseif now - lasttime > 1 then + summary() + lasttime=now + end + end +else + printf("open %s", filename) + local f = io.open(filename, "r") + for line in f:lines() do + if parse_line(line) == true then + summary() + end + end + f:close() +end + + +summary() diff --git a/debian/modules/nginx-http-push/tests/nginx-cachemanager.conf b/debian/modules/nginx-http-push/tests/nginx-cachemanager.conf new file mode 100644 index 0000000..889e061 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-cachemanager.conf @@ -0,0 +1,67 @@ +worker_processes 4; +#debug_points stop; +#error_log /dev/stderr debug; +error_log /dev/stderr notice; +#error_log err.log notice; +pid /tmp/nginx-debug.pid; + +events { + worker_connections 90000; + accept_mutex on; +} + +http { + access_log /dev/stdout; + proxy_cache_path /tmp levels=1:2 keys_zone=cache:1m; + + server { + listen 8000; + location / { + proxy_cache cache; + } + } + + server { + listen 8082; + # root ./; + location ~ /pub/(\w+)$ { + set $push_channel_id $1; + push_publisher; + push_min_message_buffer_length 5; + push_max_message_buffer_length 20; + push_message_timeout 5s; + push_channel_group test; + } + + location ~ /sub/broadcast/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency broadcast; + } + location ~ /sub/first/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency first; + } + location ~ /sub/last/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency last; + } + + #authorized channels only -- publishers must create the channel before subscribing + location ~ /sub/authorized/(\w+)$ { + push_authorized_channels_only on; + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + } + + + + + } +} \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/nginx-proxy.conf b/debian/modules/nginx-http-push/tests/nginx-proxy.conf new file mode 100644 index 0000000..97fdcc8 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-proxy.conf @@ -0,0 +1,26 @@ +worker_processes 3; +pid /tmp/pushmodule-test-nginx-proxy.pid; +daemon off; + +events { + worker_connections 90000; + accept_mutex on; +} + +error_log /dev/stderr notice; + +http { + access_log /dev/null; + client_body_temp_path /tmp/ 1 2; + sendfile on; + keepalive_timeout 65; + server { + listen 8083; + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://localhost:8082; + } + } +} \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/.gitignore b/debian/modules/nginx-http-push/tests/nginx-pushmodule/.gitignore new file mode 100644 index 0000000..980111f --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/.gitignore @@ -0,0 +1,5 @@ +src +pkg +*.tar.gz +*.pkg.tar* +*no_pool.patch \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/PKGBUILD b/debian/modules/nginx-http-push/tests/nginx-pushmodule/PKGBUILD new file mode 100644 index 0000000..bf3dfe4 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/PKGBUILD @@ -0,0 +1,155 @@ +#!/bin/zsh +_nginx_ver=1.6.0 +_nginx_ver_nopool=1.7.2 +_nginx_ver_old=1.0.1 +_nginx_ver_very_old=0.8.40 + +OPTIONS=(!strip debug docs libtool staticlibs emptydirs zipman purge !upx) +if [[ -z $NO_DEBUG ]]; then + CFLAGS="-ggdb -O0 -Wall" +fi +if [[ $NO_POOL == 1 ]]; then + _nginx_ver=$_nginx_ver_nopool +elif [[ $NGINX_OLDVERSION == 1 ]]; then + _nginx_ver=$_nginx_ver_old +elif [[ $NGINX_VERYOLDVERSION == 1 ]]; then + _nginx_ver=$_nginx_ver_very_old +fi + + +PKGEXT=".pkg.tar" + +_user="http" +_group="http" +_doc_root="/usr/share/${_pkgname}/http" +_sysconf_path="etc" +_conf_path="${_sysconf_path}/${_pkgname}" +_tmp_path="/tmp/" +_pid_path="/run" +_lock_path="/var/lock" +_access_log="/dev/stdout" +_error_log="errors.log" +_pushmodule_dir="${startdir}/pushmodule" + +_pkgver() { + pushd "$startdir/pushmodule" >/dev/null + printf "%s.%s.%s.%s" "$_nginx_ver" "$(git rev-parse --abbrev-ref HEAD | sed -r 's/-/_/g')" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + popd >/dev/null +} + +pkgname=nginx-pushmodule-dev +pkgver=$(_pkgver) +pkgrel=1 +pkgdesc="Nginx Push Module dev version" +arch=('i686' 'x86_64') +install=install + + +depends=('pcre' 'zlib' 'openssl') +url="http://nginx.org" +license=('custom') +conflicts=('nginx' 'nginx-unstable' 'nginx-svn' 'nginx-devel' 'nginx-custom-dev' 'nginx-custom-slact') +provides=('nginx' 'nginx-custom') +backup=("${_conf_path}/conf/nginx.conf" + "${_conf_path}/conf/koi-win" + "${_conf_path}/conf/koi-utf" + "${_conf_path}/conf/win-utf" + "${_conf_path}/conf/mime.types" + "${_conf_path}/conf/fastcgi.conf" + "${_conf_path}/conf/fastcgi_params" + "${_conf_path}/conf/scgi_params" + "${_conf_path}/conf/uwsgi_params" + "etc/logrotate.d/nginx") +_user=http +_group=http + +source=("http://nginx.org/download/nginx-${_nginx_ver}.tar.gz" + "nginx.conf" + "nginx.logrotate" + "nginx.service" + "https://raw.github.com/shrimp/no-pool-nginx/master/nginx-${_nginx_ver_nopool}-no_pool.patch") +md5sums=('SKIP' + '1fe7a3ca0773ce13f9f92e239a99f8b9' + 'ab1eb640c978536c1dad16674d6b3c3c' + '62d494d23aef31d0b867161f9fffa6eb' + 'SKIP') + +build() { + local _src_dir="${srcdir}/nginx-$_nginx_ver" + ln -sf $_src_dir $srcdir/nginx + local _build_dir="${_src_dir}/objs" + cd $_src_dir + + if [[ $NO_POOL == 1 ]]; then + echo "using the no-pool patch" + patch -p1 < "${srcdir}/nginx-${_nginx_ver}-no_pool.patch" + fi + if [[ $NGX_SLAB_PATCH == 1 ]]; then + echo "using the ngx_slab patch to fix large alloc/frees" + patch -p1 < "${startdir}/ngx_slab.patch" + fi + + if [[ $MUDFLAP == 1 ]]; then + export CFLAGS="$CFLAGS -fmudflap" + fi + + CONFIGURE=( + --prefix=/${_conf_path} + --sbin-path=/usr/bin/nginx + --pid-path=${_pid_path}/nginx.pid + --lock-path=${_pid_path}/nginx.lock + --http-client-body-temp-path=${_tmp_path}/client_body_temp + --http-proxy-temp-path=${_tmp_path}/proxy_temp + --http-fastcgi-temp-path=${_tmp_path}/fastcgi_temp + --http-uwsgi-temp-path=${_tmp_path}/uwsgi_temp + --http-log-path=${_access_log} + --error-log-path=${_error_log} + --user=${_user} + --group=${_group} + --with-debug + --add-module=${_pushmodule_dir}) + + if [[ -z $NGINX_VERYOLDVERSION ]]; then + CONFIGURE+=( "--http-scgi-temp-path=${_tmp_path}scgi_temp" ) + fi + + if [[ $CC == *clang* ]]; then + #not a valid clang parameter + CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" + elif [[ $CC == "cc" ]] || [[ $CC == "gcc" ]] || [[ -z $CC ]]; then + CFLAGS="-fdiagnostics-color=always $CFLAGS" + fi + + export CCACHE_CPP2=yes + if ! [[ -z $CLANG_ANALYZER ]]; then + scan-build -o "$CLANG_ANALYZER" ./configure ${CONFIGURE[@]} + scan-build -o "$CLANG_ANALYZER" make + elif ! [[ -z $CONTINUE ]]; then + make $REMAKE + else + ./configure ${CONFIGURE[@]} + make + fi +} + +package() { + echo "make install >/dev/null" + cd "${srcdir}/nginx-${_nginx_ver}" + make DESTDIR="$pkgdir/" install >/dev/null + + sed -i -e "s/\/dev/null + ln -sf /usr/share/nginx/http /etc/nginx/html +} +post_uninstall() { + rm /etc/nginx/http +} diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.conf b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.conf new file mode 100644 index 0000000..02ee838 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.conf @@ -0,0 +1 @@ +NGINX_CONFIG=/etc/nginx/conf/nginx.conf diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.logrotate b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.logrotate new file mode 100644 index 0000000..610444d --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.logrotate @@ -0,0 +1,8 @@ + /var/log/nginx/*log /var/log/nginx/*/*log { + daily + create 640 http log + compress + postrotate + [ ! -f /run/nginx.pid ] || kill -USR1 `cat /run/nginx.pid` + endscript + } diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.service b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.service new file mode 100644 index 0000000..8e28f0c --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/nginx.service @@ -0,0 +1,14 @@ +[Unit] +Description=A high performance web server and a reverse proxy server +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;' +ExecStart=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' +ExecReload=/usr/sbin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload +ExecStop=/usr/sbin/nginx -g 'pid /run/nginx.pid;' -s quit + +[Install] +WantedBy=multi-user.target diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/ngx_slab.patch b/debian/modules/nginx-http-push/tests/nginx-pushmodule/ngx_slab.patch new file mode 100644 index 0000000..6f42e69 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/ngx_slab.patch @@ -0,0 +1,98 @@ +diff --git a/src/core/ngx_slab.c b/src/core/ngx_slab.c +--- a/src/core/ngx_slab.c ++++ b/src/core/ngx_slab.c +@@ -129,6 +129,8 @@ ngx_slab_init(ngx_slab_pool_t *pool) + pool->pages->slab = pages; + } + ++ pool->last = pool->pages + pages; ++ + pool->log_nomem = 1; + pool->log_ctx = &pool->zero; + pool->zero = '\0'; +@@ -626,6 +628,8 @@ ngx_slab_alloc_pages(ngx_slab_pool_t *po + if (page->slab >= pages) { + + if (page->slab > pages) { ++ page[page->slab - 1].prev = (uintptr_t) &page[pages]; ++ + page[pages].slab = page->slab - pages; + page[pages].next = page->next; + page[pages].prev = page->prev; +@@ -672,7 +676,8 @@ static void + ngx_slab_free_pages(ngx_slab_pool_t *pool, ngx_slab_page_t *page, + ngx_uint_t pages) + { +- ngx_slab_page_t *prev; ++ ngx_uint_t type; ++ ngx_slab_page_t *prev, *join; + + page->slab = pages--; + +@@ -686,6 +691,53 @@ ngx_slab_free_pages(ngx_slab_pool_t *poo + page->next->prev = page->prev; + } + ++ join = page + page->slab; ++ ++ if (join < pool->last) { ++ type = join->prev & NGX_SLAB_PAGE_MASK; ++ ++ if (type == NGX_SLAB_PAGE && join->next != NULL) { ++ pages += join->slab; ++ page->slab += join->slab; ++ ++ prev = (ngx_slab_page_t *) (join->prev & ~NGX_SLAB_PAGE_MASK); ++ prev->next = join->next; ++ join->next->prev = join->prev; ++ ++ join->slab = NGX_SLAB_PAGE_FREE; ++ join->next = NULL; ++ join->prev = NGX_SLAB_PAGE; ++ } ++ } ++ ++ if (page > pool->pages) { ++ join = page - 1; ++ type = join->prev & NGX_SLAB_PAGE_MASK; ++ ++ if (type == NGX_SLAB_PAGE && join->slab == NGX_SLAB_PAGE_FREE) { ++ join = (ngx_slab_page_t *) (join->prev & ~NGX_SLAB_PAGE_MASK); ++ } ++ ++ if (type == NGX_SLAB_PAGE && join->next != NULL) { ++ pages += join->slab; ++ join->slab += page->slab; ++ ++ prev = (ngx_slab_page_t *) (join->prev & ~NGX_SLAB_PAGE_MASK); ++ prev->next = join->next; ++ join->next->prev = join->prev; ++ ++ page->slab = NGX_SLAB_PAGE_FREE; ++ page->next = NULL; ++ page->prev = NGX_SLAB_PAGE; ++ ++ page = join; ++ } ++ } ++ ++ if (pages) { ++ page[pages].prev = (uintptr_t) page; ++ } ++ + page->prev = (uintptr_t) &pool->free; + page->next = pool->free.next; + +diff --git a/src/core/ngx_slab.h b/src/core/ngx_slab.h +--- a/src/core/ngx_slab.h ++++ b/src/core/ngx_slab.h +@@ -29,6 +29,7 @@ typedef struct { + size_t min_shift; + + ngx_slab_page_t *pages; ++ ngx_slab_page_t *last; + ngx_slab_page_t free; + + u_char *start; + +-- \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/nginx-pushmodule/pushmodule b/debian/modules/nginx-http-push/tests/nginx-pushmodule/pushmodule new file mode 120000 index 0000000..6581736 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx-pushmodule/pushmodule @@ -0,0 +1 @@ +../../ \ No newline at end of file diff --git a/debian/modules/nginx-http-push/tests/nginx.conf b/debian/modules/nginx-http-push/tests/nginx.conf new file mode 100644 index 0000000..e89c5ce --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx.conf @@ -0,0 +1,121 @@ + +#user nobody; +worker_processes 20; +working_directory /tmp; + +worker_rlimit_core 1024M; +worker_rlimit_nofile 100000; +#debug_points stop; + +#error_log /dev/stderr debug; +error_log /dev/stderr notice; +#error_log err.log notice; + +pid /tmp/pushmodule-test-nginx.pid; +daemon off; + +events { + worker_connections 10000; + accept_mutex off; +} + +http { + access_log /dev/stdout; +# access_log /dev/stdout; + default_type application/octet-stream; + client_body_temp_path /tmp/ 1 2; + sendfile on; + keepalive_timeout 65; + push_authorized_channels_only off; + push_max_reserved_memory 32M; + #cachetag + + server { + listen 8082; +# root ./; + location ~ /pub/(\w+)$ { + set $push_channel_id $1; + push_publisher; + push_min_message_buffer_length 5; + push_max_message_buffer_length 20; + push_message_timeout 5s; + push_channel_group test; + } + + location ~/pub/nobuffer/(\w+)$ { + set $push_channel_id $1; + push_publisher; + push_store_messages off; + push_message_timeout 60s; + push_channel_group test; + } + + location ~ /pub/2_sec_message_timeout/(\w+)$ { + set $push_channel_id $1; + push_publisher; + push_min_message_buffer_length 5; + push_max_message_buffer_length 20; + push_message_timeout 2s; + push_channel_group test; + } + + location ~ /sub/broadcast/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency broadcast; + } + location ~ /sub/first/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency first; + } + location ~ /sub/last/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency last; + } + location ~ /sub/intervalpoll/(\w+)$ { + push_subscriber interval-poll; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency broadcast; + } + + location ~ /sub/gzip/(\w+)$ { + add_header Content-Type text/plain; + gzip on; + gzip_min_length 10; + gzip_proxied any; + gzip_types *; + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency broadcast; + } + + #quick subscriber timeout + location ~ /sub/timeout/(\w+)$ { + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + push_subscriber_concurrency broadcast; + push_subscriber_timeout 2s; + } + + #authorized channels only -- publishers must create the channel before subscribing + location ~ /sub/authorized/(\w+)$ { + push_authorized_channels_only on; + push_subscriber; + push_channel_group test; + set $push_channel_id $1; + } + + location ~ /rewrite/(.*)$ { + rewrite ^/(.*)$ $1; + } + + } +} diff --git a/debian/modules/nginx-http-push/tests/nginx.sh b/debian/modules/nginx-http-push/tests/nginx.sh new file mode 100755 index 0000000..9172db1 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/nginx.sh @@ -0,0 +1,117 @@ +#!/bin/zsh +TESTDIR=`pwd` +SRCDIR=$(readlink -m $TESTDIR/../src) +echo $TESTDIR $SRCDIR +NGINX_CONFIG=`pwd`/nginx.conf +NGINX_TEMP_CONFIG=`pwd`/.nginx.thisrun.conf +NGINX_OPT=( -p `pwd`/ + -c $NGINX_TEMP_CONFIG +) +cp -fv $NGINX_CONFIG $NGINX_TEMP_CONFIG +VALGRIND_OPT=( --trace-children=yes --track-origins=yes --read-var-info=yes ) +WORKERS=5 +NGINX_DAEMON="off" +NGINX_CONF="" +ACCESS_LOG="/dev/null" +ERROR_LOG="stderr" +ERRLOG_LEVEL="notice" +TMPDIR="" +MEM="32M" + + +_cacheconf=" proxy_cache_path _CACHEDIR_ levels=1:2 keys_zone=cache:1m; \\n server {\\n listen 8007;\\n location / { \\n proxy_cache cache; \\n }\\n }\\n" +echo $cacheconf + +for opt in $*; do + if [[ "$opt" = <-> ]]; then + WORKERS=$opt + fi + case $opt in + leak|leakcheck) + VALGRIND_OPT+=("--leak-check=full" "--show-leak-kinds=all" "--track-fds=yes");; + valgrind) + valgrind=1;; + alleyoop) + alleyoop=1;; + cache) + CACHE=1;; + access) + ACCESS_LOG="/dev/stdout";; + worker|one|single) + WORKERS=1 + ;; + debug|kdbg) + WORKERS=1 + NGINX_DAEMON="on" + debugger=1 + ;; + debuglog) + ERRLOG_LEVEL="debug" + ;; + errorlog) + ERROR_LOG="errors.log" + rm ./errors.log 2>/dev/null + ;; + lomem|lowmem|small) + MEM="5M";; + himem|highmem|large) + MEM="256M";; + verylowmem|tiny) + MEM="1M";; + esac +done + +conf_replace(){ + echo "$1 $2" + sed "s|\($1\).*|\1 $2;|g" $NGINX_TEMP_CONFIG -i +} + +ulimit -c unlimited + +if [[ ! -z $NGINX_CONF ]]; then + NGINX_OPT+=( -g "$NGINX_CONF" ) +fi +#echo $NGINX_CONF +#echo $NGINX_OPT +echo "nginx $NGINX_OPT" +conf_replace "access_log" $ACCESS_LOG +conf_replace "error_log" "$ERROR_LOG $ERRLOG_LEVEL" +conf_replace "worker_processes" $WORKERS +conf_replace "daemon" $NGINX_DAEMON +conf_replace "working_directory" "\"$(pwd)\"" +conf_replace "push_max_reserved_memory" "$MEM" +if [[ ! -z $CACHE ]]; then + sed "s|^\s*#cachetag.*|${_cacheconf}|g" $NGINX_TEMP_CONFIG -i + tmpdir=`pwd`"/.tmp" + mkdir $tmpdir 2>/dev/null + sed "s|_CACHEDIR_|\"$tmpdir\"|g" $NGINX_TEMP_CONFIG -i +fi + +if [[ $debugger == 1 ]]; then + + ./nginx $NGINX_OPT + sleep 0.2 + master_pid=`cat /tmp/pushmodule-test-nginx.pid` + child_pids=`pgrep -P $master_pid` + kdbg_pids=() + ln -sf $TESTDIR/nginx $SRCDIR/nginx >/dev/null + ln -sf $TESTDIR/nginx-pushmodule/src/nginx/src/ $SRCDIR/nginx-source >/dev/null + sudo echo "attaching kdbg..." + while read -r line; do + sudo kdbg -p $line $SRCDIR/nginx & + kdbg_pids+="$!" + done <<< $child_pids + echo "kdbg at $kdbg_pids" + wait $kdbg_pids + kill $master_pid + rm -f $SRCDIR/nginx $SRCDIR/nginx-source 2>/dev/null +elif [[ $valgrind == 1 ]]; then + mkdir ./coredump 2>/dev/null + pushd ./coredump >/dev/null + valgrind $VALGRIND_OPT ../nginx $NGINX_OPT + popd >/dev/null +elif [[ $alleyoop == 1 ]]; then + alleyoop ./nginx $NGINX_OPT +else + ./nginx $NGINX_OPT +fi diff --git a/debian/modules/nginx-http-push/tests/pub.rb b/debian/modules/nginx-http-push/tests/pub.rb new file mode 100755 index 0000000..0f0e64a --- /dev/null +++ b/debian/modules/nginx-http-push/tests/pub.rb @@ -0,0 +1,54 @@ +#!/usr/bin/ruby +require 'securerandom' +require_relative 'pubsub.rb' +require "optparse" +server= "localhost:8082" +msg=false +loop=false +repeat_sec=0.5 + +opt=OptionParser.new do |opts| + opts.on("-s", "--server SERVER (#{server})", "server and port."){|v| server=v} + opts.on("-v", "--verbose", "Blabberhttp"){Typhoeus::Config.verbose=true} + opts.on("-r", "--repeat [SECONDS]", "re-send message every N seconds (#{repeat_sec})") do |v| + loop=true + repeat_sec=Float(v) unless v.nil? + end + opts.on("-m", "--message MSG", "publish this message instead of prompting"){|v| msg=v} +end +opt.banner="Usage: pub.rb [options] url" +opt.parse! + +url = "http://#{server}#{ARGV.last}" + +puts "Publishing to #{url}." + + +loopmsg=("\r"*20) + "sending message #" + +pub = Publisher.new url +repeat=true +i=1 +while repeat do + if msg + if loop + sleep repeat_sec + print loopmsg + print i + i+=1 + else + puts "Press enter to send message." + STDIN.gets + end + pub.post msg + + else + if loop + puts "Can't repeat with custom message. use -m option" + end + puts "Enter one-line message, press enter." + message=STDIN.gets #doesn't work when there are parameters. wtf? + pub.post message + puts "" + end +end diff --git a/debian/modules/nginx-http-push/tests/pubsub.rb b/debian/modules/nginx-http-push/tests/pubsub.rb new file mode 100644 index 0000000..83ffd30 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/pubsub.rb @@ -0,0 +1,375 @@ +#!/usr/bin/ruby +require 'typhoeus' +require 'json' +require 'pry' +require 'celluloid' +Typhoeus::Config.memoize = false + +class Message + attr_accessor :content_type, :message, :times_seen, :etag, :last_modified + def initialize(msg, last_modified=nil, etag=nil) + @times_seen=1 + @message, @last_modified, @etag = msg, last_modified, etag + end + def id + @id||="#{last_modified}:#{etag}" + end + def to_s + @message + end +end + +class MessageStore + include Enumerable + attr_accessor :msgs, :quit_message + + def matches? (msg_store) + my_messages = messages + if MessageStore === msg_store + other_messages = msg_store.messages + else + other_messages = msg_store + end + return false, "Message count doesn't match. ( #{my_messages.count}, #{other_messages.count})" unless my_messages.count == other_messages.count + other_messages.each_with_index do |msg, i| + return false, "Message #{i} doesn't match. (|#{my_messages[i].length}|, |#{msg.length}|) " if my_messages[i] != msg + end + true + end + + def initialize(opt={}) + @array||=opt[:noid] + clear + end + + def messages + self.to_a.map{|m|m.to_s} + end + + #remove n oldest messages + def remove_old(n=1) + n.times {@msgs.shift} + @msgs.count + end + + def clear + @msgs= @array ? [] : {} + end + + def to_a + @array ? @msgs : @msgs.values + end + def pp + each do |msg| + puts "\"#{msg.to_s}\" (seen #{msg.times_seen} times.)" + end + end + def each + if @array + @msgs.each {|msg| yield msg } + else + @msgs.each {|key, msg| yield msg } + end + end + def <<(msg) + if @array + @msgs << msg + else + if (cur_msg=@msgs[msg.id]) + puts "Received different messages with same message id #{msg.id}: '#{cur_msg.message}' and '#{msg.message}'" unless cur_msg.message == msg.message + cur_msg.times_seen+=1 + cur_msg.times_seen + else + @msgs[msg.id]=msg + 1 + end + end + end +end + +class Subscriber + class LongPollClient + include Celluloid + attr_accessor :last_modified, :etag, :hydra, :timeout + def initialize(subscr, opt={}) + @last_modified, @etag, @timeout = opt[:last_modified], opt[:etag], opt[:timeout] || 10 + @connect_timeout = opt[:connect_timeout] + @subscriber=subscr + @url=subscr.url + @concurrency=opt[:concurrency] || opt[:clients] || 1 + @hydra= Typhoeus::Hydra.new( max_concurrency: @concurrency) + @gzip=opt[:gzip] + @retry_delay=opt[:retry_delay] + end + + def response_success(response, req) + #puts "received OK response at #{req.url}" + #parse it + msg=Message.new response.body, response.headers["Last-Modified"], response.headers["Etag"] + msg.content_type=response.headers["Content-Type"] + req.options[:headers]["If-None-Match"]=msg.etag + req.options[:headers]["If-Modified-Since"]=msg.last_modified + unless @subscriber.on_message(msg) == false + @subscriber.waiting+=1 + Celluloid.sleep @retry_delay if @retry_delay + @hydra.queue req + else + @subscriber.finished+=1 + end + end + + def response_failure(response, req) + #puts "received bad or no response at #{req.url}" + unless @subscriber.on_failure(response) == false + @subscriber.waiting+=1 + Celluloid.sleep @retry_delay if @retry_delay + @hydra.queue req + else + @subscriber.finished+=1 + end + end + + def new_request + req=Typhoeus::Request.new(@url, timeout: @timeout, connecttimeout: @connect_timeout, accept_encoding: (@gzip ? "gzip" : nil) ) + req.on_complete do |response| + @subscriber.waiting-=1 + if response.success? + response_success response, req + else + response_failure response, req + end + end + req + end + + def run(was_success=nil) + #puts "running #{self.class.name} hydra with #{@hydra.queued_requests.count} requests." + (@concurrency - @hydra.queued_requests.count).times do + @subscriber.waiting+=1 + @hydra.queue new_request + end + @hydra.run + end + + def poke + end + end + + class IntervalPollClient < LongPollClient + def initialize(subscr, opt={}) + @last_modified=nil + @etag=nil + super + end + + def store_msg_id(response, req) + @last_modified=response.headers["Last-Modified"] if response.headers["Last-Modified"] + @etag=response.headers["Etag"] if response.headers["Etag"] + req.options[:headers]["If-Modified-Since"]=@last_modified + req.options[:headers]["If-None-Match"]=@etag + end + + def response_success(response, req) + store_msg_id(response, req) + super response, req + end + def response_failure(response, req) + if response.code == 304 || @subscriber.on_failure(response) != false + @subscriber.waiting+=1 + Celluloid.sleep @retry_delay if @retry_delay + @hydra.queue req + else + @subscriber.finished+=1 + end + end + + def poke + while @subscriber.finished < @concurrency do + sleep 1 + end + end + end + + attr_accessor :url, :client, :messages, :max_round_trips, :quit_message, :errors, :concurrency, :waiting, :finished, :client_class + def initialize(url, concurrency=1, opt={}) + @care_about_message_ids=opt[:use_message_id].nil? ? true : opt[:use_message_id] + @url=url + @timeout=opt[:timeout] || 30 + @connect_timeout=opt[:connect_timeout] || 5 + @quit_message=opt[:quit_message] + @gzip=opt[:gzip] + @retry_delay=opt[:retry_delay] + reset + #puts "Starting subscriber on #{url}" + case opt[:client] + when :longpoll, :long, nil + @client_class=LongPollClient + when :interval, :intervalpoll + @client_class=IntervalPollClient + when :ws, :websocket + raise "websocket client not yet implemented" + when :es, :eventsource + raise "EventSource client not yet implemented" + else + raise "unknown client type #{opt[:client]}" + end + @concurrency=concurrency + @client_class ||= opt[:client_class] || LongPollClient + new_client @client_class + end + def new_client(client_class=LongPollClient) + @client=client_class.new(self, concurrency: @concurrency, timeout: @timeout, connect_timeout: @connect_timeout, gzip: @gzip, retry_delay: @retry_delay) + end + def reset + @errors=[] + @messages=MessageStore.new :noid => !@care_about_message_ids + @waiting=0 + @finished=0 + new_client if terminated? + self + end + def abort + @client.terminate + end + def errors? + not no_errors? + end + def no_errors? + @errors.empty? + end + def match_errors(regex) + @errors.each do |err| + return false unless err =~ regex + end + true + end + + + def run + begin + client.current_actor + rescue Celluloid::DeadActorError + return false + end + @client.async.run + self + end + def terminate + begin + @client.terminate + rescue Celluloid::DeadActorError + return false + end + true + end + def terminated? + begin + client.current_actor unless client == nil + rescue Celluloid::DeadActorError + return false + end + true + end + def wait + @client.poke + end + + def on_message(msg=nil, &block) + #puts "received message #{msg.to_s[0..15]}" + if block_given? + @on_message=block + else + @messages << msg + return false if @quit_message == msg.to_s + @on_message.call(msg) if @on_message.respond_to? :call + end + end + def on_failure(response=nil, &block) + if block_given? + @on_failure=block + else + #puts "failed with #{response.to_s}. handler is #{@on_failure.to_s}" + if response.timed_out? + # aw hell no + @errors << "Client response timeout." + elsif response.code == 0 + # Could not get an http response, something's wrong. + @errors << response.return_message + else + # Received a non-successful http response. + @errors << "HTTP request failed: #{response.return_message} (code #{response.code})" + end + @on_failure.call(response) if @on_failure.respond_to? :call + end + end +end + +class Publisher + include Celluloid + attr_accessor :messages, :response, :response_code, :response_body, :nofail, :accept + def initialize(url) + @url= url + @messages = MessageStore.new :noid => true + end + + def submit(body, method=:POST, content_type= :'text/plain', &block) + self.response=nil + self.response_code=nil + self.response_body=nil + + if Enumerable===body + i=0 + body.each{|b| i+=1; submit(b, method, content_type, &block)} + return i + end + post = Typhoeus::Request.new( + @url, + headers: {:'Content-Type' => content_type, :'Accept' => accept}, + method: method, + body: body, + ) + msg=Message.new body + msg.content_type=content_type + post.on_complete do |response| + self.response=response + self.response_code=response.response_code + self.response_body=response.response_body + if response.success? + #puts "published message #{msg.to_s[0..15]}" + @messages << msg + elsif response.timed_out? + # aw hell no + #puts "publisher err: timeout" + raise "Response timed out." + elsif response.code == 0 + # Could not get an http response, something's wrong. + #puts "publisher err: #{response.return_message}" + raise "No HTTP response: #{response.return_message}" unless self.nofail + else + # Received a non-successful http response. + #puts "publisher err: #{response.code.to_s}" + raise "HTTP request failed: #{response.code.to_s}" unless self.nofail + end + block.call(self) if block + end + #puts "publishing to #{@url}" + post.run + end + + def get(accept_header=nil) + self.accept=accept_header + submit nil, :GET + self.accept=nil + end + def delete + submit nil, :DELETE + end + def post(body, content_type=nil, &block) + submit body, :POST, content_type, &block + end + def put(body, content_type=nil, &block) + submit body, :PUT, content_type, &block + end + + +end diff --git a/debian/modules/nginx-http-push/tests/rebuild.sh b/debian/modules/nginx-http-push/tests/rebuild.sh new file mode 100755 index 0000000..8ee0115 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/rebuild.sh @@ -0,0 +1,55 @@ +#!/bin/zsh +#assumes PKGBUILDy nginx located at ./nginx-pushmodule +MY_PATH="`dirname \"$0\"`" +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" + +ccached_clang="ccache clang -Qunused-arguments -fcolor-diagnostics" +for opt in $*; do + case $opt in + clang) + export CC=$ccached_clang;; + nopool|no-pool|nop) + export NO_POOL=1;; + re|remake) + export REMAKE="-B" + export CONTINUE=1;; + c|continue|cont) + export CONTINUE=1;; + nomake) + export NO_MAKE=1;; + nodebug) + export NO_DEBUG=1;; + mudflap) + export MUDFLAP=1 + export CC=gcc + ;; + oldversion|old) + export NGINX_OLDVERSION=1;; + veryoldversion|veryold) + export NGINX_VERYOLDVERSION=1;; + slabpatch|slab) + export NGX_SLAB_PATCH=1;; + clang-analyzer|analyzer|scan|analyze) + export CC="clang" + export CLANG_ANALYZER=$MY_PATH/clang-analyzer + mkdir $CLANG_ANALYZER 2>/dev/null + ;; + esac +done + +if [[ -z $NO_MAKE ]]; then + pushd ./nginx-pushmodule >/dev/null + if [[ $CONTINUE == 1 ]]; then + makepkg -f -e + else + makepkg -f + fi + popd >/dev/null +fi +if ! [[ -z $CLANG_ANALYZER ]]; then + pushd $CLANG_ANALYZER >/dev/null + latest_scan=`ls -c |head -n1` + echo "run 'scan-view ${CLANG_ANALYZER}/${latest_scan}' for static analysis." + scan-view $latest_scan 2>/dev/null + popd >/dev/null +fi diff --git a/debian/modules/nginx-http-push/tests/sub.rb b/debian/modules/nginx-http-push/tests/sub.rb new file mode 100755 index 0000000..e55fb73 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/sub.rb @@ -0,0 +1,52 @@ +#!/usr/bin/ruby +require 'securerandom' +require_relative 'pubsub.rb' +require "optparse" + +server= "localhost:8082" +par=1 +quit_msg='FIN' +no_message=false +max_wait=60 +msg_count=0 +opt=OptionParser.new do |opts| + opts.on("-s", "--server SERVER (#{server})", "server and port."){|v| server=v} + opts.on("-p", "--parallel NUM (#{par})", "number of parallel clients"){|v| par = v.to_i} + opts.on("-t", "--timeout SEC (#{max_wait})", "Long-poll timeout"){|v| max_wait = v} + opts.on("-q", "--quit STRING (#{quit_msg})", "Quit message"){|v| quit_msg = v} + opts.on("-n", "--no-message", "Don't output retrieved message."){|v| no_message = true} + opts.on("-v", "--verbose", "somewhat rather extraneously wordful output"){Typhoeus::Config.verbose=true} +end +opt.banner="Usage: sub.rb [options] url" +opt.parse! + +url = "http://#{server}#{ARGV.last}" + +puts "Subscribing #{par} client#{par!=1 ? "s":""} to #{url}." +puts "Timeout: #{max_wait}sec, quit msg: #{quit_msg}" + + +sub = Subscriber.new url, par, timeout: max_wait, quit_message: quit_msg + +nomsgmessage="\r"*20 + "Received message #" + +sub.on_message do |msg| + if no_message + msg_count+=1 + print nomsgmessage + print msg_count + else + puts msg + end +end + +errors_shown=false +sub.on_failure do |x,y| + puts sub.errors.join "\r\n" unless errors_shown + errors_shown=true + false +end + + +sub.run +sub.wait diff --git a/debian/modules/nginx-http-push/tests/test-parallel.sh b/debian/modules/nginx-http-push/tests/test-parallel.sh new file mode 100755 index 0000000..c5e5ecb --- /dev/null +++ b/debian/modules/nginx-http-push/tests/test-parallel.sh @@ -0,0 +1,25 @@ +#!/bin/bash +par=$1 +if [[ -z "$par" ]]; then + par=5 + echo "No parallel count given. Assuming $par." +fi +if ! [[ $par =~ ^[0-9]+$ ]]; then + echo "Parallel count isn't a number." > /dev/stderr + exit 1 +fi + +for ((i = 0; i < $par; i++)); do + ./test.rb ${@:2} & +done + +jobs=$(jobs -p) +#echo "jobs are $jobs" +killjobs() { + for job_pid in $jobs; do + kill $job_pid + done +} + +trap killjobs SIGINT +wait $jobs diff --git a/debian/modules/nginx-http-push/tests/test.rb b/debian/modules/nginx-http-push/tests/test.rb new file mode 100755 index 0000000..c4428a7 --- /dev/null +++ b/debian/modules/nginx-http-push/tests/test.rb @@ -0,0 +1,396 @@ +#!/usr/bin/ruby +require 'minitest' +require 'minitest/reporters' +Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new +require "minitest/autorun" +require 'securerandom' +require_relative 'pubsub.rb' +SERVER=ENV["PUSHMODULE_SERVER"] || "127.0.0.1" +PORT=ENV["PUSHMODULE_PORT"] || "8082" +#Typhoeus::Config.verbose = true +def url(part="") + part=part[1..-1] if part[0]=="/" + "http://#{SERVER}:#{PORT}/#{part}" +end +puts "Server at #{url}" +def pubsub(concurrent_clients=1, opt={}) + urlpart=opt[:urlpart] || 'broadcast' + timeout = opt[:timeout] + sub_url=opt[:sub] || "sub/broadcast/" + pub_url=opt[:pub] || "pub/" + chan_id = opt[:channel] || SecureRandom.hex + sub = Subscriber.new url("#{sub_url}#{chan_id}"), concurrent_clients, timeout: timeout, use_message_id: opt[:use_message_id], quit_message: 'FIN', gzip: opt[:gzip], retry_delay: opt[:retry_delay], client: opt[:client] + pub = Publisher.new url("#{pub_url}#{chan_id}") + return pub, sub +end +def verify(pub, sub, check_errors=true) + assert sub.errors.empty?, "There were subscriber errors: \r\n#{sub.errors.join "\r\n"}" if check_errors + ret, err = sub.messages.matches?(pub.messages) + assert ret, err || "Messages don't match" + sub.messages.each do |msg| + assert_equal sub.concurrency, msg.times_seen, "Concurrent subscribers didn't all receive a message." + end +end + +class PubSubTest < Minitest::Test + def setup + Celluloid.boot + end + + def test_interval_poll + pub, sub=pubsub 1, client: :intervalpoll, quit_message: 'FIN', retry_delay:0.1 + sub.run + pub.post ["hello this", "is a thing"] + sleep 1 + pub.post ["oh now what", "is this even a thing?"] + sleep 1 + pub.post "FIN" + sub.wait + verify pub, sub + sub.terminate + end + + def test_channel_info + require 'json' + require 'nokogiri' + require 'yaml' + + subs=20 + + chan=SecureRandom.hex + pub, sub = pubsub(subs, channel: chan) + pub.nofail=true + pub.get + assert_equal 404, pub.response_code + + pub.post ["hello", "what is this i don't even"] + assert_equal 202, pub.response_code + pub.get + assert_equal 200, pub.response_code + assert_match /last requested: \d+ sec/, pub.response_body + + pub.get "text/json" + info_json=JSON.parse pub.response_body + assert_equal 2, info_json["messages"] + #assert_equal 0, info_json["requested"] + assert_equal 0, info_json["subscribers"] + + + sub.run + sleep 0.2 + pub.get "text/json" + info_json=JSON.parse pub.response_body + assert_equal 2, info_json["messages"] + #assert_equal 0, info_json["requested"] + assert_equal subs, info_json["subscribers"] + + pub.get "text/xml" + ix = Nokogiri::XML pub.response_body + assert_equal 2, ix.at_xpath('//messages').content.to_i + #assert_equal 0, ix.at_xpath('//requested').content.to_i + assert_equal subs, ix.at_xpath('//subscribers').content.to_i + + pub.get "text/yaml" + yaml_resp1=pub.response_body + pub.get "application/yaml" + yaml_resp2=pub.response_body + pub.get "application/x-yaml" + yaml_resp3=pub.response_body + yam=YAML.load pub.response_body + assert_equal 2, yam["messages"] + #assert_equal 0, yam["requested"] + assert_equal subs, yam["subscribers"] + + assert_equal yaml_resp1, yaml_resp2 + assert_equal yaml_resp2, yaml_resp3 + + + pub.post "FIN" + sub.wait + pub.get "text/json" + info_json=JSON.parse pub.response_body + assert_equal 3, info_json["messages"] + #assert_equal 0, info_json["requested"] + assert_equal 0, info_json["subscribers"] + + sub.terminate + end + + def test_message_delivery + pub, sub = pubsub + sub.run + sleep 0.2 + assert_equal 0, sub.messages.messages.count + pub.post "hi there" + assert_equal 201, pub.response_code + sleep 0.2 + assert_equal 1, sub.messages.messages.count + pub.post "FIN" + assert_equal 201, pub.response_code + sleep 0.2 + assert_equal 2, sub.messages.messages.count + assert sub.messages.matches? pub.messages + sub.terminate + end + + def test_authorized_channels + #must be published to before subscribing + pub, sub = pubsub 5, timeout: 1, sub: "sub/authorized/" + sub.on_failure { false } + sub.run + sub.wait + assert_equal 5, sub.finished + assert sub.match_errors(/code 40[34]/) + sub.reset + pub.post %w( fweep ) + assert_match /20[12]/, pub.response_code.to_s + sleep 0.1 + sub.run + sleep 0.1 + pub.post ["fwoop", "FIN"] { assert_match /20[12]/, pub.response_code.to_s } + sub.wait + verify pub, sub + sub.terminate + end + + def test_deletion + #delete active channel + pub, sub = pubsub 5, timeout: 10 + sub.on_failure { false } + sub.run + sleep 0.2 + pub.delete + sleep 0.2 + assert_equal 200, pub.response_code + sub.wait + assert sub.match_errors(/code 410/), "Expected subscriber code 410: Gone, instead was \"#{sub.errors.first}\"" + + #delete channel with no subscribers + pub, sub = pubsub 5, timeout: 1 + pub.post "hello" + assert_equal 202, pub.response_code + pub.delete + assert_equal 200, pub.response_code + + #delete nonexistent channel + pub, sub = pubsub + pub.nofail=true + pub.delete + assert_equal 404, pub.response_code + end + + def test_no_message_buffer + chan_id=SecureRandom.hex + pub = Publisher.new url("/pub/nobuffer/#{chan_id}") + sub=[] + 40.times do + sub.push Subscriber.new(url("/sub/broadcast/#{chan_id}"), 1, use_message_id: false, quit_message: 'FIN') + end + + pub.post ["this message should not be delivered", "nor this one"] + sub.each {|s| s.run} + sleep 0.2 + pub.post "received1" + sleep 0.2 + pub.post "received2" + sleep 0.2 + pub.post "FIN" + sub.each {|s| s.wait} + sub.each do |s| + assert s.errors.empty?, "There were subscriber errors: \r\n#{s.errors.join "\r\n"}" + ret, err = s.messages.matches? ["received1", "received2", "FIN"] + assert ret, err || "Messages don't match" + end + end + + def test_channel_isolation + rands= %w( foo bar baz bax qqqqqqqqqqqqqqqqqqq eleven andsoon andsoforth feh ) + pub=[] + sub=[] + 10.times do |i| + pub[i], sub[i]=pubsub 15 + sub[i].run + end + pub.each do |p| + rand(1..10).times do + p.post rands.sample + end + end + sleep 1 + pub.each do |p| + p.post 'FIN' + end + sub.each do |s| + s.wait + end + pub.each_with_index do |p, i| + verify p, sub[i] + end + sub.each {|s| s.terminate } + end + + def test_broadcast(clients=400) + pub, sub = pubsub clients + pub.post "yeah okay" + sub.run #celluloid async FTW + sleep 0.5 + pub.post ["hello there", "what is this", "it's nothing", "nothing at all really"] + pub.post "FIN" + sub.wait + verify pub, sub + sub.terminate + end + + #def test_broadcast_for_3000 + # test_broadcast 3000 + #end + + def test_subscriber_concurrency + chan=SecureRandom.hex + pub_first = Publisher.new url("pub/first#{chan}") + pub_last = Publisher.new url("pub/last#{chan}") + + sub_first, sub_last = [], [] + { url("sub/first/first#{chan}") => sub_first, url("sub/last/last#{chan}") => sub_last }.each do |url, arr| + 3.times do + sub=Subscriber.new(url, 1, quit_message: 'FIN', timeout: 20) + sub.on_failure do |resp, req| + false + end + arr << sub + end + end + + sub_first.each {|s| s.run; sleep 0.1 } + assert sub_first[0].no_errors? + sub_first[1..2].each do |s| + assert s.errors? + assert s.match_errors(/code 409/) + end + + sub_last.each {|s| s.run; sleep 0.1 } + assert sub_last[2].no_errors? + sub_last[0..1].each do |s| + assert s.errors? + assert s.match_errors(/code 40[49]/) + end + + pub_first.post %w( foo bar FIN ) + pub_last.post %w( foobar baz somethingelse FIN ) + + sub_first[0].wait + sub_last[2].wait + + verify pub_first, sub_first[0] + verify pub_last, sub_last[2] + + sub_first[1..2].each{ |s| assert s.messages.count == 0 } + sub_last[0..1].each{ |s| assert s.messages.count == 0 } + [sub_first, sub_last].each {|sub| sub.each{|s| s.terminate}} + end + + def test_queueing + pub, sub = pubsub 5 + pub.post %w( what is this_thing andnow 555555555555555555555 eleven FIN ) + sleep 0.3 + sub.run + sub.wait + verify pub, sub + sub.terminate + end + + def test_long_message(kb=1) + pub, sub = pubsub 10, timeout: 10 + sub.run + pub.post ["q" * kb * 1024, "FIN"] + sub.wait + verify pub, sub + sub.terminate + end + + def test_long_message_500kb + test_long_message 500 + end + + def test_long_message_700kb + test_long_message 700 + end + + def test_long_message_950kb + test_long_message 950 + end + + def test_message_length_range + pub, sub = pubsub 2, timeout: 6 + sub.run + + n=5 + while n <= 10000 do + pub.post "T" * n + n=n*1.01 + sleep 0.001 + end + pub.post "FIN" + sub.wait + verify pub, sub + sub.terminate + end + + def test_message_timeout + pub, sub = pubsub 10, pub: "/pub/2_sec_message_timeout/", timeout: 4 + pub.post %w( foo bar etcetera ) #these shouldn't get delivered + pub.messages.clear + sleep 3 + + sub.run + pub.post %w( what is this even FIN ) + sub.wait + verify pub, sub + sub.terminate + end + + def test_subscriber_timeout + chan=SecureRandom.hex + sub=Subscriber.new(url("sub/timeout/#{chan}"), 2, timeout: 10) + sub.on_failure { false } + pub=Publisher.new url("pub/#{chan}") + sub.run + pub.post "hello" + sub.wait + verify pub, sub, false + assert sub.match_errors(/code 304/) + end + + def assert_header_includes(response, header, str) + assert response.headers[header].include?(str), "Response header '#{header}:#{response.headers[header]}' must include \"#{str}\", but does not." + end + + def test_options + chan=SecureRandom.hex + request = Typhoeus::Request.new url("sub/broadcast/#{chan}"), method: :OPTIONS + resp = request.run + assert_equal "*", resp.headers["Access-Control-Allow-Origin"] + %w( GET OPTIONS ).each {|v| assert_header_includes resp, "Access-Control-Allow-Methods", v} + %w( If-None-Match If-Modified-Since Origin ).each {|v| assert_header_includes resp, "Access-Control-Allow-Headers", v} + + request = Typhoeus::Request.new url("pub/#{chan}"), method: :OPTIONS + resp = request.run + assert_equal "*", resp.headers["Access-Control-Allow-Origin"] + %w( GET POST DELETE OPTIONS ).each {|v| assert_header_includes resp, "Access-Control-Allow-Methods", v} + %w( Content-Type Origin ).each {|v| assert_header_includes resp, "Access-Control-Allow-Headers", v} + end + + def test_gzip + #bug: turning on gzip cleared the response etag + pub, sub = pubsub 1, sub: "/sub/gzip/", gzip: true, retry_delay: 0.3 + sub.run + pub.post ["2", "123456789A", "alsdjklsdhflsajkfhl", "boq"] + sleep 1 + pub.post "foobar" + pub.post "FIN" + sleep 1 + verify pub, sub + end +end + + diff --git a/debian/modules/nginx-lua/Changes b/debian/modules/nginx-lua/Changes new file mode 100644 index 0000000..703f73d --- /dev/null +++ b/debian/modules/nginx-lua/Changes @@ -0,0 +1,51 @@ +0.2.0 - 5 July 2011 +* now we support ngx.var[1], ngx.var[2], and etc to refer to the nginx regex capturing variables \$1, \$2, and etc in Lua. this resolved github issue #43. thanks Tobia Conforto for reporting it. + +* now we use the same value overriding mechanism as ngx_rewrite's set command for ngx.var.VAR = new_value. Assigning values to special variables like $limit_rate and $args should now work; also writing to built-in variables that are not changeable (like $arg_PARAMETER) will result in a 500 error page, as expected, now. thanks Richard Kearsley for reporting it. + +* fixed the lua_code_cache off warning when the lua_code_cache is explicitly on. thanks Feng Xingguo. + +* applied the patch from cyberty to add ngx.http_time() function to expose the nginx core function ngx_http_time to the Lua land. + +* fixed an issue on i386: we now use off_t consistently. mixing it with size_t on 32-bit systems can cause Bad Things. this fixed github issue #42. thanks moodydeath. + +* fixed an issue on i386: fixed a formatter mismatch issue in ngx_http_echo_adjust_subrequest. thanks Wang Bin. This caused incorrect subrequest Content-Length header when a body is specified. + +* now in the subrequest capturing processor, we worked around an issue in ngx_http_static_module that when it issues 301 redirect for directory access w/o a trailing slash, it does not inject r->headers_out.location into the r->headers_out.headers list. thanks moodydeath for reporting it in the discussion of github issue #41. + +* fixed a bug in ngx.location.capture() and ngx.location.capture_multi() that we could not capture locations with internal redirections in them. thanks moodydeath for reporting it in github issue #41. + +* fixed redundant last chunk issue for ngx.exec() invocation at rewrite and access phases: we should quit the current core_run_phases cycle; this also fixed github issue #40: 2 Subrequest calls when using access_by_lua, ngx.exec and echo_location. + +* fixed ngx.exit(status) where status >= 200 and status < 300 for access_by_lua* and rewrite_by_lua*: it should quit the whole request altegother and skip all those subsequent phase handlers (if any). thanks moodydeath for reporting it. + +* fixed github issue #39: setting differnt response headers in Lua with common prefix might interfere with each other. thanks moodydeath. + +* fixed GitHub issue #38: request headers did not forward to subrequests when the "method" or "body" option is explicitly specified by a non-nil value for ngx.location.capture(). thanks Richard Kearsley. + +* fixed a bug in output header set; we should always set the header->hash to 1. thanks moodydeath for reporting it. + +* fixed spots that trigger the "variable set but not used" warning issued by gcc 4.6.0. + +* now we turn the ngx.req.header table into an ngx.req.get_headers() function; we also added ngx.req.set_header(name, value) and ngx.req.clear_header(name). thanks moodydeath. + +* now we make ngx_devel_kit (NDK) optional. thanks Kirill A. Korinskiy. + +* removed a duplicate definition of the ngx_str_set macro caught by ctags; also fixed a warning thrown by gcc -O3 on Mac OS X 10.6. + +* added patch to use PCRE related Lua extensions in ngx_lua (chaoslawful) + +* now we change the way we process HTTP 1.0 requests by automatically buffering all the user outputs generated by ngx.print()/ngx.say() calls, which is much more natural than the old broken way. + +* fixed the "ngx.exec() after ngx.location.capture() hanging" bug for rewrite_by_lua* and access_by_lua* as well. thanks Wendal Chen. + +* applied a patch from moodydeath to introduce the "ngx.is_subrequest" attribute. + +* now we encourage use of the client_body_in_single_buffer directive instead of big client_body_buffer_size when lua_need_request_body is turned on. + +* fixed the config script and added extra linking options needed by LuaJIT in 64-bit Mac OS X. + +* fixed the zero size alert caused by ngx.print("") in Lua. + +* now we always allocate r->request_body for subrequests when the method option is specified for ngx.location.capture*. this prevents accidental inheritance of parent request's request body when client_body_buffer_size < client_max_body_size. + diff --git a/debian/modules/nginx-lua/README.markdown b/debian/modules/nginx-lua/README.markdown new file mode 100644 index 0000000..b344ff5 --- /dev/null +++ b/debian/modules/nginx-lua/README.markdown @@ -0,0 +1,6872 @@ + + +Name +==== + +ngx_lua - Embed the power of Lua into Nginx + +*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). + +Table of Contents +================= + +* [Status](#status) +* [Version](#version) +* [Synopsis](#synopsis) +* [Description](#description) +* [Typical Uses](#typical-uses) +* [Nginx Compatibility](#nginx-compatibility) +* [Installation](#installation) + * [C Macro Configurations](#c-macro-configurations) + * [Installation on Ubuntu 11.10](#installation-on-ubuntu-1110) +* [Community](#community) + * [English Mailing List](#english-mailing-list) + * [Chinese Mailing List](#chinese-mailing-list) +* [Code Repository](#code-repository) +* [Bugs and Patches](#bugs-and-patches) +* [Lua/LuaJIT bytecode support](#lualuajit-bytecode-support) +* [System Environment Variable Support](#system-environment-variable-support) +* [HTTP 1.0 support](#http-10-support) +* [Statically Linking Pure Lua Modules](#statically-linking-pure-lua-modules) +* [Data Sharing within an Nginx Worker](#data-sharing-within-an-nginx-worker) +* [Known Issues](#known-issues) + * [TCP socket connect operation issues](#tcp-socket-connect-operation-issues) + * [Lua Coroutine Yielding/Resuming](#lua-coroutine-yieldingresuming) + * [Lua Variable Scope](#lua-variable-scope) + * [Locations Configured by Subrequest Directives of Other Modules](#locations-configured-by-subrequest-directives-of-other-modules) + * [Special PCRE Sequences](#special-pcre-sequences) + * [Mixing with SSI Not Supported](#mixing-with-ssi-not-supported) + * [SPDY Mode Not Fully Supported](#spdy-mode-not-fully-supported) +* [TODO](#todo) + * [Short Term](#short-term) + * [Longer Term](#longer-term) +* [Changes](#changes) +* [Test Suite](#test-suite) +* [Copyright and License](#copyright-and-license) +* [See Also](#see-also) +* [Directives](#directives) +* [Nginx API for Lua](#nginx-api-for-lua) + +Status +====== + +This module is under active development and is production ready. + +Version +======= + +This document describes ngx_lua [v0.9.12](https://github.com/openresty/lua-nginx-module/tags) released on 2 September 2014. + +Synopsis +======== +```nginx + +# set search paths for pure Lua external libraries (';;' is the default path): +lua_package_path '/foo/bar/?.lua;/blah/?.lua;;'; + +# set search paths for Lua external libraries written in C (can also use ';;'): +lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;'; + +server { + location /inline_concat { + # MIME type determined by default_type: + default_type 'text/plain'; + + set $a "hello"; + set $b "world"; + # inline Lua script + set_by_lua $res "return ngx.arg[1]..ngx.arg[2]" $a $b; + echo $res; + } + + location /rel_file_concat { + set $a "foo"; + set $b "bar"; + # script path relative to nginx prefix + # $ngx_prefix/conf/concat.lua contents: + # + # return ngx.arg[1]..ngx.arg[2] + # + set_by_lua_file $res conf/concat.lua $a $b; + echo $res; + } + + location /abs_file_concat { + set $a "fee"; + set $b "baz"; + # absolute script path not modified + set_by_lua_file $res /usr/nginx/conf/concat.lua $a $b; + echo $res; + } + + location /lua_content { + # MIME type determined by default_type: + default_type 'text/plain'; + + content_by_lua "ngx.say('Hello,world!')"; + } + + location /nginx_var { + # MIME type determined by default_type: + default_type 'text/plain'; + + # try access /nginx_var?a=hello,world + content_by_lua "ngx.print(ngx.var['arg_a'], '\\n')"; + } + + location /request_body { + # force reading request body (default off) + lua_need_request_body on; + client_max_body_size 50k; + client_body_buffer_size 50k; + + content_by_lua 'ngx.print(ngx.var.request_body)'; + } + + # transparent non-blocking I/O in Lua via subrequests + location /lua { + # MIME type determined by default_type: + default_type 'text/plain'; + + content_by_lua ' + local res = ngx.location.capture("/some_other_location") + if res.status == 200 then + ngx.print(res.body) + end'; + } + + # GET /recur?num=5 + location /recur { + # MIME type determined by default_type: + default_type 'text/plain'; + + content_by_lua ' + local num = tonumber(ngx.var.arg_num) or 0 + + if num > 50 then + ngx.say("num too big") + return + end + + ngx.say("num is: ", num) + + if num > 0 then + res = ngx.location.capture("/recur?num=" .. tostring(num - 1)) + ngx.print("status=", res.status, " ") + ngx.print("body=", res.body) + else + ngx.say("end") + end + '; + } + + location /foo { + rewrite_by_lua ' + res = ngx.location.capture("/memc", + { args = { cmd = "incr", key = ngx.var.uri } } + ) + '; + + proxy_pass http://blah.blah.com; + } + + location /blah { + access_by_lua ' + local res = ngx.location.capture("/auth") + + if res.status == ngx.HTTP_OK then + return + end + + if res.status == ngx.HTTP_FORBIDDEN then + ngx.exit(res.status) + end + + ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) + '; + + # proxy_pass/fastcgi_pass/postgres_pass/... + } + + location /mixed { + rewrite_by_lua_file /path/to/rewrite.lua; + access_by_lua_file /path/to/access.lua; + content_by_lua_file /path/to/content.lua; + } + + # use nginx var in code path + # WARN: contents in nginx var must be carefully filtered, + # otherwise there'll be great security risk! + location ~ ^/app/(.+) { + content_by_lua_file /path/to/lua/app/root/$1.lua; + } + + location / { + lua_need_request_body on; + + client_max_body_size 100k; + client_body_buffer_size 100k; + + access_by_lua ' + -- check the client IP address is in our black list + if ngx.var.remote_addr == "132.5.72.3" then + ngx.exit(ngx.HTTP_FORBIDDEN) + end + + -- check if the request body contains bad words + if ngx.var.request_body and + string.match(ngx.var.request_body, "fsck") + then + return ngx.redirect("/terms_of_use.html") + end + + -- tests passed + '; + + # proxy_pass/fastcgi_pass/etc settings + } +} +``` + +[Back to TOC](#table-of-contents) + +Description +=========== + +This module embeds Lua, via the standard Lua 5.1 interpreter or [LuaJIT 2.0/2.1](http://luajit.org/luajit.html), into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model. + +Unlike [Apache's mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html) and [Lighttpd's mod_magnet](http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet), Lua code executed using this module can be *100% non-blocking* on network traffic as long as the [Nginx API for Lua](#nginx-api-for-lua) provided by this module is used to handle +requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services. + +At least the following Lua libraries and Nginx modules can be used with this ngx_lua module: + +* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) +* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) +* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) +* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) +* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) +* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) +* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) +* [lua-resty-string](https://github.com/openresty/lua-resty-string) +* [ngx_memc](http://github.com/openresty/memc-nginx-module) +* [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres) +* [ngx_redis2](http://github.com/openresty/redis2-nginx-module) +* [ngx_redis](http://wiki.nginx.org/HttpRedisModule) +* [ngx_proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) +* [ngx_fastcgi](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) + +Almost all the Nginx modules can be used with this ngx_lua module by means of [ngx.location.capture](#ngxlocationcapture) or [ngx.location.capture_multi](#ngxlocationcapture_multi) but it is recommended to use those `lua-resty-*` libraries instead of creating subrequests to access the Nginx upstream modules because the former is usually much more flexible and memory-efficient. + +The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines. + +Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads. + +[Back to TOC](#table-of-contents) + +Typical Uses +============ + +Just to name a few: + +* Mashup'ing and processing outputs of various nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua, +* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends, +* manipulating response headers in an arbitrary way (by Lua) +* fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly, +* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage, +* doing very complex URL dispatch in Lua at rewrite phase, +* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations. + +The possibilities are unlimited as the module allows bringing together various elements within Nginx as well as exposing the power of the Lua language to the user. The module provides the full flexibility of scripting while offering performance levels comparable with native C language programs both in terms of CPU time as well as memory footprint. This is particularly the case when LuaJIT 2.x is enabled. + +Other scripting language implementations typically struggle to match this performance level. + +The Lua state (Lua VM instance) is shared across all the requests handled by a single nginx worker process to minimize memory use. + +[Back to TOC](#table-of-contents) + +Nginx Compatibility +=================== +The latest module is compatible with the following versions of Nginx: + +* 1.7.x (last tested: 1.7.4) +* 1.6.x +* 1.5.x (last tested: 1.5.12) +* 1.4.x (last tested: 1.4.4) +* 1.3.x (last tested: 1.3.11) +* 1.2.x (last tested: 1.2.9) +* 1.1.x (last tested: 1.1.5) +* 1.0.x (last tested: 1.0.15) +* 0.9.x (last tested: 0.9.4) +* 0.8.x >= 0.8.54 (last tested: 0.8.54) + +[Back to TOC](#table-of-contents) + +Installation +============ + +The [ngx_openresty bundle](http://openresty.org) can be used to install Nginx, ngx_lua, either one of the standard Lua 5.1 interpreter or LuaJIT 2.0/2.1, as well as a package of powerful companion Nginx modules. The basic installation step is a simple `./configure --with-luajit && make && make install`. + +Alternatively, ngx_lua can be manually compiled into Nginx: + +1. Install LuaJIT 2.0 or 2.1 (recommended) or Lua 5.1 (Lua 5.2 is *not* supported yet). LuaJIT can be downloaded from the [the LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuajIT and/or Lua. +1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](http://github.com/simpl/ngx_devel_kit/tags). +1. Download the latest version of ngx_lua [HERE](http://github.com/openresty/lua-nginx-module/tags). +1. Download the latest version of Nginx [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility)) + +Build the source with this module: + +```bash + +wget 'http://nginx.org/download/nginx-1.7.4.tar.gz' +tar -xzvf nginx-1.7.4.tar.gz +cd nginx-1.7.4/ + +# tell nginx's build system where to find LuaJIT 2.0: +export LUAJIT_LIB=/path/to/luajit/lib +export LUAJIT_INC=/path/to/luajit/include/luajit-2.0 + +# tell nginx's build system where to find LuaJIT 2.1: +export LUAJIT_LIB=/path/to/luajit/lib +export LUAJIT_INC=/path/to/luajit/include/luajit-2.1 + +# or tell where to find Lua if using Lua instead: +#export LUA_LIB=/path/to/lua/lib +#export LUA_INC=/path/to/lua/include + +# Here we assume Nginx is to be installed under /opt/nginx/. +./configure --prefix=/opt/nginx \ + --add-module=/path/to/ngx_devel_kit \ + --add-module=/path/to/lua-nginx-module + +make -j2 +make install +``` + +[Back to TOC](#table-of-contents) + +C Macro Configurations +---------------------- + +While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options: + +* `NGX_LUA_USE_ASSERT` + When defined, will enable assertions in the ngx_lua C code base. Recommended for debugging or testing builds. It can introduce some (small) runtime overhead when enabled. This macro was first introduced in the `v0.9.10` release. +* `NGX_LUA_ABORT_AT_PANIC` + When the Lua/LuaJIT VM panics, ngx_lua will instruct the current nginx worker process to quit gracefully by default. By specifying this C macro, ngx_lua will abort the current nginx worker process (which usually result in a core dump file) immediately. This option is useful for debugging VM panics. This option was first introduced in the `v0.9.8` release. +* `NGX_LUA_NO_FFI_API` + Excludes pure C API functions for FFI-based Lua API for NGINX (as required by [lua-resty-core](https://github.com/openresty/lua-resty-core#readme), for example). Enabling this macro can make the resulting binary code size smaller. + +To enable one or more of these macros, just pass extra C compiler options to the `./configure` script of either NGINX or OpenResty. For instance, + + + ./configure --with-cc-opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC" + + +[Back to TOC](#table-of-contents) + +Installation on Ubuntu 11.10 +---------------------------- + +Note that it is recommended to use LuaJIT 2.0 or LuaJIT 2.1 instead of the standard Lua 5.1 interpreter wherever possible. + +If the standard Lua 5.1 interpreter is required however, run the following command to install it from the Ubuntu repository: + +```bash + +apt-get install -y lua5.1 liblua5.1-0 liblua5.1-0-dev +``` + +Everything should be installed correctly, except for one small tweak. + +Library name `liblua.so` has been changed in liblua5.1 package, it only comes with `liblua5.1.so`, which needs to be symlinked to `/usr/lib` so it could be found during the configuration process. + +```bash + +ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so +``` + +[Back to TOC](#table-of-contents) + +Community +========= + +[Back to TOC](#table-of-contents) + +English Mailing List +-------------------- + +The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. + +[Back to TOC](#table-of-contents) + +Chinese Mailing List +-------------------- + +The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. + +[Back to TOC](#table-of-contents) + +Code Repository +=============== + +The code repository of this project is hosted on github at [openresty/lua-nginx-module](http://github.com/openresty/lua-nginx-module). + +[Back to TOC](#table-of-contents) + +Bugs and Patches +================ + +Please submit bug reports, wishlists, or patches by + +1. creating a ticket on the [GitHub Issue Tracker](https://github.com/openresty/lua-nginx-module/issues), +1. or posting to the [OpenResty community](#community). + +[Back to TOC](#table-of-contents) + +Lua/LuaJIT bytecode support +=========================== + +As from the `v0.5.0rc32` release, all `*_by_lua_file` configure directives (such as [content_by_lua_file](#content_by_lua_file)) support loading Lua 5.1 and LuaJIT 2.0/2.1 raw bytecode files directly. + +Please note that the bytecode format used by LuaJIT 2.0/2.1 is not compatible with that used by the standard Lua 5.1 interpreter. So if using LuaJIT 2.0/2.1 with ngx_lua, LuaJIT compatible bytecode files must be generated as shown: + +```bash + +/path/to/luajit/bin/luajit -b /path/to/input_file.lua /path/to/output_file.luac +``` + +The `-bg` option can be used to include debug information in the LuaJIT bytecode file: + +```bash + +/path/to/luajit/bin/luajit -bg /path/to/input_file.lua /path/to/output_file.luac +``` + +Please refer to the official LuaJIT documentation on the `-b` option for more details: + + + +Also, the bytecode files generated by LuaJIT 2.1 is *not* compatible with LuaJIT 2.0, and vice versa. The support for LuaJIT 2.1 bytecode was first added in ngx_lua v0.9.3. + +Similarly, if using the standard Lua 5.1 interpreter with ngx_lua, Lua compatible bytecode files must be generated using the `luac` commandline utility as shown: + +```bash + +luac -o /path/to/output_file.luac /path/to/input_file.lua +``` + +Unlike as with LuaJIT, debug information is included in standard Lua 5.1 bytecode files by default. This can be striped out by specifying the `-s` option as shown: + +```bash + +luac -s -o /path/to/output_file.luac /path/to/input_file.lua +``` + +Attempts to load standard Lua 5.1 bytecode files into ngx_lua instances linked to LuaJIT 2.0/2.1 or vice versa, will result in an error message, such as that below, being logged into the Nginx `error.log` file: + + + [error] 13909#0: *1 failed to load Lua inlined code: bad byte-code header in /path/to/test_file.luac + + +Loading bytecode files via the Lua primitives like `require` and `dofile` should always work as expected. + +[Back to TOC](#table-of-contents) + +System Environment Variable Support +=================================== + +If you want to access the system environment variable, say, `foo`, in Lua via the standard Lua API [os.getenv](http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv), then you should also list this environment variable name in your `nginx.conf` file via the [env directive](http://nginx.org/en/docs/ngx_core_module.html#env). For example, + +```nginx + +env foo; +``` + +[Back to TOC](#table-of-contents) + +HTTP 1.0 support +================ + +The HTTP 1.0 protocol does not support chunked output and requires an explicit `Content-Length` header when the response body is not empty in order to support the HTTP 1.0 keep-alive. +So when a HTTP 1.0 request is made and the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`, ngx_lua will buffer the +output of [ngx.say](#ngxsay) and [ngx.print](#ngxprint) calls and also postpone sending response headers until all the response body output is received. +At that time ngx_lua can calculate the total length of the body and construct a proper `Content-Length` header to return to the HTTP 1.0 client. +If the `Content-Length` response header is set in the running Lua code, however, this buffering will be disabled even if the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`. + +For large streaming output responses, it is important to disable the [lua_http10_buffering](#lua_http10_buffering) directive to minimise memory usage. + +Note that common HTTP benchmark tools such as `ab` and `http_load` issue HTTP 1.0 requests by default. +To force `curl` to send HTTP 1.0 requests, use the `-0` option. + +[Back to TOC](#table-of-contents) + +Statically Linking Pure Lua Modules +=================================== + +When LuaJIT 2.x is used, it is possible to statically link the bytecode of pure Lua modules into the Nginx executable. + +Basically you use the `luajit` executable to compile `.lua` Lua module files to `.o` object files containing the exported bytecode data, and then link the `.o` files directly in your Nginx build. + +Below is a trivial example to demonstrate this. Consider that we have the following `.lua` file named `foo.lua`: + +```lua + +-- foo.lua +local _M = {} + +function _M.go() + print("Hello from foo") +end + +return _M +``` + +And then we compile this `.lua` file to `foo.o` file: + + /path/to/luajit/bin/luajit -bg foo.lua foo.o + +What matters here is the name of the `.lua` file, which determines how you use this module later on the Lua land. The file name `foo.o` does not matter at all except the `.o` file extension (which tells `luajit` what output format is used). If you want to strip the Lua debug information from the resulting bytecode, you can just specify the `-b` option above instead of `-bg`. + +Then when building Nginx or OpenResty, pass the `--with-ld-opt="foo.o"` option to the `./configure` script: + +```bash + +./configure --with-ld-opt="/path/to/foo.o" ... +``` + +Finally, you can just do the following in any Lua code run by ngx_lua: + +```lua + +local foo = require "foo" +foo.go() +``` + +And this piece of code no longer depends on the external `foo.lua` file any more because it has already been compiled into the `nginx` executable. + +If you want to use dot in the Lua module name when calling `require`, as in + +```lua + +local foo = require "resty.foo" +``` + +then you need to rename the `foo.lua` file to `resty_foo.lua` before compiling it down to a `.o` file with the `luajit` command-line utility. + +It is important to use exactly the same version of LuaJIT when compiling `.lua` files to `.o` files as building nginx + ngx_lua. This is because the LuaJIT bytecode format may be incompatible between different LuaJIT versions. When the bytecode format is incompatible, you will see a Lua runtime error saying that the Lua module is not found. + +When you have multiple `.lua` files to compile and link, then just specify their `.o` files at the same time in the value of the `--with-ld-opt` option. For instance, + +```bash + +./configure --with-ld-opt="/path/to/foo.o /path/to/bar.o" ... +``` + +If you have just too many `.o` files, then it might not be feasible to name them all in a single command. In this case, you can build a static library (or archive) for your `.o` files, as in + +```bash + +ar rcus libmyluafiles.a *.o +``` + +then you can link the `myluafiles` archive as a whole to your nginx executable: + +```bash + +./configure \ + --with-ld-opt="-L/path/to/lib -Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive" +``` + +where `/path/to/lib` is the path of the directory containing the `libmyluafiles.a` file. It should be noted that the linker option `--whole-archive` is required here because otherwise our archive will be skipped because no symbols in our archive are mentioned in the main parts of the nginx executable. + +[Back to TOC](#table-of-contents) + +Data Sharing within an Nginx Worker +=================================== + +To globally share data among all the requests handled by the same nginx worker process, encapsulate the shared data into a Lua module, use the Lua `require` builtin to import the module, and then manipulate the shared data in Lua. This works because required Lua modules are loaded only once and all coroutines will share the same copy of the module (both its code and data). Note however that Lua global variables (note, not module-level variables) WILL NOT persist between requests because of the one-coroutine-per-request isolation design. + +Here is a complete small example: + +```lua + +-- mydata.lua +local _M = {} + +local data = { + dog = 3, + cat = 4, + pig = 5, +} + +function _M.get_age(name) + return data[name] +end + +return _M +``` + +and then accessing it from `nginx.conf`: + +```nginx + +location /lua { + content_by_lua ' + local mydata = require "mydata" + ngx.say(mydata.get_age("dog")) + '; +} +``` + +The `mydata` module in this example will only be loaded and run on the first request to the location `/lua`, +and all subsequent requests to the same nginx worker process will use the reloaded instance of the +module as well as the same copy of the data in it, until a `HUP` signal is sent to the Nginx master process to force a reload. +This data sharing technique is essential for high performance Lua applications based on this module. + +Note that this data sharing is on a *per-worker* basis and not on a *per-server* basis. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers. + +It is usually recommended to share read-only data this way. You can also share changeable data among all the concurrent requests of each nginx worker process as +long as there is *no* nonblocking I/O operations (including [ngx.sleep](#ngxsleep)) +in the middle of your calculations. As long as you do not give the +control back to the nginx event loop and ngx_lua's light thread +scheduler (even implicitly), there can never be any race conditions in +between. For this reason, always be very careful when you want to share changeable data on the +worker level. Buggy optimizations can easily lead to hard-to-debug +race conditions under load. + +If server-wide data sharing is required, then use one or more of the following approaches: + +1. Use the [ngx.shared.DICT](#ngxshareddict) API provided by this module. +1. Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine). +1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The ngx_openresty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms. + +[Back to TOC](#table-of-contents) + +Known Issues +============ + +[Back to TOC](#table-of-contents) + +TCP socket connect operation issues +----------------------------------- +The [tcpsock:connect](#tcpsockconnect) method may indicate `success` despite connection failures such as with `Connection Refused` errors. + +However, later attempts to manipulate the cosocket object will fail and return the actual error status message generated by the failed connect operation. + +This issue is due to limitations in the Nginx event model and only appears to affect Mac OS X. + +[Back to TOC](#table-of-contents) + +Lua Coroutine Yielding/Resuming +------------------------------- +* Because Lua's `dofile` and `require` builtins are currently implemented as C functions in both Lua 5.1 and LuaJIT 2.0/2.1, if the Lua file being loaded by `dofile` or `require` invokes [ngx.location.capture*](#ngxlocationcapture), [ngx.exec](#ngxexec), [ngx.exit](#ngxexit), or other API functions requiring yielding in the *top-level* scope of the Lua file, then the Lua error "attempt to yield across C-call boundary" will be raised. To avoid this, put these calls requiring yielding into your own Lua functions in the Lua file instead of the top-level scope of the file. +* As the standard Lua 5.1 interpreter's VM is not fully resumable, the methods [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), [ngx.redirect](#ngxredirect), [ngx.exec](#ngxexec), and [ngx.exit](#ngxexit) cannot be used within the context of a Lua [pcall()](http://www.lua.org/manual/5.1/manual.html#pdf-pcall) or [xpcall()](http://www.lua.org/manual/5.1/manual.html#pdf-xpcall) or even the first line of the `for ... in ...` statement when the standard Lua 5.1 interpreter is used and the `attempt to yield across metamethod/C-call boundary` error will be produced. Please use LuaJIT 2.x, which supports a fully resumable VM, to avoid this. + +[Back to TOC](#table-of-contents) + +Lua Variable Scope +------------------ +Care must be taken when importing modules and this form should be used: + +```lua + +local xxx = require('xxx') +``` + +instead of the old deprecated form: + +```lua + +require('xxx') +``` + +Here is the reason: by design, the global environment has exactly the same lifetime as the Nginx request handler associated with it. Each request handler has its own set of Lua global variables and that is the idea of request isolation. The Lua module is actually loaded by the first Nginx request handler and is cached by the `require()` built-in in the `package.loaded` table for later reference, and the `module()` builtin used by some Lua modules has the side effect of setting a global variable to the loaded module table. But this global variable will be cleared at the end of the request handler, and every subsequent request handler all has its own (clean) global environment. So one will get Lua exception for accessing the `nil` value. + +Generally, use of Lua global variables is a really really bad idea in the context of ngx_lua because + +1. misuse of Lua globals has very bad side effects for concurrent requests when these variables are actually supposed to be local only, +1. Lua global variables require Lua table look-up in the global environment (which is just a Lua table), which is kinda expensive, and +1. some Lua global variable references are just typos, which are hard to debug. + +It's *highly* recommended to always declare them via "local" in the scope that is reasonable. + +To find out all the uses of Lua global variables in your Lua code, you can run the [lua-releng tool](https://github.com/openresty/nginx-devel-utils/blob/master/lua-releng) across all your .lua source files: + + $ lua-releng + Checking use of Lua global variables in file lib/foo/bar.lua ... + 1 [1489] SETGLOBAL 7 -1 ; contains + 55 [1506] GETGLOBAL 7 -3 ; setvar + 3 [1545] GETGLOBAL 3 -4 ; varexpand + +The output says that the line 1489 of file `lib/foo/bar.lua` writes to a global variable named `contains`, the line 1506 reads from the global variable `setvar`, and line 1545 reads the global `varexpand`. + +This tool will guarantee that local variables in the Lua module functions are all declared with the `local` keyword, otherwise a runtime exception will be thrown. It prevents undesirable race conditions while accessing such variables. See [Data Sharing within an Nginx Worker](#data_sharing_within_an_nginx_worker) for the reasons behind this. + +[Back to TOC](#table-of-contents) + +Locations Configured by Subrequest Directives of Other Modules +-------------------------------------------------------------- +The [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) directives cannot capture locations that include the [echo_location](http://github.com/openresty/echo-nginx-module#echo_location), [echo_location_async](http://github.com/openresty/echo-nginx-module#echo_location_async), [echo_subrequest](http://github.com/openresty/echo-nginx-module#echo_subrequest), or [echo_subrequest_async](http://github.com/openresty/echo-nginx-module#echo_subrequest_async) directives. + +```nginx + +location /foo { + content_by_lua ' + res = ngx.location.capture("/bar") + '; +} +location /bar { + echo_location /blah; +} +location /blah { + echo "Success!"; +} +``` + +```nginx + +$ curl -i http://example.com/foo +``` + +will not work as expected. + +[Back to TOC](#table-of-contents) + +Special PCRE Sequences +---------------------- +PCRE sequences such as `\d`, `\s`, or `\w`, require special attention because in string literals, the backslash character, `\`, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected: + +```nginx + +# nginx.conf +? location /test { +? content_by_lua ' +? local regex = "\d+" -- THIS IS WRONG!! +? local m = ngx.re.match("hello, 1234", regex) +? if m then ngx.say(m[0]) else ngx.say("not matched!") end +? '; +? } +# evaluates to "not matched!" +``` + +To avoid this, *double* escape the backslash: + +```nginx + +# nginx.conf +location /test { + content_by_lua ' + local regex = "\\\\d+" + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; +} +# evaluates to "1234" +``` + +Here, `\\\\d+` is stripped down to `\\d+` by the Nginx config file parser and this is further stripped down to `\d+` by the Lua language parser before running. + +Alternatively, the regex pattern can be presented as a long-bracketed Lua string literal by encasing it in "long brackets", `[[...]]`, in which case backslashes have to only be escaped once for the Nginx config file parser. + +```nginx + +# nginx.conf +location /test { + content_by_lua ' + local regex = [[\\d+]] + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; +} +# evaluates to "1234" +``` + +Here, `[[\\d+]]` is stripped down to `[[\d+]]` by the Nginx config file parser and this is processed correctly. + +Note that a longer from of the long bracket, `[=[...]=]`, may be required if the regex pattern contains `[...]` sequences. +The `[=[...]=]` form may be used as the default form if desired. + +```nginx + +# nginx.conf +location /test { + content_by_lua ' + local regex = [=[[0-9]+]=] + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; +} +# evaluates to "1234" +``` + +An alternative approach to escaping PCRE sequences is to ensure that Lua code is placed in external script files and executed using the various `*_by_lua_file` directives. +With this approach, the backslashes are only stripped by the Lua language parser and therefore only need to be escaped once each. + +```lua + +-- test.lua +local regex = "\\d+" +local m = ngx.re.match("hello, 1234", regex) +if m then ngx.say(m[0]) else ngx.say("not matched!") end +-- evaluates to "1234" +``` + +Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification. + +```lua + +-- test.lua +local regex = [[\d+]] +local m = ngx.re.match("hello, 1234", regex) +if m then ngx.say(m[0]) else ngx.say("not matched!") end +-- evaluates to "1234" +``` + +[Back to TOC](#table-of-contents) + +Mixing with SSI Not Supported +----------------------------- + +Mixing SSI with ngx_lua in the same Nginx request is not supported at all. Just use ngx_lua exclusively. Everything you can do with SSI can be done atop ngx_lua anyway and it can be more efficient when using ngx_lua. + +[Back to TOC](#table-of-contents) + +SPDY Mode Not Fully Supported +----------------------------- + +Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), and [ngx.req.socket](#ngxreqsocket). + +[Back to TOC](#table-of-contents) + +TODO +==== + +[Back to TOC](#table-of-contents) + +Short Term +---------- +* review and apply Jader H. Silva's patch for `ngx.re.split()`. +* review and apply vadim-pavlov's patch for [ngx.location.capture](#ngxlocationcapture)'s `extra_headers` option +* use `ngx_hash_t` to optimize the built-in header look-up process for [ngx.req.set_header](#ngxreqset_header), [ngx.header.HEADER](#ngxheaderheader), and etc. +* add configure options for different strategies of handling the cosocket connection exceeding in the pools. +* add directives to run Lua codes when nginx stops. +* add `ignore_resp_headers`, `ignore_resp_body`, and `ignore_resp` options to [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) methods, to allow micro performance tuning on the user side. + +[Back to TOC](#table-of-contents) + +Longer Term +----------- +* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks. +* add `stat` mode similar to [mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html). + +[Back to TOC](#table-of-contents) + +Changes +======= + +The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: + + + +[Back to TOC](#table-of-contents) + +Test Suite +========== + +The following dependencies are required to run the test suite: + +* Nginx version >= 1.4.2 + +* Perl modules: + * Test::Nginx: + +* Nginx modules: + * [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) + * [ngx_set_misc](http://github.com/openresty/set-misc-nginx-module) + * [ngx_auth_request](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz) (this is not needed if you're using Nginx 1.5.4+. + * [ngx_echo](http://github.com/openresty/echo-nginx-module) + * [ngx_memc](http://github.com/openresty/memc-nginx-module) + * [ngx_srcache](http://github.com/openresty/srcache-nginx-module) + * ngx_lua (i.e., this module) + * [ngx_lua_upstream](http://github.com/openresty/lua-upstream-nginx-module) + * [ngx_headers_more](http://github.com/openresty/headers-more-nginx-module) + * [ngx_drizzle](http://github.com/openresty/drizzle-nginx-module) + * [ngx_rds_json](http://github.com/openresty/rds-json-nginx-module) + * [ngx_coolkit](https://github.com/FRiCKLE/ngx_coolkit) + * [ngx_redis2](http://github.com/openresty/redis2-nginx-module) + +The order in which these modules are added during configuration is important because the position of any filter module in the +filtering chain determines the final output, for example. The correct adding order is shown above. + +* 3rd-party Lua libraries: + * [lua-cjson](http://www.kyne.com.au/~mark/software/lua-cjson.php) + +* Applications: + * mysql: create database 'ngx_test', grant all privileges to user 'ngx_test', password is 'ngx_test' + * memcached: listening on the default port, 11211. + * redis: listening on the default port, 6379. + +See also the [developer build script](https://github.com/openresty/lua-nginx-module/blob/master/util/build2.sh) for more details on setting up the testing environment. + +To run the whole test suite in the default testing mode: + + cd /path/to/lua-nginx-module + export PATH=/path/to/your/nginx/sbin:$PATH + prove -I/path/to/test-nginx/lib -r t + + +To run specific test files: + + cd /path/to/lua-nginx-module + export PATH=/path/to/your/nginx/sbin:$PATH + prove -I/path/to/test-nginx/lib t/002-content.t t/003-errors.t + + +To run a specific test block in a particular test file, add the line `--- ONLY` to the test block you want to run, and then use the `prove` utility to run that `.t` file. + +There are also various testing modes based on mockeagain, valgrind, and etc. Refer to the [Test::Nginx documentation](http://search.cpan.org/perldoc?Test::Nginx) for more details for various advanced testing modes. See also the test reports for the Nginx test cluster running on Amazon EC2: + +[Back to TOC](#table-of-contents) + +Copyright and License +===================== + +This module is licensed under the BSD license. + +Copyright (C) 2009-2014, by Xiaozhe Wang (chaoslawful) . + +Copyright (C) 2009-2014, by Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[Back to TOC](#table-of-contents) + +See Also +======== + +* [lua-resty-memcached](http://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket. +* [lua-resty-redis](http://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket. +* [lua-resty-mysql](http://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket. +* [lua-resty-upload](http://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket. +* [lua-resty-dns](http://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket. +* [lua-resty-websocket](http://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket. +* [lua-resty-string](http://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html). +* [lua-resty-lock](http://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API. +* [Routing requests to different MySQL queries based on URI arguments](http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs) +* [Dynamic Routing Based on Redis and Lua](http://openresty.org/#DynamicRoutingBasedOnRedis) +* [Using LuaRocks with ngx_lua](http://openresty.org/#UsingLuaRocks) +* [Introduction to ngx_lua](https://github.com/openresty/lua-nginx-module/wiki/Introduction) +* [ngx_devel_kit](http://github.com/simpl/ngx_devel_kit) +* [echo-nginx-module](http://github.com/openresty/echo-nginx-module) +* [drizzle-nginx-module](http://github.com/openresty/drizzle-nginx-module) +* [postgres-nginx-module](http://github.com/FRiCKLE/ngx_postgres) +* [memc-nginx-module](http://github.com/openresty/memc-nginx-module) +* [The ngx_openresty bundle](http://openresty.org) +* [Nginx Systemtap Toolkit](https://github.com/openresty/nginx-systemtap-toolkit) + +[Back to TOC](#table-of-contents) + +Directives +========== + +* [lua_use_default_type](#lua_use_default_type) +* [lua_code_cache](#lua_code_cache) +* [lua_regex_cache_max_entries](#lua_regex_cache_max_entries) +* [lua_regex_match_limit](#lua_regex_match_limit) +* [lua_package_path](#lua_package_path) +* [lua_package_cpath](#lua_package_cpath) +* [init_by_lua](#init_by_lua) +* [init_by_lua_file](#init_by_lua_file) +* [init_worker_by_lua](#init_worker_by_lua) +* [init_worker_by_lua_file](#init_worker_by_lua_file) +* [set_by_lua](#set_by_lua) +* [set_by_lua_file](#set_by_lua_file) +* [content_by_lua](#content_by_lua) +* [content_by_lua_file](#content_by_lua_file) +* [rewrite_by_lua](#rewrite_by_lua) +* [rewrite_by_lua_file](#rewrite_by_lua_file) +* [access_by_lua](#access_by_lua) +* [access_by_lua_file](#access_by_lua_file) +* [header_filter_by_lua](#header_filter_by_lua) +* [header_filter_by_lua_file](#header_filter_by_lua_file) +* [body_filter_by_lua](#body_filter_by_lua) +* [body_filter_by_lua_file](#body_filter_by_lua_file) +* [log_by_lua](#log_by_lua) +* [log_by_lua_file](#log_by_lua_file) +* [lua_need_request_body](#lua_need_request_body) +* [lua_shared_dict](#lua_shared_dict) +* [lua_socket_connect_timeout](#lua_socket_connect_timeout) +* [lua_socket_send_timeout](#lua_socket_send_timeout) +* [lua_socket_send_lowat](#lua_socket_send_lowat) +* [lua_socket_read_timeout](#lua_socket_read_timeout) +* [lua_socket_buffer_size](#lua_socket_buffer_size) +* [lua_socket_pool_size](#lua_socket_pool_size) +* [lua_socket_keepalive_timeout](#lua_socket_keepalive_timeout) +* [lua_socket_log_errors](#lua_socket_log_errors) +* [lua_ssl_ciphers](#lua_ssl_ciphers) +* [lua_ssl_crl](#lua_ssl_crl) +* [lua_ssl_protocols](#lua_ssl_protocols) +* [lua_ssl_trusted_certificate](#lua_ssl_trusted_certificate) +* [lua_ssl_verify_depth](#lua_ssl_verify_depth) +* [lua_http10_buffering](#lua_http10_buffering) +* [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) +* [lua_transform_underscores_in_response_headers](#lua_transform_underscores_in_response_headers) +* [lua_check_client_abort](#lua_check_client_abort) +* [lua_max_pending_timers](#lua_max_pending_timers) +* [lua_max_running_timers](#lua_max_running_timers) + + +[Back to TOC](#table-of-contents) + +lua_use_default_type +-------------------- +**syntax:** *lua_use_default_type on | off* + +**default:** *lua_use_default_type on* + +**context:** *http, server, location, location if* + +Specifies whether to use the MIME type specified by the [default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) directive for the default value of the `Content-Type` response header. If you do not want a default `Content-Type` response header for your Lua request handlers, then turn this directive off. + +This directive is turned on by default. + +This directive was first introduced in the `v0.9.1` release. + +[Back to TOC](#directives) + +lua_code_cache +-------------- +**syntax:** *lua_code_cache on | off* + +**default:** *lua_code_cache on* + +**context:** *http, server, location, location if* + +Enables or disables the Lua code cache for Lua code in `*_by_lua_file` directives (like [set_by_lua_file](#set_by_lua_file) and +[content_by_lua_file](#content_by_lua_file)) and Lua modules. + +When turning off, every request served by ngx_lua will run in a separate Lua VM instance, starting from the `0.9.3` release. So the Lua files referenced in [set_by_lua_file](#set_by_lua_file), +[content_by_lua_file](#content_by_lua_file), [access_by_lua_file](#access_by_lua_file), +and etc will not be cached +and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach. + +Please note however, that Lua code written inlined within nginx.conf +such as those specified by [set_by_lua](#set_by_lua), [content_by_lua](#content_by_lua), +[access_by_lua](#access_by_lua), and [rewrite_by_lua](#rewrite_by_lua) will not be updated when you edit the inlined Lua code in your `nginx.conf` file because only the Nginx config file parser can correctly parse the `nginx.conf` +file and the only way is to reload the config file +by sending a `HUP` signal or just to restart Nginx. + +Even when the code cache is enabled, Lua files which are loaded by `dofile` or `loadfile` +in *_by_lua_file cannot be cached (unless you cache the results yourself). Usually you can either use the [init_by_lua](#init_by_lua) +or [init_by_lua_file](#init-by_lua_file) directives to load all such files or just make these Lua files true Lua modules +and load them via `require`. + +The ngx_lua module does not support the `stat` mode available with the +Apache `mod_lua` module (yet). + +Disabling the Lua code cache is strongly +discouraged for production use and should only be used during +development as it has a significant negative impact on overall performance. For example, the performance a "hello world" Lua example can drop by an order of magnitude after disabling the Lua code cache. + +[Back to TOC](#directives) + +lua_regex_cache_max_entries +--------------------------- +**syntax:** *lua_regex_cache_max_entries <num>* + +**default:** *lua_regex_cache_max_entries 1024* + +**context:** *http* + +Specifies the maximum number of entries allowed in the worker process level compiled regex cache. + +The regular expressions used in [ngx.re.match](#ngxrematch), [ngx.re.gmatch](#ngxregmatch), [ngx.re.sub](#ngxresub), and [ngx.re.gsub](#ngxregsub) will be cached within this cache if the regex option `o` (i.e., compile-once flag) is specified. + +The default number of entries allowed is 1024 and when this limit is reached, new regular expressions will not be cached (as if the `o` option was not specified) and there will be one, and only one, warning in the `error.log` file: + + + 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ... + + +Do not activate the `o` option for regular expressions (and/or `replace` string arguments for [ngx.re.sub](#ngxresub) and [ngx.re.gsub](#ngxregsub)) that are generated *on the fly* and give rise to infinite variations to avoid hitting the specified limit. + +[Back to TOC](#directives) + +lua_regex_match_limit +--------------------- +**syntax:** *lua_regex_match_limit <num>* + +**default:** *lua_regex_match_limit 0* + +**context:** *http* + +Specifies the "match limit" used by the PCRE library when executing the [ngx.re API](#ngxrematch). To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place." + +When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [ngx.re API](#ngxrematch) functions on the Lua land. + +When setting the limit to 0, the default "match limit" when compiling the PCRE library is used. And this is the default value of this directive. + +This directive was first introduced in the `v0.8.5` release. + +[Back to TOC](#directives) + +lua_package_path +---------------- + +**syntax:** *lua_package_path <lua-style-path-str>* + +**default:** *The content of LUA_PATH environ variable or Lua's compiled-in defaults.* + +**context:** *http* + +Sets the Lua module search path used by scripts specified by [set_by_lua](#set_by_lua), +[content_by_lua](#content_by_lua) and others. The path string is in standard Lua path form, and `;;` +can be used to stand for the original search paths. + +As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. + +[Back to TOC](#directives) + +lua_package_cpath +----------------- + +**syntax:** *lua_package_cpath <lua-style-cpath-str>* + +**default:** *The content of LUA_CPATH environment variable or Lua's compiled-in defaults.* + +**context:** *http* + +Sets the Lua C-module search path used by scripts specified by [set_by_lua](#set_by_lua), +[content_by_lua](#content_by_lua) and others. The cpath string is in standard Lua cpath form, and `;;` +can be used to stand for the original cpath. + +As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. + +[Back to TOC](#directives) + +init_by_lua +----------- + +**syntax:** *init_by_lua <lua-script-str>* + +**context:** *http* + +**phase:** *loading-config* + +Runs the Lua code specified by the argument `` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file. + +When Nginx receives the `HUP` signal and starts reloading the config file, the Lua VM will also be re-created and `init_by_lua` will run again on the new Lua VM. In case that the [lua_code_cache](#lua_code_cache) directive is turned off (default on), the `init_by_lua` handler will run upon every request because in this special mode a standalone Lua VM is always created for each request. + +Usually you can register (true) Lua global variables or pre-load Lua modules at server start-up by means of this hook. Here is an example for pre-loading Lua modules: + +```nginx + +init_by_lua 'cjson = require "cjson"'; + +server { + location = /api { + content_by_lua ' + ngx.say(cjson.encode({dog = 5, cat = 6})) + '; + } +} +``` + +You can also initialize the [lua_shared_dict](#lua_shared_dict) shm storage at this phase. Here is an example for this: + +```nginx + +lua_shared_dict dogs 1m; + +init_by_lua ' + local dogs = ngx.shared.dogs; + dogs:set("Tom", 56) +'; + +server { + location = /api { + content_by_lua ' + local dogs = ngx.shared.dogs; + ngx.say(dogs:get("Tom")) + '; + } +} +``` + +But note that, the [lua_shared_dict](#lua_shared_dict)'s shm storage will not be cleared through a config reload (via the `HUP` signal, for example). So if you do *not* want to re-initialize the shm storage in your `init_by_lua` code in this case, then you just need to set a custom flag in the shm storage and always check the flag in your `init_by_lua` code. + +Because the Lua code in this context runs before Nginx forks its worker processes (if any), data or code loaded here will enjoy the [Copy-on-write (COW)](http://en.wikipedia.org/wiki/Copy-on-write) feature provided by many operating systems among all the worker processes, thus saving a lot of memory. + +Do *not* initialize your own Lua global variables in this context because use of Lua global variables have performance penalties and can lead to global namespace pollution (see the [Lua Variable Scope](#lua_variable_scope) section for more details). The recommended way is to use proper [Lua module](http://www.lua.org/manual/5.1/manual.html#5.3) files (but do not use the standard Lua function [module()](http://www.lua.org/manual/5.1/manual.html#pdf-module) to define Lua modules because it pollutes the global namespace as well) and call [require()](http://www.lua.org/manual/5.1/manual.html#pdf-require) to load your own module files in `init_by_lua` or other contexts ([require()](http://www.lua.org/manual/5.1/manual.html#pdf-require) does cache the loaded Lua modules in the global `package.loaded` table in the Lua registry so your modules will only loaded once for the whole Lua VM instance). + +Only a small set of the [Nginx API for Lua](#nginx-api-for-lua) is supported in this context: + +* Logging APIs: [ngx.log](#ngxlog) and [print](#print), +* Shared Dictionary API: [ngx.shared.DICT](#ngxshareddict). + +More Nginx APIs for Lua may be supported in this context upon future user requests. + +Basically you can safely use Lua libraries that do blocking I/O in this very context because blocking the master process during server start-up is completely okay. Even the Nginx core does blocking I/O (at least on resolving upstream's host names) at the configure-loading phase. + +You should be very careful about potential security vulnerabilities in your Lua code registered in this context because the Nginx master process is often run under the `root` account. + +This directive was first introduced in the `v0.5.5` release. + +[Back to TOC](#directives) + +init_by_lua_file +---------------- + +**syntax:** *init_by_lua_file <path-to-lua-script-file>* + +**context:** *http* + +**phase:** *loading-config* + +Equivalent to [init_by_lua](#init_by_lua), except that the file specified by `` contains the Lua code or [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +This directive was first introduced in the `v0.5.5` release. + +[Back to TOC](#directives) + +init_worker_by_lua +------------------ + +**syntax:** *init_worker_by_lua <lua-script-str>* + +**context:** *http* + +**phase:** *starting-worker* + +Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [init_by_lua*](#init_by_lua). + +This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend healthcheck or other timed routine work. Below is an example, + +```nginx + +init_worker_by_lua ' + local delay = 3 -- in seconds + local new_timer = ngx.timer.at + local log = ngx.log + local ERR = ngx.ERR + local check + + check = function(premature) + if not premature then + -- do the health check or other routine work + local ok, err = new_timer(delay, check) + if not ok then + log(ERR, "failed to create timer: ", err) + return + end + end + end + + local ok, err = new_timer(delay, check) + if not ok then + log(ERR, "failed to create timer: ", err) + return + end +'; +``` + +This directive was first introduced in the `v0.9.5` release. + +[Back to TOC](#directives) + +init_worker_by_lua_file +----------------------- + +**syntax:** *init_worker_by_lua_file <lua-file-path>* + +**context:** *http* + +**phase:** *starting-worker* + +Similar to [init_worker_by_lua](#init_worker_by_lua), but accepts the file path to a Lua source file or Lua bytecode file. + +This directive was first introduced in the `v0.9.5` release. + +[Back to TOC](#directives) + +set_by_lua +---------- + +**syntax:** *set_by_lua $res <lua-script-str> [$arg1 $arg2 ...]* + +**context:** *server, server if, location, location if* + +**phase:** *rewrite* + +Executes code specified in `` with optional input arguments `$arg1 $arg2 ...`, and returns string output to `$res`. +The code in `` can make [API calls](#nginx-api-for-lua) and can retrieve input arguments from the `ngx.arg` table (index starts from `1` and increases sequentially). + +This directive is designed to execute short, fast running code blocks as the Nginx event loop is blocked during code execution. Time consuming code sequences should therefore be avoided. + +This directive is implemented by injecting custom commands into the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s command list. Because [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) does not support nonblocking I/O in its commands, Lua APIs requiring yielding the current Lua "light thread" cannot work in this directive. + +At least the following API functions are currently disabled within the context of `set_by_lua`: + +* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) +* Control API functions (e.g., [ngx.exit](#ngxexit)) +* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) +* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). +* Sleeping API function [ngx.sleep](#ngxsleep). + +In addition, note that this directive can only write out a value to a single Nginx variable at +a time. However, a workaround is possible using the [ngx.var.VARIABLE](#ngxvarvariable) interface. + +```nginx + +location /foo { + set $diff ''; # we have to predefine the $diff variable here + + set_by_lua $sum ' + local a = 32 + local b = 56 + + ngx.var.diff = a - b; -- write to $diff directly + return a + b; -- return the $sum value normally + '; + + echo "sum = $sum, diff = $diff"; +} +``` + +This directive can be freely mixed with all directives of the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), [set-misc-nginx-module](http://github.com/openresty/set-misc-nginx-module), and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module) modules. All of these directives will run in the same order as they appear in the config file. + +```nginx + +set $foo 32; +set_by_lua $bar 'tonumber(ngx.var.foo) + 1'; +set $baz "bar: $bar"; # $baz == "bar: 33" +``` + +As from the `v0.5.0rc29` release, Nginx variable interpolation is disabled in the `` argument of this directive and therefore, the dollar sign character (`$`) can be used directly. + +This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. + +[Back to TOC](#directives) + +set_by_lua_file +--------------- +**syntax:** *set_by_lua_file $res <path-to-lua-script-file> [$arg1 $arg2 ...]* + +**context:** *server, server if, location, location if* + +**phase:** *rewrite* + +Equivalent to [set_by_lua](#set_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +Nginx variable interpolation is supported in the `` argument string of this directive. But special care must be taken for injection attacks. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached +and the Nginx config must be reloaded each time the Lua source file is modified. +The Lua code cache can be temporarily disabled during development by +switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. + +This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. + +[Back to TOC](#directives) + +content_by_lua +-------------- + +**syntax:** *content_by_lua <lua-script-str>* + +**context:** *location, location if* + +**phase:** *content* + +Acts as a "content handler" and executes Lua code string specified in `` for every request. +The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). + +Do not use this directive and other content handler directives in the same location. For example, this directive and the [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive should not be used in the same location. + +[Back to TOC](#directives) + +content_by_lua_file +------------------- + +**syntax:** *content_by_lua_file <path-to-lua-script-file>* + +**context:** *location, location if* + +**phase:** *content* + +Equivalent to [content_by_lua](#content_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached +and the Nginx config must be reloaded each time the Lua source file is modified. +The Lua code cache can be temporarily disabled during development by +switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. + +[Back to TOC](#directives) + +rewrite_by_lua +-------------- + +**syntax:** *rewrite_by_lua <lua-script-str>* + +**context:** *http, server, location, location if* + +**phase:** *rewrite tail* + +Acts as a rewrite phase handler and executes Lua code string specified in `` for every request. +The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). + +Note that this handler always runs *after* the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html). So the following will work as expected: + +```nginx + +location /foo { + set $a 12; # create and initialize $a + set $b ""; # create and initialize $b + rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; + echo "res = $b"; +} +``` + +because `set $a 12` and `set $b ""` run *before* [rewrite_by_lua](#rewrite_by_lua). + +On the other hand, the following will not work as expected: + +```nginx + +? location /foo { +? set $a 12; # create and initialize $a +? set $b ''; # create and initialize $b +? rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; +? if ($b = '13') { +? rewrite ^ /bar redirect; +? break; +? } +? +? echo "res = $b"; +? } +``` + +because `if` runs *before* [rewrite_by_lua](#rewrite_by_lua) even if it is placed after [rewrite_by_lua](#rewrite_by_lua) in the config. + +The right way of doing this is as follows: + +```nginx + +location /foo { + set $a 12; # create and initialize $a + set $b ''; # create and initialize $b + rewrite_by_lua ' + ngx.var.b = tonumber(ngx.var.a) + 1 + if tonumber(ngx.var.b) == 13 then + return ngx.redirect("/bar"); + end + '; + + echo "res = $b"; +} +``` + +Note that the [ngx_eval](http://www.grid.net.ru/nginx/eval.en.html) module can be approximated by using [rewrite_by_lua](#rewrite_by_lua). For example, + +```nginx + +location / { + eval $res { + proxy_pass http://foo.com/check-spam; + } + + if ($res = 'spam') { + rewrite ^ /terms-of-use.html redirect; + } + + fastcgi_pass ...; +} +``` + +can be implemented in ngx_lua as: + +```nginx + +location = /check-spam { + internal; + proxy_pass http://foo.com/check-spam; +} + +location / { + rewrite_by_lua ' + local res = ngx.location.capture("/check-spam") + if res.body == "spam" then + return ngx.redirect("/terms-of-use.html") + end + '; + + fastcgi_pass ...; +} +``` + +Just as any other rewrite phase handlers, [rewrite_by_lua](#rewrite_by_lua) also runs in subrequests. + +Note that when calling `ngx.exit(ngx.OK)` within a [rewrite_by_lua](#rewrite_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [rewrite_by_lua](#rewrite_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. + +If the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) directive is used to change the URI and initiate location re-lookups (internal redirections), then any [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code sequences within the current location will not be executed. For example, + +```nginx + +location /foo { + rewrite ^ /bar; + rewrite_by_lua 'ngx.exit(503)'; +} +location /bar { + ... +} +``` + +Here the Lua code `ngx.exit(503)` will never run. This will be the case if `rewrite ^ /bar last` is used as this will similarly initiate an internal redirection. If the `break` modifier is used instead, there will be no internal redirection and the `rewrite_by_lua` code will be executed. + +The `rewrite_by_lua` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. + +[Back to TOC](#directives) + +rewrite_by_lua_file +------------------- + +**syntax:** *rewrite_by_lua_file <path-to-lua-script-file>* + +**context:** *http, server, location, location if* + +**phase:** *rewrite tail* + +Equivalent to [rewrite_by_lua](#rewrite_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached and the Nginx config must be reloaded each time the Lua source file is modified. The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. + +The `rewrite_by_lua_file` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. + +[Back to TOC](#directives) + +access_by_lua +------------- + +**syntax:** *access_by_lua <lua-script-str>* + +**context:** *http, server, location, location if* + +**phase:** *access tail* + +Acts as an access phase handler and executes Lua code string specified in `` for every request. +The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). + +Note that this handler always runs *after* the standard [ngx_http_access_module](http://nginx.org/en/docs/http/ngx_http_access_module.html). So the following will work as expected: + +```nginx + +location / { + deny 192.168.1.1; + allow 192.168.1.0/24; + allow 10.1.1.0/16; + deny all; + + access_by_lua ' + local res = ngx.location.capture("/mysql", { ... }) + ... + '; + + # proxy_pass/fastcgi_pass/... +} +``` + +That is, if a client IP address is in the blacklist, it will be denied before the MySQL query for more complex authentication is executed by [access_by_lua](#access_by_lua). + +Note that the [ngx_auth_request](http://mdounin.ru/hg/ngx_http_auth_request_module/) module can be approximated by using [access_by_lua](#access_by_lua): + +```nginx + +location / { + auth_request /auth; + + # proxy_pass/fastcgi_pass/postgres_pass/... +} +``` + +can be implemented in ngx_lua as: + +```nginx + +location / { + access_by_lua ' + local res = ngx.location.capture("/auth") + + if res.status == ngx.HTTP_OK then + return + end + + if res.status == ngx.HTTP_FORBIDDEN then + ngx.exit(res.status) + end + + ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) + '; + + # proxy_pass/fastcgi_pass/postgres_pass/... +} +``` + +As with other access phase handlers, [access_by_lua](#access_by_lua) will *not* run in subrequests. + +Note that when calling `ngx.exit(ngx.OK)` within a [access_by_lua](#access_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [access_by_lua](#access_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. + +[Back to TOC](#directives) + +access_by_lua_file +------------------ + +**syntax:** *access_by_lua_file <path-to-lua-script-file>* + +**context:** *http, server, location, location if* + +**phase:** *access tail* + +Equivalent to [access_by_lua](#access_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached +and the Nginx config must be reloaded each time the Lua source file is modified. +The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid repeatedly reloading Nginx. + +[Back to TOC](#directives) + +header_filter_by_lua +-------------------- + +**syntax:** *header_filter_by_lua <lua-script-str>* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +Uses Lua code specified in `` to define an output header filter. + +Note that the following API functions are currently disabled within this context: + +* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) +* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) +* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) +* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). + +Here is an example of overriding a response header (or adding one if absent) in our Lua header filter: + +```nginx + +location / { + proxy_pass http://mybackend; + header_filter_by_lua 'ngx.header.Foo = "blah"'; +} +``` + +This directive was first introduced in the `v0.2.1rc20` release. + +[Back to TOC](#directives) + +header_filter_by_lua_file +------------------------- + +**syntax:** *header_filter_by_lua_file <path-to-lua-script-file>* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +Equivalent to [header_filter_by_lua](#header_filter_by_lua), except that the file specified by `` contains the Lua code, or as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +This directive was first introduced in the `v0.2.1rc20` release. + +[Back to TOC](#directives) + +body_filter_by_lua +------------------ + +**syntax:** *body_filter_by_lua <lua-script-str>* + +**context:** *http, server, location, location if* + +**phase:** *output-body-filter* + +Uses Lua code specified in `` to define an output body filter. + +The input data chunk is passed via [ngx.arg](#ngxarg)[1] (as a Lua string value) and the "eof" flag indicating the end of the response body data stream is passed via [ngx.arg](#ngxarg)[2] (as a Lua boolean value). + +Behind the scene, the "eof" flag is just the `last_buf` (for main requests) or `last_in_chain` (for subrequests) flag of the Nginx chain link buffers. (Before the `v0.7.14` release, the "eof" flag does not work at all in subrequests.) + +The output data stream can be aborted immediately by running the following Lua statement: + +```lua + +return ngx.ERROR +``` + +This will truncate the response body and usually result in incomplete and also invalid responses. + +The Lua code can pass its own modified version of the input data chunk to the downstream Nginx output body filters by overriding [ngx.arg](#ngxarg)[1] with a Lua string or a Lua table of strings. For example, to transform all the lowercase letters in the response body, we can just write: + +```nginx + +location / { + proxy_pass http://mybackend; + body_filter_by_lua 'ngx.arg[1] = string.upper(ngx.arg[1])'; +} +``` + +When setting `nil` or an empty Lua string value to `ngx.arg[1]`, no data chunk will be passed to the downstream Nginx output filters at all. + +Likewise, new "eof" flag can also be specified by setting a boolean value to [ngx.arg](#ngxarg)[2]. For example, + +```nginx + +location /t { + echo hello world; + echo hiya globe; + + body_filter_by_lua ' + local chunk = ngx.arg[1] + if string.match(chunk, "hello") then + ngx.arg[2] = true -- new eof + return + end + + -- just throw away any remaining chunk data + ngx.arg[1] = nil + '; +} +``` + +Then `GET /t` will just return the output + + + hello world + + +That is, when the body filter sees a chunk containing the word "hello", then it will set the "eof" flag to true immediately, resulting in truncated but still valid responses. + +When the Lua code may change the length of the response body, then it is required to always clear out the `Content-Length` response header (if any) in a header filter to enforce streaming output, as in + +```nginx + +location /foo { + # fastcgi_pass/proxy_pass/... + + header_filter_by_lua 'ngx.header.content_length = nil'; + body_filter_by_lua 'ngx.arg[1] = string.len(ngx.arg[1]) .. "\\n"'; +} +``` + +Note that the following API functions are currently disabled within this context due to the limitations in NGINX output filter's current implementation: + +* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) +* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) +* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) +* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). + +Nginx output filters may be called multiple times for a single request because response body may be delivered in chunks. Thus, the Lua code specified by in this directive may also run multiple times in the lifetime of a single HTTP request. + +This directive was first introduced in the `v0.5.0rc32` release. + +[Back to TOC](#directives) + +body_filter_by_lua_file +----------------------- + +**syntax:** *body_filter_by_lua_file <path-to-lua-script-file>* + +**context:** *http, server, location, location if* + +**phase:** *output-body-filter* + +Equivalent to [body_filter_by_lua](#body_filter_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +This directive was first introduced in the `v0.5.0rc32` release. + +[Back to TOC](#directives) + +log_by_lua +---------- + +**syntax:** *log_by_lua <lua-script-str>* + +**context:** *http, server, location, location if* + +**phase:** *log* + +Run the Lua source code inlined as the `` at the `log` request processing phase. This does not replace the current access logs, but runs after. + +Note that the following API functions are currently disabled within this context: + +* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) +* Control API functions (e.g., [ngx.exit](#ngxexit)) +* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) +* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). + +Here is an example of gathering average data for [$upstream_response_time](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_response_time): + +```nginx + +lua_shared_dict log_dict 5M; + +server { + location / { + proxy_pass http://mybackend; + + log_by_lua ' + local log_dict = ngx.shared.log_dict + local upstream_time = tonumber(ngx.var.upstream_response_time) + + local sum = log_dict:get("upstream_time-sum") or 0 + sum = sum + upstream_time + log_dict:set("upstream_time-sum", sum) + + local newval, err = log_dict:incr("upstream_time-nb", 1) + if not newval and err == "not found" then + log_dict:add("upstream_time-nb", 0) + log_dict:incr("upstream_time-nb", 1) + end + '; + } + + location = /status { + content_by_lua ' + local log_dict = ngx.shared.log_dict + local sum = log_dict:get("upstream_time-sum") + local nb = log_dict:get("upstream_time-nb") + + if nb and sum then + ngx.say("average upstream response time: ", sum / nb, + " (", nb, " reqs)") + else + ngx.say("no data yet") + end + '; + } +} +``` + +This directive was first introduced in the `v0.5.0rc31` release. + +[Back to TOC](#directives) + +log_by_lua_file +--------------- + +**syntax:** *log_by_lua_file <path-to-lua-script-file>* + +**context:** *http, server, location, location if* + +**phase:** *log* + +Equivalent to [log_by_lua](#log_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + +When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + +This directive was first introduced in the `v0.5.0rc31` release. + +[Back to TOC](#directives) + +lua_need_request_body +--------------------- + +**syntax:** *lua_need_request_body <on|off>* + +**default:** *off* + +**context:** *main | server | location* + +**phase:** *depends on usage* + +Determines whether to force the request body data to be read before running rewrite/access/access_by_lua* or not. The Nginx core does not read the client request body by default and if request body data is required, then this directive should be turned `on` or the [ngx.req.read_body](#ngxreqread_body) function should be called within the Lua code. + +To read the request body data within the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable, +[client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) must have the same value as [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size). Because when the content length exceeds [client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) but less than [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size), Nginx will buffer the data into a temporary file on the disk, which will lead to empty value in the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable. + +If the current location includes [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) directives, +then the request body will be read just before the [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code is run (and also at the +`rewrite` phase). Similarly, if only [content_by_lua](#content_by_lua) is specified, +the request body will not be read until the content handler's Lua code is +about to run (i.e., the request body will be read during the content phase). + +It is recommended however, to use the [ngx.req.read_body](#ngxreqread_body) and [ngx.req.discard_body](#ngxreqdiscard_body) functions for finer control over the request body reading process instead. + +This also applies to [access_by_lua](#access_by_lua) and [access_by_lua_file](#access_by_lua_file). + +[Back to TOC](#directives) + +lua_shared_dict +--------------- + +**syntax:** *lua_shared_dict <name> <size>* + +**default:** *no* + +**context:** *http* + +**phase:** *depends on usage* + +Declares a shared memory zone, ``, to serve as storage for the shm based Lua dictionary `ngx.shared.`. + +Shared memory zones are always shared by all the nginx worker processes in the current nginx server instance. + +The `` argument accepts size units such as `k` and `m`: + +```nginx + +http { + lua_shared_dict dogs 10m; + ... +} +``` + +See [ngx.shared.DICT](#ngxshareddict) for details. + +This directive was first introduced in the `v0.3.1rc22` release. + +[Back to TOC](#directives) + +lua_socket_connect_timeout +-------------------------- + +**syntax:** *lua_socket_connect_timeout <time>* + +**default:** *lua_socket_connect_timeout 60s* + +**context:** *http, server, location* + +This directive controls the default timeout value used in TCP/unix-domain socket object's [connect](#tcpsockconnect) method and can be overridden by the [settimeout](#tcpsocksettimeout) method. + +The `