Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: parse http2 data in text mode #580

Merged
merged 6 commits into from
Jul 21, 2024
Merged

feat: parse http2 data in text mode #580

merged 6 commits into from
Jul 21, 2024

Conversation

yuweizzz
Copy link
Contributor

Parse http2 data in text mode.

Copy link
Member

@cfc4n cfc4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some unit tests.

}

func (h2r *HTTP2Request) Display() []byte {
h2r.bufReader.Discard(H2MagicLen)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catch error here please

@yuweizzz
Copy link
Contributor Author

ok.

@yuweizzz
Copy link
Contributor Author

And I found a build question, not sure if it happened in others system too.

cd /usr/src/linux-source-6.1.0
whoami || exit 1
/bin/bash: line 1: cd: /usr/src/linux-source-6.1.0: No such file or directory
root
clang \
                -emit-llvm -O2 -S -D__TARGET_ARCH_x86 -xc -g -isystem -D__BPF_TRACING__ -D__KERNEL__ -DNOCORE -nostdinc -DKBUILD_MODNAME=\"eCapture\" -target x86_64  -Wall -Wno-unused-variable -Wnounused-but-set-variable -Wno-frame-address -Wno-unused-value -Wno-unknown-warning-option -Wno-pragma-once-outside-header -Wno-pointer-sign -Wno-gnu-variable-sized-type-not-at-end -Wno-deprecated-declarations -Wno-compare-distinct-pointer-types -Wno-address-of-packed-member -fno-stack-protector -fno-jump-tables -fno-unwind-tables -fno-asynchronous-unwind-tables \
                -I ./kern -I ./kern/bpf/x86 \
                -I /lib/modules/6.1.0-18-amd64/source/arch/x86/include \
                -I /lib/modules/6.1.0-18-amd64/build/arch/x86/include/generated \
                -I /lib/modules/6.1.0-18-amd64/source/include \
                -I /lib/modules/6.1.0-18-amd64/source/arch/x86/include/uapi \
                -I /lib/modules/6.1.0-18-amd64/build/arch/x86/include/generated/uapi \
                -I /lib/modules/6.1.0-18-amd64/source/include/uapi \
                -I /lib/modules/6.1.0-18-amd64/build/include/generated/uapi \
                -c kern/boringssl_na_kern.c \
                -o - |llc \
                -march=bpf \
                -filetype=obj \
                -o user/bytecode/boringssl_na_kern_noncore.o
clang \
                -emit-llvm -O2 -S -D__TARGET_ARCH_x86 -xc -g -isystem -D__BPF_TRACING__ -D__KERNEL__ -DNOCORE -nostdinc -DKBUILD_MODNAME=\"eCapture\" -target x86_64  -Wall -Wno-unused-variable -Wnounused-but-set-variable -Wno-frame-address -Wno-unused-value -Wno-unknown-warning-option -Wno-pragma-once-outside-header -Wno-pointer-sign -Wno-gnu-variable-sized-type-not-at-end -Wno-deprecated-declarations -Wno-compare-distinct-pointer-types -Wno-address-of-packed-member -fno-stack-protector -fno-jump-tables -fno-unwind-tables -fno-asynchronous-unwind-tables \
                -I ./kern -I ./kern/bpf/x86 \
                -I /lib/modules/6.1.0-18-amd64/source/arch/x86/include \
                -I /lib/modules/6.1.0-18-amd64/build/arch/x86/include/generated \
                -I /lib/modules/6.1.0-18-amd64/source/include \
                -I /lib/modules/6.1.0-18-amd64/source/arch/x86/include/uapi \
                -I /lib/modules/6.1.0-18-amd64/build/arch/x86/include/generated/uapi \
                -I /lib/modules/6.1.0-18-amd64/source/include/uapi \
                -I /lib/modules/6.1.0-18-amd64/build/include/generated/uapi \
                -DKERNEL_LESS_5_2 \
                -c kern/boringssl_na_kern.c \
                -o - |llc \
                -march=bpf \
                -filetype=obj \
                -o user/bytecode/boringssl_na_kern_noncore_less52.o
In file included from kern/boringssl_na_kern.c:71:
In file included from ./kern/boringssl_masterkey.h:15:
In file included from ./kern/ecapture.h:28:
/lib/modules/6.1.0-18-amd64/source/include/linux/kconfig.h:5:10: fatal error: 'generated/autoconf.h' file not found
#include <generated/autoconf.h>
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from kern/boringssl_na_kern.c:71:
In file included from ./kern/boringssl_masterkey.h:15:
In file included from ./kern/ecapture.h:28:
/lib/modules/6.1.0-18-amd64/source/include/linux/kconfig.h:5:10: fatal error: 'generated/autoconf.h' file not found
#include <generated/autoconf.h>
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

I use debian 12, and I add -I $(KERN_BUILD_PATH)/include \ in Makefile L156 and L172 will fix this error.

@cfc4n
Copy link
Member

cfc4n commented Jul 16, 2024

Have you executed the code for setting up the build environment?

cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}

