help-bash
[Top][All Lists]
Advanced

[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: Peng Yu
Subject: Re: Difference of packets sent via /dev/tcp to chromedriver and httpbin
Date: Fri, 2 Apr 2021 09:41:34 -0500

On Fri, Apr 2, 2021 at 9:18 AM Leonid Isaev (ifax)
<leonid.isaev@ifax.com> wrote:
>
> 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"

So the ignore is at the TCP level but not at the HTTP level (as the
response header prints "Connection: close")?

So the inconsistency between TCP and HTTP is not correct according to
some official standard? Or it is OK to have inconsistency in between?

> > #!/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?

I want to see what the response headers are.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]