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

How can I post some data (not file)? #53

Closed
luodijia opened this issue Nov 14, 2018 · 5 comments
Closed

How can I post some data (not file)? #53

luodijia opened this issue Nov 14, 2018 · 5 comments
Labels

Comments

@luodijia
Copy link

Can the -P parameter supports to post some string?

@dtikhonov
Copy link
Contributor

Not, at the moment, no:

        case 'P':
            client_ctx.payload = optarg;
            if (0 != stat(optarg, &st))
            {
                perror("stat");
                exit(2);
            }

But pull requests are welcome!

@litespeedtech
Copy link
Owner

Question answered: closing.

@luodijia
Copy link
Author

Thx. Then how can I modify some code to support posting some string? Which interface or code segment can put the contents of file to the request body? Wait for your advice! Thx again!

@dtikhonov
Copy link
Contributor

Start with this code in test/http_client.c:

    if (st_h->client_ctx->payload)
    {
        st_h->reader.lsqr_read = test_reader_read;
        st_h->reader.lsqr_size = test_reader_size;
        st_h->reader.lsqr_ctx = create_lsquic_reader_ctx(st_h->client_ctx->payload);
        if (!st_h->reader.lsqr_ctx)
            exit(1);
    }
    else
        st_h->reader.lsqr_ctx = NULL;

test_reader_read() reads from a file. You can change it (or add another reader) to do something else.

@luodijia
Copy link
Author

I will try, Thx a lot!

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

No branches or pull requests

3 participants