Copy link
Member

@cfc4n cfc4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to submit the unit test files?

@yuweizzz
Copy link
Contributor Author

Have you executed the code for setting up the build environment?

cd /usr/src
sudo tar -xf linux-source-${kernel_ver}.tar.bz2
cd /usr/src/linux-source-${kernel_ver}
test -f .config || sudo make oldconfig
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- prepare V=0
ls -al /usr/src/linux-source-${kernel_ver}

I use apt to install linux headers, apt install linux-headers-6.1.0-18-amd64, and don't have kernel source. Maybe this is the reason?

@yuweizzz
Copy link
Contributor Author

As for test, I added http2 bin file, and do we need the others test file?

@cfc4n
Copy link
Member

cfc4n commented Jul 17, 2024

As for test, I added http2 bin file, and do we need the others test file?

Of course. Unit testing is an important means of ensuring the quality of engineering. Please add these unit test codes as well. During CI and CD processes, these test codes are executed for verification purposes.

please refer :

func TestEventProcessor_Serve(t *testing.T) {

@cfc4n cfc4n added the enhancement New feature or request label Jul 17, 2024
@yuweizzz
Copy link
Contributor Author

ok, I will try.

@cfc4n
Copy link
Member

cfc4n commented Jul 21, 2024

I have verified this feature, and it has passed the verification. In addition, after decrypting the five bin files, the content is as follows: it is a correct HTTP/2 request and response. Thank you for your contribution.

go test -v -race .
=== RUN   TestEventProcessor_Serve
    processor_test.go:120: done
--- PASS: TestEventProcessor_Serve (10.01s)
PASS
ok  	github.com/gojue/ecapture/pkg/event_processor	11.021s

cat output.log
UUID:469965_469965_curl_5_0, Name:HTTP2Response, Type:4, Length:3313
00000000  0a 46 72 61 6d 65 20 54  79 70 65 09 3d 3e 09 53  |.Frame Type.=>.S|
00000010  45 54 54 49 4e 47 53 0a  0a 46 72 61 6d 65 20 54  |ETTINGS..Frame T|
00000020  79 70 65 09 3d 3e 09 57  49 4e 44 4f 57 5f 55 50  |ype.=>.WINDOW_UP|
00000030  44 41 54 45 0a 0a 46 72  61 6d 65 20 54 79 70 65  |DATE..Frame Type|
00000040  09 3d 3e 09 53 45 54 54  49 4e 47 53 0a 0a 46 72  |.=>.SETTINGS..Fr|
00000050  61 6d 65 20 54 79 70 65  09 3d 3e 09 48 45 41 44  |ame Type.=>.HEAD|
00000060  45 52 53 0a 68 65 61 64  65 72 20 66 69 65 6c 64  |ERS.header field|
00000070  20 22 3a 73 74 61 74 75  73 22 20 3d 20 22 32 30  | ":status" = "20|
00000080  30 22 0a 68 65 61 64 65  72 20 66 69 65 6c 64 20  |0".header field |
00000090  22 64 61 74 65 22 20 3d  20 22 54 75 65 2c 20 31  |"date" = "Tue, 1|
000000a0  36 20 4a 75 6c 20 32 30  32 34 20 30 37 3a 34 34  |6 Jul 2024 07:44|
000000b0  3a 31 39 20 47 4d 54 22  0a 68 65 61 64 65 72 20  |:19 GMT".header |
000000c0  66 69 65 6c 64 20 22 63  6f 6e 74 65 6e 74 2d 74  |field "content-t|
000000d0  79 70 65 22 20 3d 20 22  61 70 70 6c 69 63 61 74  |ype" = "applicat|
000000e0  69 6f 6e 2f 6a 73 6f 6e  22 0a 68 65 61 64 65 72  |ion/json".header|
000000f0  20 66 69 65 6c 64 20 22  63 6f 6e 74 65 6e 74 2d  | field "content-|
00000100  6c 65 6e 67 74 68 22 20  3d 20 22 31 38 38 22 0a  |length" = "188".|
00000110  68 65 61 64 65 72 20 66  69 65 6c 64 20 22 73 65  |header field "se|
00000120  72 76 65 72 22 20 3d 20  22 67 75 6e 69 63 6f 72  |rver" = "gunicor|
00000130  6e 2f 31 39 2e 39 2e 30  22 0a 68 65 61 64 65 72  |n/19.9.0".header|
00000140  20 66 69 65 6c 64 20 22  63 6f 6e 74 65 6e 74 2d  | field "content-|
00000150  65 6e 63 6f 64 69 6e 67  22 20 3d 20 22 62 72 22  |encoding" = "br"|
00000160  0a 68 65 61 64 65 72 20  66 69 65 6c 64 20 22 61  |.header field "a|
00000170  63 63 65 73 73 2d 63 6f  6e 74 72 6f 6c 2d 61 6c  |ccess-control-al|
00000180  6c 6f 77 2d 6f 72 69 67  69 6e 22 20 3d 20 22 2a  |low-origin" = "*|
00000190  22 0a 68 65 61 64 65 72  20 66 69 65 6c 64 20 22  |".header field "|
000001a0  61 63 63 65 73 73 2d 63  6f 6e 74 72 6f 6c 2d 61  |access-control-a|
000001b0  6c 6c 6f 77 2d 63 72 65  64 65 6e 74 69 61 6c 73  |llow-credentials|
000001c0  22 20 3d 20 22 74 72 75  65 22 0a 0a 46 72 61 6d  |" = "true"..Fram|
000001d0  65 20 54 79 70 65 09 3d  3e 09 44 41 54 41 0a 1b  |e Type.=>.DATA..|
000001e0  fe 00 00 9c 05 76 73 1a  59 98 cf ea c1 c3 e2 5d  |.....vs.Y......]|
000001f0  21 05 1b 70 c8 c9 01 ef  9b 9d 20 22 7d 83 e7 c8  |!..p...... "}...|
00000200  e7 99 7e c0 6b 44 83 43  ce 4f 7c a0 8c d3 16 fc  |..~.kD.C.O|.....|
00000210  e7 6e 3b 60 7c fb db 5d  cb c2 3a a0 30 b3 cc 92  |.n;`|..]..:.0...|
00000220  16 49 76 33 25 d2 df 4c  0b ab 3d ee b9 eb a1 7c  |.Iv3%..L..=....||
00000230  5f ce b1 03 ef 58 dc ea  67 39 84 a8 a4 af 18 b1  |_....X..g9......|
00000240  45 a9 18 cc 04 92 91 fc  d0 b5 3d cf 35 ef e6 3b  |E.........=.5..;|
00000250  e1 eb 20 96 2a 44 70 c1  af e2 da 47 2c 32 06 51  |.. .*Dp....G,2.Q|
00000260  8a d4 e6 fe 19 ae 52 1d  b6 a1 00 b6 fe 45 60 94  |......R......E`.|
00000270  55 4c 94 1c 6a 09 ad 72  59 6a 51 65 a5 22 19 ad  |UL..j..rYjQe."..|
00000280  84 aa 8b d2 02 f8 ec 2a  12 09 18 40 f9 d5 1a 3b  |.......*...@...;|
00000290  53 ca 91 b1 88 09 89 b4  de d9 06                 |S..........|

