Remove minor TODOs
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
Copyright © 2025 Francesco Cozzuto
|
||||
Copyright © 2025 Francesco Cozzuto
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the “Software”),
|
||||
copy of this software and associated documentation files (the “Software”),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
@@ -11,7 +11,7 @@ Software is furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
@@ -248,13 +248,17 @@ typedef struct CWEB_Request CWEB_Request;
|
||||
int cweb_global_init(void);
|
||||
void cweb_global_free(void);
|
||||
|
||||
// TODO: comment
|
||||
CWEB *cweb_init(CWEB_String addr, uint16_t port, uint16_t secure_port,
|
||||
CWEB_String cert_key, CWEB_String private_key);
|
||||
|
||||
// TODO: comment
|
||||
void cweb_free(CWEB *cweb);
|
||||
|
||||
// TODO: comment
|
||||
int cweb_add_website(CWEB *cweb, CWEB_String domain, CWEB_String cert_file, CWEB_String key_file);
|
||||
|
||||
// TODO: comment
|
||||
int cweb_create_test_certificate(CWEB_String C, CWEB_String O,
|
||||
CWEB_String CN, CWEB_String cert_file, CWEB_String key_file);
|
||||
|
||||
@@ -272,6 +276,8 @@ void cweb_enable_template_cache(CWEB *cweb, bool enable);
|
||||
// TODO: When does this function return NULL?
|
||||
CWEB_Request *cweb_wait(CWEB *cweb);
|
||||
|
||||
bool cweb_match_domain(CWEB_Request *req, CWEB_String str);
|
||||
|
||||
// Returns true iff the request matches the specified endpoint
|
||||
bool cweb_match_endpoint(CWEB_Request *req, CWEB_String str);
|
||||
|
||||
@@ -14520,6 +14526,14 @@ CWEB_Request *cweb_wait(CWEB *cweb)
|
||||
return req;
|
||||
}
|
||||
|
||||
bool cweb_match_domain(CWEB_Request *req, CWEB_String str)
|
||||
{
|
||||
int idx = http_find_header(req->req->headers, req->req->num_headers, HTTP_STR("host"));
|
||||
if (idx < 0) return false;
|
||||
|
||||
return http_streq((HTTP_String) { str.ptr, str.len }, req->req->headers[idx].value);
|
||||
}
|
||||
|
||||
bool cweb_match_endpoint(CWEB_Request *req, CWEB_String str)
|
||||
{
|
||||
return http_streq(req->req->url.path, (HTTP_String) { str.ptr, str.len });
|
||||
|
||||
+6
-11
@@ -7,31 +7,29 @@
|
||||
|
||||
bool valid_name(CWEB_String str)
|
||||
{
|
||||
(void) str; // TODO
|
||||
return true;
|
||||
return str.len >= 3 && str.len < 100;
|
||||
}
|
||||
|
||||
bool valid_email(CWEB_String str)
|
||||
{
|
||||
(void) str; // TODO
|
||||
(void) str;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool valid_pass(CWEB_String str)
|
||||
{
|
||||
(void) str; // TODO
|
||||
return true;
|
||||
return str.len >= 8 && str.len < 1000;
|
||||
}
|
||||
|
||||
bool valid_post_title(CWEB_String str)
|
||||
{
|
||||
(void) str; // TODO
|
||||
(void) str;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool valid_post_content(CWEB_String str)
|
||||
{
|
||||
(void) str; // TODO
|
||||
(void) str;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -351,10 +349,7 @@ int main(void)
|
||||
cert_key,
|
||||
private_key
|
||||
);
|
||||
if (ret < 0) {
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0) return -1;
|
||||
#endif
|
||||
|
||||
CWEB *cweb = cweb_init(addr, port, secure_port, cert_key, private_key);
|
||||
|
||||
Reference in New Issue
Block a user