Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some format strings and some return types. #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

moritzbuhl
Copy link
Contributor

No description provided.

goto err;
if (ret != left)
goto again;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including 'read(fd, req->data, req->len)', can you make the above into a loop? like:

off = req->data;
left = req->len;

while (left > 0) {
    ret = read(fd, off, left);
    if (ret < 0)
        goto err
    off += ret;
    left -= ret;
}

also try to move the variables definition at the beginning of the function in reversed Christmas tree order, like:

        struct http_request *req = user_data;
        char len[10], status[] = "200";
        nghttp3_data_reader dr = {};
        char path[128] = {};
        nghttp3_nv nva[4];
        struct stat st;
        uint8_t *off;
        int ret, fd;
        size_t left;

int ret, i, flags = 0, fin = 0, sent;
ssize_t n;
size_t sent;
int ret, i, flags = 0, fin = 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, move 'sent' and 'n' down just to look better, :-)

        int ret, i, flags = 0, fin = 0;
        int64_t stream_id = -1;
        nghttp3_vec vec[16];
        nghttp3_ssize cnt;
        size_t sent;
        ssize_t n;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants