Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/experimental/url_sig/url_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,27 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
char line[300];
int line_no = 0;
int keynum;
bool eat_comment = false;

cfg = TSmalloc(sizeof(struct config));
memset(cfg, 0, sizeof(struct config));

while (fgets(line, sizeof(line), file) != NULL) {
TSDebug(PLUGIN_NAME, "LINE: %s (%d)", line, (int)strlen(line));
line_no++;

if (eat_comment) {
// Check if final char is EOL, if so we are done eating
if (line[strlen(line) - 1] == '\n') {
eat_comment = false;
}
continue;
}
if (line[0] == '#' || strlen(line) <= 1) {
// Check if we have a comment longer than the full buffer if no EOL
if (line[strlen(line) - 1] != '\n') {
eat_comment = true;
}
continue;
}
char *pos = strchr(line, '=');
Expand Down
1 change: 1 addition & 0 deletions tests/gold_tests/pluginTest/url_sig/url_sig.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line. This is a very long test line.
key0 = hV3wqyq1QxJeF76JkzHf93tuLYv_abw5
key1 = nIpyXbVqPFVN7y8yMlfgFBLnOqDSufMy
key2 = 4UED1ELmHkEcXrS_7yEYPKtgUZdGWaP2
Expand Down
1 change: 1 addition & 0 deletions tests/gold_tests/pluginTest/url_sig/url_sig.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,4 @@ def sign(payload, key):

# Overriding the built in ERROR check since we expect some ERROR messages
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests")
ts.Disk.diags_log.Content += Testers.ExcludesExpression("Error parsing", "Verify that we can accept long comment lines")