HTTP cleanup
This ifdef's out more functions that are not used while !USE_MULTI in http code. Also the dependency of http related objects on http.h header file was missing in the Makefile. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
b3ca4e4ebb
commit
dd8239f997
3
Makefile
3
Makefile
@ -552,7 +552,7 @@ http.o: http.c
|
|||||||
$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
|
$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
|
||||||
|
|
||||||
ifdef NO_EXPAT
|
ifdef NO_EXPAT
|
||||||
http-fetch.o: http-fetch.c
|
http-fetch.o: http-fetch.c http.h
|
||||||
$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
|
$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -576,6 +576,7 @@ git-ssh-push$X: rsh.o
|
|||||||
|
|
||||||
git-imap-send$X: imap-send.o $(LIB_FILE)
|
git-imap-send$X: imap-send.o $(LIB_FILE)
|
||||||
|
|
||||||
|
http.o http-fetch.o http-push.o: http.h
|
||||||
git-http-fetch$X: fetch.o http.o http-fetch.o $(LIB_FILE)
|
git-http-fetch$X: fetch.o http.o http-fetch.o $(LIB_FILE)
|
||||||
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
|
||||||
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
|
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
|
||||||
|
70
http-push.c
70
http-push.c
@ -186,6 +186,7 @@ static void process_response(void *callback_data)
|
|||||||
finish_request(request);
|
finish_request(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURL_MULTI
|
||||||
static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
|
static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
@ -349,6 +350,41 @@ static void start_fetch_loose(struct transfer_request *request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void start_mkcol(struct transfer_request *request)
|
||||||
|
{
|
||||||
|
char *hex = sha1_to_hex(request->obj->sha1);
|
||||||
|
struct active_request_slot *slot;
|
||||||
|
char *posn;
|
||||||
|
|
||||||
|
request->url = xmalloc(strlen(remote->url) + 13);
|
||||||
|
strcpy(request->url, remote->url);
|
||||||
|
posn = request->url + strlen(remote->url);
|
||||||
|
strcpy(posn, "objects/");
|
||||||
|
posn += 8;
|
||||||
|
memcpy(posn, hex, 2);
|
||||||
|
posn += 2;
|
||||||
|
strcpy(posn, "/");
|
||||||
|
|
||||||
|
slot = get_active_slot();
|
||||||
|
slot->callback_func = process_response;
|
||||||
|
slot->callback_data = request;
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); /* undo PUT setup */
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, DAV_MKCOL);
|
||||||
|
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_null);
|
||||||
|
|
||||||
|
if (start_active_slot(slot)) {
|
||||||
|
request->slot = slot;
|
||||||
|
request->state = RUN_MKCOL;
|
||||||
|
} else {
|
||||||
|
request->state = ABORTED;
|
||||||
|
free(request->url);
|
||||||
|
request->url = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void start_fetch_packed(struct transfer_request *request)
|
static void start_fetch_packed(struct transfer_request *request)
|
||||||
{
|
{
|
||||||
char *url;
|
char *url;
|
||||||
@ -438,40 +474,6 @@ static void start_fetch_packed(struct transfer_request *request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_mkcol(struct transfer_request *request)
|
|
||||||
{
|
|
||||||
char *hex = sha1_to_hex(request->obj->sha1);
|
|
||||||
struct active_request_slot *slot;
|
|
||||||
char *posn;
|
|
||||||
|
|
||||||
request->url = xmalloc(strlen(remote->url) + 13);
|
|
||||||
strcpy(request->url, remote->url);
|
|
||||||
posn = request->url + strlen(remote->url);
|
|
||||||
strcpy(posn, "objects/");
|
|
||||||
posn += 8;
|
|
||||||
memcpy(posn, hex, 2);
|
|
||||||
posn += 2;
|
|
||||||
strcpy(posn, "/");
|
|
||||||
|
|
||||||
slot = get_active_slot();
|
|
||||||
slot->callback_func = process_response;
|
|
||||||
slot->callback_data = request;
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); /* undo PUT setup */
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, DAV_MKCOL);
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_null);
|
|
||||||
|
|
||||||
if (start_active_slot(slot)) {
|
|
||||||
request->slot = slot;
|
|
||||||
request->state = RUN_MKCOL;
|
|
||||||
} else {
|
|
||||||
request->state = ABORTED;
|
|
||||||
free(request->url);
|
|
||||||
request->url = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void start_put(struct transfer_request *request)
|
static void start_put(struct transfer_request *request)
|
||||||
{
|
{
|
||||||
char *hex = sha1_to_hex(request->obj->sha1);
|
char *hex = sha1_to_hex(request->obj->sha1);
|
||||||
|
Loading…
Reference in New Issue
Block a user