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

curl use proxy #13

Open
13015517713 opened this issue Sep 28, 2023 · 2 comments
Open

curl use proxy #13

13015517713 opened this issue Sep 28, 2023 · 2 comments

Comments

@13015517713
Copy link

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 ?

@rampageX
Copy link

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

@13015517713
Copy link
Author

13015517713 commented Oct 2, 2023

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.

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

2 participants