/
httpio.h
48 lines (36 loc) · 1.03 KB
/
httpio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __HTTPIO_H__
#define __HTTPIO_H__
#include "platform.h"
#include "tidy.h"
#ifdef WIN32
# include <winsock.h>
# define ECONNREFUSED WSAECONNREFUSED
#else
# include <sys/socket.h>
# include <netdb.h>
# include <netinet/in.h>
#ifndef __BEOS__
# include <arpa/inet.h>
#endif
#endif /* WIN32 */
TIDY_STRUCT
typedef struct _HTTPInputSource
{
TidyInputSource tis; // This declaration must be first and must not be changed!
tmbstr pHostName;
tmbstr pResource;
unsigned short nPort, nextBytePos, nextUnGotBytePos, nBufSize;
SOCKET s;
char buffer[1024];
char unGetBuffer[16];
} HTTPInputSource;
/* get next byte from input source */
int HTTPGetByte( HTTPInputSource *source );
/* unget byte back to input source */
void HTTPUngetByte( HTTPInputSource *source, uint byteValue );
/* check if input source at end */
Bool HTTPIsEOF( HTTPInputSource *source );
int parseURL( HTTPInputSource* source, tmbstr pUrl );
int openURL( HTTPInputSource* source, tmbstr pUrl );
void closeURL( HTTPInputSource *source );
#endif