diff --git a/Cargo.lock b/Cargo.lock index 9c609210c..4c00145ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,10 +139,13 @@ dependencies = [ "hyper-multipart-rfc7578", "indexmap", "libc", + "lz4_flex", + "mime", "mime_guess", "percent-encoding", "prost", "prost-build", + "serde_json", "tokio", "tokio-util", ] @@ -524,6 +527,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "lz4_flex" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a8cbbb2831780bc3b9c15a41f5b49222ef756b6730a95f3decfdd15903eb5a3" +dependencies = [ + "twox-hash", +] + [[package]] name = "maplit" version = "1.0.2" @@ -974,6 +986,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "1.0.93" @@ -1165,6 +1183,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "unicase" version = "2.6.0" diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index 8d104f2a9..9587db20b 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -317,6 +317,12 @@ third_party_libraries: text: "Copyright (c) 2014 The Rust Project Developers\r\n\r\nPermission is hereby granted, free of charge, to any\r\nperson obtaining a copy of this software and associated\r\ndocumentation files (the \"Software\"), to deal in the\r\nSoftware without restriction, including without\r\nlimitation the rights to use, copy, modify, merge,\r\npublish, distribute, sublicense, and/or sell copies of\r\nthe Software, and to permit persons to whom the Software\r\nis furnished to do so, subject to the following\r\nconditions:\r\n\r\nThe above copyright notice and this permission notice\r\nshall be included in all copies or substantial portions\r\nof the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\r\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\r\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\r\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\r\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r\nDEALINGS IN THE SOFTWARE.\r\n" - license: Apache-2.0 text: " Apache License\r\n Version 2.0, January 2004\r\n http://www.apache.org/licenses/\r\n\r\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r\n\r\n1. Definitions.\r\n\r\n \"License\" shall mean the terms and conditions for use, reproduction,\r\n and distribution as defined by Sections 1 through 9 of this document.\r\n\r\n \"Licensor\" shall mean the copyright owner or entity authorized by\r\n the copyright owner that is granting the License.\r\n\r\n \"Legal Entity\" shall mean the union of the acting entity and all\r\n other entities that control, are controlled by, or are under common\r\n control with that entity. For the purposes of this definition,\r\n \"control\" means (i) the power, direct or indirect, to cause the\r\n direction or management of such entity, whether by contract or\r\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\r\n outstanding shares, or (iii) beneficial ownership of such entity.\r\n\r\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\r\n exercising permissions granted by this License.\r\n\r\n \"Source\" form shall mean the preferred form for making modifications,\r\n including but not limited to software source code, documentation\r\n source, and configuration files.\r\n\r\n \"Object\" form shall mean any form resulting from mechanical\r\n transformation or translation of a Source form, including but\r\n not limited to compiled object code, generated documentation,\r\n and conversions to other media types.\r\n\r\n \"Work\" shall mean the work of authorship, whether in Source or\r\n Object form, made available under the License, as indicated by a\r\n copyright notice that is included in or attached to the work\r\n (an example is provided in the Appendix below).\r\n\r\n \"Derivative Works\" shall mean any work, whether in Source or Object\r\n form, that is based on (or derived from) the Work and for which the\r\n editorial revisions, annotations, elaborations, or other modifications\r\n represent, as a whole, an original work of authorship. For the purposes\r\n of this License, Derivative Works shall not include works that remain\r\n separable from, or merely link (or bind by name) to the interfaces of,\r\n the Work and Derivative Works thereof.\r\n\r\n \"Contribution\" shall mean any work of authorship, including\r\n the original version of the Work and any modifications or additions\r\n to that Work or Derivative Works thereof, that is intentionally\r\n submitted to Licensor for inclusion in the Work by the copyright owner\r\n or by an individual or Legal Entity authorized to submit on behalf of\r\n the copyright owner. For the purposes of this definition, \"submitted\"\r\n means any form of electronic, verbal, or written communication sent\r\n to the Licensor or its representatives, including but not limited to\r\n communication on electronic mailing lists, source code control systems,\r\n and issue tracking systems that are managed by, or on behalf of, the\r\n Licensor for the purpose of discussing and improving the Work, but\r\n excluding communication that is conspicuously marked or otherwise\r\n designated in writing by the copyright owner as \"Not a Contribution.\"\r\n\r\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\r\n on behalf of whom a Contribution has been received by Licensor and\r\n subsequently incorporated within the Work.\r\n\r\n2. Grant of Copyright License. Subject to the terms and conditions of\r\n this License, each Contributor hereby grants to You a perpetual,\r\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n copyright license to reproduce, prepare Derivative Works of,\r\n publicly display, publicly perform, sublicense, and distribute the\r\n Work and such Derivative Works in Source or Object form.\r\n\r\n3. Grant of Patent License. Subject to the terms and conditions of\r\n this License, each Contributor hereby grants to You a perpetual,\r\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r\n (except as stated in this section) patent license to make, have made,\r\n use, offer to sell, sell, import, and otherwise transfer the Work,\r\n where such license applies only to those patent claims licensable\r\n by such Contributor that are necessarily infringed by their\r\n Contribution(s) alone or by combination of their Contribution(s)\r\n with the Work to which such Contribution(s) was submitted. If You\r\n institute patent litigation against any entity (including a\r\n cross-claim or counterclaim in a lawsuit) alleging that the Work\r\n or a Contribution incorporated within the Work constitutes direct\r\n or contributory patent infringement, then any patent licenses\r\n granted to You under this License for that Work shall terminate\r\n as of the date such litigation is filed.\r\n\r\n4. Redistribution. You may reproduce and distribute copies of the\r\n Work or Derivative Works thereof in any medium, with or without\r\n modifications, and in Source or Object form, provided that You\r\n meet the following conditions:\r\n\r\n (a) You must give any other recipients of the Work or\r\n Derivative Works a copy of this License; and\r\n\r\n (b) You must cause any modified files to carry prominent notices\r\n stating that You changed the files; and\r\n\r\n (c) You must retain, in the Source form of any Derivative Works\r\n that You distribute, all copyright, patent, trademark, and\r\n attribution notices from the Source form of the Work,\r\n excluding those notices that do not pertain to any part of\r\n the Derivative Works; and\r\n\r\n (d) If the Work includes a \"NOTICE\" text file as part of its\r\n distribution, then any Derivative Works that You distribute must\r\n include a readable copy of the attribution notices contained\r\n within such NOTICE file, excluding those notices that do not\r\n pertain to any part of the Derivative Works, in at least one\r\n of the following places: within a NOTICE text file distributed\r\n as part of the Derivative Works; within the Source form or\r\n documentation, if provided along with the Derivative Works; or,\r\n within a display generated by the Derivative Works, if and\r\n wherever such third-party notices normally appear. The contents\r\n of the NOTICE file are for informational purposes only and\r\n do not modify the License. You may add Your own attribution\r\n notices within Derivative Works that You distribute, alongside\r\n or as an addendum to the NOTICE text from the Work, provided\r\n that such additional attribution notices cannot be construed\r\n as modifying the License.\r\n\r\n You may add Your own copyright statement to Your modifications and\r\n may provide additional or different license terms and conditions\r\n for use, reproduction, or distribution of Your modifications, or\r\n for any such Derivative Works as a whole, provided Your use,\r\n reproduction, and distribution of the Work otherwise complies with\r\n the conditions stated in this License.\r\n\r\n5. Submission of Contributions. Unless You explicitly state otherwise,\r\n any Contribution intentionally submitted for inclusion in the Work\r\n by You to the Licensor shall be under the terms and conditions of\r\n this License, without any additional terms or conditions.\r\n Notwithstanding the above, nothing herein shall supersede or modify\r\n the terms of any separate license agreement you may have executed\r\n with Licensor regarding such Contributions.\r\n\r\n6. Trademarks. This License does not grant permission to use the trade\r\n names, trademarks, service marks, or product names of the Licensor,\r\n except as required for reasonable and customary use in describing the\r\n origin of the Work and reproducing the content of the NOTICE file.\r\n\r\n7. Disclaimer of Warranty. Unless required by applicable law or\r\n agreed to in writing, Licensor provides the Work (and each\r\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r\n implied, including, without limitation, any warranties or conditions\r\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r\n PARTICULAR PURPOSE. You are solely responsible for determining the\r\n appropriateness of using or redistributing the Work and assume any\r\n risks associated with Your exercise of permissions under this License.\r\n\r\n8. Limitation of Liability. In no event and under no legal theory,\r\n whether in tort (including negligence), contract, or otherwise,\r\n unless required by applicable law (such as deliberate and grossly\r\n negligent acts) or agreed to in writing, shall any Contributor be\r\n liable to You for damages, including any direct, indirect, special,\r\n incidental, or consequential damages of any character arising as a\r\n result of this License or out of the use or inability to use the\r\n Work (including but not limited to damages for loss of goodwill,\r\n work stoppage, computer failure or malfunction, or any and all\r\n other commercial damages or losses), even if such Contributor\r\n has been advised of the possibility of such damages.\r\n\r\n9. Accepting Warranty or Additional Liability. While redistributing\r\n the Work or Derivative Works thereof, You may choose to offer,\r\n and charge a fee for, acceptance of support, warranty, indemnity,\r\n or other liability obligations and/or rights consistent with this\r\n License. However, in accepting such obligations, You may act only\r\n on Your own behalf and on Your sole responsibility, not on behalf\r\n of any other Contributor, and only if You agree to indemnify,\r\n defend, and hold each Contributor harmless for any liability\r\n incurred by, or claims asserted against, such Contributor by reason\r\n of your accepting any such warranty or additional liability.\r\n\r\nEND OF TERMS AND CONDITIONS\r\n\r\nAPPENDIX: How to apply the Apache License to your work.\r\n\r\n To apply the Apache License to your work, attach the following\r\n boilerplate notice, with the fields enclosed by brackets \"[]\"\r\n replaced with your own identifying information. (Don't include\r\n the brackets!) The text should be enclosed in the appropriate\r\n comment syntax for the file format. We also recommend that a\r\n file or class name and description of purpose be included on the\r\n same \"printed page\" as the copyright notice for easier\r\n identification within third-party archives.\r\n\r\nCopyright [yyyy] [name of copyright owner]\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n\thttp://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n" + - package_name: lz4_flex + package_version: 0.9.5 + license: MIT + licenses: + - license: MIT + text: NOT FOUND - package_name: memchr package_version: 2.5.0 license: Unlicense/MIT @@ -629,6 +635,14 @@ third_party_libraries: licenses: - license: MIT text: "The MIT License (MIT)\n\nCopyright (c) 2014 Mathijs van de Nes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE." + - package_name: static_assertions + package_version: 1.1.0 + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: "MIT License\n\nCopyright (c) 2017 Nikolai Vazquez\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" + - license: Apache-2.0 + text: "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" - package_name: syn package_version: 1.0.93 license: MIT OR Apache-2.0 @@ -717,6 +731,12 @@ third_party_libraries: licenses: - license: MIT text: "Copyright (c) 2018 Sean McArthur\nCopyright (c) 2016 Alex Crichton\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n" + - package_name: twox-hash + package_version: 1.6.3 + license: MIT + licenses: + - license: MIT + text: "The MIT License (MIT)\n\nCopyright (c) 2015 Jake Goulding\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" - package_name: unicase package_version: 2.6.0 license: MIT/Apache-2.0 diff --git a/examples/ffi/exporter.cpp b/examples/ffi/exporter.cpp index 13e0245f1..c28ab7cca 100644 --- a/examples/ffi/exporter.cpp +++ b/examples/ffi/exporter.cpp @@ -90,8 +90,13 @@ int main(int argc, char *argv[]) { ddog_PushTagResult_drop(tag_result); - ddog_NewProfileExporterResult exporter_new_result = - ddog_ProfileExporter_new(DDOG_CHARSLICE_C("native"), &tags, endpoint); + ddog_NewProfileExporterResult exporter_new_result = ddog_ProfileExporter_new( + DDOG_CHARSLICE_C("exporter-example"), + DDOG_CHARSLICE_C("1.2.3"), + DDOG_CHARSLICE_C("native"), + &tags, + endpoint + ); ddog_Vec_tag_drop(tags); if (exporter_new_result.tag == DDOG_NEW_PROFILE_EXPORTER_RESULT_ERR) { @@ -109,8 +114,14 @@ int main(int argc, char *argv[]) { ddog_Slice_file files = {.ptr = files_, .len = sizeof files_ / sizeof *files_}; - ddog_Request *request = ddog_ProfileExporter_build(exporter, encoded_profile->start, - encoded_profile->end, files, nullptr, 30000); + ddog_Request *request = ddog_ProfileExporter_build( + exporter, + encoded_profile->start, + encoded_profile->end, + files, + nullptr, + 30000 + ); ddog_CancellationToken *cancel = ddog_CancellationToken_new(); ddog_CancellationToken *cancel_for_background_thread = ddog_CancellationToken_clone(cancel); diff --git a/profiling-ffi/src/exporter.rs b/profiling-ffi/src/exporter.rs index 29bb9fb9e..f8f28b93d 100644 --- a/profiling-ffi/src/exporter.rs +++ b/profiling-ffi/src/exporter.rs @@ -116,15 +116,25 @@ unsafe fn try_to_endpoint(endpoint: Endpoint) -> anyhow::Result>, endpoint: Endpoint, ) -> NewProfileExporterResult { match || -> anyhow::Result { + let library_name = unsafe { profiling_library_name.to_utf8_lossy() }.into_owned(); + let library_version = unsafe { profiling_library_version.to_utf8_lossy() }.into_owned(); let family = unsafe { family.to_utf8_lossy() }.into_owned(); let converted_endpoint = unsafe { try_to_endpoint(endpoint)? }; let tags = tags.map(|tags| tags.iter().map(Tag::clone).collect()); - ProfileExporter::new(family, tags, converted_endpoint) + ProfileExporter::new( + library_name, + library_version, + family, + tags, + converted_endpoint, + ) }() { Ok(exporter) => NewProfileExporterResult::Ok(Box::into_raw(Box::new(exporter))), Err(err) => NewProfileExporterResult::Err(err.into()), @@ -316,6 +326,14 @@ mod test { use crate::exporter::*; use ddcommon_ffi::Slice; + fn profiling_library_name() -> CharSlice<'static> { + CharSlice::from("dd-trace-foo") + } + + fn profiling_library_version() -> CharSlice<'static> { + CharSlice::from("1.2.3") + } + fn family() -> CharSlice<'static> { CharSlice::from("native") } @@ -334,14 +352,20 @@ mod test { let host = Tag::new("host", "localhost").expect("static tags to be valid"); tags.push(host); - let result = profile_exporter_new(family(), Some(&tags), endpoint_agent(endpoint())); + let result = profile_exporter_new( + profiling_library_name(), + profiling_library_version(), + family(), + Some(&tags), + endpoint_agent(endpoint()), + ); match result { NewProfileExporterResult::Ok(exporter) => unsafe { profile_exporter_delete(Some(Box::from_raw(exporter))) }, NewProfileExporterResult::Err(message) => { - std::mem::drop(message); + drop(message); panic!("Should not occur!") } } @@ -349,7 +373,13 @@ mod test { #[test] fn test_build() { - let exporter_result = profile_exporter_new(family(), None, endpoint_agent(endpoint())); + let exporter_result = profile_exporter_new( + profiling_library_name(), + profiling_library_version(), + family(), + None, + endpoint_agent(endpoint()), + ); let exporter = match exporter_result { NewProfileExporterResult::Ok(exporter) => unsafe { diff --git a/profiling/Cargo.toml b/profiling/Cargo.toml index c22d59561..99968fe9f 100644 --- a/profiling/Cargo.toml +++ b/profiling/Cargo.toml @@ -28,8 +28,11 @@ hyper = {version = "0.14", features = ["client"], default-features = false} hyper-multipart-rfc7578 = "0.7.0" indexmap = "1.8" libc = "0.2" +lz4_flex = { version = "0.9", default-features = false, features = ["std", "safe-encode", "frame"] } +mime = "0.3.16" mime_guess = {version = "2.0", default-features = false} percent-encoding = "2.1" prost = "0.10" +serde_json = {version = "1.0"} tokio = {version = "1.8", features = ["rt", "macros"]} tokio-util = "0.7.1" diff --git a/profiling/src/exporter/config.rs b/profiling/src/exporter/config.rs index 70f73b283..5a869ad88 100644 --- a/profiling/src/exporter/config.rs +++ b/profiling/src/exporter/config.rs @@ -61,7 +61,7 @@ pub fn agentless, IntoCow: Into>>( site: AsStrRef, api_key: IntoCow, ) -> anyhow::Result { - let intake_url: String = format!("https://intake.profile.{}/v1/input", site.as_ref()); + let intake_url: String = format!("https://intake.profile.{}/api/v2/profile", site.as_ref()); Ok(Endpoint { url: Uri::from_str(intake_url.as_str())?, diff --git a/profiling/src/exporter/mod.rs b/profiling/src/exporter/mod.rs index ecb7aecb8..28111aacd 100644 --- a/profiling/src/exporter/mod.rs +++ b/profiling/src/exporter/mod.rs @@ -10,6 +10,10 @@ pub use chrono::{DateTime, Utc}; pub use ddcommon::tag::Tag; pub use hyper::Uri; use hyper_multipart_rfc7578::client::multipart; +use lz4_flex::frame::FrameEncoder; +use mime; +use serde_json::json; +use std::io::Write; use tokio::runtime::Runtime; use tokio_util::sync::CancellationToken; @@ -40,6 +44,8 @@ pub struct ProfileExporter { exporter: Exporter, endpoint: Endpoint, family: Cow<'static, str>, + profiling_library_name: Cow<'static, str>, + profiling_library_version: Cow<'static, str>, tags: Option>, } @@ -106,15 +112,24 @@ impl Request { } impl ProfileExporter { - pub fn new>>( - family: IntoCow, + pub fn new( + profiling_library_name: N, + profiling_library_version: V, + family: F, tags: Option>, endpoint: Endpoint, - ) -> anyhow::Result { + ) -> anyhow::Result + where + F: Into>, + N: Into>, + V: Into>, + { Ok(Self { exporter: Exporter::new()?, endpoint, family: family.into(), + profiling_library_name: profiling_library_name.into(), + profiling_library_version: profiling_library_version.into(), tags, }) } @@ -130,30 +145,58 @@ impl ProfileExporter { ) -> anyhow::Result { let mut form = multipart::Form::default(); - form.add_text("version", "3"); - form.add_text("start", start.format("%Y-%m-%dT%H:%M:%S%.9fZ").to_string()); - form.add_text("end", end.format("%Y-%m-%dT%H:%M:%S%.9fZ").to_string()); - form.add_text("family", self.family.as_ref()); - - for tags in self.tags.as_ref().iter().chain(additional_tags.iter()) { - for tag in tags.iter() { - form.add_text("tags[]", tag.to_string()); - } + // combine tags and additional_tags + let mut tags_profiler = String::new(); + let other_tags = additional_tags.into_iter(); + for tag in self.tags.iter().chain(other_tags).flatten() { + tags_profiler.push_str(tag.as_ref()); + tags_profiler.push(','); } + tags_profiler.pop(); // clean up the trailing comma + + let attachments: Vec = files.iter().map(|file| file.name.to_owned()).collect(); + + let event = json!({ + "attachments": attachments, + "tags_profiler": tags_profiler, + "start": start.format("%Y-%m-%dT%H:%M:%S%.9fZ").to_string(), + "end": end.format("%Y-%m-%dT%H:%M:%S%.9fZ").to_string(), + "family": self.family.as_ref(), + "version": "4", + }) + .to_string(); + + form.add_reader_file_with_mime( + // Intake does not look for filename=event.json, it looks for name=event. + "event", + // this one shouldn't be compressed + Cursor::new(event), + "event.json", + mime::APPLICATION_JSON, + ); for file in files { - form.add_reader_file( - format!("data[{}]", file.name), - Cursor::new(file.bytes.to_owned()), - file.name, - ) + let mut encoder = FrameEncoder::new(Vec::new()); + encoder.write_all(file.bytes)?; + let encoded = encoder.finish()?; + /* The Datadog RFC examples strip off the file extension, but the exact behavior isn't + * specified. This does the simple thing of using the filename without modification for + * the form name because intake does not care about these name of the form field for + * these attachments. + */ + form.add_reader_file(file.name, Cursor::new(encoded), file.name) } let builder = self .endpoint .into_request_builder(concat!("DDProf/", env!("CARGO_PKG_VERSION")))? .method(http::Method::POST) - .header("Connection", "close"); + .header("Connection", "close") + .header("DD-EVP-ORIGIN", self.profiling_library_name.as_ref()) + .header( + "DD-EVP-ORIGIN-VERSION", + self.profiling_library_version.as_ref(), + ); Ok( Request::from(form.set_body_convert::(builder)?) diff --git a/profiling/tests/form.rs b/profiling/tests/form.rs index 073ca8c5f..a73c03027 100644 --- a/profiling/tests/form.rs +++ b/profiling/tests/form.rs @@ -55,10 +55,18 @@ mod tests { #[test] fn multipart_agent() { + let profiling_library_name = "dd-trace-foo"; + let profiling_library_version = "1.2.3"; let base_url = "http://localhost:8126".parse().expect("url to parse"); let endpoint = config::agent(base_url).expect("endpoint to construct"); - let exporter = ProfileExporter::new("php", Some(default_tags()), endpoint) - .expect("exporter to construct"); + let exporter = ProfileExporter::new( + profiling_library_name, + profiling_library_version, + "php", + Some(default_tags()), + endpoint, + ) + .expect("exporter to construct"); let request = multipart(&exporter); @@ -69,27 +77,50 @@ mod tests { let actual_headers = request.headers(); assert!(!actual_headers.contains_key("DD-API-KEY")); + assert_eq!( + actual_headers.get("DD-EVP-ORIGIN").unwrap(), + profiling_library_name + ); + assert_eq!( + actual_headers.get("DD-EVP-ORIGIN-VERSION").unwrap(), + profiling_library_version + ); } #[test] fn multipart_agentless() { + let profiling_library_name = "dd-trace-foo"; + let profiling_library_version = "1.2.3"; let api_key = "1234567890123456789012"; let endpoint = config::agentless("datadoghq.com", api_key).expect("endpoint to construct"); - let exporter = ProfileExporter::new("php", Some(default_tags()), endpoint) - .expect("exporter to construct"); + let exporter = ProfileExporter::new( + profiling_library_name, + profiling_library_version, + "php", + Some(default_tags()), + endpoint, + ) + .expect("exporter to construct"); let request = multipart(&exporter); assert_eq!( request.uri().to_string(), - "https://intake.profile.datadoghq.com/v1/input" + "https://intake.profile.datadoghq.com/api/v2/profile" ); let actual_headers = request.headers(); + assert_eq!(actual_headers.get("DD-API-KEY").unwrap(), api_key); + + assert_eq!( + actual_headers.get("DD-EVP-ORIGIN").unwrap(), + profiling_library_name + ); + assert_eq!( - actual_headers.get("DD-API-KEY").expect("api key to exist"), - api_key + actual_headers.get("DD-EVP-ORIGIN-VERSION").unwrap(), + profiling_library_version ); } }