...
|
...
|
@@ -433,6 +433,19 @@ The request was not understood or is not allowed by this server.\r\n\
|
433
|
433
|
int
|
434
|
434
|
wk_serve_redirect(wk *paramweb, int connid, char *newlocation)
|
435
|
435
|
{
|
|
436
|
+ static const char strredirect1[]={"\
|
|
437
|
+HTTP/1.1 307 Temporary Redirect\r\n\
|
|
438
|
+Content-Type: text/html\r\n\
|
|
439
|
+Content-Length: 114\r\n\
|
|
440
|
+Location: "
|
|
441
|
+};
|
|
442
|
+ static const char strredirect2[]={"\
|
|
443
|
+\r\n\
|
|
444
|
+\r\n\
|
|
445
|
+<title>307 Temporary Redirect</title>\r\n\
|
|
446
|
+<h1>307 Temporary Redirect</h1>\r\n\
|
|
447
|
+The requsted page was moved temporarily.\r\n\
|
|
448
|
+"};
|
436
|
449
|
int res;
|
437
|
450
|
int total;
|
438
|
451
|
_wk *web=(_wk *)paramweb;
|
...
|
...
|
@@ -442,13 +455,13 @@ wk_serve_redirect(wk *paramweb, int connid, char *newlocation)
|
442
|
455
|
if((client=wk_clientget(web,connid))==NULL || newlocation==NULL || newlocation[0]=='\0')
|
443
|
456
|
return(-1);
|
444
|
457
|
total=0;
|
445
|
|
- if((res=wk_writestr((wk *)web,connid,"HTTP/1.1 302 Found\r\nLocation: "))<0)
|
|
458
|
+ if((res=wk_writestr((wk *)web,connid,strredirect1))<0)
|
446
|
459
|
return(-1);
|
447
|
460
|
total+=res;
|
448
|
461
|
if((res=wk_writestr((wk *)web,connid,newlocation))<0)
|
449
|
462
|
return(-1);
|
450
|
463
|
total+=res;
|
451
|
|
- if((res=wk_writestr((wk *)web,connid,"\r\n\r\n\r\n"))<0)
|
|
464
|
+ if((res=wk_writestr((wk *)web,connid,strredirect2))<0)
|
452
|
465
|
return(-1);
|
453
|
466
|
total+=res;
|
454
|
467
|
return(total);
|