[PATCH] dynamic providers
Jim Meyering
jim at meyering.net
Sat Dec 18 09:38:24 UTC 2010
Jeff Darcy wrote:
> On 12/17/2010 02:51 PM, Jim Meyering wrote:
>> I've included below a 7-cset series that allows providers to be added
>> and removed dynamically. This shows you what the interface will look
>> like.
>
> I've looked at the code a bit; here are the first few things that I noticed.
...
> (2) I don't particularly care, but the RESTafarians might prefer PUT to
> _primary instead of PUT to _set_primary.
I don't particularly care either, so here's what I'm folding in:
diff --git a/rest.c b/rest.c
index be4a888..b58f1bc 100644
--- a/rest.c
+++ b/rest.c
@@ -1762,7 +1762,7 @@ proxy_set_primary (void *cctx, struct MHD_Connection *conn, const char *url,
char *name = NULL;
unsigned int rc = MHD_HTTP_BAD_REQUEST;
- /* URL is guaranteed to be of the form "/_providers/NAME/_set_primary"
+ /* URL is guaranteed to be of the form "/_providers/NAME/_primary"
Extract NAME: */
bool valid = memcmp (url, "/_providers/", strlen("/_providers/")) == 0;
if (!valid) {
@@ -2055,7 +2055,7 @@ parse_url (const char *url, my_state *ms)
eindex = URL_PROVIDER;
else if (eindex == URL_ATTR
&& !strcmp (parts[URL_BUCKET], "_providers")
- && !strcmp (parts[URL_ATTR], "_set_primary"))
+ && !strcmp (parts[URL_ATTR], "_primary"))
eindex = URL_PROVIDER_SET_PRIMARY;
DPRINTF("parse_url: %d: %s %s %s", eindex, parts[URL_BUCKET],
diff --git a/t/basic b/t/basic
index 436f123..a2f91ca 100644
--- a/t/basic
+++ b/t/basic
@@ -366,7 +366,7 @@ curl http://localhost:$port/_primary > p || fail=1
grep _primary p && { warn_ add-provider/reserved-name not rejected; fail=1; }
# Move the "primary" attribute to a different provider.
-curl -X PUT $p1_url/_set_primary > p || fail=1
+curl -X PUT $p1_url/_primary > p || fail=1
test -s p && fail=1
new_primary=$(curl http://localhost:$port/_providers/_primary) || fail=1
test $new_primary = PROVIDER-1 || fail=1
@@ -375,7 +375,7 @@ test $new_primary = PROVIDER-1 || fail=1
# FIXME: if I don't restore, the following headless test makes iwhd segfault.
# Investigate that.
p1_url=http://localhost:$port/_providers/primary
-curl -X PUT $p1_url/_set_primary > p || fail=1
+curl -X PUT $p1_url/_primary > p || fail=1
More information about the iwhd-devel
mailing list