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

incorrect detection of http_response_header version #6

Open
shopapps opened this issue May 18, 2023 · 1 comment
Open

incorrect detection of http_response_header version #6

shopapps opened this issue May 18, 2023 · 1 comment

Comments

@shopapps
Copy link

in NlpClient.php line 175 you have:

if ( empty($result) || ( isset($http_response_header) && $http_response_header[0] != 'HTTP/1.0 200 OK' ) ) // empty if server is down

can you please move the check for the HTTP version to config?

if ( empty($result) || ( isset($http_response_header) && $http_response_header[0] != 'HTTP/' . config('nlp.http.version') . ' 200 OK' ) ) // empty if server is down

or even better:

if ( empty($result) || ( isset($http_response_header) && !stristr($http_response_header[0],  '200 OK' ))) // empty if server is down

currently, my local build returns: "HTTP/1.1 200 OK" (so HTTP/1.1 not HTTP/1.0 ) so all my attempts to use your laravel wrapper package are failing :-(

the output of my $http_response_header

"Web64\Nlp\NlpClient::post_call Line: 173" // vendor/web64/php-nlp-client/src/NlpClient.php:173
array:6 [ // vendor/web64/php-nlp-client/src/NlpClient.php:173
  0 => "HTTP/1.1 200 OK"
  1 => "Server: Werkzeug/2.3.4 Python/3.11.3"
  2 => "Date: Thu, 18 May 2023 10:19:01 GMT"
  3 => "Content-Type: application/json"
  4 => "Content-Length: 434"
  5 => "Connection: close"
]
@shopapps shopapps changed the title incorrect detection of incorrect detection of http_response_header version May 18, 2023
@shopapps
Copy link
Author

I have created a PR for it if that helps?

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

No branches or pull requests

1 participant