Skip to content

return 0 from http_data(struct http_roundtripper*, const char*, int size, int*) when size is 0?  #8

@bl4ck5un

Description

@bl4ck5un

Hi, Thanks for this project!

Sometimes servers send responses without Content-Length and expect the client to consume input (for the body) until EOF. Basically renders recv to return 0 before the parser decides the stream is complete, which will result in an error.

    int ndata = recv(conn, buffer, sizeof(buffer), 0);
    if (ndata <= 0) {
        fprintf(stderr, "Error receiving data\n");
        http_free(&rt);
        close(conn);
        return -1;
    }

I wonder if this would be resolved by simply return 0 from http_data is the third parameter is passed as 0, i.e. EOF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions