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;

  1. [student@secondary Desktop]$ nc main 80
  2. GET / HTTP/1.1
  3. Host: foo.example.com
  4. Referrer: secondary.example.com
  5. User-Agent: test-browser
  6. HTTP/1.1 400 Bad Request
  7. Date: Sun, 04 Jul 2021 08:16:35 GMT
  8. Server: Apache/2.4.37 (centos)
  9. Content-Length: 226
  10. Connection: close
  11. Content-Type: text/html; charset=iso-8859-1
  12.  
  13. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  14. <html><head>
  15. <title>400 Bad Request</title>
  16. </head><body>
  17.  
  18.  
  19. Bad Request
  20.  
  21.  
  22.  
  23.  
  24. 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

  1. [student@secondary Desktop]$ nc -C main 80
  2. GET / HTTP/1.1
  3. Host: foo.example.com
  4. Referrer: secondary.example.com
  5. User-Agent: test-browser
  6.  
  7. HTTP/1.1 200 OK
  8. Date: Sun, 04 Jul 2021 08:20:51 GMT
  9. Server: Apache/2.4.37 (centos)
  10. Last-Modified: Sat, 15 May 2021 23:48:43 GMT
  11. ETag: "14-5c26700209e14"
  12. Accept-Ranges: bytes
  13. Content-Length: 20
  14. Content-Type: text/html; charset=UTF-8
  15.  
  16. The test page works
  17.  

Thanks.

Comments

  • Posts: 380
    edited July 2021

    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:

    [root@sec ~]# 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.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training