定义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;
};