Fossil SCM

Handle 301 redirect the same as 302 redirect.

andybradford 2014-12-20 19:26 trunk
Commit 2678d87d6a2c36435cae66b371a908d61385b4b4
1 file changed +5 -4
+5 -4
--- src/http.c
+++ src/http.c
@@ -285,11 +285,11 @@
285285
g.zHttpAuth = prompt_for_httpauth_creds();
286286
transport_close(&g.url);
287287
return http_exchange(pSend, pReply, useLogin, maxRedirect);
288288
}
289289
}
290
- if( rc!=200 && rc!=302 ){
290
+ if( rc!=200 && rc!=301 && rc!=302 ){
291291
int ii;
292292
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
293293
while( zLine[ii]==' ' ) ii++;
294294
fossil_warning("server says: %s", &zLine[ii]);
295295
goto write_err;
@@ -299,11 +299,11 @@
299299
}else{
300300
closeConnection = 0;
301301
}
302302
}else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
303303
if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
304
- if( rc!=200 && rc!=302 ){
304
+ if( rc!=200 && rc!=301 && rc!=302 ){
305305
int ii;
306306
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
307307
while( zLine[ii]==' ' ) ii++;
308308
fossil_warning("server says: %s", &zLine[ii]);
309309
goto write_err;
@@ -319,11 +319,12 @@
319319
if( c=='c' || c=='C' ){
320320
closeConnection = 1;
321321
}else if( c=='k' || c=='K' ){
322322
closeConnection = 0;
323323
}
324
- }else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
324
+ }else if( ( rc==301 || rc==302 ) &&
325
+ fossil_strnicmp(zLine, "location:", 9)==0 ){
325326
int i, j;
326327
327328
if ( --maxRedirect == 0){
328329
fossil_warning("redirect limit exceeded");
329330
goto write_err;
@@ -360,11 +361,11 @@
360361
if( iLength<0 ){
361362
fossil_warning("server did not reply");
362363
goto write_err;
363364
}
364365
if( rc!=200 ){
365
- fossil_warning("\"location:\" missing from 302 redirect reply");
366
+ fossil_warning("\"location:\" missing from %d redirect reply", rc);
366367
goto write_err;
367368
}
368369
369370
/*
370371
** Extract the reply payload that follows the header
371372
--- src/http.c
+++ src/http.c
@@ -285,11 +285,11 @@
285 g.zHttpAuth = prompt_for_httpauth_creds();
286 transport_close(&g.url);
287 return http_exchange(pSend, pReply, useLogin, maxRedirect);
288 }
289 }
290 if( rc!=200 && rc!=302 ){
291 int ii;
292 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
293 while( zLine[ii]==' ' ) ii++;
294 fossil_warning("server says: %s", &zLine[ii]);
295 goto write_err;
@@ -299,11 +299,11 @@
299 }else{
300 closeConnection = 0;
301 }
302 }else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
303 if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
304 if( rc!=200 && rc!=302 ){
305 int ii;
306 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
307 while( zLine[ii]==' ' ) ii++;
308 fossil_warning("server says: %s", &zLine[ii]);
309 goto write_err;
@@ -319,11 +319,12 @@
319 if( c=='c' || c=='C' ){
320 closeConnection = 1;
321 }else if( c=='k' || c=='K' ){
322 closeConnection = 0;
323 }
324 }else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
 
325 int i, j;
326
327 if ( --maxRedirect == 0){
328 fossil_warning("redirect limit exceeded");
329 goto write_err;
@@ -360,11 +361,11 @@
360 if( iLength<0 ){
361 fossil_warning("server did not reply");
362 goto write_err;
363 }
364 if( rc!=200 ){
365 fossil_warning("\"location:\" missing from 302 redirect reply");
366 goto write_err;
367 }
368
369 /*
370 ** Extract the reply payload that follows the header
371
--- src/http.c
+++ src/http.c
@@ -285,11 +285,11 @@
285 g.zHttpAuth = prompt_for_httpauth_creds();
286 transport_close(&g.url);
287 return http_exchange(pSend, pReply, useLogin, maxRedirect);
288 }
289 }
290 if( rc!=200 && rc!=301 && rc!=302 ){
291 int ii;
292 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
293 while( zLine[ii]==' ' ) ii++;
294 fossil_warning("server says: %s", &zLine[ii]);
295 goto write_err;
@@ -299,11 +299,11 @@
299 }else{
300 closeConnection = 0;
301 }
302 }else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){
303 if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err;
304 if( rc!=200 && rc!=301 && rc!=302 ){
305 int ii;
306 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
307 while( zLine[ii]==' ' ) ii++;
308 fossil_warning("server says: %s", &zLine[ii]);
309 goto write_err;
@@ -319,11 +319,12 @@
319 if( c=='c' || c=='C' ){
320 closeConnection = 1;
321 }else if( c=='k' || c=='K' ){
322 closeConnection = 0;
323 }
324 }else if( ( rc==301 || rc==302 ) &&
325 fossil_strnicmp(zLine, "location:", 9)==0 ){
326 int i, j;
327
328 if ( --maxRedirect == 0){
329 fossil_warning("redirect limit exceeded");
330 goto write_err;
@@ -360,11 +361,11 @@
361 if( iLength<0 ){
362 fossil_warning("server did not reply");
363 goto write_err;
364 }
365 if( rc!=200 ){
366 fossil_warning("\"location:\" missing from %d redirect reply", rc);
367 goto write_err;
368 }
369
370 /*
371 ** Extract the reply payload that follows the header
372

Keyboard Shortcuts

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