Refactor and improve CTL and other code

This commit is contained in:
Justine Tunney 2024-06-04 05:41:53 -07:00
parent 1d8f37a2f0
commit 9906f299bb
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
25 changed files with 5768 additions and 5350 deletions

View file

@ -16,11 +16,10 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/stdckdint.h"
#include "libc/str/str.h"
#include "net/http/http.h"
#define MAXIMUM (1024L * 1024L * 1024L * 1024L)
/**
* Parses Content-Length header.
*
@ -41,7 +40,7 @@ int64_t ParseContentLength(const char *s, size_t n) {
return -1;
r *= 10;
r += s[i] - '0';
if (r >= MAXIMUM)
if (r > 0x000000ffffffffff)
return -1;
}
return r;