summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/server_file.c
AgeCommit message (Collapse)Author
2015-05-05Implement If-Modified-Since.Florian Obser
From Kyle Thompson <jmp AT giga DOT moe>. Tweaks by me. OK benno@
2015-05-03Implement byte ranges.Florian Obser
From Sunil Nimmagadda <sunil At nimmagadda DOT net> OK benno@
2015-04-25Prepend files or directories containing ":" with "./" in directoryFlorian Obser
indexes as per RFC 3986: A path segment that contains a colon character (e.g., "this:that") cannot be used as the first segment of a relative-path reference, as it would be mistaken for a scheme name. Such a segment must be preceded by a dot-segment (e.g., "./this:that") to make a relative- path reference. While here add a "/" to the end of directory names, this saves us one redirect round trip. Found the hard way & "functionality wise, OK" ajacoutot@ RFC pointer & OK benno@
2015-02-12Rename escape_uri() to url_encode() because it is the opposite ofReyk Floeter
url_decode(). No functional change.
2015-02-10Encode directory listings.Florian Obser
Problem pointed out by remco AT d-compu.dyndns.org some time ago. Input / OK reyk@
2015-02-08spacingReyk Floeter
2015-01-21httpd is based on relayd and had included many headers that are onlyReyk Floeter
needed by its ancestor. jsg@, include-what-you-use, and some manual review helped to cleanup the headers (take iwyu with a grain of salt). Based on common practice, httpd.h now also includes the necessary headers for itself. OK florian@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2015-01-13bump copyright yearReyk Floeter
2015-01-06Make httpd return "404 not found" if an intermediate component of a requestedStefan Sperling
file path does not exist rather than returning "500 internal server error". ok reyk
2015-01-04add new url stripping option:Christopher Zimmermann
strip number Strip number path components from the beginning of the request URI before looking up the stripped-down URI at the document root. reviewed with much patience and OK by reyk@
2015-01-01Use the HTML5 doctype for error and auto index pages because it isReyk Floeter
shorter, newer, and the recommendation. From James Jerkins. Exclude the charset for now because it is not explicitly handled by httpd. OK validator.w3.org (This document was successfully checked as HTML5!)
2014-12-21Stop pulling in <arpa/inet.h> or <arpa/nameser.h> when unnecessary.Philip Guenther
*Do* pull it in when in_{port,addr}_h is needed and <netinet/in.h> isn't. ok reyk@
2014-12-12Like previously done in relayd, change the keyword "ssl" to "tls" toReyk Floeter
reflect reality. OK benno@
2014-12-04stop viral header propagation. none of this code uses sys/hash.hTed Unangst
from Max Fillinger
2014-10-25Remove unnecessary netinet/in_systm.h include.Lawrence Teo
ok millert@
2014-10-21Rework the error message a little bit: Do not send details of theReyk Floeter
error. Traditionally, web servers responsed with the request path on 40x errors which could be abused to inject JavaScript etc. Instead of sanitizing the path, we just don't reprint it. Also modify the style a little bit but keep Comic Sans. With input from Jonas Lindemann and doug@
2014-10-02Fix an error case that was never handled ending up in an endless eventReyk Floeter
loop that could eat all CPU. I thought that the previous (correct) commit fixed it which wasn't the case. But this one is obvious. ok florian@
2014-09-27In addition to READ, disable WRITE events when closing the fileReyk Floeter
descriptor of the file I/O bufferevent. This fixes a potential event flood. OK florian@
2014-08-29Use two instead of one http descriptor for request and response.Reyk Floeter
OK chrisz@
2014-08-21Add Last-Modified: HTTP header.Christopher Zimmermann
OK reyk@
2014-08-14Remove obsolete struct stat parameters.Christopher Zimmermann
ok reyk@
2014-08-08When opening directories, re-match the location after the index fileReyk Floeter
has been appended. This allows to use a fastcgi target as the default index, for example index.php. OK florian@
2014-08-06The watermark exposed a bug in server_write that broke keep-aliveReyk Floeter
support. Instead of calling server_close from server_write, we have to proceed to the next connection by calling the error handler. OK jsg@
2014-08-06Adjust the read/write watermarks according to the TCP send buffer.Reyk Floeter
This fixes sending of large files. Previously, httpd was reading the input file too quickly and could run out of memory when filling the input buffer. Found by jsg@ OK florian@
2014-08-04Redirect to https:// if SSL/TLS is enabled.Reyk Floeter
2014-08-04httpd doesn't support SSL/TLS yet, remove the remaining bits.Reyk Floeter
The secrect plan is to add it later using the ressl wrapper library.
2014-08-03Only allow GET and HEAD for static files or return 405.Reyk Floeter
ok florian@
2014-08-03Also write log messages, like 404 Not Found, on error. This is a bitReyk Floeter
tricky because we couldn't guarantee a sane state after server_response_http() so fail hard afterwards and close the connection. ok doug@
2014-08-03Split fastcgi socket path and document root option and add theReyk Floeter
SCRIPT_FILENAME CGI param with a prepended root. This fixes php-fpm that expects SCRIPT_FILENAME and also works with slowcgi if you configure the root correctly. For example, if SCRIPT_NAME and REQUEST_URI are /php/index.php, root is /htdocs, SCRIPT_FILENAME will be /htdocs/php/index.php. As tested and discussed with florian@
2014-08-02spacingReyk Floeter
2014-08-02scandir(3)-based directory auto index didn't work on NFS because theReyk Floeter
file system is not filling in d_type properly. Using st_mode from the stat call fixes the problem, eg. S_ISDIR(st.st_mode) instead of dp->d_type == DT_DIR. Pointed out by pelikan@
2014-07-31some fastcgi improvements:Reyk Floeter
- DPRINTF instead of log_info for internal debugging. - submit QUERY_STRING, if it exists - use a proper function to create an HTTP header. - use server_file_error() to detect EOF and fastcgi stream errors. - disable keep-alive/persist for now until we have a reliable way to get the content length from the cgi response or support chunked encoding. "Cool, jep" florian@
2014-07-31One bufferevent can be shared by file and fcgi.Reyk Floeter
2014-07-31Rename the "docroot" variable to "path" because it will be used forReyk Floeter
either files or the fastcgi socket (and there's no need to use a union yet).
2014-07-30Reserve an extra file descriptor per connection instead of perReyk Floeter
request. This fixes fd accounting with persistent connections and reduces the complexity of the implementation. ok benno@
2014-07-29Add extended directory index options: "[no] index" and "[no] auto index".Reyk Floeter
The option "directory auto index" implements basic directory listing and is turned off by default. ok deraadt@
2014-07-26Remove redundant slashReyk Floeter
2014-07-25It is recommended to use a URL in the Location header of 3xxReyk Floeter
responses. To accomplish this, add some semantics to retrieve the server host name of a connection: either IP, IP:PORT (if not 80) or [IP6]:PORT, or Host value (if valid).
2014-07-25Canonicalize the request path once without the docroot and prepend theReyk Floeter
docroot only only when it's needed. Suggested by deraadt@.
2014-07-25Don't leak docroot in the error message if the default index file is missing.Reyk Floeter
OK florian@
2014-07-25Split server and server_config.Reyk Floeter
2014-07-25Rename a field, needed later, no functional change.Reyk Floeter
2014-07-25Move the docroot into the server block.Reyk Floeter
2014-07-23The default index page shouldn't be a directory. It's a 500.Reyk Floeter
2014-07-23Don't expose the docroot on error.Reyk Floeter
2014-07-23First attempt at verifying the request path and the accessReyk Floeter
permissions. We also have to redirect with 301 if a directory name was requested without the trailing slash.
2014-07-23Add canonicalize_path() to canonicalize the requested URL path.Reyk Floeter
2014-07-16Implement file descriptor accounting. The concept was taken fromReyk Floeter
relayd but had to be adjusted for httpd. It now handles single-pass HTTP connections, persistent connections with multiple requests, and body-less HEAD requests. With input from benno@
2014-07-15don't diplay the full path in error messagesReyk Floeter