本文整理汇总了C++中GetRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRequest函数的具体用法?C++ GetRequest怎么用?C++ GetRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRequest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxSocketInit
DWORD CAsyncUrlReader::ThreadProc()
{
AfxSocketInit(nullptr);
DWORD cmd = GetRequest();
if (cmd != CMD_INIT) {
Reply((DWORD)E_FAIL);
return (DWORD) - 1;
}
try {
CInternetSession is;
CAutoPtr<CStdioFile> fin(is.OpenURL(m_url, 1, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_CACHE_WRITE));
TCHAR path[MAX_PATH], fn[MAX_PATH];
CFile fout;
if (GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
&& fout.Open(fn, modeCreate | modeWrite | shareDenyWrite | typeBinary)) {
m_fn = fn;
char buff[1024];
int len = fin->Read(buff, sizeof(buff));
if (len > 0) {
fout.Write(buff, len);
}
Reply(S_OK);
while (!CheckRequest(&cmd)) {
int len2 = fin->Read(buff, sizeof(buff));
if (len2 > 0) {
fout.Write(buff, len2);
}
}
} else {
Reply((DWORD)E_FAIL);
}
fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
} catch (CInternetException* ie) {
ie->Delete();
Reply((DWORD)E_FAIL);
}
//
cmd = GetRequest();
ASSERT(cmd == CMD_EXIT);
Reply(S_OK);
//
m_hThread = nullptr;
return S_OK;
}
示例2: ap_table_add
bool qEnvApache::AppendHeader(const char *str, const char *val)
{
if (!IsFlushed()) {
ap_table_add(GetRequest()->headers_out, str, val);
if (!stricmp(str,"set-cookie"))
ap_table_add(GetRequest()->err_headers_out, str, val);
return true;
}
return false;
}
示例3: ap_table_set
bool qEnvApache::SetHeader(const char *str, const char *val)
{
if (!IsFlushed()) {
ap_table_set(GetRequest()->headers_out, str, val);
if (!stricmp(str,"content-type")) {
myReq->content_type = ap_pstrdup(myReq->pool, val);
} else if (!stricmp(str,"set-cookie"))
ap_table_set(GetRequest()->err_headers_out, str, val);
return true;
}
return false;
}
示例4: main
/*
* @brief 主程序
*/
int main(void)
{
Request req;
char weightBUf[32];
char devCode[32];
SystemInit();
ModulesInit();
SelectChannel(GPRS_CHANNEL);
GPRS_GetDevCode(devCode, sizeof(devCode));
SelectChannel(BLUETOOTH_CHANNEL);
while(GetRequest() != SYS_START){} /* 等待接收SYS_START信号以开始工作 */
SendResponse(SYS_START);
BT_Println(devCode);
while(1) {
myWDGInit(30); /* 设置定时器,值为30*2=60s=1min。超时会导致系统认为蓝牙已断开,从而进入alarm模式。 */
req = GetRequest(); /* 获取应用请求,并调用相应功能API */
if(FALSE == TimeoutFlag) {
switch(req) {
case KEEP_ALIVE:
SendResponse(KEEP_ALIVE);
ResetWDGCounter();
break;
case GET_WEIGHT:
SendResponse(GET_WEIGHT);
GetWeight(weightBUf);
BT_Println(weightBUf);
ResetWDGCounter();
break;
case UNLOCK_DEVICE:
SendResponse(UNLOCK_DEVICE);
LOCK_Unlock(); /* 解锁电子锁 */
ResetWDGCounter();
break;
default:
BT_Println("Request invalid.");
}
}else {
while(1) { ReportLocation(); }
}
}
return 0;
}
示例5: DiscardRequest
void HTTP::DiscardRequest(int requestHandle)
{
Request* request=GetRequest(requestHandle);
if (request)
{
if (request->connection)
{
delete request->connection;
}
if (request->requestString)
{
Free(request->requestString);
}
if (request->resource)
{
delete request->resource;
}
BagIterator<Request*> it(requests_);
if (it.Find(request))
{
requests_.Remove(it);
}
delete request;
}
}
示例6: GetRequest
FileRequestAsync* AsyncHandler::RequestFile(const std::string& folder_name, const std::string& file_name) {
std::string path = FileFinder::MakePath(folder_name, file_name);
FileRequestAsync* request = GetRequest(path);
if (request) {
return request;
}
FileRequestAsync req(folder_name, file_name);
RegisterRequest(path, req);
//Output::Debug("Waiting for %s", path.c_str());
return GetRequest(path);
}
示例7: GetRequest
DWORD
CPullPin::ThreadProc(void)
{
for (;;) {
DWORD cmd = GetRequest();
switch(cmd) {
case TM_Exit:
Reply(S_OK);
return 0;
case TM_Pause:
// we are paused already
Reply(S_OK);
break;
case TM_Start:
Reply(S_OK);
Process();
break;
}
// at this point, there should be no outstanding requests on the
// upstream filter.
// We should force begin/endflush to ensure that this is true.
// !!!Note that we may currently be inside a BeginFlush/EndFlush pair
// on another thread, but the premature EndFlush will do no harm now
// that we are idle.
m_pReader->BeginFlush();
CleanupCancelled();
m_pReader->EndFlush();
}
}
示例8: DebugLog
DWORD CWavPackDSSplitterInputPin::ThreadProc()
{
Command com;
DebugLog("===> Entering CWavPackDSSplitterInputPin::ThreadProc... 0x%08X", GetCurrentThreadId());
do
{
DebugLog("===> ThreadProc waiting command... 0x%08X", GetCurrentThreadId());
com = (Command)GetRequest();
switch (com)
{
case CMD_EXIT:
DebugLog("===> ThreadProc CMD_EXIT 0x%08X", GetCurrentThreadId());
Reply(NOERROR);
break;
case CMD_STOP:
DebugLog("===> ThreadProc CMD_STOP 0x%08X", GetCurrentThreadId());
Reply(NOERROR);
break;
case CMD_RUN:
DebugLog("===> ThreadProc CMD_RUN 0x%08X", GetCurrentThreadId());
DebugLog("===> Entering DoProcessingLoop... 0x%08X", GetCurrentThreadId());
DoProcessingLoop();
DebugLog("<=== Leaving DoProcessingLoop 0x%08X", GetCurrentThreadId());
break;
}
} while (com != CMD_EXIT);
DebugLog("<=== Leaving CWavPackDSSplitterInputPin::ThreadProc 0x%08X", GetCurrentThreadId());
return NOERROR;
}
示例9: iislua_req_get_headers
int iislua_req_get_headers(lua_State *L)
{
auto ctx = iislua_get_http_ctx(L);
if (ctx == NULL)
{
return luaL_error(L, "context is null");
}
auto headers = ctx->GetRequest()->GetRawHttpRequest()->Headers;
lua_createtable(L, 0, headers.UnknownHeaderCount);
for (USHORT i = 0; i < HttpHeaderRequestMaximum; i++)
{
if (headers.KnownHeaders[i].pRawValue != NULL)
{
lua_pushstring(L, iislua_util_get_http_req_header(i));
lua_pushlstring(L, headers.KnownHeaders[i].pRawValue, headers.KnownHeaders[i].RawValueLength);
lua_settable(L, -3);
}
}
for (USHORT i = 0; i < headers.UnknownHeaderCount; i++)
{
lua_pushlstring(L, headers.pUnknownHeaders[i].pName, headers.pUnknownHeaders[i].NameLength);
lua_pushlstring(L, headers.pUnknownHeaders[i].pRawValue, headers.pUnknownHeaders[i].RawValueLength);
lua_settable(L, -3);
}
return 1;
}
示例10: augeGetLoggerInstance
void GetCountRequest::Info()
{
GLogger* pLogger = augeGetLoggerInstance();
char str[AUGE_MSG_MAX];
const char* value = GetRequest();
pLogger->Debug("[Requet Parameters]");
g_sprintf(str,"\t%s:%s", "Request", (value==NULL)?"":value);
pLogger->Debug(str);
value = GetVersion();
g_sprintf(str,"\t%s:%s", "Version", (value==NULL)?"":value);
pLogger->Debug(str);
g_sprintf(str,"\t%s:%s", "Service", "wfs");
pLogger->Debug(str);
value = GetMimeType();
g_sprintf(str,"\t%s:%s", "MimeType", (value==NULL)?"":value);
pLogger->Debug(str);
value = GetTypeName();
g_sprintf(str,"\t%s:%s", "TypeName", (value==NULL)?"":value);
pLogger->Debug(str);
}
示例11: GetCurrentThreadId
DWORD CAVISplitter::ThreadProc()
{
m_threadid = GetCurrentThreadId();
while (1)
{
DWORD cmd = GetRequest();
switch (cmd)
{
case tm_exit:
stopPinsProcessingThreads();
Reply(S_OK);
return 0;
case tm_pause:
// we are paused already
stopPinsProcessingThreads();
Reply(S_OK);
break;
case tm_start:
startPinsProcessingThreads();
Reply(S_OK);
break;
}
}
return 0;
}
示例12: augeGetLoggerInstance
void GetFeatureRequest::Info()
{
GLogger* pLogger = augeGetLoggerInstance();
char str[AUGE_MSG_MAX];
const char* value = GetRequest();
pLogger->Debug("[Requet Parameters]");
g_sprintf(str,"\t%s:%s", "Request", (value==NULL)?"":value);
pLogger->Debug(str);
value = GetVersion();
g_sprintf(str,"\t%s:%s", "Version", (value==NULL)?"":value);
pLogger->Debug(str);
g_sprintf(str,"\t%s:%s", "Service", "wfs");
pLogger->Debug(str);
value = GetMimeType();
g_sprintf(str,"\t%s:%s", "MimeType", (value==NULL)?"":value);
pLogger->Debug(str);
value = GetTypeName();
g_sprintf(str,"\t%s:%s", "TypeName", (value==NULL)?"":value);
pLogger->Debug(str);
value = GetOutputFormat();
g_sprintf(str,"\t%s:%s", "OutputFormat", (value==NULL)?"":value);
pLogger->Debug(str);
g_sprintf(str,"\t%s:%d", "MaxFeatures", GetMaxFeatures());
pLogger->Debug(str);
g_sprintf(str,"\t%s:%d", "Offset", GetOffset());
pLogger->Debug(str);
}
示例13: iislua_req_get_remote_addr
int iislua_req_get_remote_addr(lua_State *L)
{
auto ctx = iislua_get_http_ctx(L);
if (ctx == NULL)
{
return luaL_error(L, "context is null");
}
auto remoteAddr = ctx->GetRequest()->GetRemoteAddress();
char ipAddress[INET6_ADDRSTRLEN];
if (remoteAddr->sa_family == AF_INET)
{
inet_ntop(AF_INET, &reinterpret_cast<SOCKADDR_IN *>(remoteAddr)->sin_addr, ipAddress, sizeof(ipAddress));
}
else
{
inet_ntop(AF_INET6, &reinterpret_cast<SOCKADDR_IN6 *>(remoteAddr)->sin6_addr, ipAddress, sizeof(ipAddress));
}
lua_pushstring(L, ipAddress);
return 1;
}
示例14: while
void* WorkerThread::Entry()
{
while( true )
{
// Did we get a request to terminate?
if(TestDestroy())
break;
ThreadRequest *request = GetRequest();
if( request )
{
// Call user's implementation for processing request
ProcessRequest( request );
wxThread::Sleep(10); // Allow other threads to work as well
delete request;
request = NULL;
continue; // to avoid the sleep
}
// Sleep for 1 seconds, and then try again
wxThread::Sleep(200);
}
return NULL;
}
示例15: while
//CAMThread Stuff
DWORD OggDemuxFilter::ThreadProc()
{
while(true)
{
DWORD locThreadCommand = GetRequest();
switch(locThreadCommand)
{
case THREAD_EXIT:
Reply(S_OK);
LOG(logDEBUG) << __FUNCTIONW__ << " THREAD IS EXITING";
return S_OK;
case THREAD_RUN:
Reply(S_OK);
DataProcessLoop();
LOG(logDEBUG) << __FUNCTIONW__ << " Data Process Loop has returned";
break;
case THREAD_SEEK:
m_oggBuffer.clearData();
SetCurrentReaderPos(GetRequestedSeekPos());
Reply(S_OK);
DataProcessLoop();
LOG(logDEBUG) << __FUNCTIONW__ << " Seek request";
break;
}
}
return S_OK;
}