microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k stars 1.65k forks source link

resolve: Host not found (authoritative)----------> while using http_listener() #1688

Closed samrajput1143 closed 2 years ago

samrajput1143 commented 2 years ago

below is the part of server side code:->
utility::string_t port = U("8080"); utility::string_t address = U("http://service-ricxapp-bouncer-xapp-http.ricxapp:"); address.append(port); address.append(U("/ric/v1/subscriptions/response")); uri_builder uri(address); auto addr = uri.to_uri().to_string(); http_listener listener(addr);

cout<<uri::validate(addr)<<"\n"; --------> this is printing 1

samrajput1143 commented 2 years ago

Iam running this code in Ubuntu 18

barcharcraz commented 2 years ago

note that the http server component is not supported, and has NEVER been supported, and probably has bugs and is probably insecure. We recommend you do not use that component (use a real web server like apache or nginx, or IIS, instead).

In any case that is not a valid URI and I wouldn't expect basically any resolver to be able to deal with it.

Is that last line printing "1" or printing "Host not found (authoritative)"

barcharcraz commented 2 years ago

the URI is valid as far as the URI parser is concerned, but that TLD is not a "real" TLD, so you better make sure your dns server knows how to deal with it. In this case it's possible your machine is not correctly assigning that name to itself. You probably want to listen on "[::]" or 0.0.0.0 instead, or a specific IP you have been assigned. Not all systems (esp ones as old as ubuntu 18.04) support assigning hostnames to specific links

Closing this as it's a problem with your DNS setup and we don't support the server component beyound using it to test cpprestsdk itself. Seriously consider using a different server.