ckhttprequest.h
来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 122 行
H
122 行
// CkHttpRequest.h: interface for the CkHttpRequest class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _CKHTTPREQUEST_H
#define _CKHTTPREQUEST_H
#pragma once
#include "CkString.h"
class CkByteData;
/*
IMPORTANT: Objects returned by methods as non-const pointers must be deleted
by the calling application.
*/
#include "CkObject.h"
// CLASS: CkHttpRequest
class CkHttpRequest : public CkObject
{
private:
void *m_impl;
bool m_utf8; // If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
// Don't allow assignment or copying these objects.
CkHttpRequest(const CkHttpRequest &) { }
CkHttpRequest &operator=(const CkHttpRequest &) { return *this; }
CkHttpRequest(void *impl) : m_impl(impl) { }
public:
void *getImpl(void) const { return m_impl; }
CkHttpRequest();
virtual ~CkHttpRequest();
// BEGIN PUBLIC INTERFACE
bool get_Utf8(void) const;
void put_Utf8(bool b);
void UsePost(void);
void UseGet(void);
void UseHead(void);
void UseXmlHttp(const char *xmlBody);
void UseUpload(void);
void SetFromUrl(const char *url);
// Path if not set from a URL.
void put_Path(const char *path);
void get_Path(CkString &str);
// Default is "utf-8"
void put_Charset(const char *charset);
void get_Charset(CkString &str);
// If true, the charset attribute is included in the
// content-type header field in the HTTP request.
void put_SendCharset(bool val);
bool get_SendCharset(void);
void put_HttpVersion(const char *version);
void get_HttpVersion(CkString &str);
// HTTP headers.
void AddHeader(const char *name, const char *value);
// Add a string request parameter.
void AddParam(const char *name, const char *value);
// Data to upload.
bool AddFileForUpload(const char *name, const char *filename);
// Generate the HTTP request header for this object.
void GenerateRequestText(CkString &str);
// Get a header field by name.
bool GetHeaderField(const char *name, CkString &str);
int get_NumHeaderFields(void);
bool GetHeaderName(int index, CkString &str);
bool GetHeaderValue(int index, CkString &str);
// Get request parameters.
bool GetParam(const char *name, CkString &str);
int get_NumParams(void);
bool GetParamName(int index, CkString &str);
bool GetParamValue(int index, CkString &str);
// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
//bool SaveLastError(const char *filename);
//void LastErrorXml(CkString &str);
//void LastErrorHtml(CkString &str);
//void LastErrorText(CkString &str);
CkString m_resultString;
const char *path(void);
const char *charset(void);
const char *httpVersion(void);
const char *getHeaderField(const char *name);
const char *getHeaderName(int index);
const char *getHeaderValue(int index);
const char *getParam(const char *name);
const char *getParamName(int index);
const char *getParamValue(int index);
// END PUBLIC INTERFACE
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?