mirror of
https://github.com/fumiama/C302.git
synced 2024-11-17 13:37:09 +09:00
fix
This commit is contained in:
parent
a813727662
commit
6298cfc645
8
c302.c
8
c302.c
@ -22,8 +22,8 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
unsigned int i = rand() % (sizeof(urls)/sizeof(char*));
|
uint32_t i = rand() % (sizeof(urls)/sizeof(char*));
|
||||||
const struct iovec iov[3] = {{HTTP302HEAD, sizeof(HTTP302HEAD)}, {(void *)urls[i], urlsl[i]}, {"\r\n\r\n", 4}};
|
uint32_t len = sizeof(HTTP302HEAD) - 1 + urlsl[i];
|
||||||
writev(1, (const struct iovec *)&iov, 3);
|
const struct iovec iov[3] = {{(void *)&len, sizeof(uint32_t)}, {HTTP302HEAD, sizeof(HTTP302HEAD)-1}, {(void *)urls[i], urlsl[i]}};
|
||||||
return 0;
|
return writev(1, (const struct iovec *)&iov, 3) != len+sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
2
c302.h
2
c302.h
@ -4,7 +4,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SERVER_STRING "Server: C302 by Fumiama/1.0\r\n"
|
#define SERVER_STRING "Server: C302 by Fumiama/1.0\r\n"
|
||||||
#define HTTP302 "HTTP/1.0 302 Moved Temporarily\r\n"
|
#define HTTP302 "HTTP/1.1 302 Found\r\n"
|
||||||
#define LOCATION "Location: "
|
#define LOCATION "Location: "
|
||||||
#define HTTP302HEAD HTTP302 SERVER_STRING LOCATION
|
#define HTTP302HEAD HTTP302 SERVER_STRING LOCATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user