OLD | NEW |
1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 [req setHTTPBody:postBody]; | 188 [req setHTTPBody:postBody]; |
189 [req setHTTPMethod:@"POST"]; | 189 [req setHTTPMethod:@"POST"]; |
190 | 190 |
191 [response_ release]; | 191 [response_ release]; |
192 response_ = nil; | 192 response_ = nil; |
193 | 193 |
194 NSData *data = nil; | 194 NSData *data = nil; |
195 if ([[req URL] isFileURL]) { | 195 if ([[req URL] isFileURL]) { |
196 [[req HTTPBody] writeToURL:[req URL] options:0 error:error]; | 196 [[req HTTPBody] writeToURL:[req URL] options:0 error:error]; |
197 } else { | 197 } else { |
| 198 NSURLResponse *response = nil; |
198 data = [NSURLConnection sendSynchronousRequest:req | 199 data = [NSURLConnection sendSynchronousRequest:req |
199 returningResponse:&response_ | 200 returningResponse:&response |
200 error:error]; | 201 error:error]; |
201 [response_ retain]; | 202 response_ = (NSHTTPURLResponse *)[response retain]; |
202 } | 203 } |
203 [req release]; | 204 [req release]; |
204 | 205 |
205 return data; | 206 return data; |
206 } | 207 } |
207 | 208 |
208 //============================================================================= | 209 //============================================================================= |
209 - (NSHTTPURLResponse *)response { | 210 - (NSHTTPURLResponse *)response { |
210 return response_; | 211 return response_; |
211 } | 212 } |
212 | 213 |
213 @end | 214 @end |
OLD | NEW |