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

IO::Socket::INET not properly handling input-line-separator param #2627

Closed
p6rt opened this issue Jan 29, 2012 · 5 comments
Closed

IO::Socket::INET not properly handling input-line-separator param #2627

p6rt opened this issue Jan 29, 2012 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jan 29, 2012

Migrated from rt.perl.org#109306 (status was 'resolved')

Searchable as RT109306$

@p6rt
Copy link
Author

p6rt commented Jan 29, 2012

From @bbkr

Run following P6 listener​:

perl6 -e 'my $l = IO​::Socket​::INET.new( input-line-separator => "\r\n", localport => 8080, :listen); while my $c = $l.accept() { for ^10 { $c.get().encode().gist.say; }; $c.close }'

Then call it with P5 client​:

perl -e 'use LWP​::UserAgent; LWP​::UserAgent->new->post("http://localhost​:8080");'

Listener will print​:

Buf​:0x<50 4f 53 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d>
Buf​:0x<54 45 3a 20 64 65 66 6c 61 74 65 2c 67 7a 69 70 3b 71 3d 30 2e 33 0d>
Buf​:0x<43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 54 45 2c 20 63 6c 6f 73 65 0d>
Buf​:0x<48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 30 0d>
Buf​:0x<55 73 65 72 2d 41 67 65 6e 74 3a 20 6c 69 62 77 77 77 2d 70 65 72 6c 2f 36 2e 30 32 0d>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 30 0d>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0d>
Buf​:0x<0d>

As you can see carriage return (0x0D) is present in get() output despite fact that it was defined as line separator.

@p6rt
Copy link
Author

p6rt commented Jan 24, 2013

From @FROGGS

Now (with latest commit from moritz today)​:

Buf​:0x<50 4f 53 54 20 2f 20 48 54 54 50 2f 31 2e 31>
Buf​:0x<54 45 3a 20 64 65 66 6c 61 74 65 2c 67 7a 69 70 3b 71 3d 30 2e 33>
Buf​:0x<43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 54 45 2c 20 63 6c 6f 73 65>
Buf​:0x<48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 30>
Buf​:0x<55 73 65 72 2d 41 67 65 6e 74 3a 20 6c 69 62 77 77 77 2d 70 65 72
6c 2f 36 2e 30 34>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 30>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74
69 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64>

Please confirm.

@p6rt
Copy link
Author

p6rt commented Jan 24, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 5, 2015

From @jnthn

On Sun Jan 29 02​:39​:03 2012, pawel.pabian@​implix.com wrote​:

Run following P6 listener​:

perl6 -e 'my $l = IO​::Socket​::INET.new( input-line-separator =>
"\r\n", localport => 8080, :listen); while my $c = $l.accept() { for
^10 { $c.get().encode().gist.say; }; $c.close }'

Then call it with P5 client​:

perl -e 'use LWP​::UserAgent; LWP​::UserAgent->new-

post("http://localhost&#8203;:8080");'

Listener will print​:

Buf​:0x<50 4f 53 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d>
Buf​:0x<54 45 3a 20 64 65 66 6c 61 74 65 2c 67 7a 69 70 3b 71 3d 30 2e
33 0d>
Buf​:0x<43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 54 45 2c 20 63 6c 6f 73 65
0d>
Buf​:0x<48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 30 0d>
Buf​:0x<55 73 65 72 2d 41 67 65 6e 74 3a 20 6c 69 62 77 77 77 2d 70 65
72 6c 2f 36 2e 30 32 0d>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 30 0d>
Buf​:0x<43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61
74 69 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f
64 65 64 0d>
Buf​:0x<0d>

As you can see carriage return (0x0D) is present in get() output
despite fact that it was defined as line separator.

Was fixed for a good while; was doing some further improvements to get today and confirmed it is still fixed and added a test in S32-io/IO-Socket-INET.t.

/jnthn

@p6rt
Copy link
Author

p6rt commented Nov 5, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant