Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
64dd4c59
Commit
64dd4c59
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Remove Accept-Encoding header
parent
c59cd0e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-7
1 addition, 7 deletions
CMakeLists.txt
include/MatrixClient.h
+0
-1
0 additions, 1 deletion
include/MatrixClient.h
src/MatrixClient.cc
+0
-64
0 additions, 64 deletions
src/MatrixClient.cc
with
1 addition
and
72 deletions
CMakeLists.txt
+
1
−
7
View file @
64dd4c59
...
...
@@ -60,12 +60,6 @@ find_package(Qt5LinguistTools REQUIRED)
find_package
(
Qt5Concurrent REQUIRED
)
find_package
(
Qt5Multimedia REQUIRED
)
find_package
(
ZLIB
)
if
(
ZLIB_FOUND
)
include_directories
(
${
ZLIB_INCLUDE_DIRS
}
)
endif
()
if
(
APPLE
)
find_package
(
Qt5MacExtras REQUIRED
)
endif
(
APPLE
)
...
...
@@ -328,7 +322,7 @@ add_subdirectory(libs/matrix-structs)
include_directories
(
${
matrix_structs_SOURCE_DIR
}
/include
)
include_directories
(
${
matrix_structs_SOURCE_DIR
}
/deps
)
set
(
COMMON_LIBS matrix_structs Qt5::Widgets Qt5::Network Qt5::Concurrent
${
ZLIB_LIBRARIES
}
)
set
(
COMMON_LIBS matrix_structs Qt5::Widgets Qt5::Network Qt5::Concurrent
)
if
(
APPVEYOR_BUILD
)
set
(
NHEKO_LIBS
${
COMMON_LIBS
}
lmdb
)
...
...
This diff is collapsed.
Click to expand it.
include/MatrixClient.h
+
0
−
1
View file @
64dd4c59
...
...
@@ -143,7 +143,6 @@ signals:
private
:
QNetworkReply
*
makeUploadRequest
(
QSharedPointer
<
QIODevice
>
iodev
);
QByteArray
uncompress
(
const
QByteArray
&
data
);
// Client API prefix.
QString
clientApiUrl_
;
...
...
This diff is collapsed.
Click to expand it.
src/MatrixClient.cc
+
0
−
64
View file @
64dd4c59
...
...
@@ -254,7 +254,6 @@ MatrixClient::sync() noexcept
endpoint
.
setQuery
(
query
);
QNetworkRequest
request
(
QString
(
endpoint
.
toEncoded
()));
request
.
setRawHeader
(
QByteArray
(
"Accept-Encoding"
),
QByteArray
(
"gzip, deflate"
));
auto
reply
=
get
(
request
);
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
[
this
,
reply
]()
{
...
...
@@ -269,9 +268,6 @@ MatrixClient::sync() noexcept
auto
data
=
reply
->
readAll
();
if
(
reply
->
hasRawHeader
(
QByteArray
(
"Content-Encoding"
)))
data
=
uncompress
(
data
);
try
{
mtx
::
responses
::
Sync
response
=
nlohmann
::
json
::
parse
(
data
);
emit
syncCompleted
(
response
);
...
...
@@ -382,7 +378,6 @@ MatrixClient::initialSync() noexcept
endpoint
.
setQuery
(
query
);
QNetworkRequest
request
(
QString
(
endpoint
.
toEncoded
()));
request
.
setRawHeader
(
QByteArray
(
"Accept-Encoding"
),
QByteArray
(
"gzip, deflate"
));
auto
reply
=
get
(
request
);
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
[
this
,
reply
]()
{
...
...
@@ -397,9 +392,6 @@ MatrixClient::initialSync() noexcept
auto
data
=
reply
->
readAll
();
if
(
reply
->
hasRawHeader
(
QByteArray
(
"Content-Encoding"
)))
data
=
uncompress
(
data
);
try
{
mtx
::
responses
::
Sync
response
=
nlohmann
::
json
::
parse
(
data
);
emit
initialSyncCompleted
(
response
);
...
...
@@ -1235,59 +1227,3 @@ MatrixClient::makeUploadRequest(QSharedPointer<QIODevice> iodev)
return
reply
;
}
QByteArray
MatrixClient
::
uncompress
(
const
QByteArray
&
data
)
{
/*
* https://stackoverflow.com/questions/2690328/qt-quncompress-gzip-data/7351507#7351507
*/
if
(
data
.
size
()
<=
4
)
{
qWarning
(
"uncompress: Input data is truncated"
);
return
QByteArray
();
}
QByteArray
result
;
int
ret
;
z_stream
strm
;
static
const
int
CHUNK_SIZE
=
1024
;
char
out
[
CHUNK_SIZE
];
/* allocate inflate state */
strm
.
zalloc
=
Z_NULL
;
strm
.
zfree
=
Z_NULL
;
strm
.
opaque
=
Z_NULL
;
strm
.
avail_in
=
data
.
size
();
strm
.
next_in
=
(
Bytef
*
)(
data
.
data
());
ret
=
inflateInit2
(
&
strm
,
15
+
32
);
// gzip decoding
if
(
ret
!=
Z_OK
)
return
QByteArray
();
// run inflate()
do
{
strm
.
avail_out
=
CHUNK_SIZE
;
strm
.
next_out
=
(
Bytef
*
)(
out
);
ret
=
inflate
(
&
strm
,
Z_NO_FLUSH
);
Q_ASSERT
(
ret
!=
Z_STREAM_ERROR
);
// state not clobbered
switch
(
ret
)
{
case
Z_NEED_DICT
:
ret
=
Z_DATA_ERROR
;
// fall through
case
Z_DATA_ERROR
:
case
Z_MEM_ERROR
:
(
void
)
inflateEnd
(
&
strm
);
return
QByteArray
();
}
result
.
append
(
out
,
CHUNK_SIZE
-
strm
.
avail_out
);
}
while
(
strm
.
avail_out
==
0
);
// clean up and return
inflateEnd
(
&
strm
);
return
result
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment