Exemple #1
0
void HTTPClient::ReadyFile() {
	std::stringstream _header_path_stream;
	_header_path_stream << HTTPManager::Share()->GetTemporaryHeaderPath() + "/";
	_header_path_stream << __http_client_identity;
	header_file_path = _header_path_stream.str();
	
	header.open(header_file_path.c_str());
	OPEN_FD();
	HTTP_DEBUG(!header.is_open(), std::string("응답헤더를 저장할 파일이 열리지 않습니다.HTTPConfig.h의 HTTP_MANAGER_DIRECTORY, HTTP_RESPONSE_HEADER_FILE_PREFIX의 경로를 확인해주세요.권한문제 혹은 잘못된 경로일 수 있습니다.\n경로: ") + header_file_path + "\n");
	
	std::stringstream _body_path_stream;
	_body_path_stream << HTTPManager::Share()->GetTemporaryBodyPath() + "/";
	_body_path_stream << __http_client_identity;
	body_file_path = _body_path_stream.str();
	
	body.open(body_file_path.c_str());
	OPEN_FD();
	HTTP_DEBUG(!body.is_open(), std::string("응답바디를 저장할 파일이 열리지 않습니다.HTTPConfig.h의 HTTP_MANAGER_DIRECTORY, HTTP_RESPONSE_BODY_FILE_PREFIX의 경로를 확인해주세요.권한문제 혹은 잘못된 경로일 수 있습니다.\n경로: ") + body_file_path + "\n");
	
	__http_client_identity++;

#ifdef ANDROID_NDK
    if (is_https) {
        requestHttps(tag, request.url, this);
    }
#endif
}
Exemple #2
0
int
readlines(char *lineptr[], int maxlines)
{
	int len, nlines;
	char *p, line[MAXLEN];
	OPEN_FD();
	nlines = 0;
	while ((len = _getline(line, MAXLEN)) > 1)
		if (nlines >= MAXLINES )
		{
			CLOSE_FD();
			return nlines*(-1) - 1;
		}
		else
		if(!(p=malloc(len)))
		{
			CLOSE_FD();
			return nlines*(-1) - 1;
		}
		else {
			line[len - 1] = '\0';
			strcpy(p, line);
			int ans;
			int ff=myAtoi(p,&ans);
			if(numeric)
			{
				myItoa(ans,p);
			}
			if(numeric && ff==-1)
			{
				drop_error_string_format();
				CLOSE_FD();
				free(p);
				strcpy(line,"");
				return nlines*(-1) - 1;
			}
			lineptr[nlines++] = p;
		}
	CLOSE_FD();
	return nlines;
}