Browse Source

[core] disperse settings.h to appropriate headers

master
Glenn Strauss 1 year ago
parent
commit
e1bb579361
  1. 2
      src/Makefile.am
  2. 1
      src/array.c
  3. 1
      src/buffer.c
  4. 6
      src/buffer.h
  5. 4
      src/chunk.h
  6. 2
      src/connections-glue.c
  7. 2
      src/connections.c
  8. 2
      src/gw_backend.c
  9. 12
      src/http-header-glue.c
  10. 25
      src/settings.h

2
src/Makefile.am

@ -451,7 +451,7 @@ mod_wstunnel_la_LIBADD = $(common_libadd) $(CRYPTO_LIB)
hdr = base64.h buffer.h burl.h network.h log.h http_kv.h keyvalue.h \
response.h request.h fastcgi.h chunk.h \
first.h settings.h http_chunk.h \
first.h http_chunk.h \
algo_sha1.h md5.h http_auth.h http_header.h http_vhostdb.h stream.h \
fdevent.h gw_backend.h connections.h base.h base_decls.h stat_cache.h \
plugin.h plugin_config.h \

1
src/array.c

@ -2,7 +2,6 @@
#include "array.h"
#include "buffer.h"
#include "settings.h" /* BUFFER_MAX_REUSE_SIZE */
#include <string.h>
#include <stdlib.h>

1
src/buffer.c

@ -1,7 +1,6 @@
#include "first.h"
#include "buffer.h"
#include "settings.h" /* BUFFER_MAX_REUSE_SIZE */
#include <stdlib.h>
#include <string.h>

6
src/buffer.h

@ -4,6 +4,12 @@
struct tm; /* declaration */
/**
* max size of a buffer which will just be reset
* to ->used = 0 instead of really freeing the buffer
*/
#define BUFFER_MAX_REUSE_SIZE 4096
/* generic string + binary data container; contains a terminating 0 in both
* cases
*

4
src/chunk.h

@ -9,6 +9,10 @@
#include "buffer.h"
#include "array.h"
/* both should be way smaller than SSIZE_MAX :) */
#define MAX_READ_LIMIT (256*1024)
#define MAX_WRITE_LIMIT (256*1024)
struct log_error_st; /*(declaration)*/
typedef struct chunk {

2
src/connections-glue.c

@ -2,12 +2,12 @@
#include "sys-socket.h"
#include "base.h"
#include "chunk.h"
#include "connections.h"
#include "fdevent.h"
#include "http_header.h"
#include "log.h"
#include "response.h"
#include "settings.h" /* MAX_READ_LIMIT */
#include <stdlib.h>
#include <string.h>

2
src/connections.c

@ -3,7 +3,7 @@
#include "base.h"
#include "buffer.h"
#include "burl.h" /* HTTP_PARSEOPT_HEADER_STRICT */
#include "settings.h" /* BUFFER_MAX_REUSE_SIZE MAX_READ_LIMIT MAX_WRITE_LIMIT */
#include "chunk.h"
#include "log.h"
#include "connections.h"
#include "fdevent.h"

2
src/gw_backend.c

@ -29,11 +29,11 @@
#include "base.h"
#include "array.h"
#include "buffer.h"
#include "chunk.h"
#include "crc32.h"
#include "fdevent.h"
#include "log.h"
#include "sock_addr.h"
#include "settings.h" /* MAX_WRITE_LIMIT */

12
src/http-header-glue.c

@ -3,6 +3,7 @@
#include "base.h"
#include "array.h"
#include "buffer.h"
#include "chunk.h"
#include "fdevent.h"
#include "log.h"
#include "etag.h"
@ -11,7 +12,6 @@
#include "response.h"
#include "sock_addr.h"
#include "stat_cache.h"
#include "settings.h" /* MAX_HTTP_REQUEST_HEADER MAX_READ_LIMIT */
#include <stdlib.h>
#include <string.h>
@ -23,6 +23,12 @@
#include "sys-socket.h"
#include <unistd.h>
/**
* max size of the HTTP response header from backends
* (differs from server.max-request-field-size for max request field size)
*/
#define MAX_HTTP_RESPONSE_FIELD_SIZE 65535
static int http_response_buffer_append_authority(request_st * const r, buffer * const o) {
if (!buffer_string_is_empty(&r->uri.authority)) {
@ -1133,9 +1139,7 @@ handler_t http_response_parse_headers(request_st * const r, http_response_opts *
}
if (!is_header_end) {
/*(reuse MAX_HTTP_REQUEST_HEADER as max size
* for response headers from backends)*/
if (header_len > MAX_HTTP_REQUEST_HEADER) {
if (header_len > MAX_HTTP_RESPONSE_FIELD_SIZE) {
log_error(r->conf.errh, __FILE__, __LINE__,
"response headers too large for %s", r->uri.path.ptr);
r->http_status = 502; /* Bad Gateway */

25
src/settings.h

@ -1,25 +0,0 @@
#ifndef _LIGHTTPD_SETTINGS_H_
#define _LIGHTTPD_SETTINGS_H_
#include "first.h"
/**
* max size of a buffer which will just be reset
* to ->used = 0 instead of really freeing the buffer
*
* 64kB (no real reason, just a guess)
*/
#define BUFFER_MAX_REUSE_SIZE (4 * 1024)
/* both should be way smaller than SSIZE_MAX :) */
#define MAX_READ_LIMIT (256*1024)
#define MAX_WRITE_LIMIT (256*1024)
/**
* max size of the HTTP request header
*
* 32k should be enough for everything (just a guess)
*
*/
#define MAX_HTTP_REQUEST_HEADER (32 * 1024)
#endif
Loading…
Cancel
Save