summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
AgeCommit message (Collapse)Author
2022-10-24remove unused references to httpd.sock; found by dante catalfamoJason McIntyre
ok florian
2022-09-21Default request message body size should be 0.YASUOKA Masahiko
ok claudio
2022-09-02Make newer mime type definitions take precedence over existing ones.Sebastian Benoit
Patch from Ben Fuller <ben -AT- bvnf -DOT- space>, helped along by florian@ ok florian@ and some mumblings from claudio who does not want okays in httpd.
2022-09-01ugly whitespaceTheo Buehler
2022-08-15Neither clt_descreq nor clt_descresp in struct client need to be void *.Claudio Jeker
They both are only used as struct http_descriptor. OK tb@
2022-08-15For FCGI_END_REQUEST reset the clt struct similar to what is done in theClaudio Jeker
file and other cases. Especially when the session uses keep-alive it is important to set TOREAD_HTTP_HEADER so that the state machine knows what's next. OK op@
2022-08-15plug some memory leaks in server_file_index when failures occurOmar Polo
namelist and its entries are not freed if escape_html fails or if we fail in the inner loop. Move scandir later so it's closer to the for loop and handle escape_html and url_encode failures. With lots of help from tb, thanks! ok tb@
2022-08-15plug a fd leak in read_errdoc if fstat fails or if the file is emptyOmar Polo
tweak/ok tb@
2022-08-12Use break instead of return so that a HEAD request still consumes all data.Claudio Jeker
OK op@
2022-08-12fix regression introduced in previous commit. HEAD replies don't have aOmar Polo
body so server_fcgi_error shouldn't print the end marker. OK claudio@
2022-08-11correctly handle an abnormal fastcgi termination. httpd handles theOmar Polo
disconnection from the fastcgi application via server_file_error which assumes that the reply was completey done. However, if the fastcgi reply wasn't complete (e.g. because slowcgi hit the timeout) the HTTP client are left "hanging" and waiting for a reply until they give up. This adds a server_fcgi_error callback to handle the "no headers" and "incomplete data" cases and properly close the reply before falling back to server_file_error. OK claudio@
2022-03-09bandwith -> bandwidthJonathan Gray
2022-03-04Only provide the .gz file if timestamp is >= the non-gzip file. MakeTheo de Raadt
sure it is a regular file. Use the timestamp of the non-gzip file as the last-modified timestamp, as proposed by claudio. ok claudio bluhm millert
2022-03-02struct stat from early file inspection was being used after actual fileTheo de Raadt
open() which means the stat could refer to the wrong file. Mostly this relates to st_size use. This bug could mean that httpd sends new files truncated to the old length, saying "I am sure you have the correct file now"? Could have other bad effects. ok tb millert bluhm
2022-03-02Simplify .gz handling a bitTheo Buehler
Combine strlcpy + strlcat into a single snprintf and remove a few unnecessary parentheses. ok deraadt millert
2022-03-02Nothing uses kv_flags.Florian Obser
John (j AT bitminer.ca) pointed out that we didn't correctly initialize struct kv and might use slower KV_FLAG_GLOBBING path in kv_find depending on stack garbage. Instead of fixing the initialization just delete kv_flags from struct kv. OK claudio, tb
2022-02-27Add gzip-static option to httpd. This allows to deliver precompressedAlexander Bluhm
files with content-encoding gzip. from prx at si3t dot ch; OK tracey@
2022-02-18prefer https links in man pagesJonathan Gray
ok gnezdo@ miod@ jmc@
2021-12-04Do not setup pipes between SERVER processes, they don't talk to eachFlorian Obser
other. Since this generates a full mesh, the amount of filedescriptors needed grows quadratically with the amount of configured prefork processes. Might fix an out of filedescriptor bug that beck is seeing. OK benno
2021-11-11Move the assignment of http_query down. Also do not assign a non-mallocedClaudio Jeker
string to it since the code assumes it can call free on it. Fixes crashes noticed by tobhe@ and florian@ OK otto@ tobhe@
2021-11-05Perform stricter checking on the version string (which RFC 7230 saysSebastian Benoit
must be "HTTP" "/" DIGIT "." DIGIT), and answer 505 version not supported when the number is outside of what we support, and 400 bad request when the version format is wrong. from Ross L Richardson, thanks! ok claudio@
2021-10-24Add httpd custom error page facility. Adapted by me fromIan Darwin
https://github.com/mpfr/httpd-plus. Improvements from & (earlier version) reads fine to tracey@; improvements & OK this version benno@, florian@. Thanks.
2021-10-23* stop sending the content for head requests, even when its supplied by theSebastian Benoit
fcgi. Required by RFC 7231 and RFC 3875 section 4.3.2. * If the client sends an empty body without a Content-Lenght: do not add the Content-Lenght if it's a HEAD request. If it's a HEAD request, the Content-Lenght should show the size of the equivalent GET request, but we don't know how much that will be so don't lie. found by and fix suggested by Ross L Richardson, Thanks! Additionally: * when the fcgi supplies a Content-Length header, do not remove it and set Transfer-Encoding: chunked. Instead, leave the Content-Lenght header in place, as obviously the fcgi knows how much data will come. ok claudio@
2021-10-23annotate a 413 error with "request body too large" in the error log.Sebastian Benoit
ok claudio@
2021-10-22return unsupported version for version less than HTTP/0.9 and higherSebastian Benoit
than HTTP/1.9. Downgrade version >= HTTP/1.2++ to 1.1. Found by "J. K." (openbsd DOT list AT krottmayer DOT com) ok claudio@
2021-10-21when a client sends header lines without a colon, respond with 400 BadSebastian Benoit
Request instead of 500 Internal Server Error. ok claudio@
2021-10-15Don't declare variables as "unsigned char *" that are passed toChristian Weisgerber
functions that take "char *" arguments. Where such chars are assigned to int or passed to ctype functions, explicitly cast them to unsigned char. For OpenBSD's clang, -Wpointer-sign has been disabled by default, but when the parse.y code was built elsewhere, the compiler would complain. With help from millert@ ok benno@ deraadt@
2021-07-14Remove unneeded calls to tls_init(3)kn
As per the manual and lib/libtls/tls.c revision 1.79 from 2018 "Automatically handle library initialisation for libtls." initialisation is handled automatically by other tls_*(3) functions. Remove explicit tls_init() calls from base to not give the impression of it being needed. Feedback tb OK Tests mestre
2021-06-07tweak previous: avoid markup and refer to an HTTP header only by itsTheo Buehler
name as is done elsewhere on this page. pointed out by jmc
2021-06-06appease mandoc -TlintTheo Buehler
2021-06-06Add .Pp for consistency with all other config blocks.Theo Buehler
2021-05-20Fix previous.Florian Obser
Only set Content-Length when we no the body is empty and we disable chunked encoding. Otherwise we break the nextcloud app again :/ Pointed out by Matthias Pressfreund, thanks!
2021-05-19When we disable "Transfer-Encoding: chunked" in the fastcgi backendFlorian Obser
because we are going to send an empty body we have to provide "Content-Length: 0" otherwise some browsers (Firefox, Safari) just hang until httpd(8) closes the connection. Problem reported by Matthias Pressfreund, debugged with weerd@ who pointed out that the problem is browser dependent. OK tracey
2021-05-17Do not try to chunk encode an empty http body coming from an fcgiFlorian Obser
upstream. Found the hard way by Chris Narkiewicz who tracked failing uploads in the nextcloud mobile app down to httpd(8) trying to chunk encode a "204 No Content" resonse. Testing by Steve Williams Testing & OK stsp
2021-05-15Remove outdated comment. We got all httpd headers from the fcgi serverFlorian Obser
at this point.
2021-04-29Use relative reference URIs in Location header on directory redirects.dv
This adds support for front-ending httpd(8) with a TLS-terminating gateway like relayd(8) that forwards unencrypted http traffic. Previously httpd(8) would use a full URL in the Location header in 301 redirects when a user-agent requests a directory but without the trailing '/'. If the user-agent originally connected with https, this caused the redirected url to be http. This change conforms to RFC7231 section 7.1.2. Reported by Vincent Lee. OK claudio@
2021-04-20Move TAILQ initialization to files where they are used.dv
These priv-sep daemons all follow a similar design and use TAILQs for tracking control process connections. In most cases, the TAILQs are initialized separate from where they are used. Since the scope of use is generally confined to a specific control process file, this commit also removes any extern definitions and exposing the TAILQ structures to other compilation units. ok bluhm@, tb@
2021-04-10Do not compare TLS config params for non-TLS servers. This allows toClaudio Jeker
mix 'listen * port 80' and 'listen * tls port 443' in one server block. Also the last argument of server_tls_cmp - match_keypair - is always 0 so remove this code. OK florian@ tb@ some long time ago
2021-04-06use "braces" consistenly; fastcgi can take multiple options;Jason McIntyre
original issue and text from laurence tratt, with updates from raf czlonka
2021-03-16A socket buffer is not the best size to read from a disk.Otto Moerbeek
Use st_blksize to set high water mark; florian@
2021-01-27these programs (with common ancestry) had a -fno-common problem relatedTheo de Raadt
to privsep_procid. ok mortimer
2021-01-22fix a memory leak, found by rob@ in relayd.Sebastian Benoit
ok tb@
2021-01-18Fix httpd example configTheo Buehler
A server configuration yields multiple struct server_config in the env->sc_servers queue: an actual server ("parent") and one for each location directive in httpd.conf. In parent_configure(), the parents are configured first, then the corresponding locations. parse.y r1.118 kills the parent if an error is encountered on loading the TLS keypairs but leaves the locations in the sc_servers queue. When running the default config without TLS keys already in place, this then leads to the self-explanatory "invalid location" error message. Its intention is to indicates the unexpected situation that config_setserver() encounters a location without an associated server. Fix this by not only destroying the parent but also removing all of its locations. ok jsing
2021-01-05unwrap a lineTheo Buehler
2021-01-02Pull tls_close() and tls_free() further up, so tls_free() will alreadyTheo Buehler
be in the right spot once tls_close() is handled by libevent. suggested by jsing
2021-01-02Call tls_close() before closing the underlying socketTheo Buehler
In order to end a TLS connection regularly, an implementation MUST send a close_notify alert. libtls does this in tls_close() via SSL_shutdown(), so the socket had better still be open. The incorrect order in server_close() caused a leak on each tls connection due to a bug in libssl (fixed in tls_record_layer.c r1.56). As pointed out by claudio, tls_close() should really be handled from the main event loop. This will be addressed in a later commit. ok claudio florian jsing
2020-12-31Don't leak the log message in server_sendlogTheo Buehler
While there, use the length calculated by vasprintf() instead of using strlen needlessly. ok claudio florian
2020-12-31Don't leak access.log and error.log on reload.Theo Buehler
ok florian
2020-12-30getifaddrs() can return entries where ifa_addr is NULL. Check for thisSebastian Benoit
before accessing anything in ifa_addr. ok claudio@
2020-11-20remove an unused structJoerg Jung
from Edgar Pettijohn ok kn