feat: add http headers parameter to cli and local app#2162
Conversation
| config.setStdoutOutput(false); | ||
|
|
||
| String gtfsInput = gtfsInputField.getText(); | ||
| String gtfsInput = gtfsInputField.getText().strip(); |
There was a problem hiding this comment.
Not quite related to the PR's main purpose. However, this fixes a critical error when the URL contains extra spaces.
| } | ||
|
|
||
| String outputDirectory = outputDirectoryField.getText(); | ||
| String outputDirectory = outputDirectoryField.getText().strip(); |
There was a problem hiding this comment.
Not quite related to the PR's main purpose. However, this fixes a critical error when the output directory contains extra spaces.
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit 7c955ff 📊 Notices ComparisonNew Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check2 out of 1003 sources (~0 %) are corrupted.
🔍 System errors for mdb-1114 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1114 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]💾 Out of Memory CheckNo datasets experienced an OutOfMemoryError. ⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
📜 Memory Consumption
|
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit 71a93ee 📊 Notices ComparisonNew Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check2 out of 1003 sources (~0 %) are corrupted.
🔍 System errors for mdb-1114 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1114 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]💾 Out of Memory CheckNo datasets experienced an OutOfMemoryError. ⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
📜 Memory Consumption
|
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit 67d2d3d 📊 Notices ComparisonNew Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. New Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Info Notices (0 out of 1001 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check2 out of 1003 sources (~0 %) are corrupted.
🔍 System errors for mdb-1114 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1114 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (reference)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]🔍 System errors for mdb-1123 (latest)[
{
"code": "i_o_error",
"severity": "ERROR",
"totalNotices": 1,
"sampleNotices": [
{
"exception": "java.util.zip.ZipException",
"message": "Archive is not a ZIP archive"
}
]
}
]💾 Out of Memory CheckNo datasets experienced an OutOfMemoryError. ⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
📜 Memory Consumption
|
Summary:
Closes: #2138
This PR adds support for custom HTTP headers. The custom HTTP headers are only present in the feed download request. The changes include CLI and local App support; Out of scope: web/API support for custom headers.
This can be tested locally:
App changes:

From our AI friend
This pull request adds support for specifying custom HTTP headers when downloading GTFS feeds, both in the GUI and CLI. It introduces a multi-line text field in the GUI for headers, validates the input format, ensures headers are not persisted for security, and updates the CLI to support repeated
--http_headerarguments. Comprehensive tests are included to verify correct parsing, validation, and security behavior.GUI enhancements:
Added a multi-line
JTextAreafor custom HTTP headers in the advanced options panel of the GUI (GtfsValidatorApp.java). This includes input validation, error display, and disables the Validate button if the headers are invalid. Headers are parsed and attached to the validation config when running. ([[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR84-R85),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR310-R337),[[3]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR389-R395),[[4]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR406-R408),[[5]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR456-R497), [6]Added new methods to get/set HTTP headers in
GtfsValidatorApp, and ensured the text is stripped for input fields. ([[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR137-R147),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aL376-R430),[[3]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aL386-R440))Security improvements:
GtfsValidatorPreferencesso that HTTP headers are never persisted between sessions, preventing accidental credential leaks. ([[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-894cc05fe01e8f1e52dc74d7340a0358bdd7c8b322aeb13cc6dc8e905cdd955dR18),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-894cc05fe01e8f1e52dc74d7340a0358bdd7c8b322aeb13cc6dc8e905cdd955dR31-R41))CLI enhancements:
--http_headerarguments to the CLI, with validation and parsing logic to ensure correct format and inclusion in the validation config. ([[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-22608f7bb87b67e77e85dac973612a22a56a222bac933221964362f9bd14c397R20-R28),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-22608f7bb87b67e77e85dac973612a22a56a222bac933221964362f9bd14c397R120-R127),[[3]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-22608f7bb87b67e77e85dac973612a22a56a222bac933221964362f9bd14c397R163-R176),[[4]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-22608f7bb87b67e77e85dac973612a22a56a222bac933221964362f9bd14c397R237-R244))Dependency updates:
[[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-8bd2117f4359f8d33aa1e1e7f848b5c560e87e4893ab60f33e346754af397470R28),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-ae112f27bed85c17615136da6c93e309513cd176c91961233ae845ad15abb27aR18),[[3]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-3eb8597d612f3d3fa4b3d73e7ec0834c4e74c6a5f85e0f4f9f9c947c788245e2R7),[[4]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-75dac53269f1932f673cd90f34757b8df1138413a3f227f890833d37313627a4R25))Testing:
[[1]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-3eb8597d612f3d3fa4b3d73e7ec0834c4e74c6a5f85e0f4f9f9c947c788245e2R105-R193),[[2]](https://github.com/MobilityData/gtfs-validator/pull/2162/files#diff-718ef9d6774ef19503af1607cd078479c581350d7a736a9fdf8ce82305614512R59-R80))These changes collectively improve flexibility for authenticated/authorized downloads, ensure user credentials are not leaked, and maintain robust input validation.
Expected behavior:
The CLI accepts the
--http_headerparameter to override the default values. The local app's advanced section contains the HTTP headers sectionPlease make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything