Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttree
Flow DebugProxy
Commits
1f9477ad
Unverified
Commit
1f9477ad
authored
Aug 10, 2018
by
Dominique Feyer
Committed by
GitHub
Aug 10, 2018
Browse files
Merge pull request #21 from dfeyer/task-windows-support
TASK: Support Windows
parents
3f1e5374
3bb27414
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
1f9477ad
...
...
@@ -19,7 +19,7 @@ Build your own
# Get the dependecies
go get
# Build
go
B
uild
go
b
uild
Run the proxy
-------------
...
...
flowpathmapper/flowpathmapper.go
View file @
1f9477ad
...
...
@@ -18,6 +18,7 @@ import (
"regexp"
"strconv"
"strings"
"runtime"
)
const
(
...
...
@@ -28,7 +29,8 @@ const (
var
(
regexpPhpFile
=
regexp
.
MustCompile
(
`(?://)?(/[^ ]*\.php)`
)
regexpFilename
=
regexp
.
MustCompile
(
`filename=["]?file://(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`
)
regexpFilename__Win
=
regexp
.
MustCompile
(
`filename=["]?file:///(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`
)
regexpFilename__Unix
=
regexp
.
MustCompile
(
`filename=["]?file://(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`
)
regexpPathAndFilename
=
regexp
.
MustCompile
(
`(?m)^# PathAndFilename: (.*)$`
)
regexpPackageClass
=
regexp
.
MustCompile
(
`(.*?)/Packages/[^/]*/(.*?)/Classes/(.*).php`
)
regexpDot
=
regexp
.
MustCompile
(
`[\./]`
)
...
...
@@ -39,6 +41,13 @@ func init() {
pathmapperfactory
.
Register
(
framework
,
p
)
}
func
regexpFilename
()
*
regexp
.
Regexp
{
if
runtime
.
GOOS
==
"windows"
{
return
regexpFilename__Win
}
return
regexpFilename__Unix
}
// PathMapper handle the mapping between real code and proxy
type
PathMapper
struct
{
config
*
config
.
Config
...
...
@@ -78,6 +87,9 @@ func (p *PathMapper) doTextPathMapping(message []byte) []byte {
var
processedMapping
=
map
[
string
]
string
{}
for
_
,
match
:=
range
regexpPhpFile
.
FindAllStringSubmatch
(
string
(
message
),
-
1
)
{
originalPath
:=
match
[
1
]
if
runtime
.
GOOS
==
"windows"
{
originalPath
=
strings
.
Replace
(
originalPath
,
"//"
,
""
,
1
)
}
path
:=
p
.
mapPath
(
originalPath
)
p
.
logger
.
Debug
(
"doTextPathMapping %s >>> %s"
,
path
,
originalPath
)
processedMapping
[
path
]
=
originalPath
...
...
@@ -104,7 +116,7 @@ func (p *PathMapper) getCachePath(base, filename string) string {
func
(
p
*
PathMapper
)
doXMLPathMapping
(
b
[]
byte
)
[]
byte
{
var
processedMapping
=
map
[
string
]
string
{}
for
_
,
match
:=
range
regexpFilename
.
FindAllStringSubmatch
(
string
(
b
),
-
1
)
{
for
_
,
match
:=
range
regexpFilename
()
.
FindAllStringSubmatch
(
string
(
b
),
-
1
)
{
path
:=
p
.
getCachePath
(
match
[
1
],
match
[
2
])
if
_
,
ok
:=
processedMapping
[
path
];
ok
==
false
{
if
originalPath
,
exist
:=
p
.
pathMapping
.
Get
(
path
);
exist
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment