#include "blob.h"
#include "http.h"
-#ifdef USE_CURL_MULTI
-
#include <expat.h>
static const char http_push_usage[] =
} else {
request->state = ABORTED;
free(request->url);
+ request->url = NULL;
}
}
} else {
request->state = ABORTED;
free(request->url);
+ request->url = NULL;
}
}
request->buffer.size = stream.total_out;
request->buffer.posn = 0;
- if (request->url != NULL)
- free(request->url);
request->url = xmalloc(strlen(remote->url) +
strlen(request->lock->token) + 51);
strcpy(request->url, remote->url);
} else {
request->state = ABORTED;
free(request->url);
+ request->url = NULL;
}
}
} else {
request->state = ABORTED;
free(request->url);
+ request->url = NULL;
}
}
if (request->headers != NULL)
curl_slist_free_all(request->headers);
+
+ /* URL is reused for MOVE after PUT */
+ if (request->state != RUN_PUT) {
+ free(request->url);
+ request->url = NULL;
+ }
+
if (request->state == RUN_HEAD) {
if (request->http_code == 404) {
request->state = NEED_PUSH;
entry->next = entry->next->next;
}
- free(request->url);
+ if (request->url != NULL)
+ free(request->url);
free(request);
}
}
} else {
free(url);
+ fclose(indexfile);
return error("Unable to start request");
}
strtol(ctx->cdata + 7, NULL, 10);
} else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) {
if (!strncmp(ctx->cdata, "opaquelocktoken:", 16)) {
- lock->token = xmalloc(strlen(ctx->cdata - 15));
+ lock->token = xmalloc(strlen(ctx->cdata) - 15);
strcpy(lock->token, ctx->cdata + 16);
}
}
if (lock->owner != NULL)
free(lock->owner);
free(lock->url);
-/* Freeing the token causes a segfault...
free(lock->token);
-*/
free(lock);
return rc;
int rc = 0;
int i;
+ setup_git_directory();
setup_ident();
remote = xmalloc(sizeof(*remote));
break;
}
+ if (!remote->url)
+ usage(http_push_usage);
+
memset(remote_dir_exists, 0, 256);
http_init();
return rc;
}
-#else /* ifdef USE_CURL_MULTI */
-int main(int argc, char **argv)
-{
- fprintf(stderr, "http-push requires curl 7.9.8 or higher.\n");
- return 1;
-}
-#endif