ObjFW  Check-in [05a0a6f65c]

Overview
Comment:utils/ofhttp: Print redirects in non-quiet mode
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 05a0a6f65cb163846b93df64282c678d87b0aca204271d1921ee4a37dad00fe5
User & Date: js on 2015-04-26 12:45:45
Other Links: manifest | tags
Context
2015-04-26
14:08
utils/ofhttp: Better error output check-in: 9fb003e423 user: js tags: trunk
12:45
utils/ofhttp: Print redirects in non-quiet mode check-in: 05a0a6f65c user: js tags: trunk
12:26
OFKernelEventObserverTests: Make old GCCs happy check-in: 8697161608 user: js tags: trunk
Changes

Modified src/OFHTTPClient.h from [ef2286c80d] to [95e9e3b5c5].

64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78







-
+







 */
-      (void)client: (OFHTTPClient*)client
  didReceiveHeaders: (OFDictionary*)headers
	 statusCode: (int)statusCode
	    request: (OFHTTPRequest*)request;

/*!
 * @brief A callback which is called when an OFHTTPClient will follow a
 * @brief A callback which is called when an OFHTTPClient wants to follow a
 *	  redirect.
 *
 * If you want to get the headers and data for each redirect, set the number of
 * redirects to 0 and perform a new OFHTTPClient for each redirect. However,
 * this callback will not be called then and you have to look at the status code
 * to detect a redirect.
 *

Modified utils/ofhttp/OFHTTP.m from [f40132b96b] to [4922b58539].

78
79
80
81
82
83
84


85
86
87
88
89
90
91
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93







+
+







@implementation OFHTTP
- init
{
	self = [super init];

	@try {
		_HTTPClient = [[OFHTTPClient alloc] init];
		[_HTTPClient setDelegate: self];

		_buffer = [self allocMemoryWithSize: [OFSystemInfo pageSize]];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
134
135
136
137
138
139
140












141
142
143
144
145
146
147
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161







+
+
+
+
+
+
+
+
+
+
+
+







					[OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

	[self performSelector: @selector(downloadNextURL)
		   afterDelay: 0];
}

-	  (bool)client: (OFHTTPClient*)client
  shouldFollowRedirect: (OFURL*)URL
	    statusCode: (int)statusCode
	       request: (OFHTTPRequest*)request
{
	if (!_quiet)
		[of_stdout writeFormat: @" ➜ %d\n↻ %@",
					statusCode, [URL string]];

	return true;
}

-      (bool)stream: (OFHTTPResponse*)response
  didReadIntoBuffer: (void*)buffer
	     length: (size_t)length
	  exception: (OFException*)e
{
	if (e != nil) {