ObjFW  Diff

Differences From Artifact [cd147444d1]:

To Artifact [20466a8b30]:


602
603
604
605
606
607
608
609

610
611
612
613
614
615
616
602
603
604
605
606
607
608

609
610
611
612
613
614
615
616







-
+







		[body writeBuffer: buffer
			   length: length];
	}
}

-	  (bool)client: (OFHTTPClient *)client
  shouldFollowRedirect: (OFURL *)URL
	    statusCode: (int)statusCode
	    statusCode: (short)statusCode
	       request: (OFHTTPRequest *)request
	      response: (OFHTTPResponse *)response
{
	if (_verbose) {
		void *pool = objc_autoreleasePoolPush();
		OFDictionary OF_GENERIC(OFString *, OFString *) *headers =
		    response.headers;
703
704
705
706
707
708
709
710

711
712
713
714
715
716
717
703
704
705
706
707
708
709

710
711
712
713
714
715
716
717







-
+







		    @"  %[error]: %[exception]",
		    @"prog", [OFApplication programName],
		    @"url", request.URL.string,
		    @"error", error,
		    @"exception", e)];
	} else if ([e isKindOfClass: [OFHTTPRequestFailedException class]]) {
		short statusCode = [[e response] statusCode];
		OFString *codeString = [OFString stringWithFormat: @"%d %@",
		OFString *codeString = [OFString stringWithFormat: @"%hd %@",
		    statusCode, of_http_status_code_to_string(statusCode)];
		[of_stderr writeLine: OF_LOCALIZED(@"download_failed",
		    @"%[prog]: Failed to download <%[url]>!\n"
		    @"  HTTP status code: %[code]",
		    @"prog", [OFApplication programName],
		    @"url", request.URL.string,
		    @"code", codeString)];
782
783
784
785
786
787
788
789

790
791
792
793
794
795
796
797
798
799
800

801
802
803
804
805
806
807
782
783
784
785
786
787
788

789
790
791
792
793
794
795
796
797
798
799

800
801
802
803
804
805
806
807







-
+










-
+







	}

	return true;
}

-      (void)client: (OFHTTPClient *)client
  didReceiveHeaders: (OFDictionary OF_GENERIC(OFString *, OFString *) *)headers
	 statusCode: (int)statusCode
	 statusCode: (short)statusCode
	    request: (OFHTTPRequest *)request
{
	if (statusCode != 206)
		_resumedFrom = 0;

	if (!_quiet) {
		OFString *lengthString =
		    [headers objectForKey: @"Content-Length"];
		OFString *type = [headers objectForKey: @"Content-Type"];

		[of_stdout writeFormat: @" ➜ %d\n", statusCode];
		[of_stdout writeFormat: @" ➜ %hd\n", statusCode];

		if (type == nil)
			type = OF_LOCALIZED(@"type_unknown", @"unknown");

		if (lengthString != nil) {
			_length = lengthString.unsignedLongLongValue;