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

socks using its own buffer instead of data->state.buffer #12788

Closed
wants to merge 4 commits into from

Conversation

icing
Copy link
Contributor

@icing icing commented Jan 25, 2024

No description provided.

@icing icing marked this pull request as ready for review January 25, 2024 13:57
@bagder
Copy link
Member

bagder commented Jan 25, 2024

docs/libcurl/libcurl-symbols.md

That's a generated file... 😬

lib/socks.c Outdated
@@ -74,6 +74,7 @@ enum connect_t {
struct socks_state {
enum connect_t state;
ssize_t outstanding; /* send this many bytes more */
unsigned char buffer[8*1024]; /* more than enough */
Copy link
Member

Choose a reason for hiding this comment

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

How did you pick the size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a crystal skull next to my dropping candles here in my lair.

As I read the code, one socks packets always seem to be smaller than 1k, but I might be wrong...therefore the assertions.

Copy link
Contributor Author

@icing icing Jan 25, 2024

Choose a reason for hiding this comment

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

I started replacing the fixed buffer with a bufq, but that quickly escalated all over the file and I was not sure if it would be worth it.

Copy link
Member

Choose a reason for hiding this comment

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

I believe username, password and hostname are all limited to 256 bytes max, so 1K should probably be enough.

@bagder
Copy link
Member

bagder commented Jan 25, 2024

Line 434 in the original, 435 in your update, references data->set.buffer_size to check if the data fits, which is now wrong.

@icing
Copy link
Contributor Author

icing commented Jan 25, 2024

Line 434 in the original, 435 in your update, references data->set.buffer_size to check if the data fits, which is now wrong.

Nice catch! Push a fix.

@bagder
Copy link
Member

bagder commented Jan 25, 2024

line 288: DEBUGASSERT(READBUFFER_MIN >= 600);

This check verifies the the smallest download buffer is big enough. It should now probably check that buffer is at least this big.

@icing
Copy link
Contributor Author

icing commented Jan 25, 2024

I added a #define for the size and a compile time check.

@bagder
Copy link
Member

bagder commented Jan 25, 2024

I did #12797 to help us verify that a ~600 byte buffer will work fine, but we can also adjust the size after the initial merge.

@bagder bagder closed this in 65c7e4f Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants