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>
Junio C Hamano committed
Jun 6, 2006 at 14:26 UTC
dd8239f997962d94162790039b008acb6068a242
2 files changed
+38
-35
Makefile
+2
-1
@@ -552,7 +552,7 @@ http.o: http.c
552
$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
553
554
ifdef NO_EXPAT
555
-http-fetch.o: http-fetch.c
555
+http-fetch.o: http-fetch.c http.h
556
$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
557
endif
558
@@ -576,6 +576,7 @@ git-ssh-push$X: rsh.o
576
577
git-imap-send$X: imap-send.o $(LIB_FILE)
578
579
+http.o http-fetch.o http-push.o: http.h
580
git-http-fetch$X: fetch.o http.o http-fetch.o $(LIB_FILE)
581
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
582
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
http-push.c
+36
-34
@@ -186,6 +186,7 @@ static void process_response(void *callback_data)
186
finish_request(request);
187
}
188
189
+#ifdef USE_CURL_MULTI
190
static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
191
void *data)
192
{
@@ -349,6 +350,41 @@ static void start_fetch_loose(struct transfer_request *request)
350
}
351
}
352
353
+static void start_mkcol(struct transfer_request *request)
354
+{
355
+ char *hex = sha1_to_hex(request->obj->sha1);
356
+ struct active_request_slot *slot;
357
+ char *posn;
358
+
359
+ request->url = xmalloc(strlen(remote->url) + 13);
360
+ strcpy(request->url, remote->url);
361
+ posn = request->url + strlen(remote->url);
362
+ strcpy(posn, "objects/");
363
+ posn += 8;
364
+ memcpy(posn, hex, 2);
365
+ posn += 2;
366
+ strcpy(posn, "/");
367
+
368
+ slot = get_active_slot();
369
+ slot->callback_func = process_response;
370
+ slot->callback_data = request;
371
+ curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); /* undo PUT setup */
372
+ curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
373
+ curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);
374
+ curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, DAV_MKCOL);
375
+ curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_null);
376
+
377
+ if (start_active_slot(slot)) {
378
+ request->slot = slot;
379
+ request->state = RUN_MKCOL;
380
+ } else {
381
+ request->state = ABORTED;
382
+ free(request->url);
383
+ request->url = NULL;
384
+ }
385
+}
386
+#endif
387
+
388
static void start_fetch_packed(struct transfer_request *request)
389
{
390
char *url;
@@ -438,40 +474,6 @@ static void start_fetch_packed(struct transfer_request *request)
474
}
475
}
476
441
-static void start_mkcol(struct transfer_request *request)
442
-{
443
- char *hex = sha1_to_hex(request->obj->sha1);
444
- struct active_request_slot *slot;
445
- char *posn;
446
-
447
- request->url = xmalloc(strlen(remote->url) + 13);
448
- strcpy(request->url, remote->url);
449
- posn = request->url + strlen(remote->url);
450
- strcpy(posn, "objects/");
451
- posn += 8;
452
- memcpy(posn, hex, 2);
453
- posn += 2;
454
- strcpy(posn, "/");
455
-
456
- slot = get_active_slot();
457
- slot->callback_func = process_response;
458
- slot->callback_data = request;
459
- curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); /* undo PUT setup */
460
- curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
461
- curl_easy_setopt(slot->curl, CURLOPT_ERRORBUFFER, request->errorstr);
462
- curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, DAV_MKCOL);
463
- curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_null);
464
-
465
- if (start_active_slot(slot)) {
466
- request->slot = slot;
467
- request->state = RUN_MKCOL;
468
- } else {
469
- request->state = ABORTED;
470
- free(request->url);
471
- request->url = NULL;
472
- }
473
-}
474
-
477
static void start_put(struct transfer_request *request)
478
{
479
char *hex = sha1_to_hex(request->obj->sha1);