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

HttpException: Connection closed while receiving data #1185

Closed
jianleepb opened this issue Jun 4, 2021 · 16 comments
Closed

HttpException: Connection closed while receiving data #1185

jianleepb opened this issue Jun 4, 2021 · 16 comments

Comments

@jianleepb
Copy link

post 数据量比较大的时候直接报error。
[✓] Flutter (Channel stable, 1.22.5)
[✓] dio: ^3.0.8

@y-alkhateeb
Copy link

y-alkhateeb commented Jun 7, 2021

+1
Any update?
dio: ^4.0.0

@troncomputers
Copy link

I think it's same for me. Users are able to send request but there is no response. On server side (API) all data is saved correctly, no exception, no errors. I don't have an exception message from mobile devices because I'm not able to reproduce this behavior on my devices. All I have is duplications in ERP system because there is no response and app is not able to unflag data from "toSend" status.

@mirkancal
Copy link

I don't receive anything from Dio. It's like sending http request to blackhole. No exception or errors.

@mirkancal
Copy link

I find the issue, with the new Dio API, you need to return handler.next, otherwise interceptors just stuck.

dio.interceptors.add(InterceptorsWrapper(
    onRequest:(options, handler){
     // Do something before request is sent
     return handler.next(options); //continue
     // If you want to resolve the request with some custom data,
     // you can resolve a `Response` object eg: return `dio.resolve(response)`.
     // If you want to reject the request with a error message,
     // you can reject a `DioError` object eg: return `dio.reject(dioError)`
    },
    onResponse:(response,handler) {
     // Do something with response data
     return handler.next(response); // continue
     // If you want to reject the request with a error message,
     // you can reject a `DioError` object eg: return `dio.reject(dioError)` 
    },
    onError: (DioError e, handler) {
     // Do something with response error
     return  handler.next(e);//continue
     // If you want to resolve the request with some custom data,
     // you can resolve a `Response` object eg: return `dio.resolve(response)`.  
    }
));

@jianleepb
Copy link
Author

service error , the post data is too large

@wmhseir3
Copy link

hi, the 0.0.11 still won't get through with this issue. The same DioError appeared as followings. I even tried to add the timeout lines but not helpings.
response = await dio.post(url,
data: requestData,
options: Options(
sendTimeout: 2000,
receiveTimeout: 0,
headers: {
Headers.contentTypeHeader: 'text/xml; charset=utf-8',
Headers.contentLengthHeader: requestData.length
}));

E/flutter (16871): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Exception: DioError [DioErrorType.other]: HttpException: Connection closed before full header was received, uri = http://192.168.1.102:8000/onvif/device_service
E/flutter (16871): #0 DioMixin.assureDioError (package:dio/src/dio_mixin.dart:819:20)
E/flutter (16871): #1 DioMixin._dispatchRequest (package:dio/src/dio_mixin.dart:678:13)
E/flutter (16871):
E/flutter (16871): #2 DioMixin.fetch.. (package:dio/src/dio_mixin.dart)
E/flutter (16871):
E/flutter (16871):
E/flutter (16871): #0 Soap.send (package:easy_onvif/src/soap.dart:34:7)
E/flutter (16871):
E/flutter (16871): #1 Soap.retrieveEnvlope (package:easy_onvif/src/soap.dart:43:26)
E/flutter (16871):
E/flutter (16871): #2 DeviceManagement.getSystemDateAndTime (package:easy_onvif/src/deviceManagement.dart:145:22)
E/flutter (16871):
E/flutter (16871): #3 Onvif.initialize (package:easy_onvif/src/onvif.dart:33:22)

any other work around?

@FakharAlyas119
Copy link

i am also facing the same issue
any one how to solve this issue?

@sara010
Copy link

sara010 commented Apr 12, 2022

same problem

1 similar comment
@guischpor
Copy link

same problem

@guischpor
Copy link

@FakharAlyas119 Could you solved this issue?

@FakharAlyas119
Copy link

@guischpor
Nope looking for the soulation

@Shimingli
Copy link

me too :
DioError [DioErrorType.other]: HttpException: Connection closed while receiving data

@KaranImaginationMedia
Copy link

flutter: DioException [unknown]: null
Error: HttpException: Connection closed while receiving data,

@santoshpatil2003
Copy link

Error downloading audio: DioException [unknown]: null
Error: HttpException: Connection closed while receiving data,

@nebulaqueen
Copy link

nebulaqueen commented Aug 30, 2023

Me too
sometime: "Error: HttpException: Connection closed while receiving data, uri ="
sometime: "Error: HttpException: Connection reset by peer, uri ="
but when i open the link in chrome on emulator it response as expected

@shoyabsiddique0
Copy link

is it for http links or https links? If its for HTTP then try turning off the proxy in android emulator settings. It might work...

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