Fix compilation errors in cookie_jar branch
This commit fixes multiple compilation errors introduced by the refactoring: 1. Added missing http_client_conn_free() helper function 2. Fixed cookie_jar reference (cookie_jar->count to client->cookie_jar.count) 3. Restored missing HTTP_ClientConn fields: handle, client, and url 4. Fixed undefined 'conn' variable in http_client_get_builder (changed to 'i') 5. Fixed incorrect field reference (entry.domain.len to domain.len) 6. Added missing closing parenthesis in should_send_cookie 7. Removed duplicate 'path' variable declaration 8. Fixed cookie jar access to use builder.client instead of conn->client 9. Fixed byte_queue_write calls to use .ptr and .len instead of HTTP_String structs 10. Fixed missing -> operators in url_to_connect_target 11. Fixed undefined 'url' variable by using conn->url 12. Fixed headers[i].value to set_cookie.value in save_one_cookie 13. Fixed typo: antry to entry 14. Fixed save_one_cookie parameter type (headers[i] instead of headers[i].value) 15. Fixed print_bytes calls to create HTTP_String structs 16. Added logic to store socket handle when connection is established 17. Updated http_client_get_builder signature to return HTTP_RequestBuilder 18. Updated simple_client.c example to match new API
This commit is contained in:
@@ -878,6 +878,12 @@ typedef struct HTTP_Client HTTP_Client;
|
||||
typedef struct {
|
||||
HTTP_ClientConnState state;
|
||||
|
||||
// Handle to the socket
|
||||
SocketHandle handle;
|
||||
|
||||
// Pointer back to the client
|
||||
HTTP_Client *client;
|
||||
|
||||
// Generation counter for request builder validation
|
||||
uint16_t gen;
|
||||
|
||||
@@ -893,6 +899,9 @@ typedef struct {
|
||||
HTTP_String domain;
|
||||
HTTP_String path;
|
||||
|
||||
// Parsed URL for connection establishment
|
||||
HTTP_URL url;
|
||||
|
||||
// Data received from the server
|
||||
ByteQueue input;
|
||||
|
||||
@@ -965,15 +974,8 @@ typedef struct {
|
||||
uint16_t gen;
|
||||
} HTTP_RequestBuilder;
|
||||
|
||||
// Create a new request builder object. If the response
|
||||
// pointer is NULL, a brand new builder is created. If
|
||||
// response isn't NULL (and http_free_response wasn't
|
||||
// called on it yet), the connection associated to that
|
||||
// previous exchange is reused. Note that it's up to the
|
||||
// user to make sure the requests are targeting the same
|
||||
// host. Returns 0 on success, -1 on error.
|
||||
int http_client_get_builder(HTTP_Client *client,
|
||||
HTTP_Response *response, HTTP_RequestBuilder *builder);
|
||||
// Create a new request builder object.
|
||||
HTTP_RequestBuilder http_client_get_builder(HTTP_Client *client);
|
||||
|
||||
// TODO: comment
|
||||
void http_request_builder_set_user(HTTP_RequestBuilder builder, void *user);
|
||||
|
||||
Reference in New Issue
Block a user