static void test_HttpCreateHttpHandle(void) { HANDLE handle, handle2; ULONG ret; BOOL b; ret = HttpCreateHttpHandle(NULL, 0); todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Unexpected ret value %u.\n", ret); /* Non-zero reserved parameter is accepted on XP/2k3. */ handle = NULL; ret = HttpCreateHttpHandle(&handle, 0); todo_wine { ok(!ret, "Unexpected ret value %u.\n", ret); ok(handle != NULL, "Unexpected handle value %p.\n", handle); } handle2 = NULL; ret = HttpCreateHttpHandle(&handle2, 0); todo_wine { ok(!ret, "Unexpected ret value %u.\n", ret); ok(handle2 != NULL && handle != handle2, "Unexpected handle %p.\n", handle2); } b = CloseHandle(handle); todo_wine ok(b, "Failed to close queue handle.\n"); }
void xmlrpc_server_httpsys( xmlrpc_env * const envP, const xmlrpc_server_httpsys_parms * const parmsP, unsigned int const parm_size ) { ULONG retCode; HANDLE hReqQueue = NULL; HTTPAPI_VERSION HttpApiVersion = HTTPAPI_VERSION_1; WCHAR wszURL[35]; XMLRPC_ASSERT_ENV_OK(envP); if (parm_size < XMLRPC_HSSIZE(authfn)) { xmlrpc_faultf(envP, "You must specify members at least up through " "'authfn' in the server parameters argument. " "That would mean the parameter size would be >= %u " "but you specified a size of %u", XMLRPC_HSSIZE(authfn), parm_size); return; } //Set logging options if (parmsP->logLevel>0) g_bDebug=TRUE; else g_bDebug=FALSE; if (parmsP->logLevel>1) g_bDebugString=TRUE; else g_bDebugString=FALSE; if (!parmsP->logFile) g_bDebug=FALSE; else StringCchPrintfA(g_fLogFile,MAX_PATH,parmsP->logFile); //construct the URL we are listening on if (parmsP->useSSL!=0) StringCchPrintf(wszURL,35,L"https://+:%u/RPC2",parmsP->portNum); else StringCchPrintf(wszURL,35,L"http://+:%u/RPC2",parmsP->portNum); global_registryP = parmsP->registryP; // Initialize HTTP APIs. retCode = HttpInitialize(HttpApiVersion, HTTP_INITIALIZE_SERVER, // Flags NULL // Reserved ); if (retCode != NO_ERROR) { xmlrpc_faultf(envP, "HttpInitialize failed with %lu", retCode); return; } // Create a Request Queue Handle retCode = HttpCreateHttpHandle(&hReqQueue, // Req Queue 0 // Reserved ); if (retCode != NO_ERROR) { xmlrpc_faultf(envP, "HttpCreateHttpHandle failed with %lu", retCode); goto CleanUp; } retCode = HttpAddUrl(hReqQueue, // Req Queue wszURL, // Fully qualified URL NULL // Reserved ); if (retCode != NO_ERROR) { xmlrpc_faultf(envP, "HttpAddUrl failed with %lu", retCode); goto CleanUp; } TraceW(L"we are listening for requests on the following url: %ws", wszURL); // Loop while receiving requests for(;;) { TraceW(L"Calling DoReceiveRequests()"); retCode = DoReceiveRequests(hReqQueue, parmsP); if(NO_ERROR == retCode) { TraceW(L"DoReceiveRequests() returned NO_ERROR, breaking"); break; } } CleanUp: TraceW(L"Tearing down the server.", wszURL); // Call HttpRemoveUrl for the URL that we added. HttpRemoveUrl( hReqQueue, wszURL ); // Close the Request Queue handle. if(hReqQueue) CloseHandle(hReqQueue); // Call HttpTerminate. HttpTerminate(HTTP_INITIALIZE_SERVER, NULL); return; }