Menu ▾ ▴

#13 curl use proxy

open
nobody
None
2023-10-02
2023-09-28
Anonymous
No

Originally created by: 13015517713

when I use curl library to view some pages use this proxy, like

curl -x 0.0.0.0:8080 http://www.baidu.com

It will use web_server to handle the seesion. I found it will return empty page by judging m_option.doc_directory_.empty().
I'm confused that why not it parse target page, resend the request to the page and return the content to client ?

Discussion

  • Anonymous

    Anonymous - 2023-09-29

    Originally posted by: rampageX

    Use your network interface ip address or 127.0.0.1 as you proxy ip, not 0.0.0.0

     
  • Anonymous

    Anonymous - 2023-10-02

    Originally posted by: 13015517713

    Use your network interface ip address or 127.0.0.1 as you proxy ip, not 0.0.0.0

    Maybe it's not the reason.

    func: inline net::awaitable<void> web_server()
    if (m_option.doc_directory_.empty())
    {
    co_await net::async_write(
        m_local_socket,
        net::buffer(fake_web_page()),
        net::transfer_all(),
        net_awaitable[ec]);
    net::streambuf bufs(8192);
    co_await net::async_read_until(
        m_local_socket,
        bufs,
        "\r\n\r\n",
        net_awaitable[ec]);
    if (!ec)
        m_local_socket.shutdown(
            net::socket_base::shutdown_both, ec);
    co_return;  
    }
    

    when recv the GET request, it dirtectly check the doc_directory and return fake page.

     

Log in to post a comment.