Comments (12)
Can confirm the same error with Instagram and other sites.
edit: This seems to stem from an issue in dart's standard library. I created a push request with a fix here: dart-lang/sdk#33765
from dio.
Could you paste the stacktrace ?
from dio.
Unhandled exception:
FormatException: Invalid character in cookie value, code unit: '34'
#0 _Cookie._validate (dart:io/http_headers.dart:995)
#1 new _Cookie (dart:io/http_headers.dart:844)
#2 new Cookie (dart:io/http.dart:868)
#3 Instagram.basePage... (package:instascrapper/instascrapper.dart:45:31)
from dio.
i have same error
from dio.
[ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
DioError [DioErrorType.DEFAULT]: FormatException: Invalid character in cookie name, code unit: '58'
from dio.
@jave1987 what's your request url ?
from dio.
I fix it , there is '@' in url
from dio.
@thismachinechills
I also encountered this problem when using dio in the project of flutter. How should I use the code you submitted
from dio.
I have encountered the same problem, how to solve it ...
DioError [DioErrorType.DEFAULT]: FormatException: Invalid character in cookie value, code unit: '34'
from dio.
In my box I run the code as follows:
try {
Response r = await dio.get("https://www.instagram.com");
print(r.headers);
}on DioError catch(e){
print(e);
print(e.response.statusCode);
}
It works well,and the log:
connection: keep-alive
cache-control: private, no-cache, no-store, must-revalidate
set-cookie: sessionid=""; Domain=instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; Domain=.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; Domain=i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; Domain=.i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; Domain=www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; Domain=.www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: sessionid=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
set-cookie: rur=PRN; Domain=.instagram.com; Path=/
set-cookie: mid=W6B4uAAEAAHsy45UUgwJdX2vQLf5; Domain=.instagram.com; expires=Fri, 15 Sep 2028 04:02:00 GMT; Max-Age=315360000; Path=/
set-cookie: mcd=3; Domain=.instagram.com; expires=Fri, 15 Sep 2028 04:02:00 GMT; Path=/
set-cookie: csrftoken=ZnlfxdwG4v7zmFE3Kz5wmuPPcG8HQN4g; expires=Tue, 17-Sep-2019 04:02:00 GMT; Max-Age=31449600; Path=/; Secure
date: Tue, 18 Sep 2018 04:02:00 GMT
content-encoding: gzip
vary: Accept-Language, Cookie, Accept-Encoding
strict-transport-security: max-age=60
pragma: no-cache
content-type: text/html; charset=utf-8
content-language: en
content-security-policy-report-only: report-uri /security/csp_report/; default-src * data: blob:; script-src https://*.instagram.com https://*.cdninstagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net wss://*.instagram.com 'unsafe-inline' 'unsafe-eval' blob: data: 'self'; style-src data: blob: 'unsafe-inline' *; connect-src https://*.instagram.com https://*.cdninstagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'self' chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; block-all-mixed-content; frame-ancestors 'self'; frame-src 'self' https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'
content-length: 7935
x-frame-options: SAMEORIGIN
expires: Sat, 01 Jan 2000 00:00:00 GMT
my dart version:
Dart VM version: 2.1.0-dev.4.0 (Fri Sep 7 16:44:38 2018 +0200) on "macos_x64"
It seems to be the lower version Dart SDK bug, and has been fixed dart-lang/sdk@a9ad427.
from dio.
Fixed, dart-lang/sdk#33765
from dio.
This happens again when using the cookie_manager interceptor.
Stacktrace:
E/flutter (23638): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: FormatException: Invalid character in cookie value, code unit: '92' (at character 3)
E/flutter (23638): "{\"1.1.1.11\": 33576}:1kbxcM:p0LIbXZDKdd3sLDH3dlI"
E/flutter (23638): ^
E/flutter (23638):
�[38;5;248mE/flutter (23638): #0 DioMixin._request._errorInterceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure>�[39;49m
package:dio/src/dio.dart
Steps to reproduce:
import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:cookie_jar/cookie_jar.dart';
var dio = Dio(BaseOptions(followRedirects: true));
var cookieJar = CookieJar();
dio.interceptors.add(CookieManager(cookieJar));
var resp = await dio.get('https://www.instagram.com/p/CGQ8sl2DwTj/')
from dio.
Related Issues (20)
- [Web] ERROR_TYPE: DioExceptionType.connectionError HOT 2
- Flutter web deployment HOT 1
- [Dio native adapter] proxy HOT 2
- Exception has occurred. DioException (DioException [bad response]: This exception was thrown because the response has a status code of 401 and RequestOptions.validateStatus was configured to throw for this status code. The status code of 401 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled" Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code. ) HOT 1
- error 404 when trying to download a file. HOT 3
- How to mock Dio.interceptors.add when write unit test? HOT 1
- Conditionally allows relative path for `baseUrl` HOT 11
- Need a way to catch DioException [request cancelled] from the caller code HOT 3
- 有没有大佬帮我看看我的代码有什么问题,handler.resolve(res) 后,原始请求返回值一直为空,不知道为什么? HOT 1
- I don't know where the problem is with my code. After handler.reslove(res), the return value of the original request is always empty. HOT 3
- [Flutter Web] dio.get() sends options. HOT 1
- How to use handler.reject in onError of QueuedInterceptor HOT 1
- [native_dio_adapter] Exception fetching LoggerImpl class HOT 4
- http请求头不标准,大小写全部错误 HOT 1
- Error using interceptors HOT 1
- [native_dio_adapter] update cronet_http version HOT 1
- Dio REST call response is slow than Postman HOT 5
- Response Header is missing except content-length & content-type HOT 5
- dio https connect can not keep Alive? HOT 8
- onError not working in dio interceptor HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dio.