Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libhttp重定向 #45

Open
BreakingY opened this issue Jul 25, 2023 · 0 comments
Open

libhttp重定向 #45

BreakingY opened this issue Jul 25, 2023 · 0 comments

Comments

@BreakingY
Copy link

http_client.c http_client_onread_header函数里面对重定向进行了判断
'''
if(300 <= code && code < 400)
{
if(http_client_redirect_handler(http))
{
code = http_client_request(http, http->parameters.method, http->parameters.uri, http->parameters.headers, http->parameters.n, http->parameters.msg, http->parameters.bytes, http->onreply, http->cbparam);
if(0 != code)
http_client_handle(http, code > 0 ? -code : code);
return;
}
}
'''
但是这里并没有使用Location指定的url,http_client_redirect_handler函数里面仅仅是把Location指定的url保存到http->redirect.urls,应该进行如下修改
'''
http->redirect.urls[http->redirect.n++] = strdup(uri);
//指向Location指定的url
http->parameters.uri=http->redirect.urls[http->redirect.n-1];
'''

@BreakingY BreakingY changed the title libhttp libhttp重定向 Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant