diff options
Diffstat (limited to 'src/restclient/anastasis_api_policy_lookup.c')
-rw-r--r-- | src/restclient/anastasis_api_policy_lookup.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/restclient/anastasis_api_policy_lookup.c b/src/restclient/anastasis_api_policy_lookup.c index e21ed58..b3132ef 100644 --- a/src/restclient/anastasis_api_policy_lookup.c +++ b/src/restclient/anastasis_api_policy_lookup.c @@ -3,16 +3,16 @@ Copyright (C) 2014-2019 Anastasis SARL ANASTASIS is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as + it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1, or (at your option) any later version. ANASTASIS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public + You should have received a copy of the GNU General Public License along with ANASTASIS; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/> */ @@ -106,6 +106,9 @@ handle_policy_lookup_finished (void *cls, size_t data_size) { struct ANASTASIS_PolicyLookupOperation *plo = cls; + struct ANASTASIS_DownloadDetails dd = { + .http_status = response_code + }; plo->job = NULL; switch (response_code) @@ -117,7 +120,6 @@ handle_policy_lookup_finished (void *cls, break; case MHD_HTTP_OK: { - struct ANASTASIS_DownloadDetails dd; struct ANASTASIS_UploadSignaturePS usp = { .purpose.purpose = htonl (TALER_SIGNATURE_ANASTASIS_POLICY_UPLOAD), .purpose.size = htonl (sizeof (usp)), @@ -133,18 +135,17 @@ handle_policy_lookup_finished (void *cls, &plo->account_pub.pub)) { GNUNET_break_op (0); - response_code = 0; + dd.http_status = 0; + dd.ec = -1; // FIXME: needs new code in Gana! break; } /* Success, call callback with all details! */ - memset (&dd, 0, sizeof (dd)); - dd.sig = plo->account_sig; - dd.curr_policy_hash = usp.new_recovery_data_hash; - dd.policy = data; - dd.policy_size = data_size; - dd.version = plo->version; + dd.details.ok.sig = plo->account_sig; + dd.details.ok.curr_policy_hash = usp.new_recovery_data_hash; + dd.details.ok.policy = data; + dd.details.ok.policy_size = data_size; + dd.details.ok.version = plo->version; plo->cb (plo->cb_cls, - response_code, &dd); plo->cb = NULL; ANASTASIS_policy_lookup_cancel (plo); @@ -167,12 +168,10 @@ handle_policy_lookup_finished (void *cls, "Unexpected response code %u\n", (unsigned int) response_code); GNUNET_break (0); - response_code = 0; break; } plo->cb (plo->cb_cls, - response_code, - NULL); + &dd); plo->cb = NULL; ANASTASIS_policy_lookup_cancel (plo); } |