Peercast的http.h源文件分析

定义HTTP消息:

static const char *HTTP_SC_OK   = "HTTP/1.0 200 OK";
static const char *HTTP_SC_NOTFOUND  = "HTTP/1.0 404 Not Found";
static const char *HTTP_SC_UNAVAILABLE = "HTTP/1.0 503 Service Unavailable";

static const char *HTTP_HS_SERVER  = "Server:";
static const char *HTTP_HS_AGENT  = "User-Agent:";
static const char *HTTP_HS_CONTENT  = "Content-Type:";
static const char *HTTP_HS_HOST   = "Host:";
static const char *HTTP_HS_ACCEPT  = "Accept:";
static const char *HTTP_HS_LENGTH  = "Content-Length:";

static const char *MIME_MP3   = "audio/mpeg";
static const char *MIME_OGG   = "application/ogg";

HTTP类

class HTTP : public IndirectStream
{
public:
 HTTP(Stream &s)
 {
  init(&s);
 }

 void initRequest(const char *r)
 {
  strcpy(cmdLine,r);
 }
 void readRequest();
 bool isRequest(const char *);

 int  readResponse();
 bool checkResponse(int);

 bool nextHeader();
 bool isHeader(const char *);
 char *getArgStr();
 int  getArgInt();

 void getAuthUserPass(char *, char *);

 char cmdLine[8192],*arg;

};

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值