[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difference of packets sent via /dev/tcp to chromedriver and httpbin
From: |
Leonid Isaev (ifax) |
Subject: |
Re: Difference of packets sent via /dev/tcp to chromedriver and httpbin |
Date: |
Fri, 2 Apr 2021 14:18:21 +0000 |
On Thu, Apr 01, 2021 at 09:27:55PM -0500, Peng Yu wrote:
> main_chromedriver.sh below hangs there. Does anybody know why?
Hmm, chromedriver seems to ignore your "Connection: close"
> #!/usr/bin/env bash
> # vim: set noexpandtab tabstop=2:
>
> {
> req_header=(
> "GET /sessions HTTP/1.1"
> "Connection: close"
> )
> builtin printf '%s\r\n' "${req_header[@]}" '' >&"$fd"
> while true; do
> IFS= read -u "$fd" -r line || return
> line=${line%$'\r'}
> [[ $line ]] || break
> builtin printf '%s\n' "$line"
> done
> sleep 1
> cat <&"$fd"
> } {fd}<>/dev/tcp/127.0.0.1/9515
>
> it prints something like this. And the script hangs.
Yes, because of
> cat <&"$fd"
Try issuing another request to the server right after "sleep 1" -- cat(1)
should print the response. Also, what is the purpose of the while loop if you
are going to use cat(1) anyway?
HTH,
--
Leonid Isaev