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

#363 breaks pyo3-pack (Regression in 0.9.3) #374

Closed
konstin opened this issue Oct 24, 2018 · 4 comments
Closed

#363 breaks pyo3-pack (Regression in 0.9.3) #374

konstin opened this issue Oct 24, 2018 · 4 comments
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@konstin
Copy link

konstin commented Oct 24, 2018

In 0.9.2, the following works, while it fails in 0.9.3:

git clone https://github.com/PyO3/pyo3-pack
cargo run -- publish -u konstin -b bin -r https://test.pypi.org/legacy/ -m hello-world/Cargo.toml -p notmypassword

More specifically, I get the following error even though I'm using multipart POST:

<h1>405 Method Not Allowed</h1>
The method POST is not allowed for this resource. <br/><br/>

I've bisected and found the 44c8ca3 introduced by #363 causes pyo3-pack to break.

I'm using the following code for the request (complete source):

let mut form = Form::new();
for (key, value) in joined_metadata {
    form = form.text(key, value.to_owned())
}
form = form.file("content", &wheel_path)?;
let client = Client::new();
let mut response = client
    .post(registry.url.clone())
    .header(reqwest::header::CONTENT_TYPE, "application/json; charset=utf-8")
    .multipart(form)
    .basic_auth(registry.username.clone(), Some(registry.password.clone()))
    .send()?;

I know it's a difficult if people have conflicting requirements, but there should be at least a switch to get back the old behaviour. FWIW the old behaviour is also apparently what python's requests does.

@seanmonstar seanmonstar added the C-bug Category: bug. Something is wrong. This is bad! label Oct 26, 2018
@seanmonstar
Copy link
Owner

Well that's unfortunate (and annoying)! I suppose there could be an option on multipart::Form to choose a different percent encoding strategy?

@seanmonstar
Copy link
Owner

I've reverted the default config to use path-segment, and there are now options to change it: 70b68c2

(I realize I referenced the wrong issue number in the commit. 😢)

@seanmonstar
Copy link
Owner

I've published v0.9.4 with the default reverted.

@konstin
Copy link
Author

konstin commented Oct 27, 2018

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

2 participants