Killed sys-strings.h (replaced with glib functions)
This commit is contained in:
parent
01b5ea8ff2
commit
0ec334c887
|
@ -210,6 +210,5 @@
|
|||
#include <lighttpd/sys-mmap.h>
|
||||
#include <lighttpd/sys-process.h>
|
||||
#include <lighttpd/sys-socket.h>
|
||||
#include <lighttpd/sys-strings.h>
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#ifndef _SYS_STRINGS_H_
|
||||
#define _SYS_STRINGS_H_
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
#include <stdlib.h>
|
||||
#define str_to_off_t(p, e, b) _strtoi64(p, e, b)
|
||||
#define STR_OFF_T_MAX LLONG_MAX
|
||||
#define STR_OFF_T_MIN LLONG_MIN
|
||||
#define strtoull _strtoui64
|
||||
#ifdef __MINGW32__
|
||||
/* missing prototype */
|
||||
unsigned __int64 _strtoui64(
|
||||
const char *nptr,
|
||||
char **endptr,
|
||||
int base
|
||||
);
|
||||
__int64 _strtoi64(
|
||||
const char *nptr,
|
||||
char **endptr,
|
||||
int base
|
||||
);
|
||||
#endif
|
||||
#else /** we are a unix */
|
||||
#include <stdlib.h>
|
||||
/**
|
||||
* we use strtoll() for parsing the ranges into a off_t
|
||||
*
|
||||
* if off_t is 32bit, we can use strtol() instead
|
||||
*/
|
||||
#if SIZEOF_OFF_T == SIZEOF_LONG
|
||||
#define str_to_off_t(p, e, b) strtol(p, e, b)
|
||||
#define STR_OFF_T_MAX LONG_MAX
|
||||
#define STR_OFF_T_MIN LONG_MIN
|
||||
#elif defined(HAVE_STRTOLL)
|
||||
#define str_to_off_t(p, e, b) strtoll(p, e, b)
|
||||
#define STR_OFF_T_MAX LLONG_MAX
|
||||
#define STR_OFF_T_MIN LLONG_MIN
|
||||
#else
|
||||
#error off_t is more than 4 bytes but we can not parse it with strtol() (run autogen.sh again if you build from svn)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -143,10 +143,10 @@ gboolean request_validate_header(connection *con) {
|
|||
hh = http_header_lookup(req->headers, CONST_STR_LEN("content-length"));
|
||||
if (hh) {
|
||||
const gchar *val = HEADER_VALUE(hh);
|
||||
off_t r;
|
||||
gint64 r;
|
||||
char *err;
|
||||
|
||||
r = str_to_off_t(val, &err, 10);
|
||||
r = g_ascii_strtoll(val, &err, 10);
|
||||
if (*err != '\0') {
|
||||
_DEBUG(con->srv, con->mainvr, "content-length is not a number: %s (Status: 400)", err);
|
||||
bad_request(con, 400); /* bad request */
|
||||
|
@ -165,8 +165,7 @@ gboolean request_validate_header(connection *con) {
|
|||
/**
|
||||
* check if we had a over- or underrun in the string conversion
|
||||
*/
|
||||
if (r == STR_OFF_T_MIN ||
|
||||
r == STR_OFF_T_MAX) {
|
||||
if (r == G_MININT64 || r == G_MAXINT64) {
|
||||
if (errno == ERANGE) {
|
||||
bad_request(con, 413); /* Request Entity Too Large */
|
||||
return FALSE;
|
||||
|
@ -183,7 +182,7 @@ gboolean request_validate_header(connection *con) {
|
|||
|
||||
for ( ; l ; l = http_header_find_next(l, CONST_STR_LEN("expect")) ) {
|
||||
hh = (http_header*) l->data;
|
||||
if (0 == strcasecmp( HEADER_VALUE(hh), "100-continue" )) {
|
||||
if (0 == g_strcasecmp( HEADER_VALUE(hh), "100-continue" )) {
|
||||
expect_100_cont = TRUE;
|
||||
} else {
|
||||
/* we only support 100-continue */
|
||||
|
|
Loading…
Reference in New Issue