Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
88be6d7a
Commit
88be6d7a
authored
Sep 11, 2019
by
Him188moe
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
# Conflicts: # pom.xml
parents
05735776
72e4208d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
mirai-core/pom.xml
mirai-core/pom.xml
+8
-0
mirai-core/src/main/java/net/mamoe/mirai/utils/ImageNetworkUtils.java
...rc/main/java/net/mamoe/mirai/utils/ImageNetworkUtils.java
+11
-11
No files found.
mirai-core/pom.xml
View file @
88be6d7a
...
...
@@ -69,6 +69,14 @@
<artifactId>
ini4j
</artifactId>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/ImageNetworkUtils.java
View file @
88be6d7a
package
net.mamoe.mirai.utils
;
import
org.apache.commons.httpclient.util.HttpURLConnection
;
import
org.jsoup.Connection
;
import
org.jsoup.Jsoup
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
public
class
ImageNetworkUtils
{
public
static
void
postImage
(
String
ukey
,
int
fileSize
,
String
g_uin
,
String
groupCode
,
String
img
){
public
static
void
postImage
(
String
ukey
,
int
fileSize
,
String
g_uin
,
String
groupCode
,
byte
[]
img
){
//http://htdata2.qq.com/cgi-bin/httpconn?htcmd=0x6ff0071&ver=5515&term=pc&ukey=” + 删全部空 (ukey) + “&filesize=” + 到文本 (fileSize) + “&range=0&uin=” + g_uin + “&groupcode=” + Group
StringBuilder
builder
=
new
StringBuilder
(
"http://htdata2.qq.com/cgi-bin/httpconn?htcmd=0x6ff0071&ver=5515&term=pc"
);
builder
.
append
(
"&ukey="
)
...
...
@@ -17,17 +20,14 @@ public class ImageNetworkUtils {
.
append
(
"&groupcode="
).
append
(
groupCode
);
try
{
Connection
.
Response
response
=
Jsoup
.
connect
(
builder
.
toString
())
.
ignoreContentType
(
true
)
.
requestBody
(
img
)
.
followRedirects
(
true
)
.
userAgent
(
"QQClient"
)
.
header
(
"Content-Length"
,
""
+
fileSize
)
.
execute
();
HttpURLConnection
conn
=
(
HttpURLConnection
)
new
URL
(
builder
.
toString
()).
openConnection
();
conn
.
setRequestProperty
(
"User-agent"
,
"QQClient"
);
conn
.
setRequestProperty
(
"Content-length"
,
""
+
fileSize
);
conn
.
setRequestMethod
(
"POST"
);
conn
.
getOutputStream
().
write
(
img
);
System
.
out
.
println
(
response
.
statusCode
());
System
.
out
.
println
(
response
.
statusMessage
());
System
.
out
.
println
(
response
.
body
());
conn
.
connect
();
System
.
out
.
println
(
conn
.
getResponseCode
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment