Android Question java.net.ProtocolException: Unexpected status line:

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
B4A 8.8
Using OkHttpUtils2
Fetching a web page that is fetched ok with b4a older versions, Im getting the following error.

!!! java.net.ProtocolException: Unexpected status line: <!DOCTYPE html>

I can access the page using Firefox browser

http://132.148.84.1:8633/xmloc?F=Lanz&E=O-25-5-20

The result is a simple xml

What is a status line? what should I add to the page to get rid of this error?
 

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
I cant use Sockets
You mean first line of the response must be:
<Http/1.1 200 OK> ?
or how to add Http/1.1 200 OK to the response?
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Yes it is but is a server made in Clarion and does not supports sockets.
Ive added Http/1.1 200 OK in the first line of the page and now Im getting another error:

ResponseError. Reason: java.io.IOException: unexpected end of stream on okhttp3.Address@4068ce87, Response:
 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
B4A 8.8
Using OkHttpUtils2
Fetching a web page that is fetched ok with b4a older versions, Im getting the following error.

!!! java.net.ProtocolException: Unexpected status line: <!DOCTYPE html>

I can access the page using Firefox browser

http://132.148.84.1:8633/xmloc?F=Lanz&E=O-25-5-20

The result is a simple xml

What is a status line? what should I add to the page to get rid of this error?


I had this problem, I solved putting
at the time of the request
job.GetRequest.SetHeader ("Connection", "close")

Ex:
B4X:
Dim job As HttpJob
job.Initialize("", Me)
job.Download("http://myhost.com/api")
job.GetRequest.SetHeader ("Connection", "close")
 
Upvote 0
Top