X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=remote-curl.c;h=0e720ee8bbf4cbc6a50336a1f1c93bfc63842fe3;hb=06121a0a8328c8aaa7a023cf6ebb142e9dc2b45c;hp=b8cf45a7dd439b83c80bcf7a397e1b8e34c70f67;hpb=5b5d92aae910243ba12a737bbe117f0ae6ecf5c6;p=git.git diff --git a/remote-curl.c b/remote-curl.c index b8cf45a7d..0e720ee8b 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -115,7 +115,7 @@ static struct discovery* discover_refs(const char *service) http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE); /* try again with "plain" url (no ? or & appended) */ - if (http_ret != HTTP_OK) { + if (http_ret != HTTP_OK && http_ret != HTTP_NOAUTH) { free(refs_url); strbuf_reset(&buffer); @@ -573,7 +573,14 @@ static int rpc_service(struct rpc_state *rpc, struct discovery *heads) close(client.in); client.in = -1; - strbuf_read(&rpc->result, client.out, 0); + if (!err) { + strbuf_read(&rpc->result, client.out, 0); + } else { + char buf[4096]; + for (;;) + if (xread(client.out, buf, sizeof(buf)) <= 0) + break; + } close(client.out); client.out = -1; @@ -852,7 +859,7 @@ int main(int argc, const char **argv) url = strbuf_detach(&buf, NULL); - http_init(remote); + http_init(remote, url); do { if (strbuf_getline(&buf, stdin, '\n') == EOF) {