UUID:469962_469962_curl_5_1, Name:HTTP2Request, Type:2, Length:2446
00000000  0a 46 72 61 6d 65 20 54  79 70 65 09 3d 3e 09 53  |.Frame Type.=>.S|
00000010  45 54 54 49 4e 47 53 0a  0a 46 72 61 6d 65 20 54  |ETTINGS..Frame T|
00000020  79 70 65 09 3d 3e 09 57  49 4e 44 4f 57 5f 55 50  |ype.=>.WINDOW_UP|
00000030  44 41 54 45 0a 0a 46 72  61 6d 65 20 54 79 70 65  |DATE..Frame Type|
00000040  09 3d 3e 09 48 45 41 44  45 52 53 0a 68 65 61 64  |.=>.HEADERS.head|
00000050  65 72 20 66 69 65 6c 64  20 22 3a 6d 65 74 68 6f  |er field ":metho|
00000060  64 22 20 3d 20 22 50 4f  53 54 22 0a 68 65 61 64  |d" = "POST".head|
00000070  65 72 20 66 69 65 6c 64  20 22 3a 70 61 74 68 22  |er field ":path"|
00000080  20 3d 20 22 2f 61 6e 79  74 68 69 6e 67 2f 61 6e  | = "/anything/an|
00000090  79 74 68 69 6e 67 22 0a  68 65 61 64 65 72 20 66  |ything".header f|
000000a0  69 65 6c 64 20 22 3a 73  63 68 65 6d 65 22 20 3d  |ield ":scheme" =|
000000b0  20 22 68 74 74 70 73 22  0a 68 65 61 64 65 72 20  | "https".header |
000000c0  66 69 65 6c 64 20 22 3a  61 75 74 68 6f 72 69 74  |field ":authorit|
000000d0  79 22 20 3d 20 22 68 74  74 70 62 69 6e 2e 6f 72  |y" = "httpbin.or|
000000e0  67 22 0a 68 65 61 64 65  72 20 66 69 65 6c 64 20  |g".header field |
000000f0  22 75 73 65 72 2d 61 67  65 6e 74 22 20 3d 20 22  |"user-agent" = "|
00000100  63 75 72 6c 2f 37 2e 38  38 2e 31 22 0a 68 65 61  |curl/7.88.1".hea|
00000110  64 65 72 20 66 69 65 6c  64 20 22 61 63 63 65 70  |der field "accep|
00000120  74 22 20 3d 20 22 2a 2f  2a 22 0a 68 65 61 64 65  |t" = "*/*".heade|
00000130  72 20 66 69 65 6c 64 20  22 63 6f 6e 74 65 6e 74  |r field "content|
00000140  2d 65 6e 63 6f 64 69 6e  67 22 20 3d 20 22 67 7a  |-encoding" = "gz|
00000150  69 70 22 0a 68 65 61 64  65 72 20 66 69 65 6c 64  |ip".header field|
00000160  20 22 63 6f 6e 74 65 6e  74 2d 6c 65 6e 67 74 68  | "content-length|
00000170  22 20 3d 20 22 32 34 22  0a 68 65 61 64 65 72 20  |" = "24".header |
00000180  66 69 65 6c 64 20 22 63  6f 6e 74 65 6e 74 2d 74  |field "content-t|
00000190  79 70 65 22 20 3d 20 22  61 70 70 6c 69 63 61 74  |ype" = "applicat|
000001a0  69 6f 6e 2f 78 2d 77 77  77 2d 66 6f 72 6d 2d 75  |ion/x-www-form-u|
000001b0  72 6c 65 6e 63 6f 64 65  64 22 0a 0a 46 72 61 6d  |rlencoded"..Fram|
000001c0  65 20 54 79 70 65 09 3d  3e 09 53 45 54 54 49 4e  |e Type.=>.SETTIN|
000001d0  47 53 0a 0a 46 72 61 6d  65 20 54 79 70 65 09 3d  |GS..Frame Type.=|
000001e0  3e 09 44 41 54 41 0a 78  78 78 78 78 0a           |>.DATA.xxxxx.|

UUID:469964_469964_curl_5_0, Name:HTTP2Response, Type:4, Length:4018
00000000  0a 46 72 61 6d 65 20 54  79 70 65 09 3d 3e 09 53  |.Frame Type.=>.S|
00000010  45 54 54 49 4e 47 53 0a  0a 46 72 61 6d 65 20 54  |ETTINGS..Frame T|
00000020  79 70 65 09 3d 3e 09 57  49 4e 44 4f 57 5f 55 50  |ype.=>.WINDOW_UP|
00000030  44 41 54 45 0a 0a 46 72  61 6d 65 20 54 79 70 65  |DATE..Frame Type|
00000040  09 3d 3e 09 53 45 54 54  49 4e 47 53 0a 0a 46 72  |.=>.SETTINGS..Fr|
00000050  61 6d 65 20 54 79 70 65  09 3d 3e 09 48 45 41 44  |ame Type.=>.HEAD|
00000060  45 52 53 0a 68 65 61 64  65 72 20 66 69 65 6c 64  |ERS.header field|
00000070  20 22 3a 73 74 61 74 75  73 22 20 3d 20 22 32 30  | ":status" = "20|
00000080  30 22 0a 68 65 61 64 65  72 20 66 69 65 6c 64 20  |0".header field |
00000090  22 64 61 74 65 22 20 3d  20 22 54 75 65 2c 20 31  |"date" = "Tue, 1|
000000a0  36 20 4a 75 6c 20 32 30  32 34 20 30 37 3a 31 39  |6 Jul 2024 07:19|
000000b0  3a 34 35 20 47 4d 54 22  0a 68 65 61 64 65 72 20  |:45 GMT".header |
000000c0  66 69 65 6c 64 20 22 63  6f 6e 74 65 6e 74 2d 74  |field "content-t|
000000d0  79 70 65 22 20 3d 20 22  61 70 70 6c 69 63 61 74  |ype" = "applicat|
000000e0  69 6f 6e 2f 6a 73 6f 6e  22 0a 68 65 61 64 65 72  |ion/json".header|
000000f0  20 66 69 65 6c 64 20 22  63 6f 6e 74 65 6e 74 2d  | field "content-|
00000100  6c 65 6e 67 74 68 22 20  3d 20 22 33 36 35 22 0a  |length" = "365".|
00000110  68 65 61 64 65 72 20 66  69 65 6c 64 20 22 73 65  |header field "se|
00000120  72 76 65 72 22 20 3d 20  22 67 75 6e 69 63 6f 72  |rver" = "gunicor|
00000130  6e 2f 31 39 2e 39 2e 30  22 0a 68 65 61 64 65 72  |n/19.9.0".header|
00000140  20 66 69 65 6c 64 20 22  61 63 63 65 73 73 2d 63  | field "access-c|
00000150  6f 6e 74 72 6f 6c 2d 61  6c 6c 6f 77 2d 6f 72 69  |ontrol-allow-ori|
00000160  67 69 6e 22 20 3d 20 22  2a 22 0a 68 65 61 64 65  |gin" = "*".heade|
00000170  72 20 66 69 65 6c 64 20  22 61 63 63 65 73 73 2d  |r field "access-|
00000180  63 6f 6e 74 72 6f 6c 2d  61 6c 6c 6f 77 2d 63 72  |control-allow-cr|
00000190  65 64 65 6e 74 69 61 6c  73 22 20 3d 20 22 74 72  |edentials" = "tr|
000001a0  75 65 22 0a 0a 46 72 61  6d 65 20 54 79 70 65 09  |ue"..Frame Type.|
000001b0  3d 3e 09 44 41 54 41 0a  7b 0a 20 20 22 61 72 67  |=>.DATA.{.  "arg|
000001c0  73 22 3a 20 7b 7d 2c 20  0a 20 20 22 64 61 74 61  |s": {}, .  "data|
000001d0  22 3a 20 22 22 2c 20 0a  20 20 22 66 69 6c 65 73  |": "", .  "files|
000001e0  22 3a 20 7b 7d 2c 20 0a  20 20 22 66 6f 72 6d 22  |": {}, .  "form"|
000001f0  3a 20 7b 7d 2c 20 0a 20  20 22 68 65 61 64 65 72  |: {}, .  "header|
00000200  73 22 3a 20 7b 0a 20 20  20 20 22 41 63 63 65 70  |s": {.    "Accep|
00000210  74 22 3a 20 22 61 70 70  6c 69 63 61 74 69 6f 6e  |t": "application|
00000220  2f 6a 73 6f 6e 22 2c 20  0a 20 20 20 20 22 48 6f  |/json", .    "Ho|
00000230  73 74 22 3a 20 22 68 74  74 70 62 69 6e 2e 6f 72  |st": "httpbin.or|
00000240  67 22 2c 20 0a 20 20 20  20 22 55 73 65 72 2d 41  |g", .    "User-A|
00000250  67 65 6e 74 22 3a 20 22  63 75 72 6c 2f 37 2e 38  |gent": "curl/7.8|
00000260  38 2e 31 22 2c 20 0a 20  20 20 20 22 58 2d 41 6d  |8.1", .    "X-Am|
00000270  7a 6e 2d 54 72 61 63 65  2d 49 64 22 3a 20 22 52  |zn-Trace-Id": "R|
00000280  6f 6f 74 3d 31 2d 36 36  39 36 31 66 31 31 2d 34  |oot=1-66961f11-4|
00000290  34 65 63 63 33 32 32 32  62 34 65 63 36 65 32 37  |4ecc3222b4ec6e27|
000002a0  31 33 63 37 35 65 64 22  0a 20 20 7d 2c 20 0a 20  |13c75ed".  }, . |
000002b0  20 22 6a 73 6f 6e 22 3a  20 6e 75 6c 6c 2c 20 0a  | "json": null, .|
000002c0  20 20 22 6d 65 74 68 6f  64 22 3a 20 22 47 45 54  |  "method": "GET|
000002d0  22 2c 20 0a 20 20 22 6f  72 69 67 69 6e 22 3a 20  |", .  "origin": |
000002e0  22 31 38 33 2e 32 33 2e  31 34 32 2e 38 35 22 2c  |"183.23.142.85",|
000002f0  20 0a 20 20 22 75 72 6c  22 3a 20 22 68 74 74 70  | .  "url": "http|
00000300  73 3a 2f 2f 68 74 74 70  62 69 6e 2e 6f 72 67 2f  |s://httpbin.org/|
00000310  61 6e 79 74 68 69 6e 67  2f 61 6e 79 74 68 69 6e  |anything/anythin|
00000320  67 22 0a 7d 0a                                    |g".}.|

UUID:469963_469963_curl_5_0, Name:HTTP2Response, Type:4, Length:3698
00000000  0a 46 72 61 6d 65 20 54  79 70 65 09 3d 3e 09 53  |.Frame Type.=>.S|
00000010  45 54 54 49 4e 47 53 0a  0a 46 72 61 6d 65 20 54  |ETTINGS..Frame T|
00000020  79 70 65 09 3d 3e 09 57  49 4e 44 4f 57 5f 55 50  |ype.=>.WINDOW_UP|
00000030  44 41 54 45 0a 0a 46 72  61 6d 65 20 54 79 70 65  |DATE..Frame Type|
00000040  09 3d 3e 09 53 45 54 54  49 4e 47 53 0a 0a 46 72  |.=>.SETTINGS..Fr|
00000050  61 6d 65 20 54 79 70 65  09 3d 3e 09 48 45 41 44  |ame Type.=>.HEAD|
00000060  45 52 53 0a 68 65 61 64  65 72 20 66 69 65 6c 64  |ERS.header field|
00000070  20 22 3a 73 74 61 74 75  73 22 20 3d 20 22 32 30  | ":status" = "20|
00000080  30 22 0a 68 65 61 64 65  72 20 66 69 65 6c 64 20  |0".header field |
00000090  22 64 61 74 65 22 20 3d  20 22 54 75 65 2c 20 31  |"date" = "Tue, 1|
000000a0  36 20 4a 75 6c 20 32 30  32 34 20 30 37 3a 32 33  |6 Jul 2024 07:23|
000000b0  3a 31 31 20 47 4d 54 22  0a 68 65 61 64 65 72 20  |:11 GMT".header |
000000c0  66 69 65 6c 64 20 22 63  6f 6e 74 65 6e 74 2d 74  |field "content-t|
000000d0  79 70 65 22 20 3d 20 22  61 70 70 6c 69 63 61 74  |ype" = "applicat|
000000e0  69 6f 6e 2f 6a 73 6f 6e  22 0a 68 65 61 64 65 72  |ion/json".header|
000000f0  20 66 69 65 6c 64 20 22  63 6f 6e 74 65 6e 74 2d  | field "content-|
00000100  6c 65 6e 67 74 68 22 20  3d 20 22 32 30 39 22 0a  |length" = "209".|
00000110  68 65 61 64 65 72 20 66  69 65 6c 64 20 22 73 65  |header field "se|
00000120  72 76 65 72 22 20 3d 20  22 67 75 6e 69 63 6f 72  |rver" = "gunicor|
00000130  6e 2f 31 39 2e 39 2e 30  22 0a 68 65 61 64 65 72  |n/19.9.0".header|
00000140  20 66 69 65 6c 64 20 22  63 6f 6e 74 65 6e 74 2d  | field "content-|
00000150  65 6e 63 6f 64 69 6e 67  22 20 3d 20 22 67 7a 69  |encoding" = "gzi|
00000160  70 22 0a 68 65 61 64 65  72 20 66 69 65 6c 64 20  |p".header field |
00000170  22 61 63 63 65 73 73 2d  63 6f 6e 74 72 6f 6c 2d  |"access-control-|
00000180  61 6c 6c 6f 77 2d 6f 72  69 67 69 6e 22 20 3d 20  |allow-origin" = |
00000190  22 2a 22 0a 68 65 61 64  65 72 20 66 69 65 6c 64  |"*".header field|
000001a0  20 22 61 63 63 65 73 73  2d 63 6f 6e 74 72 6f 6c  | "access-control|
000001b0  2d 61 6c 6c 6f 77 2d 63  72 65 64 65 6e 74 69 61  |-allow-credentia|
000001c0  6c 73 22 20 3d 20 22 74  72 75 65 22 0a 0a 46 72  |ls" = "true"..Fr|
000001d0  61 6d 65 20 54 79 70 65  09 3d 3e 09 44 41 54 41  |ame Type.=>.DATA|
000001e0  0a 7b 0a 20 20 22 67 7a  69 70 70 65 64 22 3a 20  |.{.  "gzipped": |
000001f0  74 72 75 65 2c 20 0a 20  20 22 68 65 61 64 65 72  |true, .  "header|
00000200  73 22 3a 20 7b 0a 20 20  20 20 22 41 63 63 65 70  |s": {.    "Accep|
00000210  74 22 3a 20 22 61 70 70  6c 69 63 61 74 69 6f 6e  |t": "application|
00000220  2f 6a 73 6f 6e 22 2c 20  0a 20 20 20 20 22 48 6f  |/json", .    "Ho|
00000230  73 74 22 3a 20 22 68 74  74 70 62 69 6e 2e 6f 72  |st": "httpbin.or|
00000240  67 22 2c 20 0a 20 20 20  20 22 55 73 65 72 2d 41  |g", .    "User-A|
00000250  67 65 6e 74 22 3a 20 22  63 75 72 6c 2f 37 2e 38  |gent": "curl/7.8|
00000260  38 2e 31 22 2c 20 0a 20  20 20 20 22 58 2d 41 6d  |8.1", .    "X-Am|
00000270  7a 6e 2d 54 72 61 63 65  2d 49 64 22 3a 20 22 52  |zn-Trace-Id": "R|
00000280  6f 6f 74 3d 31 2d 36 36  39 36 31 66 64 65 2d 32  |oot=1-66961fde-2|
00000290  31 63 38 64 61 61 61 32  39 37 39 37 37 65 66 35  |1c8daaa297977ef5|
000002a0  63 30 34 64 38 36 35 22  0a 20 20 7d 2c 20 0a 20  |c04d865".  }, . |
000002b0  20 22 6d 65 74 68 6f 64  22 3a 20 22 47 45 54 22  | "method": "GET"|
000002c0  2c 20 0a 20 20 22 6f 72  69 67 69 6e 22 3a 20 22  |, .  "origin": "|
000002d0  31 31 33 2e 38 39 2e 32  34 35 2e 37 37 22 0a 7d  |113.89.245.77".}|
000002e0  0a                                                |.|

UUID:469961_469961_curl_5_1, Name:HTTP2Request, Type:2, Length:1565
00000000  0a 46 72 61 6d 65 20 54  79 70 65 09 3d 3e 09 53  |.Frame Type.=>.S|
00000010  45 54 54 49 4e 47 53 0a  0a 46 72 61 6d 65 20 54  |ETTINGS..Frame T|
00000020  79 70 65 09 3d 3e 09 57  49 4e 44 4f 57 5f 55 50  |ype.=>.WINDOW_UP|
00000030  44 41 54 45 0a 0a 46 72  61 6d 65 20 54 79 70 65  |DATE..Frame Type|
00000040  09 3d 3e 09 48 45 41 44  45 52 53 0a 68 65 61 64  |.=>.HEADERS.head|
00000050  65 72 20 66 69 65 6c 64  20 22 3a 6d 65 74 68 6f  |er field ":metho|
00000060  64 22 20 3d 20 22 47 45  54 22 0a 68 65 61 64 65  |d" = "GET".heade|
00000070  72 20 66 69 65 6c 64 20  22 3a 70 61 74 68 22 20  |r field ":path" |
00000080  3d 20 22 2f 22 0a 68 65  61 64 65 72 20 66 69 65  |= "/".header fie|
00000090  6c 64 20 22 3a 73 63 68  65 6d 65 22 20 3d 20 22  |ld ":scheme" = "|
000000a0  68 74 74 70 73 22 0a 68  65 61 64 65 72 20 66 69  |https".header fi|
000000b0  65 6c 64 20 22 3a 61 75  74 68 6f 72 69 74 79 22  |eld ":authority"|
000000c0  20 3d 20 22 68 74 74 70  62 69 6e 2e 6f 72 67 22  | = "httpbin.org"|
000000d0  0a 68 65 61 64 65 72 20  66 69 65 6c 64 20 22 75  |.header field "u|
000000e0  73 65 72 2d 61 67 65 6e  74 22 20 3d 20 22 63 75  |ser-agent" = "cu|
000000f0  72 6c 2f 37 2e 38 38 2e  31 22 0a 68 65 61 64 65  |rl/7.88.1".heade|
00000100  72 20 66 69 65 6c 64 20  22 61 63 63 65 70 74 22  |r field "accept"|
00000110  20 3d 20 22 2a 2f 2a 22  0a 0a 46 72 61 6d 65 20  | = "*/*"..Frame |
00000120  54 79 70 65 09 3d 3e 09  53 45 54 54 49 4e 47 53  |Type.=>.SETTINGS|
00000130  0a                                                |.|

