From: Wouter Wijngaards Date: Fri, 12 Sep 2008 13:01:20 +0000 (+0000) Subject: remote setup. X-Git-Tag: release-1.1.0~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08e0563483f4748a21e2e99661cc807ffce56f4b;p=thirdparty%2Funbound.git remote setup. git-svn-id: file:///svn/unbound/trunk@1234 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/remote.c b/daemon/remote.c index 714ae0108..8e8cc18ee 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -382,8 +382,7 @@ clean_point(struct daemon_remote* rc, struct rc_state* s) static void handle_req(struct daemon_remote* rc, struct rc_state* s, SSL* ssl) { - char* msg = "HTTP/1.0 200 OK\r\nContent-type: text/plain\r\n\r\n" - "unbound server control channel\n"; + char* msg = "ok\n"; int r; char buf[1024]; fd_set_block(s->c->fd); diff --git a/doc/control_proto_spec.txt b/doc/control_proto_spec.txt index d57c7aa4f..cf9078622 100644 --- a/doc/control_proto_spec.txt +++ b/doc/control_proto_spec.txt @@ -16,23 +16,25 @@ Server executes command. And sends reply in ascii text over channel, closes the channel when done. in case of error the first line of the response is: error \n - or the remainder is data of the response. + or the remainder is data of the response, for many commands the + response is 'ok\n'. Queries and responses --------------------- stop - no output + stops the server. reload - no output + reloads the config file, and flushes the cache. stats output is a list of [name]=[value] lines. clears the counters. dump_cache output is a text representation of the cache contents. + data ends with a line 'EOF' before connection close. load_cache - client sends cache contents (like from dump_cache), stored in the - cache. If client sends 'ok' or 'error' lines at start, ignored. - end of data indicated with a line with 'EOF' on it. + client sends cache contents (like from dump_cache), which is stored + in the cache. end of data indicated with a line with 'EOF' on it. + The data is sent after the query line. flush_name flushes some information regarding the name from the cache. removes the A, AAAA, NS, SOA, CNAME, DNAME, MX, PTR types. @@ -41,20 +43,25 @@ flush_type flush_zone removes name and everything below that name from the cache. has to search through the cache item by item, so this is slow. -delegation - see what servers would be queried for the given domain name. -info - see data about the domain name +delegation + see what servers would be queried for the given name. +info + see data about the name. Slow, searches the cache item by item. local_zone_remove the local-zone entry is removed. All data from the local zone is also deleted. If it did not exist, nothing happens. -local_zone_add +local_zone As the config file entry. Adds new local zone or updates existing zone type. local_data_remove Removes local-data (all types) name. -local_data_add +local_data Add new local data record (on the rest of the line). local_data_add www.example.com. IN A 192.0.2.2 + if no local_zone exists for it; a transparent zone with the same + name as the data is created. +verbosity + Change logging verbosity to new value. + diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c index 98a03c4bf..59e8f9aa6 100644 --- a/smallapp/unbound-control.c +++ b/smallapp/unbound-control.c @@ -187,9 +187,20 @@ static void go_cmd(SSL* ssl, int argc, char* argv[]) { char* cmd = "GET / HTTP/1.0\n\n"; - int r; + char* pre="UBCT"; + char* space=" "; + char* newline="\n"; + int r, i; char buf[1024]; - if(SSL_write(ssl, cmd, (int)strlen(cmd)) <= 0) + if(SSL_write(ssl, pre, (int)strlen(pre)) <= 0) + ssl_err("could not SSL_write"); + for(i=0; i