Revision: 29501
          http://sourceforge.net/p/bibdesk/svn/29501
Author:   hofman
Date:     2025-08-30 22:02:26 +0000 (Sat, 30 Aug 2025)
Log Message:
-----------
use redirect http response for redireccting custom urls

Modified Paths:
--------------
    trunk/bibdesk/BDSKBibDeskProtocol.m

Modified: trunk/bibdesk/BDSKBibDeskProtocol.m
===================================================================
--- trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-30 21:38:35 UTC (rev 29500)
+++ trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-30 22:02:26 UTC (rev 29501)
@@ -110,7 +110,7 @@
                 [[BDSKDownloadManager sharedManager] performAction:action 
withValue:value];
             }
             // redirect to clear the body, so a reload won't resubmit
-            NSURLResponse *response = [[NSURLResponse alloc] 
initWithURL:theURL MIMEType:@"text/html" expectedContentLength:-1 
textEncodingName:nil];
+            NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:301 HTTPVersion:@"HTTP/1.1" 
headerFields:@{@"Location": [theURL absoluteString]}];
             NSMutableURLRequest *redirectRequest = [request mutableCopy];
             [redirectRequest setHTTPMethod:@"GET"];
             [redirectRequest setHTTPBody:nil];
@@ -144,7 +144,7 @@
     } else if ([HELP_SPECIFIER isCaseInsensitiveEqual:[[resourceSpecifier 
pathComponents] firstObject]]) {
         // when there's no "//" the URL we get has percent escapes including 
in particular the # character, which would we don't want
         NSString *URLString = [NSString stringWithFormat:@"%@://%@", 
BDSKBibDeskScheme, [resourceSpecifier stringByRemovingPercentEncoding]];
-        NSURLResponse *response = [[NSURLResponse alloc] initWithURL:theURL 
MIMEType:@"text/html" expectedContentLength:-1 textEncodingName:nil];
+        NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:301 HTTPVersion:@"HTTP/1.1" 
headerFields:@{@"Location": [theURL absoluteString]}];
         NSMutableURLRequest *redirectRequest = [request mutableCopy];
         [redirectRequest setURL:[NSURL 
URLWithStringByNormalizingPercentEscapes:URLString]];
         [client URLProtocol:self wasRedirectedToRequest:redirectRequest 
redirectResponse:response];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to