Copy link
Member

@cfc4n cfc4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM, Thanks.

}
// http2 parse count
if strings.Contains(line, "Name:HTTP2Response") {
h2Resq += 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple counting is not the best method. If a new HTTP/2 binary file is added here, then the numerical verification will fail.

I will submit a new PR to fix this issue.

@cfc4n cfc4n merged commit b73a099 into gojue:master Jul 21, 2024
6 of 7 checks passed
@yuweizzz
Copy link
Contributor Author

yuweizzz commented Aug 8, 2024 via email

@blaisewang
Copy link
Contributor

The file is modified from pkg/event_processor/http_request.go <#580 (comment)> and just changes the user info, if there is something wrong, I can delete it. Blaise Wang @.> 于2024年8月8日周四 14:38写道:

@.
* commented on this pull request. ------------------------------ In pkg/event_processor/http2_request.go <#580 (comment)>: > @@ -0,0 +1,158 @@ +// Copyright 2024 yuweizzz @.>. All Rights Reserved. All Rights Reserved? — Reply to this email directly, view it on GitHub <#580 (review)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKMFK247RX6RKGL65DMPCG3ZQMG4VAVCNFSM6AAAAABK4A6QR6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMRWHE3TMNZTGU . You are receiving this because you authored the thread.Message ID: @.>

never mind, I just noticed that @cfc4n included an "all rights reserved" statement in each code file, which actually isn't quite consistent with the project's Apache License 2.0.

@cfc4n
Copy link
Member

cfc4n commented Aug 8, 2024

ecapture'license has been replaced, and something is missing.

@yuweizzz yuweizzz deleted the h2 branch September 23, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants