Strip trailing dot from "Host:" header

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2430 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.23
Stefan Bühler 14 years ago
parent 07d9517df6
commit ef59a62724

@ -11,6 +11,7 @@ NEWS
* Finally removed spawn-fcgi
* Allow xattr to overwrite mime type (fixes #1929)
* Remove link from errormsg about fastcgi apps (fixes #1942)
* Strip trailing dot from "Host:" header
- 1.4.22 - 2009-03-07
* Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)

@ -86,10 +86,18 @@ static int request_check_hostname(server *srv, connection *con, buffer *host) {
if (host_len == 0) return -1;
/* if the hostname ends in a "." strip it */
if (host->ptr[host_len-1] == '.') host_len -= 1;
if (host->ptr[host_len-1] == '.') {
/* shift port info one left */
if (NULL != colon) memmove(colon-1, colon, host->used - host_len);
else host->ptr[host_len-1] = '\0';
host_len -= 1;
host->used -= 1;
}
if (host_len == 0) return -1;
/* scan from the right and skip the \0 */
for (i = host_len - 1; i + 1 > 0; i--) {
for (i = host_len; i-- > 0; ) {
const char c = host->ptr[i];
switch (stage) {

Loading…
Cancel
Save