Skip to content
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
13 changes: 8 additions & 5 deletions http-relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ static int httpr_toss_http_firstline(redsocks_client *client)

uri = strchr(httpr->firstline, ' ');
if (uri)
uri += 1; // one char further
while (*uri == ' ')
uri += 1; // one char further
else {
redsocks_log_error(client, LOG_NOTICE, "malformed request came");
goto fail;
Expand All @@ -417,10 +418,12 @@ static int httpr_toss_http_firstline(redsocks_client *client)

if (httpr_buffer_append(&nbuff, httpr->firstline, uri - httpr->firstline) != 0)
goto addition_fail;
if (httpr_buffer_append(&nbuff, "http://", 7) != 0)
goto addition_fail;
if (httpr_buffer_append(&nbuff, host, strlen(host)) != 0)
goto addition_fail;
if (*uri == '/') {
if (httpr_buffer_append(&nbuff, "http://", 7) != 0)
goto addition_fail;
if (httpr_buffer_append(&nbuff, host, strlen(host)) != 0)
goto addition_fail;
}
if (httpr_buffer_append(&nbuff, uri, strlen(uri)) != 0)
goto addition_fail;
if (httpr_buffer_append(&nbuff, "\x0d\x0a", 2) != 0)
Expand Down