X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=http%2Fhttp_blerg.c;h=1a751aceff0d0aa3354b0e114ce2e336aa393bb1;hb=a52a6a8d52feccd7b2231317d667e734fd040adb;hp=949e9714358d2519e38efc4f7a43275d1ca54cb1;hpb=46babc7c3d103cff8cdced69a41d600810625413;p=blerg.git diff --git a/http/http_blerg.c b/http/http_blerg.c index 949e971..1a751ac 100644 --- a/http/http_blerg.c +++ b/http/http_blerg.c @@ -1,3 +1,6 @@ +/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a + * BSD-style license. Please see the COPYING file for details. + */ #include #include #include @@ -338,9 +341,6 @@ ahc_derp (void *cls, struct MHD_Connection *connection, const char *url, const c return ret; } else if (strncmp(url, "/put", 4) == 0) { struct put_state *ps = (struct put_state *) *ptr; - char *username; - char password[33]; - if (*ptr == NULL) { if (strcmp(method, MHD_HTTP_METHOD_POST) != 0) return respond_405(connection); @@ -375,11 +375,10 @@ ahc_derp (void *cls, struct MHD_Connection *connection, const char *url, const c struct blerg *b = blerg_open(ps->username); if (b == NULL) return respond_JSON_Failure(connection); - if (blerg_store(b, ps->data, ps->data_size) == -1) { - blerg_close(b); - return respond_JSON_Failure(connection); - } + ret = blerg_store(b, ps->data, ps->data_size); blerg_close(b); + if (ret == -1) + return respond_JSON_Failure(connection); MHD_destroy_post_processor(ps->pp); free(ps->data); @@ -530,7 +529,7 @@ ahc_derp (void *cls, struct MHD_Connection *connection, const char *url, const c } const char *given_token = MHD_lookup_connection_value(connection, MHD_COOKIE_KIND, "auth"); - if (given_token != NULL && auth_check_token(as->username, given_token)) { + if (auth_check_token(as->username, given_token)) { auth_logout(as->username); return respond_JSON_Success(connection); } else {