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

Amazon S3: Mismatch when reading HTTP header from GCS #8791

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/flb_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ static int header_lookup(struct flb_http_client *c,
return FLB_HTTP_NOT_FOUND;
}

p += header_len;

/* Lookup CRLF (end of line \r\n) */
crlf = strstr(p, "\r\n");
if (!crlf) {
return FLB_HTTP_MORE;
}

p += header_len;

*out_val = p;
*out_len = (crlf - p);

Expand All @@ -168,7 +168,7 @@ static int check_chunked_encoding(struct flb_http_client *c)
int len;
const char *header = NULL;

ret = header_lookup(c, "Transfer-Encoding: ", 19,
ret = header_lookup(c, "\r\nTransfer-Encoding: ", 21,
&header, &len);
if (ret == FLB_HTTP_NOT_FOUND) {
/* If the header is missing, this is fine */
Expand Down Expand Up @@ -199,7 +199,7 @@ static int check_content_length(struct flb_http_client *c)
return FLB_HTTP_OK;
}

ret = header_lookup(c, "Content-Length: ", 16,
ret = header_lookup(c, "\r\nContent-Length: ", 18,
&header, &len);
if (ret == FLB_HTTP_MORE) {
return FLB_HTTP_MORE;
Expand Down Expand Up @@ -229,7 +229,7 @@ static int check_connection(struct flb_http_client *c)
const char *header;
char *buf;

ret = header_lookup(c, "Connection: ", 12,
ret = header_lookup(c, "\r\nConnection: ", 14,
&header, &len);
if (ret == FLB_HTTP_NOT_FOUND) {
return FLB_HTTP_NOT_FOUND;
Expand Down