Commit ff206e56 authored by Max Lv's avatar Max Lv

update to 1.3 with polipo support

parent 0baa43b0
......@@ -11,6 +11,9 @@ tests/bin
tests/gen
tests/local.properties
NUL
libs/armeabi/polipo
libs/armeabi/pdnsd
libs/armeabi/shadowsocks
#Intellij IDEA
*.iml
......
......@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:installLocation="auto"
android:versionCode="9"
android:versionName="1.2.0">
android:versionCode="10"
android:versionName="1.3">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
......
File added
......@@ -16,6 +16,19 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
POLIPO_SOURCES := util.c event.c io.c chunk.c atom.c object.c log.c diskcache.c main.c \
config.c local.c http.c client.c server.c auth.c tunnel.c \
http_parse.c parse_time.c dns.c forbidden.c \
md5.c fts_compat.c socks.c mingw.c
LOCAL_MODULE := polipo
LOCAL_SRC_FILES := $(addprefix polipo/, $(POLIPO_SOURCES))
LOCAL_CFLAGS := -O2 -g -DHAS_STDINT_H -DNO_DISK_CACHE -DNO_SYSLOG -I$(LOCAL_PATH)/polipo
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := libev
LOCAL_CFLAGS += -O2 -DNDEBUG -DHAVE_CONFIG_H
LOCAL_SRC_FILES := \
......
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "polipo.h"
/* Atoms are interned, read-only reference-counted strings.
Interned means that equality of atoms is equivalent to structural
equality -- you don't need to strcmp, you just compare the AtomPtrs.
This property is used throughout Polipo, e.g. to speed up the HTTP
parser.
Polipo's atoms may contain NUL bytes -- you can use internAtomN to
store any random binary data within an atom. However, Polipo always
terminates your data, so if you store textual data in an atom, you
may use the result of atomString as though it were a (read-only)
C string.
*/
static AtomPtr *atomHashTable;
int used_atoms;
void
initAtoms()
{
atomHashTable = calloc((1 << LOG2_ATOM_HASH_TABLE_SIZE),
sizeof(AtomPtr));
if(atomHashTable == NULL) {
do_log(L_ERROR, "Couldn't allocate atom hash table.\n");
exit(1);
}
used_atoms = 0;
}
AtomPtr
internAtomN(const char *string, int n)
{
AtomPtr atom;
int h;
if(n < 0 || n >= (1 << (8 * sizeof(unsigned short))))
return NULL;
h = hash(0, string, n, LOG2_ATOM_HASH_TABLE_SIZE);
atom = atomHashTable[h];
while(atom) {
if(atom->length == n &&
(n == 0 || memcmp(atom->string, string, n) == 0))
break;
atom = atom->next;
}
if(!atom) {
atom = malloc(sizeof(AtomRec) - 1 + n + 1);
if(atom == NULL) {
return NULL;
}
atom->refcount = 0;
atom->length = n;
/* Atoms are used both for binary data and strings. To make
their use as strings more convenient, atoms are always
NUL-terminated. */
memcpy(atom->string, string, n);
atom->string[n] = '\0';
atom->next = atomHashTable[h];
atomHashTable[h] = atom;
used_atoms++;
}
do_log(D_ATOM_REFCOUNT, "A 0x%lx %d++\n",
(unsigned long)atom, atom->refcount);
atom->refcount++;
return atom;
}
AtomPtr
internAtom(const char *string)
{
return internAtomN(string, strlen(string));
}
AtomPtr
atomCat(AtomPtr atom, const char *string)
{
char buf[128];
char *s = buf;
AtomPtr newAtom;
int n = strlen(string);
if(atom->length + n > 128) {
s = malloc(atom->length + n + 1);
if(s == NULL)
return NULL;
}
memcpy(s, atom->string, atom->length);
memcpy(s + atom->length, string, n);
newAtom = internAtomN(s, atom->length + n);
if(s != buf) free(s);
return newAtom;
}
int
atomSplit(AtomPtr atom, char c, AtomPtr *return1, AtomPtr *return2)
{
char *p;
AtomPtr atom1, atom2;
p = memchr(atom->string, c, atom->length);
if(p == NULL)
return 0;
atom1 = internAtomN(atom->string, p - atom->string);
if(atom1 == NULL)
return -ENOMEM;
atom2 = internAtomN(p + 1, atom->length - (p + 1 - atom->string));
if(atom2 == NULL) {
releaseAtom(atom1);
return -ENOMEM;
}
*return1 = atom1;
*return2 = atom2;
return 1;
}
AtomPtr
internAtomLowerN(const char *string, int n)
{
char *s;
char buf[100];
AtomPtr atom;
if(n < 0 || n >= 50000)
return NULL;
if(n < 100) {
s = buf;
} else {
s = malloc(n);
if(s == NULL)
return NULL;
}
lwrcpy(s, string, n);
atom = internAtomN(s, n);
if(s != buf) free(s);
return atom;
}
AtomPtr
retainAtom(AtomPtr atom)
{
if(atom == NULL)
return NULL;
do_log(D_ATOM_REFCOUNT, "A 0x%lx %d++\n",
(unsigned long)atom, atom->refcount);
assert(atom->refcount >= 1 && atom->refcount < LARGE_ATOM_REFCOUNT);
atom->refcount++;
return atom;
}
void
releaseAtom(AtomPtr atom)
{
if(atom == NULL)
return;
do_log(D_ATOM_REFCOUNT, "A 0x%lx %d--\n",
(unsigned long)atom, atom->refcount);
assert(atom->refcount >= 1 && atom->refcount < LARGE_ATOM_REFCOUNT);
atom->refcount--;
if(atom->refcount == 0) {
int h = hash(0, atom->string, atom->length, LOG2_ATOM_HASH_TABLE_SIZE);
assert(atomHashTable[h] != NULL);
if(atom == atomHashTable[h]) {
atomHashTable[h] = atom->next;
free(atom);
} else {
AtomPtr previous = atomHashTable[h];
while(previous->next) {
if(previous->next == atom)
break;
previous = previous->next;
}
assert(previous->next != NULL);
previous->next = atom->next;
free(atom);
}
used_atoms--;
}
}
AtomPtr
internAtomF(const char *format, ...)
{
char *s;
char buf[150];
int n;
va_list args;
AtomPtr atom = NULL;
va_start(args, format);
n = vsnprintf(buf, 150, format, args);
va_end(args);
if(n >= 0 && n < 150) {
atom = internAtomN(buf, n);
} else {
va_start(args, format);
s = vsprintf_a(format, args);
va_end(args);
if(s != NULL) {
atom = internAtom(s);
free(s);
}
}
return atom;
}
static AtomPtr
internAtomErrorV(int e, const char *f, va_list args)
{
char *es = pstrerror(e);
AtomPtr atom;
char *s1, *s2;
int n, rc;
if(f) {
s1 = vsprintf_a(f, args);
if(s1 == NULL)
return NULL;
n = strlen(s1);
} else {
s1 = NULL;
n = 0;
}
s2 = malloc(n + 70);
if(s2 == NULL) {
free(s1);
return NULL;
}
if(s1) {
strcpy(s2, s1);
free(s1);
}
rc = snprintf(s2 + n, 69, f ? ": %s" : "%s", es);
if(rc < 0 || rc >= 69) {
free(s2);
return NULL;
}
atom = internAtomN(s2, n + rc);
free(s2);
return atom;
}
AtomPtr
internAtomError(int e, const char *f, ...)
{
AtomPtr atom;
va_list args;
va_start(args, f);
atom = internAtomErrorV(e, f, args);
va_end(args);
return atom;
}
char *
atomString(AtomPtr atom)
{
if(atom)
return atom->string;
else
return "(null)";
}
AtomListPtr
makeAtomList(AtomPtr *atoms, int n)
{
AtomListPtr list;
list = malloc(sizeof(AtomListRec));
if(list == NULL) return NULL;
list->length = 0;
list->size = 0;
list->list = NULL;
if(n > 0) {
int i;
list->list = malloc(n * sizeof(AtomPtr));
if(list->list == NULL) {
free(list);
return NULL;
}
list->size = n;
for(i = 0; i < n; i++)
list->list[i] = atoms[i];
list->length = n;
}
return list;
}
void
destroyAtomList(AtomListPtr list)
{
int i;
if(list->list) {
for(i = 0; i < list->length; i++)
releaseAtom(list->list[i]);
list->length = 0;
free(list->list);
list->list = NULL;
list->size = 0;
}
assert(list->size == 0);
free(list);
}
int
atomListMember(AtomPtr atom, AtomListPtr list)
{
int i;
for(i = 0; i < list->length; i++) {
if(atom == list->list[i])
return 1;
}
return 0;
}
void
atomListCons(AtomPtr atom, AtomListPtr list)
{
if(list->list == NULL) {
assert(list->size == 0);
list->list = malloc(5 * sizeof(AtomPtr));
if(list->list == NULL) {
do_log(L_ERROR, "Couldn't allocate AtomList\n");
return;
}
list->size = 5;
}
if(list->size <= list->length) {
AtomPtr *new_list;
int n = (2 * list->length + 1);
new_list = realloc(list->list, n * sizeof(AtomPtr));
if(new_list == NULL) {
do_log(L_ERROR, "Couldn't realloc AtomList\n");
return;
}
list->list = new_list;
list->size = n;
}
list->list[list->length] = atom;
list->length++;
}
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
typedef struct _Atom {
unsigned int refcount;
struct _Atom *next;
unsigned short length;
char string[1];
} AtomRec, *AtomPtr;
typedef struct _AtomList {
int length;
int size;
AtomPtr *list;
} AtomListRec, *AtomListPtr;
#define LOG2_ATOM_HASH_TABLE_SIZE 10
#define LARGE_ATOM_REFCOUNT 0xFFFFFF00U
extern int used_atoms;
void initAtoms(void);
AtomPtr internAtom(const char *string);
AtomPtr internAtomN(const char *string, int n);
AtomPtr internAtomLowerN(const char *string, int n);
AtomPtr atomCat(AtomPtr atom, const char *string);
int atomSplit(AtomPtr atom, char c, AtomPtr *return1, AtomPtr *return2);
AtomPtr retainAtom(AtomPtr atom);
void releaseAtom(AtomPtr atom);
AtomPtr internAtomError(int e, const char *f, ...)
ATTRIBUTE ((format (printf, 2, 3)));
AtomPtr internAtomF(const char *format, ...)
ATTRIBUTE ((format (printf, 1, 2)));
char *atomString(AtomPtr) ATTRIBUTE ((pure));
AtomListPtr makeAtomList(AtomPtr *atoms, int n);
void destroyAtomList(AtomListPtr list);
int atomListMember(AtomPtr atom, AtomListPtr list)
ATTRIBUTE ((pure));
void atomListCons(AtomPtr atom, AtomListPtr list);
/*
Copyright (c) 2004-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "polipo.h"
int
buildClientAuthHeaders(AtomPtr url, char *word,
AtomPtr *message_return, AtomPtr *headers_return)
{
int code;
char *h;
AtomPtr message, headers;
if(urlIsLocal(url->string, url->length)) {
code = 401;
message = internAtomF("Server authentication %s", word);
h = "WWW-Authenticate";
} else {
code = 407;
message = internAtomF("Proxy authentication %s", word);
h = "Proxy-Authenticate";
}
headers = internAtomF("\r\n%s: Basic realm=\"%s\"",
h, authRealm->string);
if(message_return)
*message_return = message;
else
releaseAtom(message);
*headers_return = headers;
return code;
}
int
checkClientAuth(AtomPtr auth, AtomPtr url,
AtomPtr *message_return, AtomPtr *headers_return)
{
int code = 0;
AtomPtr message = NULL, headers = NULL;
if(authRealm == NULL || authCredentials == NULL)
return 0;
if(auth == NULL)
code = buildClientAuthHeaders(url, "required", &message, &headers);
else if(auth->length >= 6 || lwrcmp(auth->string, "basic ", 6) == 0) {
if(b64cmp(auth->string + 6, auth->length - 6,
authCredentials->string, authCredentials->length) == 0)
return 0;
code = buildClientAuthHeaders(url, "incorrect", &message, &headers);
} else {
code = buildClientAuthHeaders(url, NULL, NULL, &headers);
message = internAtom("Unexpected authentication scheme");
}
*message_return = message;
*headers_return = headers;
return code;
}
int
buildServerAuthHeaders(char* buf, int n, int size, AtomPtr authCredentials)
{
char authbuf[4 * 128 + 3];
int authlen;
if(authCredentials->length >= 3 * 128)
return -1;
authlen = b64cpy(authbuf, parentAuthCredentials->string,
parentAuthCredentials->length, 0);
n = snnprintf(buf, n, size, "\r\nProxy-Authorization: Basic ");
n = snnprint_n(buf, n, size, authbuf, authlen);
return n;
}
/*
Copyright (c) 2004-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
int checkClientAuth(AtomPtr, AtomPtr, AtomPtr*, AtomPtr*);
int buildServerAuthHeaders(char*, int, int, AtomPtr);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* A larger chunk size gets you better I/O throughput, at the cost of
higer memory usage. We assume you've got plenty of memory if you've
got 64-bit longs. */
#ifndef CHUNK_SIZE
#ifdef ULONG_MAX
#if ULONG_MAX > 4294967295UL
#define CHUNK_SIZE (8 * 1024)
#else
#define CHUNK_SIZE (4 * 1024)
#endif
#else
#define CHUNK_SIZE (4 * 1024)
#endif
#endif
#define CHUNKS(bytes) ((unsigned long)(bytes) / CHUNK_SIZE)
extern int chunkLowMark, chunkHighMark, chunkCriticalMark;
extern int used_chunks;
void preinitChunks(void);
void initChunks(void);
void *get_chunk(void) ATTRIBUTE ((malloc));
void *maybe_get_chunk(void) ATTRIBUTE ((malloc));
void dispose_chunk(void *chunk);
void free_chunk_arenas(void);
int totalChunkArenaSize(void);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
int httpAccept(int, FdEventHandlerPtr, AcceptRequestPtr);
void httpClientFinish(HTTPConnectionPtr connection, int s);
int httpClientHandler(int, FdEventHandlerPtr, StreamRequestPtr);
int httpClientNoticeError(HTTPRequestPtr, int code, struct _Atom *message);
int httpClientError(HTTPRequestPtr, int code, struct _Atom *message);
int httpClientNewError(HTTPConnectionPtr, int method, int persist,
int code, struct _Atom *message);
int httpClientRawError(HTTPConnectionPtr, int, struct _Atom*, int close);
int httpErrorStreamHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpErrorNocloseStreamHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpErrorNofinishStreamHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpClientRequest(HTTPRequestPtr request, AtomPtr url);
int httpClientRequestContinue(int forbidden_code, AtomPtr url,
AtomPtr forbidden_message,
AtomPtr forbidden_headers,
void *closure);
int httpClientDiscardBody(HTTPConnectionPtr connection);
int httpClientDiscardHandler(int, FdEventHandlerPtr, StreamRequestPtr);
int httpClientGetHandler(int, ConditionHandlerPtr);
int httpClientHandlerHeaders(FdEventHandlerPtr event,
StreamRequestPtr request,
HTTPConnectionPtr connection);
int httpClientNoticeRequest(HTTPRequestPtr request, int);
int httpServeObject(HTTPConnectionPtr);
int delayedHttpServeObject(HTTPConnectionPtr connection);
int httpServeObjectStreamHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpServeObjectStreamHandler2(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpServeObjectHandler(int, ConditionHandlerPtr);
int httpClientSideRequest(HTTPRequestPtr request);
int httpClientSideHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define CONFIG_INT 0
#define CONFIG_OCTAL 1
#define CONFIG_HEX 2
#define CONFIG_TIME 3
#define CONFIG_BOOLEAN 4
#define CONFIG_TRISTATE 5
#define CONFIG_TETRASTATE 6
#define CONFIG_PENTASTATE 7
#define CONFIG_FLOAT 8
#define CONFIG_ATOM 9
#define CONFIG_ATOM_LOWER 10
#define CONFIG_PASSWORD 11
#define CONFIG_INT_LIST 12
#define CONFIG_ATOM_LIST 13
#define CONFIG_ATOM_LIST_LOWER 14
typedef struct _ConfigVariable {
AtomPtr name;
int type;
union {
int *i;
float *f;
struct _Atom **a;
struct _AtomList **al;
struct _IntList **il;
} value;
int (*setter)(struct _ConfigVariable*, void*);
char *help;
struct _ConfigVariable *next;
} ConfigVariableRec, *ConfigVariablePtr;
#define CONFIG_VARIABLE(name, type, help) \
CONFIG_VARIABLE_SETTABLE(name, type, NULL, help)
#define CONFIG_VARIABLE_SETTABLE(name, type, setter, help) \
declareConfigVariable(internAtom(#name), type, &name, setter, help)
void declareConfigVariable(AtomPtr name, int type, void *value,
int (*setter)(ConfigVariablePtr, void*),
char *help);
void printConfigVariables(FILE *out, int html);
int parseConfigLine(char *line, char *filename, int lineno, int set);
int parseConfigFile(AtomPtr);
int configIntSetter(ConfigVariablePtr, void*);
int configFloatSetter(ConfigVariablePtr, void*);
int configAtomSetter(ConfigVariablePtr, void*);
/*
Implementation of POSIX directory browsing functions and types for Win32.
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
History: Created March 1997. Updated June 2003.
Rights: See end of file.
*/
#ifdef WIN32
#include "dirent_compat.h"
#include <errno.h>
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
#include <stdlib.h>
#include <string.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct DIR
{
long handle; /* -1 for failed rewind */
struct _finddata_t info;
struct dirent result; /* d_name null iff first time */
char *name; /* null-terminated char string */
};
DIR *opendir(const char *name)
{
DIR *dir = 0;
if(name && name[0])
{
size_t base_length = strlen(name);
const char *all = /* search pattern must end with suitable wildcard */
strchr("/\\", name[base_length - 1]) ? "*" : "/*";
if((dir = (DIR *) malloc(sizeof *dir)) != 0 &&
(dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0)
{
strcat(strcpy(dir->name, name), all);
if((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1)
{
dir->result.d_name = 0;
}
else /* rollback */
{
free(dir->name);
free(dir);
dir = 0;
}
}
else /* rollback */
{
free(dir);
dir = 0;
errno = ENOMEM;
}
}
else
{
errno = EINVAL;
}
return dir;
}
int closedir(DIR *dir)
{
int result = -1;
if(dir)
{
if(dir->handle != -1)
{
result = _findclose(dir->handle);
}
free(dir->name);
free(dir);
}
if(result == -1) /* map all errors to EBADF */
{
errno = EBADF;
}
return result;
}
struct dirent *readdir(DIR *dir)
{
struct dirent *result = 0;
if(dir && dir->handle != -1)
{
if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
{
result = &dir->result;
result->d_name = dir->info.name;
}
}
else
{
errno = EBADF;
}
return result;
}
void rewinddir(DIR *dir)
{
if(dir && dir->handle != -1)
{
_findclose(dir->handle);
dir->handle = (long) _findfirst(dir->name, &dir->info);
dir->result.d_name = 0;
}
else
{
errno = EBADF;
}
}
#ifdef __cplusplus
}
#endif
#endif
/*
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided
that this copyright and permissions notice appear in all copies and
derivatives.
This software is supplied "as is" without express or implied warranty.
But that said, if there are any problems please get in touch.
*/
#ifndef DIRENT_INCLUDED
#define DIRENT_INCLUDED
/*
Declaration of POSIX directory browsing functions and types for Win32.
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
History: Created March 1997. Updated June 2003.
Rights: See end of file.
*/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct DIR DIR;
struct dirent
{
char *d_name;
};
DIR *opendir(const char *);
int closedir(DIR *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
/*
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided
that this copyright and permissions notice appear in all copies and
derivatives.
This software is supplied "as is" without express or implied warranty.
But that said, if there are any problems please get in touch.
*/
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
/*
Copyright (c) 2003-2010 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
extern int maxDiskEntries;
extern AtomPtr diskCacheRoot;
extern AtomPtr additionalDiskCacheRoot;
typedef struct _DiskCacheEntry {
char *filename;
ObjectPtr object;
int fd;
off_t offset;
off_t size;
int body_offset;
short local;
short metadataDirty;
struct _DiskCacheEntry *next;
struct _DiskCacheEntry *previous;
} *DiskCacheEntryPtr, DiskCacheEntryRec;
typedef struct _DiskObject {
char *location;
char *filename;
int body_offset;
int length;
int size;
time_t age;
time_t access;
time_t date;
time_t last_modified;
time_t expires;
struct _DiskObject *next;
} DiskObjectRec, *DiskObjectPtr;
struct stat;
extern int maxDiskCacheEntrySize;
void preinitDiskcache(void);
void initDiskcache(void);
int destroyDiskEntry(ObjectPtr object, int);
int diskEntrySize(ObjectPtr object);
ObjectPtr objectGetFromDisk(ObjectPtr);
int objectFillFromDisk(ObjectPtr object, int offset, int chunks);
int writeoutMetadata(ObjectPtr object);
int writeoutToDisk(ObjectPtr object, int upto, int max);
void dirtyDiskEntry(ObjectPtr object);
int revalidateDiskEntry(ObjectPtr object);
DiskObjectPtr readDiskObject(char *filename, struct stat *sb);
void indexDiskObjects(FILE *out, const char *root, int r);
void expireDiskObjects(void);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
extern char *nameServer;
extern int useGethostbyname;
#define DNS_A 0
#define DNS_CNAME 1
typedef struct _GethostbynameRequest {
AtomPtr name;
AtomPtr addr;
AtomPtr error_message;
int count;
ObjectPtr object;
int (*handler)(int, struct _GethostbynameRequest*);
void *data;
} GethostbynameRequestRec, *GethostbynameRequestPtr;
/* Note that this requires no alignment */
typedef struct _HostAddress {
char af; /* 4 or 6 */
char data[16];
} HostAddressRec, *HostAddressPtr;
void preinitDns(void);
void initDns(void);
int do_gethostbyname(char *name, int count,
int (*handler)(int, GethostbynameRequestPtr), void *data);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
extern struct timeval current_time;
extern struct timeval null_time;
extern int diskIsClean;
typedef struct _TimeEventHandler {
struct timeval time;
struct _TimeEventHandler *previous, *next;
int (*handler)(struct _TimeEventHandler*);
char data[1];
} TimeEventHandlerRec, *TimeEventHandlerPtr;
typedef struct _FdEventHandler {
short fd;
short poll_events;
struct _FdEventHandler *previous, *next;
int (*handler)(int, struct _FdEventHandler*);
char data[1];
} FdEventHandlerRec, *FdEventHandlerPtr;
typedef struct _ConditionHandler {
struct _Condition *condition;
struct _ConditionHandler *previous, *next;
int (*handler)(int, struct _ConditionHandler*);
char data[1];
} ConditionHandlerRec, *ConditionHandlerPtr;
typedef struct _Condition {
ConditionHandlerPtr handlers;
} ConditionRec, *ConditionPtr;
void initEvents(void);
void uninitEvents(void);
#ifdef HAVE_FORK
void interestingSignals(sigset_t *ss);
#endif
TimeEventHandlerPtr scheduleTimeEvent(int seconds,
int (*handler)(TimeEventHandlerPtr),
int dsize, void *data);
int timeval_minus_usec(const struct timeval *s1, const struct timeval *s2)
ATTRIBUTE((pure));
void cancelTimeEvent(TimeEventHandlerPtr);
int allocateFdEventNum(int fd);
void deallocateFdEventNum(int i);
void timeToSleep(struct timeval *);
void runTimeEventQueue(void);
FdEventHandlerPtr makeFdEvent(int fd, int poll_events,
int (*handler)(int, FdEventHandlerPtr),
int dsize, void *data);
FdEventHandlerPtr registerFdEvent(int fd, int poll_events,
int (*handler)(int, FdEventHandlerPtr),
int dsize, void *data);
FdEventHandlerPtr registerFdEventHelper(FdEventHandlerPtr event);
void unregisterFdEvent(FdEventHandlerPtr event);
void pokeFdEvent(int fd, int status, int what);
int workToDo(void);
void eventLoop(void);
ConditionPtr makeCondition(void);
void initCondition(ConditionPtr);
void signalCondition(ConditionPtr condition);
ConditionHandlerPtr
conditionWait(ConditionPtr condition,
int (*handler)(int, ConditionHandlerPtr),
int dsize, void *data);
void unregisterConditionHandler(ConditionHandlerPtr);
void abortConditionHandler(ConditionHandlerPtr);
void polipoExit(void);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
extern AtomPtr forbiddenUrl;
extern int forbiddenRedirectCode;
typedef struct _RedirectRequest {
AtomPtr url;
struct _RedirectRequest *next;
int (*handler)(int, AtomPtr, AtomPtr, AtomPtr, void*);
void *data;
} RedirectRequestRec, *RedirectRequestPtr;
void preinitForbidden(void);
void initForbidden(void);
int urlIsUncachable(char *url, int length);
int urlForbidden(AtomPtr url,
int (*handler)(int, AtomPtr, AtomPtr, AtomPtr, void*),
void *closure);
void redirectorKill(void);
int redirectorStreamHandler1(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest);
int redirectorStreamHandler2(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest);
void redirectorTrigger(void);
int
runRedirector(pid_t *pid_return, int *read_fd_return, int *write_fd_return);
int tunnelIsMatched(char *url, int lurl, char *hostname, int lhost);
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _FTS_COMPAT_H
#define _FTS_COMPAT_H
#ifndef FTS_MAX_DEPTH
#define FTS_MAX_DEPTH 4
#endif
#define FTS_LOGICAL 1
#define FTS_F 1
#define FTS_D 2
#define FTS_DP 3
#define FTS_DC 4
#define FTS_NS 5
#define FTS_NSOK 6
#define FTS_DNR 7
#define FTS_SLNONE 8
#define FTS_DEFAULT 9
#define FTS_ERR 10
struct _FTSENT {
unsigned short fts_info;
char *fts_path;
char *fts_accpath;
struct stat *fts_statp;
int fts_errno;
};
typedef struct _FTSENT FTSENT;
struct _FTS {
int depth;
DIR *dir[FTS_MAX_DEPTH];
char *cwd0, *cwd;
struct _FTSENT ftsent;
struct stat ftstat;
char *dname;
};
typedef struct _FTS FTS;
FTS* fts_open(char * const *path_argv, int options,
int (*compar)(const FTSENT **, const FTSENT **));
int fts_close(FTS *fts);
FTSENT * fts_read(FTS *fts);
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "polipo.h"
#ifndef HAVE_FTS
#include "fts_compat.c"
#else
static int dummy ATTRIBUTE((unused));
#endif
#ifdef HAVE_FTS
#include <fts.h>
#else
#include "fts_compat.h"
#endif
This diff is collapsed.
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
typedef struct _HTTPCondition {
time_t ims;
time_t inms;
char *im;
char *inm;
char *ifrange;
} HTTPConditionRec, *HTTPConditionPtr;
typedef struct _HTTPRequest {
int flags;
struct _HTTPConnection *connection;
ObjectPtr object;
int method;
int from;
int to;
CacheControlRec cache_control;
HTTPConditionPtr condition;
AtomPtr via;
struct _ConditionHandler *chandler;
ObjectPtr can_mutate;
int error_code;
struct _Atom *error_message;
struct _Atom *error_headers;
AtomPtr headers;
struct timeval time0, time1;
struct _HTTPRequest *request;
struct _HTTPRequest *next;
} HTTPRequestRec, *HTTPRequestPtr;
/* request->flags */
#define REQUEST_PERSISTENT 1
#define REQUEST_REQUESTED 2
#define REQUEST_WAIT_CONTINUE 4
#define REQUEST_FORCE_ERROR 8
#define REQUEST_PIPELINED 16
typedef struct _HTTPConnection {
int flags;
int fd;
char *buf;
int len;
int offset;
HTTPRequestPtr request;
HTTPRequestPtr request_last;
int serviced;
int version;
int time;
TimeEventHandlerPtr timeout;
int te;
char *reqbuf;
int reqlen;
int reqbegin;
int reqoffset;
int bodylen;
int reqte;
/* For server connections */
int chunk_remaining;
struct _HTTPServer *server;
int pipelined;
int connecting;
} HTTPConnectionRec, *HTTPConnectionPtr;
/* connection->flags */
#define CONN_READER 1
#define CONN_WRITER 2
#define CONN_SIDE_READER 4
#define CONN_BIGBUF 8
#define CONN_BIGREQBUF 16
/* request->method */
#define METHOD_UNKNOWN -1
#define METHOD_NONE -1
#define METHOD_GET 0
#define METHOD_HEAD 1
#define METHOD_CONDITIONAL_GET 2
#define METHOD_CONNECT 3
#define METHOD_POST 4
#define METHOD_PUT 5
#define REQUEST_SIDE(request) ((request)->method >= METHOD_POST)
/* server->version */
#define HTTP_10 0
#define HTTP_11 1
#define HTTP_UNKNOWN -1
/* connection->te */
#define TE_IDENTITY 0
#define TE_CHUNKED 1
#define TE_UNKNOWN -1
/* connection->connecting */
#define CONNECTING_DNS 1
#define CONNECTING_CONNECT 2
#define CONNECTING_SOCKS 3
/* the results of a conditional request. 200, 304 and 412. */
#define CONDITION_MATCH 0
#define CONDITION_NOT_MODIFIED 1
#define CONDITION_FAILED 2
extern int disableProxy;
extern AtomPtr proxyName;
extern int proxyPort;
extern int clientTimeout, serverTimeout, serverIdleTimeout;
extern int bigBufferSize;
extern AtomPtr proxyAddress;
extern int proxyOffline;
extern int relaxTransparency;
extern AtomPtr authRealm;
extern AtomPtr authCredentials;
extern AtomPtr parentAuthCredentials;
extern AtomListPtr allowedClients;
extern NetAddressPtr allowedNets;
extern IntListPtr allowedPorts;
extern IntListPtr tunnelAllowedPorts;
extern int expectContinue;
extern AtomPtr atom100Continue;
extern int disableVia;
extern int dontTrustVaryETag;
void preinitHttp(void);
void initHttp(void);
int httpTimeoutHandler(TimeEventHandlerPtr);
int httpSetTimeout(HTTPConnectionPtr connection, int secs);
int httpWriteObjectHeaders(char *buf, int offset, int len,
ObjectPtr object, int from, int to);
int httpPrintCacheControl(char*, int, int, int, CacheControlPtr);
char *httpMessage(int) ATTRIBUTE((pure));
int htmlString(char *buf, int n, int len, char *s, int slen);
void htmlPrint(FILE *out, char *s, int slen);
HTTPConnectionPtr httpMakeConnection(void);
void httpDestroyConnection(HTTPConnectionPtr connection);
void httpConnectionDestroyBuf(HTTPConnectionPtr connection);
void httpConnectionDestroyReqbuf(HTTPConnectionPtr connection);
HTTPRequestPtr httpMakeRequest(void);
void httpDestroyRequest(HTTPRequestPtr request);
void httpQueueRequest(HTTPConnectionPtr, HTTPRequestPtr);
HTTPRequestPtr httpDequeueRequest(HTTPConnectionPtr connection);
int httpConnectionBigify(HTTPConnectionPtr);
int httpConnectionBigifyReqbuf(HTTPConnectionPtr);
int httpConnectionUnbigify(HTTPConnectionPtr);
int httpConnectionUnbigifyReqbuf(HTTPConnectionPtr);
HTTPConditionPtr httpMakeCondition(void);
void httpDestroyCondition(HTTPConditionPtr condition);
int httpCondition(ObjectPtr, HTTPConditionPtr);
int httpWriteErrorHeaders(char *buf, int size, int offset, int do_body,
int code, AtomPtr message, int close, AtomPtr,
char *url, int url_len, char *etag);
AtomListPtr urlDecode(char*, int);
void httpTweakCachability(ObjectPtr);
int httpHeaderMatch(AtomPtr header, AtomPtr headers1, AtomPtr headers2);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdlib.h>
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#define HAS_STDINT_H
#else
typedef unsigned int my_uint32_t;
#undef uint32_t
#define uint32_t my_uint32_t
#endif
#include "md5.c"
#undef uint32_t
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment