Fossil SCM

Only remember a new URL for permanent redirects.

mistachkin 2019-04-18 00:00 trunk
Commit b36783e89b6ce65f5e34f4d332c00635be2115779558cadc4fd5929384285d6f
1 file changed +4 -4
+4 -4
--- src/http.c
+++ src/http.c
@@ -286,11 +286,11 @@
286286
g.zHttpAuth = prompt_for_httpauth_creds();
287287
transport_close(&g.url);
288288
return http_exchange(pSend, pReply, useLogin, maxRedirect);
289289
}
290290
}
291
- if( rc!=200 && rc!=301 && rc!=302 ){
291
+ if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
292292
int ii;
293293
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
294294
while( zLine[ii]==' ' ) ii++;
295295
fossil_warning("server says: %s", &zLine[ii]);
296296
goto write_err;
@@ -300,11 +300,11 @@
300300
}else{
301301
closeConnection = 0;
302302
}
303303
}else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
304304
if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
305
- if( rc!=200 && rc!=301 && rc!=302 ){
305
+ if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
306306
int ii;
307307
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
308308
while( zLine[ii]==' ' ) ii++;
309309
fossil_warning("server says: %s", &zLine[ii]);
310310
goto write_err;
@@ -320,11 +320,11 @@
320320
if( c=='c' || c=='C' ){
321321
closeConnection = 1;
322322
}else if( c=='k' || c=='K' ){
323323
closeConnection = 0;
324324
}
325
- }else if( ( rc==301 || rc==302 ) &&
325
+ }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
326326
fossil_strnicmp(zLine, "location:", 9)==0 ){
327327
int i, j;
328328
329329
if ( --maxRedirect == 0){
330330
fossil_warning("redirect limit exceeded");
@@ -345,11 +345,11 @@
345345
transport_close(&g.url);
346346
transport_global_shutdown(&g.url);
347347
fSeenHttpAuth = 0;
348348
if( g.zHttpAuth ) free(g.zHttpAuth);
349349
g.zHttpAuth = get_httpauth();
350
- url_remember();
350
+ if( rc==301 || rc==308 ) url_remember();
351351
return http_exchange(pSend, pReply, useLogin, maxRedirect);
352352
}else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
353353
if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
354354
isCompressed = 0;
355355
}else if( fossil_strnicmp(&zLine[14],
356356
--- src/http.c
+++ src/http.c
@@ -286,11 +286,11 @@
286 g.zHttpAuth = prompt_for_httpauth_creds();
287 transport_close(&g.url);
288 return http_exchange(pSend, pReply, useLogin, maxRedirect);
289 }
290 }
291 if( rc!=200 && rc!=301 && rc!=302 ){
292 int ii;
293 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
294 while( zLine[ii]==' ' ) ii++;
295 fossil_warning("server says: %s", &zLine[ii]);
296 goto write_err;
@@ -300,11 +300,11 @@
300 }else{
301 closeConnection = 0;
302 }
303 }else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
304 if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
305 if( rc!=200 && rc!=301 && rc!=302 ){
306 int ii;
307 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
308 while( zLine[ii]==' ' ) ii++;
309 fossil_warning("server says: %s", &zLine[ii]);
310 goto write_err;
@@ -320,11 +320,11 @@
320 if( c=='c' || c=='C' ){
321 closeConnection = 1;
322 }else if( c=='k' || c=='K' ){
323 closeConnection = 0;
324 }
325 }else if( ( rc==301 || rc==302 ) &&
326 fossil_strnicmp(zLine, "location:", 9)==0 ){
327 int i, j;
328
329 if ( --maxRedirect == 0){
330 fossil_warning("redirect limit exceeded");
@@ -345,11 +345,11 @@
345 transport_close(&g.url);
346 transport_global_shutdown(&g.url);
347 fSeenHttpAuth = 0;
348 if( g.zHttpAuth ) free(g.zHttpAuth);
349 g.zHttpAuth = get_httpauth();
350 url_remember();
351 return http_exchange(pSend, pReply, useLogin, maxRedirect);
352 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
353 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
354 isCompressed = 0;
355 }else if( fossil_strnicmp(&zLine[14],
356
--- src/http.c
+++ src/http.c
@@ -286,11 +286,11 @@
286 g.zHttpAuth = prompt_for_httpauth_creds();
287 transport_close(&g.url);
288 return http_exchange(pSend, pReply, useLogin, maxRedirect);
289 }
290 }
291 if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
292 int ii;
293 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
294 while( zLine[ii]==' ' ) ii++;
295 fossil_warning("server says: %s", &zLine[ii]);
296 goto write_err;
@@ -300,11 +300,11 @@
300 }else{
301 closeConnection = 0;
302 }
303 }else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
304 if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
305 if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){
306 int ii;
307 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
308 while( zLine[ii]==' ' ) ii++;
309 fossil_warning("server says: %s", &zLine[ii]);
310 goto write_err;
@@ -320,11 +320,11 @@
320 if( c=='c' || c=='C' ){
321 closeConnection = 1;
322 }else if( c=='k' || c=='K' ){
323 closeConnection = 0;
324 }
325 }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) &&
326 fossil_strnicmp(zLine, "location:", 9)==0 ){
327 int i, j;
328
329 if ( --maxRedirect == 0){
330 fossil_warning("redirect limit exceeded");
@@ -345,11 +345,11 @@
345 transport_close(&g.url);
346 transport_global_shutdown(&g.url);
347 fSeenHttpAuth = 0;
348 if( g.zHttpAuth ) free(g.zHttpAuth);
349 g.zHttpAuth = get_httpauth();
350 if( rc==301 || rc==308 ) url_remember();
351 return http_exchange(pSend, pReply, useLogin, maxRedirect);
352 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
353 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
354 isCompressed = 0;
355 }else if( fossil_strnicmp(&zLine[14],
356

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button