aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 4346141ee..e6757d943 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -298,6 +298,11 @@
# include <sys/sendfile.h>
#endif
+/* see sys/netinet6/in6.h */
+#if defined(__FreeBSD__)
+# define s6_addr32 __u6_addr.__u6_addr32
+#endif
+
#define DEBUG 0
#define IOBUF_SIZE 8192
@@ -1871,7 +1876,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
send_headers(HTTP_OK);
#if ENABLE_FEATURE_USE_SENDFILE
{
- off_t offset = range_start;
+ off_t offset = (range_start < 0) ? 0 : range_start;
while (1) {
/* sz is rounded down to 64k */
ssize_t sz = MAXINT(ssize_t) - 0xffff;
@@ -2486,8 +2491,8 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
if (STRNCASECMP(iobuf, "Range:") == 0) {
/* We know only bytes=NNN-[MMM] */
char *s = skip_whitespace(iobuf + sizeof("Range:")-1);
- if (is_prefixed_with(s, "bytes=")) {
- s += sizeof("bytes=")-1;
+ s = is_prefixed_with(s, "bytes=");
+ if (s) {
range_start = BB_STRTOOFF(s, &s, 10);
if (s[0] != '-' || range_start < 0) {
range_start = -1;
@@ -2783,12 +2788,12 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
, &verbose
);
if (opt & OPT_DECODE_URL) {
- fputs(percent_decode_in_place(url_for_decode, /*strict:*/ 0), stdout);
+ fputs_stdout(percent_decode_in_place(url_for_decode, /*strict:*/ 0));
return 0;
}
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
if (opt & OPT_ENCODE_URL) {
- fputs(encodeString(url_for_encode), stdout);
+ fputs_stdout(encodeString(url_for_encode));
return 0;
}
#endif