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

'http.client' sets invalid (?) reason #3681

Closed
bigbes opened this issue Sep 11, 2018 · 2 comments
Closed

'http.client' sets invalid (?) reason #3681

bigbes opened this issue Sep 11, 2018 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bigbes
Copy link
Contributor

bigbes commented Sep 11, 2018

tarantool> httpc = require('http.client')
tarantool> httpc.get('https://google.com/asdalmsdpkasmdpkmads')
---
- reason: Ok
  status: 404
  body: "<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport
    content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n  <title>Error
    404 (Not Found)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px
    arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto
    0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png)
    100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a
    img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png)
    no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png)
    no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png)
    0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png)
    no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n
    \ </style>\n  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n
    \ <p><b>404.</b> <ins>That’s an error.</ins>\n  <p>The requested URL <code>/asdalmsdpkasmdpkmads</code>
    was not found on this server.  <ins>That’s all we know.</ins>\n"
  proto:
  - 1
  - 1
  headers:
    alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
    content-type: text/html; charset=UTF-8
    connection: close
    referrer-policy: no-referrer
    content-length: '1581'
    date: Tue, 11 Sep 2018 21:09:42 GMT
...

I guess reason should be "Not Found", not "Ok".

@opomuc
Copy link
Collaborator

opomuc commented Sep 11, 2018

I've seen this countless times, never managed to find the reason behind though

@bigbes
Copy link
Contributor Author

bigbes commented Sep 11, 2018

@opomuc : I guess it's

tarantool/src/httpc.c

Lines 325 to 335 in 47969ef

case CURLE_OK:
curl_easy_getinfo(req->curl_request.easy, CURLINFO_RESPONSE_CODE, &longval);
req->status = (int) longval;
/* TODO: get real response string from resp->headers */
req->reason = "Ok";
if (req->status == 200) {
++env->stat.http_200_responses;
} else {
++env->stat.http_other_responses;
}
break;

"Ok" is the only thing that's set.

@kyukhin kyukhin added httpclient bug Something isn't working labels Oct 2, 2018
@kyukhin kyukhin added this to the 1.10.3 milestone Oct 2, 2018
romanhabibov added a commit that referenced this issue Feb 4, 2019
Set the reason "Unknown" when it is CURLE_OK and status is more than 400.

Closes #3681
romanhabibov added a commit that referenced this issue Feb 4, 2019
Set the reason "Unknown" when it is CURLE_OK and status is more than 400.

Closes #3681
romanhabibov added a commit that referenced this issue Feb 5, 2019
Set the reason "Unknown" when it is CURLE_OK and status is more than or equal
to 400.

Closes #3681
romanhabibov added a commit that referenced this issue Feb 5, 2019
Set the reason "Unknown" when it is CURLE_OK and status is more than or equal
to 400.

Closes #3681
@kyukhin kyukhin added the tmp label Mar 27, 2019
locker pushed a commit that referenced this issue Mar 5, 2022
Set the reason "Unknown" when it is CURLE_OK and status is more than or equal
to 400.

Closes #3681

(cherry picked from commit 9d99d14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants