Author: rfm
Date: Fri Nov 28 09:15:07 2014
New Revision: 38210

URL: http://svn.gna.org/viewcvs/gnustep?rev=38210&view=rev
Log:
Attempt to allow for OSX behavior change and work around bug (behavior doesn't 
match documentation) where we disallow a redirect.

Modified:
    libs/webservices/trunk/GWSService.m

Modified: libs/webservices/trunk/GWSService.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webservices/trunk/GWSService.m?rev=38210&r1=38209&r2=38210&view=diff
==============================================================================
--- libs/webservices/trunk/GWSService.m (original)
+++ libs/webservices/trunk/GWSService.m Fri Nov 28 09:15:07 2014
@@ -1920,6 +1920,31 @@
             willSendRequest: (NSURLRequest*)request
            redirectResponse: (NSURLResponse*)redirectResponse 
 {
+  /* This is a request to allow a redirect ...
+   * If redirectResponse is nil then it's internal rewriting of the
+   * request (canonicalisation) by  NSURLConnection itself, so it is
+   * safe (and necessary) to permit it.
+   */
+  if (nil == redirectResponse)
+    {
+      return request;
+    }
+
+  /* Real redirects are not supported ... if we wanted to allow that we
+   * would also have to devise some mechanism to prevent an infinite loop.
+   * NB. Some versions of OSX have a bug and don't handle a nil return
+   * properly (they don't use the callbacks to tell us the connection
+   * has failed).  So we do the cleanup here:
+   */
+  [_lock lock];
+  [self _completedIO];
+  if (NO == _cancelled)
+    {
+      [self _setProblem: @"remote host attempted redirect"];
+    }
+  [_lock unlock];
+  [self _completed];
+
   return nil;
 }
 


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to