action #53891
closed
[openqa] Posting comments results in getting comments unless the URI scheme is specified
Added by rpalethorpe about 5 years ago.
Updated almost 5 years ago.
Category:
Regressions/Crashes
Description
Take the following:
rich@rpws ~> openqa-client --host openqa.opensuse.org --apikey CB3705D3354546E0 --apisecret XXX jobs/975114/comments POST text=test123
[
{
bugrefs => [],
created => "2019-07-05 08:15:47 +0000",
id => 43271,
renderedMarkdown => "update comment test\n",
text => "update comment test",
updated => "2019-07-05 08:45:11 +0000",
userName => "rpalethorpe",
},
]
rich@rpws ~> openqa-client --host https://openqa.opensuse.org --apikey CB3705D3354546E0 --apisecret XXX jobs/975114/comments POST text=test123
{ id => 43287 }
okurz thinks this may be due to https://github.com/os-autoinst/openQA/pull/2110.
Note that this only happens on O3 and not OSD. I also tried using two different versions of the openqa-client. Also the following works:
openqa-client --host openqa.opensuse.org --apikey CB3705D3354546E0 --apisecret XXX jobs/975114/comments/43271 PUT text="update comment test"
{ id => 43271 }
So the problem maybe only effects POST requests.
- Description updated (diff)
- Assignee set to kraih
- Status changed from New to In Progress
So, what's happening here doesn't look like a bug at all. When you use --host openqa.opensuse.org
the client turns
it into --host http://openqa.opensuse.org
. Now http://openqa.opensuse.org
redirects to
https://openqa.opensuse.org
.
That means our original HTTP request was POST /api/v1/jobs/975114/comments?text=test123
, it receives a
301 Moved Permanently
to Location: https://openqa.opensuse.org/api/v1/jobs/975114/comments?text=test123
.
And because OpenQA::Client
follows redirects it requests GET /api/v1/jobs/975114/comments?text=test123
,
since redirects change the method to GET
.
The same does not happen for --host openqa.suse.de
because it does not redirect from HTTP to HTTPS.
Now we have multiple options:
- We decide this is ok and close the ticket
- We default to using HTTPS instead of HTTP when schema is missing (probably best)
- We make OpenQA::Client not follow redirects (does it have to? Only for some methods? Worst option, many side effects...)
- We throw an error when a redirect changes the schema
- Something else?
- Status changed from In Progress to Resolved
- Status changed from Resolved to Feedback
- Status changed from Feedback to Resolved
- Assignee changed from kraih to okurz
Also available in: Atom
PDF