Code Monkey home page Code Monkey logo

uri-library's People

Contributors

ben-zen avatar databaseerror avatar dereckson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

uri-library's Issues

Reorder warnings

Compiling with g++ g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

src/uri.hh: In constructor ‘uri::uri(const char*, uri::scheme_category, uri::query_argument_separator)’:
src/uri.hh:655:8: warning: ‘uri::m_path_is_rooted’ will be initialized after [-Wreorder]
  655 |   bool m_path_is_rooted;
      |        ^~~~~~~~~~~~~~~~
src/uri.hh:654:17: warning:   ‘long unsigned int uri::m_port’ [-Wreorder]
  654 |   unsigned long m_port;
      |                 ^~~~~~
src/uri.hh:54:3: warning:   when initialized here [-Wreorder]
   54 |   uri(char const *uri_text, scheme_category category = scheme_category::Hierarchical,
      |   ^~~
src/uri.hh: In constructor ‘uri::uri(const string&, uri::scheme_category, uri::query_argument_separator)’:
src/uri.hh:655:8: warning: ‘uri::m_path_is_rooted’ will be initialized after [-Wreorder]
  655 |   bool m_path_is_rooted;
      |        ^~~~~~~~~~~~~~~~
src/uri.hh:654:17: warning:   ‘long unsigned int uri::m_port’ [-Wreorder]
  654 |   unsigned long m_port;
      |                 ^~~~~~
src/uri.hh:64:3: warning:   when initialized here [-Wreorder]
   64 |   uri(std::string const &uri_text, scheme_category category = scheme_category::Hierarchical,
      |   ^~~

URI init with try-catch

How to keep uri after try-catch without empty constructor?

uri request;
try {
  request = uri(std::string(buf));
  auto requestParams = request.get_query_dictionary();
} catch (std::invalid_argument &e) {
  ...
}
request.get_path();

Following example is not working, I don't want to wrap whole logic into try-catch...

Incorrectly parsing of url without path

When attempting to parse: https://test.com:443

#include "uri.hh"
#include <iostream>

int main(int argc, char ** argv)
{
  uri test_uri("https://test.com:443");
  auto t = test_uri.to_string();
  cout << "server: " << test_uri.get_host() << " post: " << test_uri.get_port() << " new_url: " << test_uri.get_path() << " - " <<  t << std::endl;
  return 0;
}

The host and port are correctly set. However the m_path is not correctly set. It is set to //test.com:443

You can mitigate this issue by appending / to the url (e.g. https://test.com:443/). However the a uri should be parsed correctly without a path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.