Closed Xxproner closed 4 weeks ago
Can you please share your code?
On August 11, 2024, Github Notifications @.***> wrote:
Prerequisites[X]
DescriptionAny browser can not reach localhost but clear with vanilla MHD all is ok.
Steps to Reproduce
- Start webserver listening on any port
- Write http://localhost:
- Not found
Expected behavior: [What you expect to happen]
I want that browser shows the page or text that is considered as a answer
Actual behavior: [What actually happens]
"Access Error: 404 -- Not Found Cannot locate document: /"
Reproduces how often: [What percentage of the time does it reproduce?]
Versions
- wsl debian 12
- libhttpserver version 0.19
- libmicrohttpd version 0.9.72
— Reply to this email directly, view it on GitHub https://github.com/etr/libhttpserver/issues/339 or unsubscribe https://github.com/notifications/unsubscribe- auth/AAJFLABJ6RG67E2QJIVIJB3ZQ6QGLBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRRGE4DENBYG43TKNVENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWTTGNBRGY4DSMMCUR2HS4DFUVUXG43VMWSXMYLMOVS2UMRUGU4TMOJVGIYTJAVEOR4XAZNFNRQWEZLMUV3GC3DVMWVDCMJYGI2DQNZXGU3KO5DSNFTWOZLSUZRXEZLBORSQ. You are receiving this email because you were assigned.
Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification- email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification- email%26utm_medium%3Demail%26utm_source%3Dgithub.
Can you please share your code? On August 11, 2024, Github Notifications @.**> wrote: Prerequisites[X] DescriptionAny browser can not reach localhost but clear with vanilla MHD all is ok. Steps to Reproduce 1. Start webserver listening on any port 2. Write http://localhost: 3. Not found Expected behavior: [What you expect to happen] I want that browser shows the page or text that is considered as a answer Actual behavior: [What actually happens] "Access Error: 404 -- Not Found Cannot locate document: /" Reproduces how often: [What percentage of the time does it reproduce?] Versions wsl debian 12 libhttpserver version 0.19 libmicrohttpd version 0.9.72 — Reply to this email directly, view it on GitHub <#339> or unsubscribe <https://github.com/notifications/unsubscribe- auth/AAJFLABJ6RG67E2QJIVIJB3ZQ6QGLBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRRGE4DENBYG43TKNVENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWTTGNBRGY4DSMMCUR2HS4DFUVUXG43VMWSXMYLMOVS2UMRUGU4TMOJVGIYTJAVEOR4XAZNFNRQWEZLMUV3GC3DVMWVDCMJYGI2DQNZXGU3KO5DSNFTWOZLSUZRXEZLBORSQ>. You are receiving this email because you were assigned. Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification- email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification- email%26utm_medium%3Demail%26utm_source%3Dgithub>.
#include <iostream>
#include <httpserver.hpp>
using namespace httpserver;
class hello_world_resource : public http_resource
{
public:
std::shared_ptr<http_response> render(const http_request&)
{
return std::shared_ptr<http_response>(new string_response("Hello, World!"));
}
};
typedef void (httpserver_logger)(const std::string& info);
httpserver_logger Logger;
int main(int argc, char** argv)
{
webserver ws = create_webserver(8888).
log_access(&Logger);
hello_world_resource hwr;
ws.register_resource("/", &hwr);
ws.start(true);
return 0;
}
// browser can not reached webserver!
void Logger(const std::string& info)
{
std::cerr << info << "\n";
}
example is so simple. PS curl works well
Prerequisites
[X]
Description
Any browser can not reach localhost but vanilla MHD all is ok.
Steps to Reproduce
port
Expected behavior:
I want that browser shows the page or text that is considered as a answer
Actual behavior:
"Access Error: 404 -- Not Found Cannot locate document: /"
Versions
Additional information
I check in gdb webserver on localhost even does not call library's callbacks (answer_to_conection and policy_callback)