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

[BUG] Any browser can not reach the library #339

Closed
Xxproner opened this issue Aug 11, 2024 · 2 comments
Closed

[BUG] Any browser can not reach the library #339

Xxproner opened this issue Aug 11, 2024 · 2 comments
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@Xxproner
Copy link

Xxproner commented Aug 11, 2024

Prerequisites

[X]

Description

Any browser can not reach localhost but vanilla MHD all is ok.

Steps to Reproduce

  1. Start webserver listening on any port
  2. Write http://localhost: port
  3. Not found

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

  • wsl debian 12
  • libhttpserver version 0.19
  • libmicrohttpd version 0.9.72

Additional information

I check in gdb webserver on localhost even does not call library's callbacks (answer_to_conection and policy_callback)

@Xxproner Xxproner added the bug Confirmed bugs or reports that are very likely to be bugs. label Aug 11, 2024
@etr
Copy link
Owner

etr commented Aug 11, 2024 via email

@Xxproner
Copy link
Author

Xxproner commented Aug 12, 2024

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

@Xxproner Xxproner reopened this Aug 14, 2024
@Xxproner Xxproner closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

No branches or pull requests

2 participants