Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: util/net/http_transport_mac.mm

Issue 885183004: HTTPTransport: callers should be able to obtain the HTTP response body (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Update other comment Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/net/http_transport.h ('k') | util/net/http_transport_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/net/http_transport_mac.mm
diff --git a/util/net/http_transport_mac.mm b/util/net/http_transport_mac.mm
index 2170b1ff83bf6824ad7d1f460521564e633df0e6..135fd280d2eb111cc03fece50b2e2f1619c344d9 100644
--- a/util/net/http_transport_mac.mm
+++ b/util/net/http_transport_mac.mm
@@ -116,7 +116,7 @@ class HTTPTransportMac final : public HTTPTransport {
HTTPTransportMac();
~HTTPTransportMac() override;
- bool ExecuteSynchronously() override;
+ bool ExecuteSynchronously(std::string* response_body) override;
private:
DISALLOW_COPY_AND_ASSIGN(HTTPTransportMac);
@@ -128,7 +128,7 @@ HTTPTransportMac::HTTPTransportMac() : HTTPTransport() {
HTTPTransportMac::~HTTPTransportMac() {
}
-bool HTTPTransportMac::ExecuteSynchronously() {
+bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) {
DCHECK(body_stream());
@autoreleasepool {
@@ -152,9 +152,9 @@ bool HTTPTransportMac::ExecuteSynchronously() {
NSURLResponse* response = nil;
NSError* error = nil;
- [NSURLConnection sendSynchronousRequest:request
- returningResponse:&response
- error:&error];
+ NSData* body = [NSURLConnection sendSynchronousRequest:request
+ returningResponse:&response
+ error:&error];
if (error) {
LOG(ERROR) << [[error localizedDescription] UTF8String] << " ("
@@ -178,6 +178,11 @@ bool HTTPTransportMac::ExecuteSynchronously() {
return false;
}
+ if (response_body) {
+ response_body->assign(static_cast<const char*>([body bytes]),
+ [body length]);
+ }
+
return true;
}
}
« no previous file with comments | « util/net/http_transport.h ('k') | util/net/http_transport_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698