diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index b8be625400..7193582fa5 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -366,6 +366,7 @@ int Client::ReadResponseHeaders(Buffer *readbuf, std::vector &respo if (code_pos != line.npos) { code = atoi(&line[code_pos]); } else { + ERROR_LOG(IO, "Code not parse HTTP status code"); return -1; } @@ -377,6 +378,7 @@ int Client::ReadResponseHeaders(Buffer *readbuf, std::vector &respo } if (responseHeaders.size() == 0) { + ERROR_LOG(IO, "No HTTP response headers"); return -1; } diff --git a/Common/Net/HTTPHeaders.cpp b/Common/Net/HTTPHeaders.cpp index acb554ee70..ef19d3bc9d 100644 --- a/Common/Net/HTTPHeaders.cpp +++ b/Common/Net/HTTPHeaders.cpp @@ -33,7 +33,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co for (size_t i = 0; i < v.size(); i++) { std::vector parts; SplitString(v[i], '=', parts); - INFO_LOG(IO, "Param: %s Value: %s", parts[0].c_str(), parts[1].c_str()); + DEBUG_LOG(IO, "Param: %s Value: %s", parts[0].c_str(), parts[1].c_str()); if (parts[0] == param_name) { *value = parts[1]; return true; @@ -121,13 +121,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) { if (!strncasecmp(key, "User-Agent", key_len)) { user_agent = new char[value_len + 1]; memcpy(user_agent, buffer, value_len + 1); - INFO_LOG(IO, "user-agent: %s", user_agent); + VERBOSE_LOG(IO, "user-agent: %s", user_agent); } else if (!strncasecmp(key, "Referer", key_len)) { referer = new char[value_len + 1]; memcpy(referer, buffer, value_len + 1); } else if (!strncasecmp(key, "Content-Length", key_len)) { content_length = atoi(buffer); - INFO_LOG(IO, "Content-Length: %i", (int)content_length); + VERBOSE_LOG(IO, "Content-Length: %i", (int)content_length); } else { std::string key_str(key, key_len); std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower); @@ -150,12 +150,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) { line_count++; if (type == SIMPLE) { // Done! - INFO_LOG(IO, "Simple: Done parsing http request."); + VERBOSE_LOG(IO, "Simple: Done parsing http request."); break; } } - INFO_LOG(IO, "finished parsing request."); + VERBOSE_LOG(IO, "finished parsing request."); ok = line_count > 1; } diff --git a/Common/Net/HTTPServer.cpp b/Common/Net/HTTPServer.cpp index da114da85a..1deb45f72c 100644 --- a/Common/Net/HTTPServer.cpp +++ b/Common/Net/HTTPServer.cpp @@ -54,7 +54,7 @@ Request::Request(int fd) header_.ParseHeaders(in_); if (header_.ok) { - INFO_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length); + VERBOSE_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length); } else { Close(); } @@ -171,8 +171,13 @@ bool Server::Listen4(int port) { setsockopt(listener_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { +#if PPSSPP_PLATFORM(WINDOWS) + int err = WSAGetLastError(); +#else + int err = errno; +#endif + ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv4)", port, err); closesocket(listener_); - ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port); return false; } @@ -216,8 +221,13 @@ bool Server::Listen6(int port, bool ipv6_only) { setsockopt(listener_, IPPROTO_IPV6, IPV6_V6ONLY, (const char *)&opt, sizeof(opt)); if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { +#if PPSSPP_PLATFORM(WINDOWS) + int err = WSAGetLastError(); +#else + int err = errno; +#endif + ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv6)", port, err); closesocket(listener_); - ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port); return false; } diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index 2d15de15cf..2eadf3fe62 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -385,6 +385,14 @@ void OutputSink::AccountPush(size_t bytes) { void OutputSink::AccountDrain(int bytes) { if (bytes < 0) { +#if PPSSPP_PLATFORM(WINDOWS) + int err = WSAGetLastError(); + if (err == WSAEWOULDBLOCK) + return; +#else + if (errno == EWOULDBLOCK || errno == EAGAIN) + return; +#endif ERROR_LOG(IO, "Error writing to socket"); return; }