Bit more debugging
This commit is contained in:
@ -224,7 +224,7 @@ int websocket_handler(Socket *socket, stds *pipes) {
|
|||||||
|
|
||||||
int c = fgetc(pipes->stdout);
|
int c = fgetc(pipes->stdout);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
socket->receive(pipes->stdin);
|
long rec = socket->receive(pipes->stdin);
|
||||||
} else {
|
} else {
|
||||||
ungetc(c, pipes->stdout);
|
ungetc(c, pipes->stdout);
|
||||||
socket->send(pipes->stdout);
|
socket->send(pipes->stdout);
|
||||||
|
@ -383,16 +383,19 @@ string Socket::receive(const char *until, unsigned long strlen) {
|
|||||||
return receive(string(until, strlen));
|
return receive(string(until, strlen));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Socket::receive(FILE *file) {
|
long Socket::receive(FILE *file) {
|
||||||
char buffer[CPPNET_CHUNK];
|
char buffer[CPPNET_CHUNK];
|
||||||
long len = 0;
|
long len;
|
||||||
|
long rec = 0;
|
||||||
do {
|
do {
|
||||||
len = receive((void*) buffer, CPPNET_CHUNK);
|
len = receive((void*) buffer, CPPNET_CHUNK);
|
||||||
fwrite(buffer, 1, CPPNET_CHUNK, file);
|
fwrite(buffer, 1, CPPNET_CHUNK, file);
|
||||||
|
rec += len;
|
||||||
} while (len > 0 && len == CPPNET_CHUNK);
|
} while (len > 0 && len == CPPNET_CHUNK);
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Socket::receive(FILE *file, long size) {
|
long Socket::receive(FILE *file, long size) {
|
||||||
char buffer[CPPNET_CHUNK];
|
char buffer[CPPNET_CHUNK];
|
||||||
long len = 0;
|
long len = 0;
|
||||||
long rec = 0;
|
long rec = 0;
|
||||||
@ -401,6 +404,7 @@ void Socket::receive(FILE *file, long size) {
|
|||||||
fwrite(buffer, 1, len, file);
|
fwrite(buffer, 1, len, file);
|
||||||
rec += len;
|
rec += len;
|
||||||
}
|
}
|
||||||
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Socket::receiveLine() {
|
string Socket::receiveLine() {
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
string receive(const char *until);
|
string receive(const char *until);
|
||||||
|
|
||||||
void receive(FILE *file);
|
long receive(FILE *file);
|
||||||
|
|
||||||
string receiveLine();
|
string receiveLine();
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ public:
|
|||||||
|
|
||||||
static long select(list<Socket> read, list<Socket> write);
|
static long select(list<Socket> read, list<Socket> write);
|
||||||
|
|
||||||
void receive(FILE *file, long size);
|
long receive(FILE *file, long size);
|
||||||
};
|
};
|
||||||
|
|
||||||
Socket operator<<(Socket sock, const char *str);
|
Socket operator<<(Socket sock, const char *str);
|
||||||
|
Reference in New Issue
Block a user