-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify bad-fmt test use of nc (#10861)
- Loading branch information
Showing
3 changed files
with
151 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# A very simple cleartext server for one HTTP transaction. Does no validation of the Request message. | ||
|
||
response () | ||
{ | ||
# Wait for end of Request message. | ||
# | ||
while (( 1 == 1 )) | ||
do | ||
if [[ -f $outfile ]] ; then | ||
if tr '\r' '=' < $outfile | grep '^=$' > /dev/null | ||
then | ||
break; | ||
fi | ||
fi | ||
sleep 1 | ||
done | ||
|
||
# respond even if the method is funky | ||
|
||
printf "HTTP/1.1 200 OK\r\n" | ||
printf "Content-Length: 0\r\n" | ||
printf "X-Resp-Id: 3\r\n" | ||
printf "\r\n" | ||
|
||
} | ||
|
||
outfile=$2 | ||
response | nc -l $1 > $outfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
GET /sdfsdf HTTP/1.1 | ||
X-Req-Id: 0 | ||
HTTP/1.1 200 OK | ||
Content-Length: 0 | ||
GET /sdfsdf HTTP/1.1 | ||
X-Req-Id: 1 | ||
HTTP/1.1 200 OK | ||
Content-Length: 0 | ||
xyzxyz /example HTTP/1.1 | ||
xyzxyz / HTTP/1.1 | ||
Host: 127.0.0.1:`` | ||
X-Req-Id: 6 | ||
HTTP/1.1 200 OK | ||
Content-Length: 0 | ||
GET /example HTTP/1.1 | ||
X-Req-Id: 7 | ||
HTTP/1.1 200 OK | ||
Content-Length: 0 | ||
`` |