dnsdb/dnsdbq

batch input format - fully parse and allow time fencing

djw1149 opened this issue · 2 comments

The batch input format currently copies the batch input lines into a URL.
Example: $ echo foo/bar | dnsdbq -f -d
generates a invalid URL https://api.dnsdb.info/lookup/foo/bar?swclient=dnsdbq&version=1.5

I think dnsdbq should fully parse and error check its batch input lines before forming the URLs.

Additionally there is no way to specify time fencing in in the batch lines:

You might think you could add time fencing parameters to the batch line:
$ echo 'foo/bar?time_last_after=1546300800' | dnsdbq -f -d
But it generates an invalid URL https://api.dnsdb.info/lookup/foo/bar?time_last_after=1546300800?swclient=dnsdbq&version=1.5
dnsdbq: libcurl: [Error: unable to parse request]

The only thing that works now is to specify one time fence on the dnsdbq command line:
$ echo rrset/name/bbn.com | dnsdbq -f -A 2019-01-01 -d -l 1
which sends URL https://api.dnsdb.info/lookup/rrset/name/bbn.com?swclient=dnsdbq&version=1.5&limit=1&time_last_after=1546300800

That does not work if the batch inputs need to have individual time fencing values.

vixie commented

yikes. agreed in principle. we need a better internal format for -f than "what dnsdb does", anyway. and i agree that we should add time fencing to the -f format, but, it won't be in ? or & format like URI's have. let me dream up a proposal and i'll run it by you.

I was not suggesting that batch mode time fencing be in the ? or & format. I just used it as an example of what the currently generated URLs look like.