Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
0c114216
Commit
0c114216
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
https to port 443
parent
b0390be4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/src/HttpServletExamples/HttpWebPageSource.java
+7
-3
7 additions, 3 deletions
examples/src/HttpServletExamples/HttpWebPageSource.java
examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt
+31
-0
31 additions, 0 deletions
.../src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt
with
38 additions
and
3 deletions
examples/src/HttpServletExamples/HttpWebPageSource.java
+
7
−
3
View file @
0c114216
...
...
@@ -27,9 +27,13 @@ public class HttpWebPageSource {
// We request an IP to connect to a web server running on default http port 80.
String
WEB_ADDRESS
=
"www.nps.edu"
;
System
.
out
.
println
(
"New socket WEB_ADDRESS="
+
WEB_ADDRESS
);
Socket
socket
=
new
Socket
(
WEB_ADDRESS
,
80
);
// compare alternative: https on port 443
String
WEB_SERVER_ADDRESS
=
"www.nps.edu"
;
int
WEB_SERVER_PORT_HTTP
=
80
;
int
WEB_SERVER_PORT_HTTPS
=
443
;
// does this work too?
System
.
out
.
println
(
"New socket WEB_ADDRESS="
+
WEB_SERVER_ADDRESS
);
// this Java construct will work for HTTP but not HTTPS
Socket
socket
=
new
Socket
(
WEB_SERVER_ADDRESS
,
WEB_SERVER_PORT_HTTPS
);
// compare alternative: https on port 443
// we send a command to the web server, asking for what
// we want. Note that the format for the command is very
...
...
This diff is collapsed.
Click to expand it.
examples/src/HttpServletExamples/HttpWebPageSourceTerminalLog.txt
+
31
−
0
View file @
0c114216
...
...
@@ -31,3 +31,34 @@ GET /index.html HTTP/1.0
15: </body></html>
HttpWebPageSource: response finished
BUILD SUCCESSFUL (total time: 2 seconds)
now using https to port 443:
run-single:
HttpWebPageSource: create http connection and retrieve default page
Reference: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
Reference: https://tools.ietf.org/html/rfc7230
Reference: https://en.wikipedia.org/wiki/CURL
New socket WEB_ADDRESS=www.nps.edu
GET /index.html HTTP/1.0
1: HTTP/1.1 400 Bad Request
2: Date: Mon, 17 Aug 2020 18:25:20 GMT
3: Server: Apache
4: Content-Length: 362
5: Connection: close
6: Content-Type: text/html; charset=iso-8859-1
7:
8: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
9: <html><head>
10: <title>400 Bad Request</title>
11: </head><body>
12: <h1>Bad Request</h1>
13: <p>Your browser sent a request that this server could not understand.<br />
14: Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
15: Instead use the HTTPS scheme to access this URL, please.<br />
16: </p>
17: </body></html>
HttpWebPageSource: response finished
BUILD SUCCESSFUL (total time: 2 seconds)
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