File tree 3 files changed +6
-3
lines changed
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ void http_response::GET_check_state()
22
22
{
23
23
if (request->get_path ().back () != ' /' )
24
24
{
25
- headers[" LOCATION" ] = request->get_path () + ' /' ;
25
+ headers[" LOCATION" ] = (request->get_path () + " /" );
26
+ std::cout << " ************" << headers[" LOCATION" ] <<std::endl;
26
27
throw 301 ;
27
28
}
28
29
for (int i = 0 ;i < conf.index .size ();i++)
Original file line number Diff line number Diff line change @@ -230,7 +230,8 @@ void http_response::ERROR_handler(int x)
230
230
std::cout << " Error asat :: " << x << std::endl;
231
231
res_header.clear ();
232
232
body.clear ();
233
- headers.clear ();
233
+ if (x != 301 )
234
+ headers.clear ();
234
235
if (file.is_open ())
235
236
file.close ();
236
237
client->events = POLLOUT;
@@ -258,7 +259,8 @@ void http_response::ERROR_handler(int x)
258
259
headers[" Content-Length" ] = int_to_string (body.size ());
259
260
std::cout << " excesss = " << body << std::endl;
260
261
headers[" Content-Type" ] = content_type[" html" ];
261
- if (x == 301 )
262
+ std::cout << " ************" << headers[" LOCATION" ] <<std::endl;
263
+ if (x == 301 && headers[" LOCATION" ] == " " )
262
264
headers[" LOCATION" ] = conf.return_value ;
263
265
res_header = " HTTP/1.1 " + int_to_string (x) + " " + errors.get_message (x) + " \n " ;
264
266
for (std::map<std::string,std::string>::iterator it = headers.begin (); it != headers.end (); it++)
You can’t perform that action at this time.
0 commit comments