Welcome to the Linux Foundation Forum!

Lab 12.2

Hi,
I exercised Lab.12.2 today and found that the Lab didn't work for me at first .

From secondary machine , I did;
# nc main.example.com 80

but received the message like;

[[email protected] Desktop]$ nc  main 80
GET / HTTP/1.1
Host: foo.example.com
Referrer: secondary.example.com
User-Agent: test-browser
HTTP/1.1 400 Bad Request
Date: Sun, 04 Jul 2021 08:16:35 GMT
Server: Apache/2.4.37 (centos)
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>


Bad Request




Your browser sent a request that this server could not understand.

The main machine (httpd works) says;

10.0.2.20 - - [04/Jul/2021:17:16:35 +0900] "GET / HTTP/1.1\n" 400 226 "-" "-"

The problem is unnecessary "\n"

so I excuted netcat with the option "-C" and works well

[[email protected] Desktop]$ nc -C main 80
GET / HTTP/1.1
Host: foo.example.com
Referrer: secondary.example.com
User-Agent: test-browser

HTTP/1.1 200 OK
Date: Sun, 04 Jul 2021 08:20:51 GMT
Server: Apache/2.4.37 (centos)
Last-Modified: Sat, 15 May 2021 23:48:43 GMT
ETag: "14-5c26700209e14"
Accept-Ranges: bytes
Content-Length: 20
Content-Type: text/html; charset=UTF-8

The test page works

Thanks.

Comments

  • lee42xlee42x Posts: 312
    edited July 5

    Thank you for posting the issue.
    I can confirm the problem was duplicated and a change to the lab will be submitted.

    I also found that typing too slowly will trigger a timeout condition. To avoid the timeout create a file with the commands and pipe the file into the nc command.

    My file:

    [[email protected] ~]# cat 12.2.cmds
    GET / HTTP/1.1
    Host: node.example.com
    Referrer: foo.example.com
    User-Agent: test-browser

    The command becomes:

    $sudo echo 12.2.cmds | nc -C main.example.com 80

    Thank you for your input.

Sign In or Register to comment.