Revision: 29513
          http://sourceforge.net/p/bibdesk/svn/29513
Author:   hofman
Date:     2025-08-31 13:59:47 +0000 (Sun, 31 Aug 2025)
Log Message:
-----------
use status code 303 for redirect request

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

Modified: trunk/bibdesk/BDSKBibDeskProtocol.m
===================================================================
--- trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-31 09:11:22 UTC (rev 29512)
+++ trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-31 13:59:47 UTC (rev 29513)
@@ -99,7 +99,7 @@
         [self loadData:welcomeHTMLData MIMEType:@"text/html" cached:YES];
     } else if ([DOWNLOADS_SPECIFIER isCaseInsensitiveEqual:resourceSpecifier]) 
{
         if ([[request HTTPMethod] isCaseInsensitiveEqual:@"POST"] && [[request 
HTTPBody] length]) {
-            NSString *action = [[NSString alloc] initWithData:[request 
HTTPBody] encoding:NSUTF8StringEncoding];
+            NSString *action = [[NSString alloc] initWithData:[request 
HTTPBody] encoding:NSUTF8StringEncoding];NSLog(@"%@", action);
             NSUInteger i = [action rangeOfString:@"&"].location;
             if (i != NSNotFound)
                 action = [action substringToIndex:i];
@@ -110,7 +110,7 @@
                 [[BDSKDownloadManager sharedManager] performAction:action 
withValue:value];
             }
             // redirect to clear the body, so a reload won't resubmit
-            NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:301 HTTPVersion:@"HTTP/1.1" 
headerFields:@{@"Location": [theURL absoluteString]}];
+            NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:303 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]];
-        NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:301 HTTPVersion:@"HTTP/1.1" 
headerFields:@{@"Location": URLString}];
+        NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] 
initWithURL:theURL statusCode:303 HTTPVersion:@"HTTP/1.1" 
headerFields:@{@"Location": URLString}];
         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
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to