• Home
  • Raw
  • Download

Lines Matching refs:parameters

45 bool parseUrl(const struct Arguments& args, struct Parameters* parameters) {  in parseUrl()  argument
46 if (parameters == nullptr) { return false; } in parseUrl()
54 parameters->host = std::string(args.arg1).substr(strlen(HTTP_PREFIX)); in parseUrl()
55 const auto first_slash = parameters->host.find_first_of('/'); in parseUrl()
57 parameters->path = parameters->host.substr(first_slash); in parseUrl()
58 parameters->host.erase(first_slash); in parseUrl()
61 if (parameters->host.size() == 0) { in parseUrl()
66 if (parameters->host[0] == '[') { in parseUrl()
67 const auto closing_bracket = parameters->host.find_first_of(']'); in parseUrl()
72 parameters->hostname = parameters->host.substr(1, closing_bracket - 1); in parseUrl()
75 if (colon_port < parameters->host.size()) { in parseUrl()
76 if (parameters->host[colon_port] != ':') { in parseUrl()
80 parameters->port = parameters->host.substr(closing_bracket + 2); in parseUrl()
83 const auto first_colon = parameters->host.find_first_of(':'); in parseUrl()
85 parameters->port = parameters->host.substr(first_colon + 1); in parseUrl()
86 parameters->hostname = parameters->host.substr(0, first_colon); in parseUrl()
88 parameters->hostname = parameters->host; in parseUrl()
94 std::cerr << "Resolving hostname=" << parameters->hostname in parseUrl()
95 << ", port=" << parameters->port in parseUrl()
108 parameters->hostname.c_str(), in parseUrl()
109 parameters->port.c_str(), in parseUrl()
113 rval = getaddrinfo(parameters->hostname.c_str(), in parseUrl()
114 parameters->port.c_str(), in parseUrl()
130 memcpy(&(parameters->ss), result[0].ai_addr, result[0].ai_addrlen); in parseUrl()
167 int doHttpQuery(int fd, const struct Parameters& parameters) { in doHttpQuery() argument
170 reinterpret_cast<const struct sockaddr *>(&(parameters.ss)), in doHttpQuery()
171 (parameters.ss.ss_family == AF_INET6) in doHttpQuery()
188 parameters.path.c_str(), parameters.host.c_str())); in doHttpQuery()
233 struct Parameters parameters; in main() local
234 if (!parseUrl(args, &parameters)) { return -1; } in main()
239 parameters.ss.ss_family, in main()
244 return doHttpQuery(closer.fd, parameters); in main()