Veloman Yunkan
3d425f44de
Request header case is ignored
...
Originally reported against case sensitivity of the Range header
(see issue #387 ), this fix applies to all request headers (since
according to RFC 7230 all header fields are case-insensitive, see
https://tools.ietf.org/html/rfc7230#section-3.2 ). However, a
corresponding unit-test was added only for the Range header.
2020-07-30 16:01:51 +02:00
Matthieu Gautier
7ece383004
Add support for samba path on windows.
...
Fix kiwix/kiwix-desktop#429
2020-07-15 11:40:02 +02:00
Kelson
cf8e8b94eb
Fix compilation with libmicrohttpd v0.97.1
2020-07-08 14:42:46 +02:00
Matthieu Gautier
4d307e18eb
Add new thread safe suggestion API.
...
Previous API were using an internal vector to store the suggestions search
results.
The new API takes a vector as out argument. So user can call the functions
without having to protect the search.
We should change the android API to reflect the change but it is a bit
more complex to do at JNI level. As android do not call it multithreaded
we are safe for now. And we need the new API asap for kiwix-desktop.
So we keep the same API on android for now, the new api will be made
in next version.
2020-07-01 17:16:13 +02:00
Kunal Mehta
fb79cde729
Pass -latomic for architectures that need it
...
Some architectures, specifically armel, mipsel, m68k & powerpc in
Debian, need to explicitly link to atomic.
Use meson to see if the target's CPU family is one of those, and if so,
pass -latomic to the linker.
Tested on armel and mipsel machines to verify passing -latomic works, and
on armhf and amd64 to ensure normal builds aren't broken.
Fixes #371 .
2020-06-29 00:18:13 -07:00
Matthieu Gautier
ff605873ed
Include missing `algorithm` header.
...
`min` and `max` functions are defined here.
2020-06-10 15:27:51 +02:00
Veloman Yunkan
05ef5d5f51
Assertion in ByteRange allows 0-sized content
...
The assertion in the ByteRange constructor was written under the assumption that the content must have non-zero size. Now it allows that corner case.
2020-06-02 21:53:47 +04:00
Veloman Yunkan
f52b220d01
Dropped RequestContext::has_range()
2020-05-26 14:10:26 +04:00
Veloman Yunkan
50a850f3a9
Fixed a comment
2020-05-26 14:04:18 +04:00
Veloman Yunkan
886ae17274
Fixed a CodeFactor issue
2020-05-26 13:59:47 +04:00
Veloman Yunkan
85d6daabac
Rolled back minor unneeded changes
2020-05-26 13:10:50 +04:00
Veloman Yunkan
5f1918d005
Split a long line
2020-05-26 13:04:03 +04:00
Veloman Yunkan
16bd79fa1b
Final clean-up of byte_range.{h,cpp}
2020-05-26 12:50:08 +04:00
Veloman Yunkan
c2ebdefe8d
Handling of unsatisfiable ranges
2020-05-26 02:11:26 +04:00
Veloman Yunkan
37032892a4
Fixed compilation error under win32_*
...
ERROR is a macro under Windows
2020-05-26 01:58:17 +04:00
Veloman Yunkan
6b43438b74
Fixed compilation error under native_dyn
...
MHD_HTTP_RANGE_NOT_SATISFIABLE is not defined in the older version of
libmicrohttpd (that is used under CI/Linux native_dyn).
2020-05-26 01:54:36 +04:00
Veloman Yunkan
7301bf89bb
Some refactoring of byte-range parsing
2020-05-26 01:50:29 +04:00
Veloman Yunkan
ff23b28e7c
Removed unnecessary qualifier
2020-05-26 01:41:37 +04:00
Veloman Yunkan
931e95f391
Invalid byte ranges result in 416 responses
2020-05-26 01:40:07 +04:00
Veloman Yunkan
f7571b5b69
Content-Range header is set only for partial content
2020-05-25 17:42:18 +04:00
Veloman Yunkan
801ad18a89
ByteRange::resolve()
2020-05-25 17:27:35 +04:00
Veloman Yunkan
67a347c0c4
Moved byte-range parsing to byte_range.cpp
2020-05-25 17:21:10 +04:00
Veloman Yunkan
693905eb68
Default constructed ByteRange is a full range
2020-05-25 17:17:56 +04:00
Veloman Yunkan
f3e79c6b4c
Introduced src/server/byte_range.cpp
2020-05-25 16:43:44 +04:00
Veloman Yunkan
52f207eaa6
Support for single-ended byte ranges
2020-05-25 16:37:01 +04:00
Veloman Yunkan
67294217a8
ByteRange::Kind
2020-05-25 16:23:44 +04:00
Veloman Yunkan
d111a40ce8
Response::m_byteRange
2020-05-23 20:35:22 +04:00
Veloman Yunkan
0c5bb3fcfe
Moved ByteRange to a header file of its own
2020-05-23 20:08:53 +04:00
Veloman Yunkan
3fba8c20a0
Converted RequestContext::ByteRange to a class
...
Also renamed the `range_pair` data member of `RequestContext` to `byteRange_`
2020-05-23 19:59:47 +04:00
Veloman Yunkan
54db6049b7
Byte-range parsing not exposed in the header file
2020-05-23 18:58:19 +04:00
Veloman Yunkan
81c38d6b2b
parse_byte_range() without side-effects
2020-05-23 18:53:16 +04:00
Veloman Yunkan
e6a86c02ae
Got rid of RequestContext::accept_range
2020-05-23 17:15:42 +04:00
Veloman Yunkan
a0f7f32570
Re-ordered function definitions
2020-05-23 17:11:26 +04:00
Veloman Yunkan
c39fce8839
RequestContext::parse_byte_range()
2020-05-23 17:09:51 +04:00
Veloman Yunkan
de37489c53
Range header starts with a unit spec
...
After this commit valid ranges of the form "bytes=firstbyte-lastbyte" should
be handled correctly.
2020-05-22 17:17:31 +04:00
Veloman Yunkan
2a35a86de6
Fixed the size value used creating a response
...
In case of a partial response the size of the response is different
from the served entry size.
2020-05-22 16:49:35 +04:00
Veloman Yunkan
0a30a77c08
Handling of out of bound byte ranges
2020-05-22 16:46:38 +04:00
Veloman Yunkan
1a99bacfe3
Byte ranges are inclusive
...
The second component of a byte range, if present, designates the
index of the last byte to be included in the partial response.
2020-05-22 16:30:43 +04:00
Kelson
94c2ab4395
Add two OPDS related mime-types to compress for HTTP
2020-05-18 08:19:51 +02:00
Kelson
0f07cab920
Small HTTP header beautification
2020-05-17 20:19:19 +02:00
Veloman Yunkan
5f0a9d0b08
Added a comment clarifying a non-obvious case
2020-05-15 15:17:04 +04:00
Veloman Yunkan
54f5dbbd35
Handling of If-None-Match conditional requests
2020-05-14 17:01:22 +04:00
Veloman Yunkan
95a5cde359
ETags are set in the response as needed
...
Also added server-unit tests related to ETags in the response.
2020-05-14 17:01:22 +04:00
Veloman Yunkan
3d08ef43f2
HEAD request is not rejected
...
libmicrohttpd handles HEAD requests by dropping the body of the response
(if any). Hence letting a HEAD request through into the code that
processes GET requests is safe.
Also added server unit-tests related to the handling of HEAD requests.
2020-05-14 17:01:22 +04:00
Veloman Yunkan
bfa51c2d87
Refactoring: got rid of duplicate get_mime_type()
2020-04-29 18:33:25 +04:00
Veloman Yunkan
81e781133d
Refactoring: utilized is_compressible_mime_type()
2020-04-29 18:33:01 +04:00
Veloman Yunkan
9ec7757efe
Refactoring: smart Response::set_entry()
...
Response::set_entry() was upgraded from a simple setter to a method
performing certain business logic that was previously taken care of by
InternalServer::handle_content().
2020-04-29 18:22:15 +04:00
Veloman Yunkan
7bd7ec4937
Refactoring: preparing to move some code
2020-04-29 18:22:15 +04:00
Veloman Yunkan
14d8583c83
Refactoring in InternalServer::handle_content()
...
Deduplicated common code found in the two branches of the last
if(){}else{} statement in InternalServer::handle_content().
2020-04-29 18:22:15 +04:00
Veloman Yunkan
a004d96cd7
Refactoring: extracted get_range_len()
2020-04-29 18:22:15 +04:00