Initial import
This commit is contained in:
		
							
								
								
									
										79
									
								
								libweb.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								libweb.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| /** | ||||
|  * @PROJECT			WebGet Downloader | ||||
|  * @COPYRIGHT		See COPYING in the top level directory | ||||
|  * @FILE			libweb.h | ||||
|  * @PURPOSE			Common Web Library | ||||
|  * @DEVELOPERS		Al Globus <globus@nas.nasa.gov> | ||||
|  *					Rafal Kupiec <belliash@asiotec.eu.org> | ||||
|  *					Jef Poskanzer <jef@mail.acme.com> | ||||
|  */ | ||||
|  | ||||
| #ifndef __LIBWEB_H | ||||
| #define __LIBWEB_H | ||||
|  | ||||
| #define HDST_LINE1_PROTOCOL 0 | ||||
| #define HDST_LINE1_WHITESPACE 1 | ||||
| #define HDST_LINE1_STATUS 2 | ||||
| #define HDST_BOL 10 | ||||
| #define HDST_TEXT 11 | ||||
| #define HDST_LF 12 | ||||
| #define HDST_CR 13 | ||||
| #define HDST_CRLF 14 | ||||
| #define HDST_CRLFCR 15 | ||||
|  | ||||
| #define PROTO_HTTP 0 | ||||
| #define PROTO_HTTPS 1 | ||||
|  | ||||
| #define MAX_COOKIES 20 | ||||
|  | ||||
| char* argv0; | ||||
| int timeout; | ||||
| char* url; | ||||
| int verbose; | ||||
|  | ||||
| static int b64_decode_table[256] = { | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 00-0F */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 10-1F */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,  /* 20-2F */ | ||||
| 	52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,  /* 30-3F */ | ||||
| 	-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,  /* 40-4F */ | ||||
| 	15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,  /* 50-5F */ | ||||
| 	-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,  /* 60-6F */ | ||||
| 	41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,  /* 70-7F */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 80-8F */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 90-9F */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* A0-AF */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* B0-BF */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* C0-CF */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* D0-DF */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* E0-EF */ | ||||
| 	-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1   /* F0-FF */ | ||||
| }; | ||||
|  | ||||
| static char b64_encode_table[64] = { | ||||
| 	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',  /* 0-7 */ | ||||
| 	'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',  /* 8-15 */ | ||||
| 	'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',  /* 16-23 */ | ||||
| 	'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',  /* 24-31 */ | ||||
| 	'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',  /* 32-39 */ | ||||
| 	'o', 'p', 'q', 'r', 's', 't', 'u', 'v',  /* 40-47 */ | ||||
| 	'w', 'x', 'y', 'z', '0', '1', '2', '3',  /* 48-55 */ | ||||
| 	'4', '5', '6', '7', '8', '9', '+', '/'   /* 56-63 */ | ||||
| }; | ||||
|              | ||||
| int b64_encode(unsigned char* ptr, int len, char* space, int size); | ||||
| void check(void* ptr); | ||||
| off_t file_bytes(const char* filename); | ||||
| int file_copy(const char* filename, char* buf); | ||||
| int getURL(char* url, char* referer, char* user_agent, char* auth_token, int ncookies, char** cookies, char* header_name, char* header_value); | ||||
| int getURLbyParts(int protocol, char* host, unsigned short port, char* file, char* referer, char* user_agent, char* auth_token, int ncookies, char** cookies, char* header_name, char* header_value); | ||||
| void* malloc_check(size_t size); | ||||
| int open_client_socket(char* hostname, unsigned short port); | ||||
| void postURL(char* url, char* referer, char* user_agent, char* auth_token, int ncookies, char** cookies, char* header_name, char* header_value, char** args, int argc); | ||||
| void postURLbyParts(int protocol, char* host, unsigned short port, char* file, char* referer, char* user_agent, char* auth_token, int ncookies, char** cookies, char* header_name, char* header_value, char** args, int argc); | ||||
| void show_error(char* cause); | ||||
| void sigcatch(int sig); | ||||
| void strencode(char* to, char* from); | ||||
| void usage(); | ||||
|  | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user