//contacting nexus server getting login information, HTTPS
printf("acquiring login data from nexus.passport.com ...\n");
HINTERNET internetConnectionHandle;
HINTERNET openInternetHandle;
HINTERNET httpRequestHandle;
DWORD_PTR internetContext;
ZeroMemory(&internetContext, sizeof(internetContext));
openInternetHandle = InternetOpen("Villicus", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (openInternetHandle == NULL) {
printf("error: %d\n\n",GetLastError());
closesocket(msnSocket);
WSACleanup();
system("pause");
return 0;
}
internetConnectionHandle = InternetConnect(openInternetHandle, "https://nexus.passport.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, internetContext);
if (openInternetHandle == NULL) {
printf("error: %d\n\n",GetLastError());
closesocket(msnSocket);
WSACleanup();
system("pause");
return 0;
}
printf("connection to nexus.passport.com established via HTTPS\n");
printf("requesting information from nexus ...\n");
httpRequestHandle = HttpOpenRequest(internetConnectionHandle, "GET", "/rdr/pprdr.asp", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_SECURE, internetContext);
if (openInternetHandle == NULL) {
printf("error on open request: %d\n\n",GetLastError());
closesocket(msnSocket);
WSACleanup();
system("pause");
return 0;
}
if (!HttpSendRequest(httpRequestHandle, NULL, 0, NULL, 0)) {
printf("error on request: %d\n\n",GetLastError());
closesocket(msnSocket);
WSACleanup();
system("pause");
return 0;
}
printf("request successful\n");
HttpOpenRequest to HTTPS : ERROR_INTERNET_INVALID_URL
I'm learning about network programming and am working on writing a small console based MSN client as a project. I've managed to connect to the main msn servers, and send and receive information. The next step in the logging in process requires me to get some info off a server via HTTPS. I've been trying to get this code to work for a while now, but I keep getting the same error (12005) ERROR_INTERNET_INVALID_URL when trying to send the request to the server.
The code I've attached below is all the code related to the problem.
I'm writing this in C and Win32.
I've discovered what was causing the problem. Getting rid of "https://" fixed everything. But now when trying to request the header information I'm getting error 560. If anyone with networking experience could help that would be great.
if (!HttpSendRequest(httpRequestHandle, NULL, 0, NULL, 0)) { printf("error on request: %d\n\n",GetLastError()); closesocket(msnSocket); WSACleanup(); system("pause"); return 0; } printf("request successful\n"); char * requestHeaderInformation = (char *)malloc(sizeof(char) * 2048); DWORD bytesObtained = 2047; if (!HttpQueryInfo(httpRequestHandle, HTTP_QUERY_RAW_HEADERS, (LPVOID)requestHeaderInformation, &bytesObtained, NULL)) { printf("error on getting headers: %d\n\n",GetLastError()); closesocket(msnSocket); WSACleanup(); system("pause"); return 0; }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement