sdk icon indicating copy to clipboard operation
sdk copied to clipboard

libhttp重定向

Open BreakingY opened this issue 2 years ago • 0 comments

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 avatar Jul 25 '23 02:07 BreakingY