コード例 #1
0
ファイル: ApplyMarkQuery.cpp プロジェクト: 4ukuta/core
void ApplyMarkQuery::doRequest()
{
  if (httpQuery == "" || jsonQuery == "")
  {
    qDebug() << "ApplyMarkQuery: can't do request because query isn't set";
    return;
  }

  QNetworkRequest request;
  QUrl url(httpQuery);
  url.setPort(getServerPort());
  request.setUrl(url);

  QByteArray data(jsonQuery.toAscii(), jsonQuery.size());

  QNetworkReply *reply = manager->post(request, data);

  connect(manager, SIGNAL(finished(QNetworkReply*)),
    this, SLOT(onManagerFinished(QNetworkReply*)));
  connect(manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
    this, SIGNAL(managerSslErrors()));
  connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
    this, SIGNAL(replyError(QNetworkReply::NetworkError)));

  qDebug() << "ApplyMarkQuery did request:\n"
    << httpQuery << jsonQuery;
}
コード例 #2
0
ファイル: SoffidEssoManager.cpp プロジェクト: SoffidIAM/esso
// Get formated URL Server
std::string SoffidEssoManager::GetFormatedURLServer ()
{
	char serverPort[10];	// Server port

	itoa(getServerPort(), serverPort, 10);

	return ("https://" + getServerUrl() + ":" + serverPort);
}
コード例 #3
0
void CConfigInfo::_LoadDataFromCfgFile()
{
	getFileDBPath();
	getSQLiteDBPath();
	getLstUserInstrument();
	getMinStockIndex();
	getMaxStockIndex();
	getServerPort();
	getServerDBPath();
}
コード例 #4
0
ファイル: DefaultQuery.cpp プロジェクト: h0st/core
void DefaultQuery::doRequest()
{
  QNetworkRequest request;

  QUrl url(getUrl());
  url.setPort(getServerPort());
  request.setUrl(url);

  //  DEBUG() << "doing post to" << url << " with body: " << getRequestBody();
  DEBUG() << "posting http request to "<<url.toString()<<" with body "<<getRequestBody();
  QNetworkReply *reply = m_manager->post(request, getRequestBody());
  m_sendTime = QDateTime::currentDateTime();
  connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleError()));
}
コード例 #5
0
ファイル: cgiconv.cpp プロジェクト: brainiac/showeq
void CGI::logCGIData(const QString& filename)
{
	// create a QFile object to do the file I/O
	QFile file(filename);

	// open the file
	if (file.open(QIODevice::WriteOnly))
	{
		// create a QTextStream object on the file
		Q3TextStream textFile(&file);

		// get the environment
		textFile << "REQUEST_METHOD=" << getenv("REQUEST_METHOD") << endl;
		textFile << "CONTENT_LENGTH=" << getenv("CONTENT_LENGTH") << endl;

		// write the query string to the file
		textFile << "QUERY_STRING=" << query_string << endl;

		// write misc. CGI environment pieces
		textFile << "AUTH_TYPE=" << getAuthType() << endl;
		textFile << "GATEWAY_INTERFACE=" << getGatewayInterface() << endl;
		textFile << "HTTP_ACCEPT=" << getHTTPAccept() << endl;
		textFile << "HTTP_ACCEPT_ENCODING=" << getHTTPAcceptEncoding() << endl;
		textFile << "HTTP_ACCEPT_LANGUAGE=" << getHTTPAcceptLanguage() << endl;
		textFile << "HTTP_CONNECTION=" << getHTTPConnection() << endl;
		textFile << "HTTP_REFERER=" << getHTTPReferer() << endl;
		textFile << "HTTP_USER_AGENT=" << getHTTPUserAgent() << endl;
		textFile << "REMOTE_HOST=" << getRemoteHost() << endl;
		textFile << "REMOTE_ADDRESS=" << getRemoteAddress() << endl;
		textFile << "REMOTE_PORT=" << getRemotePort() << endl;
		textFile << "REQUEST_URI=" << getRequestURI() << endl;
		textFile << "SCRIPT_NAME=" << getScriptName() << endl;
		textFile << "SERVER_ADMIN=" << getServerAdmin() << endl;
		textFile << "SERVER_NAME=" << getServerName() << endl;
		textFile << "SERVER_PORT=" << getServerPort() << endl;
		textFile << "SERVER_PROTOCOL=" << getServerProtocol() << endl;
		textFile << "SERVER_SOFTWARE=" << getServerSoftware() << endl;
	}

	// close the file
	file.close();

}
コード例 #6
0
ファイル: OptionsWidget.cpp プロジェクト: aygerim/geo2tag
void OptionsWidget::readSettings()
{
  if (m_productName == "tracker")
  {
    m_visibleNameEdit->setText(m_settings.value("visibleName").toString());
  }
  m_nameEdit->setText(m_settings.value("user").toString());
  m_passwordEdit->setText(m_settings.value("password").toString());
  m_channelEdit->setText(m_settings.value("channel").toString());

  m_proxyType->setCurrentIndex(m_proxyType->findData(m_settings.value("proxy_type").toInt()));
  m_proxyHostEdit->setText(m_settings.value("proxy_host").toString());
  m_proxyPortEdit->setValue(m_settings.value("proxy_port").toInt());

  m_serverUrlEdit->setText(getServerUrl());
  m_serverPortEdit->setValue(getServerPort());

  m_cacheType->setCurrentIndex(m_cacheType->findData(m_settings.value("cache_type", 0).toInt()));
  m_cachePath->setText(m_settings.value("cache_path", QDir::homePath() + "/.geo2tag/uploaded_maps/").toString());
}
コード例 #7
0
ファイル: LoginWidget.cpp プロジェクト: aygerim/geo2tag
void LoginWidget::loginClicked()
{
  QString name = QString(usernameEdit->text().toUTF8().c_str());
  QString pass = QString(passwordEdit->text().toUTF8().c_str());
  syslog(LOG_INFO,"LoginWidget::loginClicked(), %s - %s",usernameEdit->text().toUTF8().c_str(),passwordEdit->text().toUTF8().c_str());
  syslog(LOG_INFO,"Server url: %s, server port: %i",getServerUrl().toStdString().c_str(),getServerPort());
  m_loginQuery.setQuery(name,pass);
  m_loginQuery.doRequest();

}
コード例 #8
0
static void* command_thread(void* unused)
{
	lList words;
	lInit(&words, NULL);
	
	(void)unused;

	INIT_INPUT;

	while(1)
	{
		char* command;
		void* remember;
		char* newline;

		INPUT_DECLARE;

		lDestroy(&words, free);

		if(READ_INPUT("Enter a command: ") == NULL)
			break;
		
		if((newline = strchr(input, '\n')) != NULL)
			*newline = '\0';
		
		getWords(&words, input);
		command = (char*)lGet(&words, FIRST, &remember);
		//LOG_DEBUG("Command: %s\n", command);

		if(!strcmp(command, ".") || !strcmp(command, "quit") 
		|| !strcmp(command, "q") || !strcmp(command, "exit"))
		{
			//LOG("\n");
			break;
		}
		/* 
		 * Command: send (client) (filename) 
		 */
		else if(!strcmp(command, "send") || !strcmp(command, "snd")) /* Send a file directly to a client */
		{
			ERROR_ENOUGH_ARGUMENTS(3);

			char* who = NEXT_WORD;
			char* filename = NEXT_WORD;
		
			nlServerSendFile(who, filename);
			
			WARN_TOO_MUCH_ARGUMENTS(3);
		}
		else if(!strcmp(command, "wget")) /* Tell a client to download a file at the given URL */
		{
			ERROR_ENOUGH_ARGUMENTS(4);
			
			                           /* Example: */
			char* who = NEXT_WORD;     /*   who: Client */
			char* address = NEXT_WORD; /*   address: http://some_site.org/some_file.tar.gz */
			char* where = NEXT_WORD;   /*   where: pouet.tgz */

			nlServerSendMessage(who, "W %s$%s", address, where);

			WARN_TOO_MUCH_ARGUMENTS(4);
		}
		else if(!strcmp(command, "ip")) /* Get our ip */
		{
			LOG("LAN IP: %s on port %d.", UPnPgetLanAddr(), getServerPort());
//			LOG("External IP: %s.", UPnPgetExternalAddress());
		}
		else if(!strcmp(command, "list") || !strcmp(command, "ls")) /* List all connected clients */
		{
			nlServerList();
		}
		else if(!strcmp(command, "register")) /* Register on the main server. */
		{
			if(!nlServerStartRegister())
				LOG("Unable to reach the register.");
			else
				LOG("Registered.");
		}
		else if(!strcmp(command, "h")
		     || !strcmp(command, "help"))
		{
			LOG("Non exaustive list of commands:\n"
				"\tls:\tList connected players.\n"
				"\tip:\tPrint local IP address with bound port.\n"
				"\tsend:\tSend to the given client the given file.\n"
				"\tquit:\tExit program.");
		}
		else
			LOG("Sorry, unimplemented command: %s.", cmd);	

		AFTER_INPUT;
	}
	
	lFree(&words);
	signalHandler(0);
	
	UNINIT_INPUT;

#ifndef DISABLE_PHYSICS

	thread_exit();

#else

	quit();
	return NULL;

#endif
}