aboutsummaryrefslogtreecommitdiff
path: root/src/piesctl.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-01-04 14:08:29 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-01-04 14:08:29 +0200
commit2c03055b8ed023e7d8d65f2dbd51cd128040fcfb (patch)
tree7792b90c2a99e1910ffbdd2f277b68f63190f0c0 /src/piesctl.c
parent2782ae034e51d5e9c74a9b1f2c6e6c452bd83243 (diff)
downloadpies-2c03055b8ed023e7d8d65f2dbd51cd128040fcfb.tar.gz
pies-2c03055b8ed023e7d8d65f2dbd51cd128040fcfb.tar.bz2
Redo URI handling.
* src/ctl.c (res_instance) (res_programs): Take partial URI as argument (instead of full URI split on path delimiter) (ctlio_resource): New member uri_len; Change signature of handler. (find_resource): Compare URI prefix. (ctlio_do_command): Redo URI parsing. Improve error checking. * src/piesctl.c (shttp_print_error): New function. (shttp_fatal): Print error on 404 and 409 responses.
Diffstat (limited to 'src/piesctl.c')
-rw-r--r--src/piesctl.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/piesctl.c b/src/piesctl.c
index 4319946..8c4e2e1 100644
--- a/src/piesctl.c
+++ b/src/piesctl.c
@@ -813,10 +813,9 @@ shttp_format_result (struct shttp_connection *conn, FILE *fp)
}
static void
-shttp_fatal (struct shttp_connection *conn)
+shttp_print_error (struct shttp_connection *conn)
{
struct json_value *jv;
- int status;
if (conn->result && (jv = json_value_lookup (conn->result, "error_message")))
{
@@ -827,11 +826,20 @@ shttp_fatal (struct shttp_connection *conn)
}
else
grecs_error (NULL, 0, "%s", conn->status_line[2]);
+}
+
+static void
+shttp_fatal (struct shttp_connection *conn)
+{
+ int status;
+
+ shttp_print_error (conn);
switch (conn->resp.code)
{
case 400:
case 405:
+ case 406:
case 501:
case 505:
grecs_error (NULL, 0, _("please report"));
@@ -975,6 +983,7 @@ shttp_process (struct shttp_connection *conn, int method, char const *uri)
case 404: /* Not found */
case 409: /* Conflict */
+ shttp_print_error (conn);
return;
default:

Return to:

Send suggestions and report system problems to the System administrator.